Skip to content

Commit 28304a6

Browse files
Merge pull request #209 from kmid5280/develop
Add Daily Count checkbox under Projected Admissions checkbox
2 parents c613031 + 54e67a2 commit 28304a6

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
@@ -52,7 +52,10 @@
5252
st.markdown(chart_descriptions(new_admit_chart))
5353

5454
if st.checkbox("Show Projected Admissions in tabular form"):
55-
draw_projected_admissions_table(st, admissions_df, as_date=p.as_date)
55+
if st.checkbox("Show Daily Counts"):
56+
draw_projected_admissions_table(st, admissions_df, as_date=p.as_date, daily_count=True)
57+
else:
58+
draw_projected_admissions_table(st, admissions_df, as_date=p.as_date, daily_count=False)
5659
st.subheader("Admitted Patients (Census)")
5760
st.markdown(
5861
"Projected **census** of COVID-19 patients, accounting for arrivals and discharges at Penn hospitals"
@@ -63,7 +66,10 @@
6366
)
6467
st.markdown(chart_descriptions(census_chart, suffix=" Census"))
6568
if st.checkbox("Show Projected Census in tabular form"):
66-
draw_census_table(st, census_df, as_date=p.as_date)
69+
if st.checkbox("Show Daily Census Counts"):
70+
draw_census_table(st, admissions_df, as_date=p.as_date, daily_count=True)
71+
else:
72+
draw_census_table(st, census_df, as_date=p.as_date, daily_count=False)
6773
st.markdown(
6874
"""**Click the checkbox below to view additional data generated by this simulation**"""
6975
)

src/penn_chime/presentation.py

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

390390

391391
def draw_projected_admissions_table(
392-
st, projection_admits: pd.DataFrame, as_date: bool = False
392+
st, projection_admits: pd.DataFrame, as_date: bool = False, daily_count: bool = False,
393393
):
394-
admits_table = projection_admits[np.mod(projection_admits.index, 7) == 0].copy()
394+
if daily_count == True:
395+
admits_table = projection_admits[np.mod(projection_admits.index, 1) == 0].copy()
396+
else:
397+
admits_table = projection_admits[np.mod(projection_admits.index, 7) == 0].copy()
395398
admits_table["day"] = admits_table.index
396399
admits_table.index = range(admits_table.shape[0])
397400
admits_table = admits_table.fillna(0).astype(int)
@@ -404,8 +407,11 @@ def draw_projected_admissions_table(
404407
return None
405408

406409

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

0 commit comments

Comments
 (0)