Skip to content

Commit

Permalink
Merge pull request pennsignals#27 from pennsignals/fix_22
Browse files Browse the repository at this point in the history
app: Support floating point for Market Share
  • Loading branch information
cjbayesian authored Mar 15, 2020
2 parents aa6e252 + 6c16218 commit 15c0587
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
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")
current_hosp = st.sidebar.number_input(
"Currently Hospitalized COVID-19 Patients", value=2, step=1, format="%i"
)
doubling_time = st.sidebar.number_input(
"Doubling Time (days)", value=6, step=1, format="%i"
)
Expand All @@ -42,7 +44,7 @@
vent_los = st.sidebar.number_input("Vent LOS", value=10, step=1, format="%i")
Penn_market_share = (
st.sidebar.number_input(
"Hospital Market Share (%)", 0, 100, value=15, step=1, format="%i"
"Hospital Market Share (%)", 0.0, 100.0, value=15.0, step=1.0, format="%f"
)
/ 100.0
)
Expand Down Expand Up @@ -84,10 +86,12 @@
- 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:
""")
"""
)
st.latex("g = 2^{1/T_d} - 1")

st.markdown("""
st.markdown(
"""
- Since the rate of new infections in the SIR model is $g = \\beta S - \\gamma$, and we've already computed $\\gamma$, $\\beta$ becomes a function of the initial population size of susceptible individuals.
$$\\beta = (g + \\gamma)/s$$
Expand Down Expand Up @@ -252,7 +256,9 @@ def sim_sir(S, I, R, beta, gamma, n_days, beta_decay=None):
"""**Click the checkbox below to view additional data generated by this simulation**"""
)
if st.checkbox("Show Additional Projections"):
st.subheader("The number of infected and recovered individuals in the hospital catchment region at any given moment")
st.subheader(
"The number of infected and recovered individuals in the hospital catchment region at any given moment"
)
fig, ax = plt.subplots(1, 1, figsize=(10, 4))
ax.plot(i, label="Infected")
ax.plot(r, label="Recovered")
Expand Down

0 comments on commit 15c0587

Please sign in to comment.