Skip to content

Commit 0662010

Browse files
Merge branch 'develop' into move_computation
2 parents ef00f91 + 28304a6 commit 0662010

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

src/app.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@
5050
st.markdown(chart_descriptions(new_admit_chart))
5151

5252
if st.checkbox("Show Projected Admissions in tabular form"):
53-
draw_projected_admissions_table(st, m.admits_df, as_date=p.as_date)
53+
if st.checkbox("Show Daily Counts"):
54+
draw_projected_admissions_table(st, m.admits_df, as_date=p.as_date, daily_count=True)
55+
else:
56+
draw_projected_admissions_table(st, m.admits_df, as_date=p.as_date, daily_count=False)
5457
st.subheader("Admitted Patients (Census)")
5558
st.markdown(
5659
"Projected **census** of COVID-19 patients, accounting for arrivals and discharges at Penn hospitals"
@@ -62,7 +65,10 @@
6265
)
6366
st.markdown(chart_descriptions(census_chart, suffix=" Census"))
6467
if st.checkbox("Show Projected Census in tabular form"):
65-
draw_census_table(st, m.census_df, as_date=p.as_date)
68+
if st.checkbox("Show Daily Census Counts"):
69+
draw_census_table(st, m.census_df, as_date=p.as_date, daily_count=True)
70+
else:
71+
draw_census_table(st, m.census_df, as_date=p.as_date, daily_count=False)
6672
st.markdown(
6773
"""**Click the checkbox below to view additional data generated by this simulation**"""
6874
)

src/penn_chime/presentation.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,12 @@ def show_additional_projections(
391391

392392

393393
def draw_projected_admissions_table(
394-
st, projection_admits: pd.DataFrame, as_date: bool = False
394+
st, projection_admits: pd.DataFrame, as_date: bool = False, daily_count: bool = False,
395395
):
396-
admits_table = projection_admits[np.mod(projection_admits.index, 7) == 0].copy()
396+
if daily_count == True:
397+
admits_table = projection_admits[np.mod(projection_admits.index, 1) == 0].copy()
398+
else:
399+
admits_table = projection_admits[np.mod(projection_admits.index, 7) == 0].copy()
397400
admits_table["day"] = admits_table.index
398401
admits_table.index = range(admits_table.shape[0])
399402
admits_table = admits_table.fillna(0).astype(int)
@@ -406,8 +409,11 @@ def draw_projected_admissions_table(
406409
return None
407410

408411

409-
def draw_census_table(st, census_df: pd.DataFrame, as_date: bool = False):
410-
census_table = census_df[np.mod(census_df.index, 7) == 0].copy()
412+
def draw_census_table(st, census_df: pd.DataFrame, as_date: bool = False, daily_count: bool = False):
413+
if daily_count == True:
414+
census_table = census_df[np.mod(census_df.index, 1) == 0].copy()
415+
else:
416+
census_table = census_df[np.mod(census_df.index, 7) == 0].copy()
411417
census_table.index = range(census_table.shape[0])
412418
census_table.loc[0, :] = 0
413419
census_table = census_table.dropna().astype(int)

0 commit comments

Comments
 (0)