Skip to content

Commit eed1cf6

Browse files
author
Nick Canzoneri
committed
Merge remote-tracking branch 'upstream/develop' into download_full_table_data
2 parents 1920402 + 28304a6 commit eed1cf6

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

src/app.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,15 @@
5353
st.markdown(chart_descriptions(new_admit_chart))
5454

5555
if st.checkbox("Show Projected Admissions in tabular form"):
56-
draw_projected_admissions_table(st, admissions_df, as_date=p.as_date)
56+
if st.checkbox("Show Daily Counts"):
57+
draw_projected_admissions_table(st, admissions_df, as_date=p.as_date, daily_count=True)
58+
else:
59+
draw_projected_admissions_table(st, admissions_df, as_date=p.as_date, daily_count=False)
5760
build_download_link(st,
5861
filename="projected_admissions.csv",
5962
df=admissions_df,
6063
parameters=p
6164
)
62-
6365
st.subheader("Admitted Patients (Census)")
6466
st.markdown(
6567
"Projected **census** of COVID-19 patients, accounting for arrivals and discharges at Penn hospitals"
@@ -70,12 +72,16 @@
7072
)
7173
st.markdown(chart_descriptions(census_chart, suffix=" Census"))
7274
if st.checkbox("Show Projected Census in tabular form"):
73-
draw_census_table(st, census_df, as_date=p.as_date)
75+
if st.checkbox("Show Daily Census Counts"):
76+
draw_census_table(st, admissions_df, as_date=p.as_date, daily_count=True)
77+
else:
78+
draw_census_table(st, census_df, as_date=p.as_date, daily_count=False)
7479
build_download_link(st,
7580
filename="projected_census.csv",
7681
df=census_df,
7782
parameters=p
7883
)
84+
7985
st.markdown(
8086
"""**Click the checkbox below to view additional data generated by this simulation**"""
8187
)

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)