-
Notifications
You must be signed in to change notification settings - Fork 0
/
home.py
150 lines (127 loc) · 3.76 KB
/
home.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
import streamlit as st
import plotly.express as px
from data import *
from pages.gis import drawCaseMap, drawVacMap
from pages.demographics import *
## PAGE INFO
st.set_page_config(page_title="Monkeypox Dashboard", page_icon="🛖", layout="wide")
st.sidebar.success("Select a page above.")
st.title("Real-Time Monkeypox (mpox) Surveillance System")
st.markdown(
"An Interactive Dashboard By [**CSUF's CEDDI Lab**](https://www.sampsonakwafuo.com/ceddi-lab)"
)
def overviewModule():
st.header("Overview")
tab1, tab2, tab3, tab4, tab5 = st.tabs(
[
"All Time",
"Last Month",
"Last Week",
"Weekly Difference",
"Weekly Race Difference",
]
)
dates = [
[nation_cum.iloc[-1], gender_tests.iloc[-1]],
[nation_cum.iloc[-30], gender_tests.iloc[-4]],
[nation_cum.iloc[-7], gender_tests.iloc[-2]],
]
deltas = [
(dates[0][0]["Cumulative Cases"] - dates[1][0]["Cumulative Cases"]),
(dates[0][0]["Cumulative Cases"] - dates[2][0]["Cumulative Cases"]),
]
genderDates = gender_tests.index.tolist()
# All Time
with tab1:
col1, col2 = st.columns(2)
with col1:
st.subheader("Total Cases")
st.metric(
label=f"Reporting as of {dates[0][0]['epi_date_V3']}",
value=dates[0][0]["Cumulative Cases"],
)
with col2:
st.subheader("Total Tests")
st.metric(
label=f"Reporting as of {genderDates[-1]}",
value=gender_tests["Total_Tests"].sum(),
)
# Last Month
with tab2:
col1, col2 = st.columns(2)
with col1:
st.subheader("Cases")
st.metric(
label=f"Reporting as of {dates[1][0]['epi_date_V3']}", value=deltas[0]
)
with col2:
st.subheader("Tests")
st.metric(
label=f"Reporting as of {genderDates[-4]}",
value=dates[1][1]["Total_Tests"],
)
# Last Week
with tab3:
col1, col2 = st.columns(2)
with col1:
st.subheader("Cases")
st.metric(
label=f"Reporting as of {dates[2][0]['epi_date_V3']}", value=deltas[1]
)
with col2:
st.subheader("Tests")
st.metric(
label=f"Reporting as of {genderDates[-2]}",
value=dates[2][1]["Total_Tests"],
)
# Weekly Difference
with tab4:
weeklyDifference()
# Weekly Race
with tab5:
weeklyRace()
def gisModule():
st.header("GIS Map")
col1, col2, col3 = st.columns(3)
with col1:
radio = st.radio(
label="Select One of the Following", options=["Cases", "Vaccines"]
)
with col2:
state = st.selectbox(label="Select a State", options=state_total["Location"])
with col3:
if radio == "Cases":
st.metric(
label=f"Cases in {state}",
value=state_total["Cases"][state_total["Location"] == state],
)
else:
st.metric(
label=f"Vaccines Administered in {state}",
value=int(
state_vac["Total"][state_vac["Reporting Jurisdictions"] == state]
),
)
if radio == "Cases":
drawCaseMap()
else:
drawVacMap()
def genderModule():
col1, col2 = st.columns(2)
with col1:
drawPieChart()
with col2:
drawAgeDistro()
def casesModule():
col1, col2 = st.columns(2)
with col1:
cumCases()
with col2:
dailyCases()
sevenDayAvg()
def main():
overviewModule()
genderModule()
casesModule()
gisModule()
main()