Skip to content

Commit 9ab74a7

Browse files
Merge branch 'develop' into quinn_issue_255
2 parents ef736d6 + 62ffe34 commit 9ab74a7

File tree

5 files changed

+33
-28
lines changed

5 files changed

+33
-28
lines changed

Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
FROM python:3.7.7-slim-buster
22
RUN mkdir /app
33
WORKDIR /app
4-
COPY .streamlit .streamlit
54
COPY README.md .
65
COPY setup.py .
6+
# Creating an empty src dir is a (hopefully) temporary hack to improve layer caching and speed up image builds
7+
# todo fix once the Pipfile, setup.py, requirements.txt, pyprojec.toml build/dist story is figured out
8+
RUN mkdir src && pip install -q .
9+
COPY .streamlit .streamlit
710
COPY settings.cfg .
811
COPY src src
9-
RUN pip install -q .
1012

1113
CMD ["streamlit", "run", "src/app.py"]

e2e/cypress/integration/tests/actions.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ context('Actions', () => {
1111
// This gets the "first" input from the sidebar. From clicking step up,
1212
// the Regional Population should increase from default 4119405 to 4219405.
1313
cy.get('input.st-al')
14-
.should('has.value', '4219405')
14+
.should('has.value', '4119406')
1515
})
1616
});

src/penn_chime/defaults.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ def __init__(
2222
self,
2323
*,
2424
current_hospitalized: int,
25-
doubling_time: int,
25+
doubling_time: float,
2626
known_infected: int,
27-
relative_contact_rate: int,
27+
relative_contact_rate: float,
2828
region: Regions,
2929

3030
hospitalized: RateLos,

src/penn_chime/presentation.py

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
DATE_FORMAT = "%b, %d" # see https://strftime.org
1515
DOCS_URL = "https://code-for-philly.gitbook.io/chime"
1616

17+
FLOAT_INPUT_MIN = 0.001
18+
FLOAT_INPUT_STEP = FLOAT_INPUT_MIN
19+
1720
hide_menu_style = """
1821
<style>
1922
#MainMenu {visibility: hidden;}
@@ -163,16 +166,16 @@ def display_sidebar(st, d: Constants) -> Parameters:
163166
"Number of days to project",
164167
min_value=30,
165168
value=d.n_days,
166-
step=10,
169+
step=1,
167170
format="%i",
168171
)
169172
doubling_time_input = NumberInputWrapper(
170173
st_obj,
171174
"Doubling time before social distancing (days)",
172-
min_value=0,
175+
min_value=FLOAT_INPUT_MIN,
173176
value=d.doubling_time,
174-
step=1,
175-
format="%i",
177+
step=FLOAT_INPUT_STEP,
178+
format="%f",
176179
)
177180
date_first_hospitalized_input = DateInputWrapper(
178181
st_obj,
@@ -182,19 +185,19 @@ def display_sidebar(st, d: Constants) -> Parameters:
182185
relative_contact_rate_input = NumberInputWrapper(
183186
st_obj,
184187
"Social distancing (% reduction in social contact)",
185-
min_value=0,
186-
max_value=100,
187-
value=int(d.relative_contact_rate * 100),
188-
step=5,
189-
format="%i",
188+
min_value=0.0,
189+
max_value=100.0,
190+
value=d.relative_contact_rate * 100.0,
191+
step=FLOAT_INPUT_STEP,
192+
format="%f",
190193
)
191194
hospitalized_rate_input = NumberInputWrapper(
192195
st_obj,
193196
"Hospitalization %(total infections)",
194-
min_value=0.001,
197+
min_value=0.0,
195198
max_value=100.0,
196199
value=d.hospitalized.rate * 100,
197-
step=1.0,
200+
step=FLOAT_INPUT_STEP,
198201
format="%f",
199202
)
200203
icu_rate_input = NumberInputWrapper(
@@ -203,7 +206,7 @@ def display_sidebar(st, d: Constants) -> Parameters:
203206
min_value=0.0,
204207
max_value=100.0,
205208
value=d.icu.rate * 100,
206-
step=1.0,
209+
step=FLOAT_INPUT_STEP,
207210
format="%f",
208211
)
209212
ventilated_rate_input = NumberInputWrapper(
@@ -212,7 +215,7 @@ def display_sidebar(st, d: Constants) -> Parameters:
212215
min_value=0.0,
213216
max_value=100.0,
214217
value=d.ventilated.rate * 100,
215-
step=1.0,
218+
step=FLOAT_INPUT_STEP,
216219
format="%f",
217220
)
218221
hospitalized_los_input = NumberInputWrapper(
@@ -242,33 +245,32 @@ def display_sidebar(st, d: Constants) -> Parameters:
242245
market_share_input = NumberInputWrapper(
243246
st_obj,
244247
"Hospital Market Share (%)",
245-
min_value=0.001,
248+
min_value=FLOAT_INPUT_MIN,
246249
max_value=100.0,
247250
value=d.market_share * 100,
248-
step=1.0,
251+
step=FLOAT_INPUT_STEP,
249252
format="%f",
250253
)
251254
population_input = NumberInputWrapper(
252255
st_obj,
253256
"Regional Population",
254257
min_value=1,
255258
value=d.region.population,
256-
step=100000,
259+
step=1,
257260
format="%i",
258261
)
259262
known_infected_input = NumberInputWrapper(
260263
st_obj,
261264
"Currently Known Regional Infections (only used to compute detection rate - does not change projections)",
262265
min_value=0,
263266
value=d.known_infected,
264-
step=10,
267+
step=1,
265268
format="%i",
266269
)
267270
as_date_input = CheckboxWrapper(st_obj, "Present result as dates instead of days", value=False)
268271
max_y_axis_set_input = CheckboxWrapper(st_obj, "Set the Y-axis on graphs to a static value")
269272
max_y_axis_input = NumberInputWrapper(st_obj, "Y-axis static value", value=500, format="%i", step=25)
270273

271-
272274
# Build in desired order
273275
st.sidebar.markdown("### Regional Parameters [ℹ]({docs_url}/what-is-chime/parameters)".format(docs_url=DOCS_URL))
274276
population = population_input()
@@ -306,7 +308,7 @@ def display_sidebar(st, d: Constants) -> Parameters:
306308
return Parameters(
307309
as_date=as_date,
308310
current_hospitalized=current_hospitalized,
309-
market_share=market_share,
311+
market_share=market_share / 100.0,
310312
known_infected=known_infected,
311313
doubling_time=doubling_time,
312314
date_first_hospitalized=date_first_hospitalized,
@@ -316,9 +318,9 @@ def display_sidebar(st, d: Constants) -> Parameters:
316318
relative_contact_rate=relative_contact_rate / 100.0,
317319
population=population,
318320

319-
hospitalized=RateLos(hospitalized_rate/ 100.0, hospitalized_los),
320-
icu=RateLos(icu_rate/ 100.0, icu_los),
321-
ventilated=RateLos(ventilated_rate/ 100.0, ventilated_los),
321+
hospitalized=RateLos(hospitalized_rate / 100.0, hospitalized_los),
322+
icu=RateLos(icu_rate / 100.0, icu_los),
323+
ventilated=RateLos(ventilated_rate / 100.0, ventilated_los),
322324
)
323325

324326

src/penn_chime/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020
philly=philly,
2121
),
2222
current_hospitalized=32,
23-
doubling_time=4,
23+
doubling_time=4.0,
2424
date_first_hospitalized=date(2020,3,7),
25+
2526
known_infected=510,
2627
n_days=60,
2728
market_share=0.15,

0 commit comments

Comments
 (0)