14
14
DATE_FORMAT = "%b, %d" # see https://strftime.org
15
15
DOCS_URL = "https://code-for-philly.gitbook.io/chime"
16
16
17
+ FLOAT_INPUT_MIN = 0.001
18
+ FLOAT_INPUT_STEP = FLOAT_INPUT_MIN
19
+
17
20
hide_menu_style = """
18
21
<style>
19
22
#MainMenu {visibility: hidden;}
@@ -163,16 +166,16 @@ def display_sidebar(st, d: Constants) -> Parameters:
163
166
"Number of days to project" ,
164
167
min_value = 30 ,
165
168
value = d .n_days ,
166
- step = 10 ,
169
+ step = 1 ,
167
170
format = "%i" ,
168
171
)
169
172
doubling_time_input = NumberInputWrapper (
170
173
st_obj ,
171
174
"Doubling time before social distancing (days)" ,
172
- min_value = 0 ,
175
+ min_value = FLOAT_INPUT_MIN ,
173
176
value = d .doubling_time ,
174
- step = 1 ,
175
- format = "%i " ,
177
+ step = FLOAT_INPUT_STEP ,
178
+ format = "%f " ,
176
179
)
177
180
date_first_hospitalized_input = DateInputWrapper (
178
181
st_obj ,
@@ -182,19 +185,19 @@ def display_sidebar(st, d: Constants) -> Parameters:
182
185
relative_contact_rate_input = NumberInputWrapper (
183
186
st_obj ,
184
187
"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 " ,
190
193
)
191
194
hospitalized_rate_input = NumberInputWrapper (
192
195
st_obj ,
193
196
"Hospitalization %(total infections)" ,
194
- min_value = 0.001 ,
197
+ min_value = 0.0 ,
195
198
max_value = 100.0 ,
196
199
value = d .hospitalized .rate * 100 ,
197
- step = 1.0 ,
200
+ step = FLOAT_INPUT_STEP ,
198
201
format = "%f" ,
199
202
)
200
203
icu_rate_input = NumberInputWrapper (
@@ -203,7 +206,7 @@ def display_sidebar(st, d: Constants) -> Parameters:
203
206
min_value = 0.0 ,
204
207
max_value = 100.0 ,
205
208
value = d .icu .rate * 100 ,
206
- step = 1.0 ,
209
+ step = FLOAT_INPUT_STEP ,
207
210
format = "%f" ,
208
211
)
209
212
ventilated_rate_input = NumberInputWrapper (
@@ -212,7 +215,7 @@ def display_sidebar(st, d: Constants) -> Parameters:
212
215
min_value = 0.0 ,
213
216
max_value = 100.0 ,
214
217
value = d .ventilated .rate * 100 ,
215
- step = 1.0 ,
218
+ step = FLOAT_INPUT_STEP ,
216
219
format = "%f" ,
217
220
)
218
221
hospitalized_los_input = NumberInputWrapper (
@@ -242,33 +245,32 @@ def display_sidebar(st, d: Constants) -> Parameters:
242
245
market_share_input = NumberInputWrapper (
243
246
st_obj ,
244
247
"Hospital Market Share (%)" ,
245
- min_value = 0.001 ,
248
+ min_value = FLOAT_INPUT_MIN ,
246
249
max_value = 100.0 ,
247
250
value = d .market_share * 100 ,
248
- step = 1.0 ,
251
+ step = FLOAT_INPUT_STEP ,
249
252
format = "%f" ,
250
253
)
251
254
population_input = NumberInputWrapper (
252
255
st_obj ,
253
256
"Regional Population" ,
254
257
min_value = 1 ,
255
258
value = d .region .population ,
256
- step = 100000 ,
259
+ step = 1 ,
257
260
format = "%i" ,
258
261
)
259
262
known_infected_input = NumberInputWrapper (
260
263
st_obj ,
261
264
"Currently Known Regional Infections (only used to compute detection rate - does not change projections)" ,
262
265
min_value = 0 ,
263
266
value = d .known_infected ,
264
- step = 10 ,
267
+ step = 1 ,
265
268
format = "%i" ,
266
269
)
267
270
as_date_input = CheckboxWrapper (st_obj , "Present result as dates instead of days" , value = False )
268
271
max_y_axis_set_input = CheckboxWrapper (st_obj , "Set the Y-axis on graphs to a static value" )
269
272
max_y_axis_input = NumberInputWrapper (st_obj , "Y-axis static value" , value = 500 , format = "%i" , step = 25 )
270
273
271
-
272
274
# Build in desired order
273
275
st .sidebar .markdown ("### Regional Parameters [ℹ]({docs_url}/what-is-chime/parameters)" .format (docs_url = DOCS_URL ))
274
276
population = population_input ()
@@ -306,7 +308,7 @@ def display_sidebar(st, d: Constants) -> Parameters:
306
308
return Parameters (
307
309
as_date = as_date ,
308
310
current_hospitalized = current_hospitalized ,
309
- market_share = market_share ,
311
+ market_share = market_share / 100.0 ,
310
312
known_infected = known_infected ,
311
313
doubling_time = doubling_time ,
312
314
date_first_hospitalized = date_first_hospitalized ,
@@ -316,9 +318,9 @@ def display_sidebar(st, d: Constants) -> Parameters:
316
318
relative_contact_rate = relative_contact_rate / 100.0 ,
317
319
population = population ,
318
320
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 ),
322
324
)
323
325
324
326
0 commit comments