Skip to content

Commit 2ea9593

Browse files
author
PJ Hoberman
committed
Updated code style based on review
1 parent b894b23 commit 2ea9593

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

src/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
st.altair_chart(
6868
census_chart, use_container_width=True
6969
)
70-
st.markdown(chart_descriptions(census_chart, census=True))
70+
st.markdown(chart_descriptions(census_chart, suffix=" Census"))
7171
if st.checkbox("Show Projected Census in tabular form"):
7272
draw_census_table(st, census_df, as_date=as_date)
7373
st.markdown(

src/penn_chime/charts.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,19 @@ def additional_projections_chart(
117117
)
118118

119119

120-
def chart_descriptions(chart, census=False):
120+
def chart_descriptions(chart: Chart, suffix: str = ""):
121+
"""
122+
123+
:param chart: Chart: The alt chart to be used in finding max points
124+
:param suffix: str: The assumption is that the charts have similar column names.
125+
The census chart adds " Census" to the column names.
126+
Make sure to include a space or underscore as appropriate
127+
:return: str: Returns a multi-line string description of the results
128+
"""
121129
messages = []
122130

123131
cols = ["Hospitalized", "ICU", "Ventilated"]
124-
if census:
125-
cols = [col + " Census" for col in cols]
126-
127132
asterisk = False
128-
129133
day = "date" if "date" in chart.data.columns else "day"
130134

131135
for col in cols:
@@ -139,8 +143,9 @@ def chart_descriptions(chart, census=False):
139143
on += 1 # 0 index issue
140144

141145
messages.append(
142-
"{} peaks at {:,} on day {}{}".format(
146+
"{}{} peaks at {:,} on day {}{}".format(
143147
col,
148+
suffix,
144149
ceil(chart.data[col].max()),
145150
on,
146151
"*" if asterisk else "",

0 commit comments

Comments
 (0)