File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 67
67
st .altair_chart (
68
68
census_chart , use_container_width = True
69
69
)
70
- st .markdown (chart_descriptions (census_chart , census = True ))
70
+ st .markdown (chart_descriptions (census_chart , suffix = " Census" ))
71
71
if st .checkbox ("Show Projected Census in tabular form" ):
72
72
draw_census_table (st , census_df , as_date = as_date )
73
73
st .markdown (
Original file line number Diff line number Diff line change @@ -117,15 +117,19 @@ def additional_projections_chart(
117
117
)
118
118
119
119
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
+ """
121
129
messages = []
122
130
123
131
cols = ["Hospitalized" , "ICU" , "Ventilated" ]
124
- if census :
125
- cols = [col + " Census" for col in cols ]
126
-
127
132
asterisk = False
128
-
129
133
day = "date" if "date" in chart .data .columns else "day"
130
134
131
135
for col in cols :
@@ -139,8 +143,9 @@ def chart_descriptions(chart, census=False):
139
143
on += 1 # 0 index issue
140
144
141
145
messages .append (
142
- "{} peaks at {:,} on day {}{}" .format (
146
+ "{}{} peaks at {:,} on day {}{}" .format (
143
147
col ,
148
+ suffix ,
144
149
ceil (chart .data [col ].max ()),
145
150
on ,
146
151
"*" if asterisk else "" ,
You can’t perform that action at this time.
0 commit comments