Skip to content

Commit 4bc89ef

Browse files
committed
add daily count checkbox for projected census
1 parent 83dbc41 commit 4bc89ef

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/app.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@
6666
)
6767
st.markdown(chart_descriptions(census_chart, suffix=" Census"))
6868
if st.checkbox("Show Projected Census in tabular form"):
69-
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)
7073
st.markdown(
7174
"""**Click the checkbox below to view additional data generated by this simulation**"""
7275
)

src/penn_chime/presentation.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,11 @@ def draw_projected_admissions_table(
407407
return None
408408

409409

410-
def draw_census_table(st, census_df: pd.DataFrame, as_date: bool = False):
411-
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()
412415
census_table.index = range(census_table.shape[0])
413416
census_table.loc[0, :] = 0
414417
census_table = census_table.dropna().astype(int)

0 commit comments

Comments
 (0)