Skip to content
This repository was archived by the owner on Jul 7, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
bucks = 628341
philly = 1581000
S_default = delaware + chester + montgomery + bucks + philly
known_infections = 53
known_infections = 63 # update daily
admitted_infections = 4 # update daily

# Widgets
initial_infections = st.sidebar.number_input(
"Currently Known Regional Infections", value=known_infections, step=10, format="%i"
)
current_hosp = st.sidebar.number_input(
"Currently Hospitalized COVID-19 Patients", value=2, step=1, format="%i"
"Currently Hospitalized COVID-19 Patients", value=admitted_infections, step=1, format="%i"
)
doubling_time = st.sidebar.number_input(
"Doubling Time (days)", value=6, step=1, format="%i"
Expand Down Expand Up @@ -62,13 +63,13 @@
st.markdown(
"""*This tool was developed by the [Predictive Healthcare team](http://predictivehealthcare.pennmedicine.org/) at
Penn Medicine. For questions and comments please see our
[contact page](http://predictivehealthcare.pennmedicine.org/contact/). Code can be found on [Github](https://github.com/pennsignals/chime).
[contact page](http://predictivehealthcare.pennmedicine.org/contact/). Code can be found on [Github](https://github.com/pennsignals/chime).
Join our [Slack channel](https://codeforphilly.org/chat?channel=covid19-chime-penn) if you would like to get involved!*""")

st.markdown(
"""The estimated number of currently infected individuals is **{total_infections:.0f}**. The **{initial_infections}**
confirmed cases in the region imply a **{detection_prob:.0%}** rate of detection. This is based on current inputs for
Hospitalizations (**{current_hosp}**), Hospitalization rate (**{hosp_rate:.0%}**), Region size (**{S}**),
"""The estimated number of currently infected individuals is **{total_infections:.0f}**. The **{initial_infections}**
confirmed cases in the region imply a **{detection_prob:.0%}** rate of detection. This is based on current inputs for
Hospitalizations (**{current_hosp}**), Hospitalization rate (**{hosp_rate:.0%}**), Region size (**{S}**),
and Hospital market share (**{Penn_market_share:.0%}**).""".format(
total_infections=total_infections,
current_hosp=current_hosp,
Expand All @@ -85,7 +86,7 @@
"[Discrete-time SIR modeling](https://mathworld.wolfram.com/SIRModel.html) of infections/recovery"
)
st.markdown(
"""The model consists of individuals who are either _Susceptible_ ($S$), _Infected_ ($I$), or _Recovered_ ($R$).
"""The model consists of individuals who are either _Susceptible_ ($S$), _Infected_ ($I$), or _Recovered_ ($R$).

The epidemic proceeds via a growth and decline process. This is the core model of infectious disease spread and has been in use in epidemiology for many years."""
)
Expand All @@ -96,15 +97,15 @@
st.latex("R_{t+1} = (\\gamma I_t) + R_t")

st.markdown(
"""To project the expected impact to Penn Medicine, we estimate the terms of the model.
"""To project the expected impact to Penn Medicine, we estimate the terms of the model.

To do this, we use a combination of estimates from other locations, informed estimates based on logical reasoning, and best guesses from the American Hospital Association.


### Parameters
First, we need to express the two parameters $\\beta$ and $\\gamma$ in terms of quantities we can estimate.

- The $\\gamma$ parameter represents 1 over the mean recovery time in days. Since the CDC is recommending 14 days of self-quarantine, we'll use $\\gamma = 1/14$.
- The $\\gamma$ parameter represents 1 over the mean recovery time in days. Since the CDC is recommending 14 days of self-quarantine, we'll use $\\gamma = 1/14$.
- Next, the AHA says to expect a doubling time $T_d$ of 7-10 days. That means an early-phase rate of growth can be computed by using the doubling time formula:
"""
)
Expand Down Expand Up @@ -299,7 +300,7 @@ def sim_sir(S, I, R, beta, gamma, n_days, beta_decay=None):
st.subheader("References & Acknowledgements")
st.markdown(
"""* AHA Webinar, Feb 26, James Lawler, MD, an associate professor University of Nebraska Medical Center, What Healthcare Leaders Need To Know: Preparing for the COVID-19
* We would like to recognize the valuable assistance in consultation and review of model assumptions by Michael Z. Levy, PhD, Associate Professor of Epidemiology, Department of Biostatistics, Epidemiology and Informatics at the Perelman School of Medicine
* We would like to recognize the valuable assistance in consultation and review of model assumptions by Michael Z. Levy, PhD, Associate Professor of Epidemiology, Department of Biostatistics, Epidemiology and Informatics at the Perelman School of Medicine
"""
)
st.markdown("© 2020, The Trustees of the University of Pennsylvania")