Skip to content

Commit 9a4528d

Browse files
committed
Wire up input for an optional mitigation effective date
1 parent 40165c8 commit 9a4528d

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/penn_chime/parameters.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def __init__(
5555
hospitalized: Disposition,
5656
icu: Disposition,
5757
relative_contact_rate: float,
58+
mitigation_date: Optional[date] = None,
5859
ventilated: Disposition,
5960
current_date: date = date.today(),
6061
date_first_hospitalized: Optional[date] = None,
@@ -68,7 +69,6 @@ def __init__(
6869
region: Optional[Regions] = None,
6970
):
7071
self.current_hospitalized = StrictlyPositive(value=current_hospitalized)
71-
self.relative_contact_rate = Rate(value=relative_contact_rate)
7272

7373
Rate(value=hospitalized.rate), Rate(value=icu.rate), Rate(value=ventilated.rate)
7474
StrictlyPositive(value=hospitalized.days), StrictlyPositive(value=icu.days),
@@ -92,6 +92,9 @@ def __init__(
9292
self.date_first_hospitalized = OptionalDate(value=date_first_hospitalized)
9393
self.doubling_time = OptionalStrictlyPositive(value=doubling_time)
9494

95+
self.relative_contact_rate = Rate(value=relative_contact_rate)
96+
self.mitigation_date = OptionalDate(value=mitigation_date)
97+
9598
self.infectious_days = StrictlyPositive(value=infectious_days)
9699
self.market_share = Rate(value=market_share)
97100
self.max_y_axis = OptionalStrictlyPositive(value=max_y_axis)

src/penn_chime/presentation.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ def display_sidebar(st, d: Parameters) -> Parameters:
204204
st_obj, "Date of first hospitalized case - Enter this date to have chime estimate the initial doubling time",
205205
value=d.date_first_hospitalized,
206206
)
207+
mitigation_date_input = DateInput(
208+
st_obj, "Date of social distancing measures effect (may be delayed from implementation)",
209+
value=d.mitigation_date
210+
)
207211
relative_contact_pct_input = PercentInput(
208212
st_obj,
209213
"Social distancing (% reduction in social contact going forward)",
@@ -309,7 +313,14 @@ def display_sidebar(st, d: Parameters) -> Parameters:
309313
doubling_time = doubling_time_input()
310314
date_first_hospitalized = None
311315

312-
relative_contact_rate = relative_contact_pct_input()
316+
if st.sidebar.checkbox(
317+
"Social distancing measures have been implemented"
318+
):
319+
mitigation_date = mitigation_date_input()
320+
relative_contact_rate = relative_contact_pct_input()
321+
else:
322+
mitigation_date = None
323+
relative_contact_rate = 1.e-7
313324

314325
st.sidebar.markdown(
315326
"### Severity Parameters [ℹ]({docs_url}/what-is-chime/parameters#severity-parameters)".format(

0 commit comments

Comments
 (0)