Skip to content

Commit a6db463

Browse files
LeoLiveCodesBrianThomasRoss
andauthored
Enforce-realistic-premitigation-params
* Display a warning to the user when the premitigation doubling time exceeds 15 days * Phrasing warning message more explicitly * Changed logging warning Co-authored-by: Brian Ross <[email protected]>
1 parent 8bbb38b commit a6db463

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/penn_chime/model/sir.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ def __init__(self, p: Parameters):
5959
self.infected = infected
6060
self.recovered = p.recovered
6161

62+
self.reasonable_model_parameters = True
63+
6264
if p.date_first_hospitalized is None and p.doubling_time is not None:
6365
# Back-projecting to when the first hospitalized case would have been admitted
6466
logger.info('Using doubling_time: %s', p.doubling_time)
@@ -127,6 +129,13 @@ def __init__(self, p: Parameters):
127129
# Make an initial coarse estimate
128130
dts = np.linspace(1, 15, 15)
129131
min_loss = self.get_argmin_doubling_time(p, dts)
132+
if min_loss >= 14:
133+
logger.info(
134+
'Based on the current parameters, the estimated pre-mitigation doubling time is greater than 15 days. Try different parameters.'
135+
)
136+
self.reasonable_model_parameters = False
137+
return
138+
130139

131140
# Refine the coarse estimate
132141
for iteration in range(4):

src/penn_chime/view/st_app.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ def main():
4444

4545
p = display_sidebar(st, d)
4646
m = Sir(p)
47+
48+
if not m.reasonable_model_parameters:
49+
st.subheader("Based on the current parameters, estimated pre-mitigation doubling time is greater than 15 days. Try different parameters.")
50+
return
4751

4852
display_header(st, m, p)
4953

0 commit comments

Comments
 (0)