Skip to content

Commit 2315561

Browse files
Merge pull request #410 from CodeForPhilly/fix_default_settings_current_date
Replace DEFAULTS with function call
2 parents 87c974b + ddbbf25 commit 2315561

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

src/app.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
write_definitions,
1313
write_footer,
1414
)
15-
from penn_chime.settings import DEFAULTS
15+
from penn_chime.settings import get_defaults
1616
from penn_chime.models import SimSirModel
1717
from penn_chime.charts import (
1818
build_admits_chart,
@@ -28,14 +28,15 @@
2828
# In dev, this should be shown
2929
st.markdown(hide_menu_style, unsafe_allow_html=True)
3030

31-
p = display_sidebar(st, DEFAULTS)
31+
d = get_defaults()
32+
p = display_sidebar(st, d)
3233
m = SimSirModel(p)
3334

3435
display_header(st, m, p)
3536

3637
if st.checkbox("Show more info about this tool"):
3738
notes = "The total size of the susceptible population will be the entire catchment area for our hospitals."
38-
display_more_info(st=st, model=m, parameters=p, defaults=DEFAULTS, notes=notes)
39+
display_more_info(st=st, model=m, parameters=p, defaults=d, notes=notes)
3940

4041
st.subheader("New Admissions")
4142
st.markdown("Projected number of **daily** COVID-19 admissions. \n\n _NOTE: Now including estimates of prior admissions for comparison._")

src/penn_chime/settings.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,18 @@
44

55
from .parameters import Parameters, Regions, Disposition
66

7-
DEFAULTS = Parameters(
8-
population=3600000,
9-
current_hospitalized=69,
10-
date_first_hospitalized=date(2020,3,7),
11-
doubling_time=4.0,
12-
hospitalized=Disposition(0.025, 7),
13-
icu=Disposition(0.0075, 9),
14-
infectious_days=14,
15-
market_share=0.15,
16-
n_days=100,
17-
relative_contact_rate=0.3,
18-
ventilated=Disposition(0.005, 10),
19-
)
7+
8+
def get_defaults():
9+
return Parameters(
10+
population=3600000,
11+
current_hospitalized=69,
12+
date_first_hospitalized=date(2020,3,7),
13+
doubling_time=4.0,
14+
hospitalized=Disposition(0.025, 7),
15+
icu=Disposition(0.0075, 9),
16+
infectious_days=14,
17+
market_share=0.15,
18+
n_days=100,
19+
relative_contact_rate=0.3,
20+
ventilated=Disposition(0.005, 10),
21+
)

0 commit comments

Comments
 (0)