Skip to content

Commit 96d5051

Browse files
Merge pull request #265 from kmid5280/264-detect
Warnings if infection counts incorrect
2 parents 477d139 + 8aa8f1b commit 96d5051

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/penn_chime/presentation.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,19 @@ def display_header(st, m, p):
3232
if m.detection_probability
3333
else "unknown"
3434
)
35+
36+
infection_warning_str = (
37+
"""(Warning: The number of known infections is greater than the estimate of infected patients based on inputs for current hospitalization, market share, and hospitalization rate. Please verify the market share value in the sidebar, and see if the hospitalization rate needs to be lowered.)"""
38+
if p.known_infected > m.infected
39+
else ""
40+
)
41+
42+
infected_population_warning_str = (
43+
"""(Warning: The number of estimated infections is greater than the total regional population. Please verify the values entered in the sidebar.)"""
44+
if m.infected > p.susceptible
45+
else ""
46+
)
47+
3548
st.markdown(
3649
"""
3750
<link rel="stylesheet" href="https://www1.pennmedicine.org/styles/shared/penn-medicine-header.css">
@@ -58,6 +71,9 @@ def display_header(st, m, p):
5871
confirmed cases in the region imply a **{detection_prob_str}** rate of detection. This is based on current inputs for
5972
Hospitalizations (**{current_hosp}**), Hospitalization rate (**{hosp_rate:.0%}**), Region size (**{S}**),
6073
and Hospital market share (**{market_share:.0%}**).
74+
75+
{infection_warning_str}
76+
{infected_population_warning_str}
6177
6278
An initial doubling time of **{doubling_time}** days and a recovery time of **{recovery_days}** days imply an $R_0$ of
6379
**{r_naught:.2f}**.
@@ -78,7 +94,9 @@ def display_header(st, m, p):
7894
relative_contact_rate=p.relative_contact_rate,
7995
r_t=m.r_t,
8096
doubling_time_t=abs(m.doubling_time_t),
81-
impact_statement=("halves the infections every" if m.r_t < 1 else "reduces the doubling time to")
97+
impact_statement=("halves the infections every" if m.r_t < 1 else "reduces the doubling time to"),
98+
infection_warning_str=infection_warning_str,
99+
infected_population_warning_str=infected_population_warning_str
82100
)
83101
)
84102

0 commit comments

Comments
 (0)