Skip to content

Commit 115b652

Browse files
authored
Merge pull request #490 from Kolbeckenstein/develop
Adding minimums to prevent UI crash on validation/divide by 0 errors …
2 parents 90998ad + 8eb5e60 commit 115b652

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/penn_chime/presentation.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,11 @@ def display_sidebar(st, d: Parameters) -> Parameters:
220220
step=1.0,
221221
)
222222
hospitalized_pct_input = PercentInput(
223-
st_obj, "Hospitalization %(total infections)", value=d.hospitalized.rate,
223+
st_obj,
224+
"Hospitalization %(total infections)",
225+
value=d.hospitalized.rate,
226+
min_value=FLOAT_INPUT_MIN,
227+
max_value=100.0
224228
)
225229
icu_pct_input = PercentInput(st_obj,
226230
"ICU %(total infections)",
@@ -234,23 +238,23 @@ def display_sidebar(st, d: Parameters) -> Parameters:
234238
hospitalized_days_input = NumberInput(
235239
st_obj,
236240
"Average hospital length of stay (in days)",
237-
min_value=0,
241+
min_value=1,
238242
value=d.hospitalized.days,
239243
step=1,
240244
format="%i",
241245
)
242246
icu_days_input = NumberInput(
243247
st_obj,
244248
"Average days in ICU",
245-
min_value=0,
249+
min_value=1,
246250
value=d.icu.days,
247251
step=1,
248252
format="%i",
249253
)
250254
ventilated_days_input = NumberInput(
251255
st_obj,
252256
"Average days on ventilator",
253-
min_value=0,
257+
min_value=1,
254258
value=d.ventilated.days,
255259
step=1,
256260
format="%i",
@@ -272,7 +276,7 @@ def display_sidebar(st, d: Parameters) -> Parameters:
272276
infectious_days_input = NumberInput(
273277
st_obj,
274278
"Infectious days",
275-
min_value=0,
279+
min_value=1,
276280
value=d.infectious_days,
277281
step=1,
278282
format="%i",

0 commit comments

Comments
 (0)