-
Notifications
You must be signed in to change notification settings - Fork 0
/
analytics.py
32 lines (27 loc) · 951 Bytes
/
analytics.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
import matplotlib.pyplot as plt
import streamlit as st
import pandas as pd
# Function to generate analytics
def analytics_dashboard():
st.title("Patient Data Analytics Dashboard")
# Sample Data
data = pd.DataFrame({
"Diagnosis": ["Hypertension", "Diabetes", "Asthma"],
"Patient Count": [45, 30, 25],
"Average Wait Time": [20, 30, 25]
})
# Bar chart of diagnoses
st.subheader("Diagnosis Distribution")
fig, ax = plt.subplots()
ax.bar(data['Diagnosis'], data['Patient Count'])
ax.set_ylabel('Number of Patients')
st.pyplot(fig)
# Line chart of average wait time
st.subheader("Average Wait Time by Diagnosis")
fig, ax = plt.subplots()
ax.plot(data['Diagnosis'], data['Average Wait Time'], marker='o')
ax.set_ylabel('Average Wait Time (minutes)')
st.pyplot(fig)
# Call the analytics dashboard in the main app
if __name__ == "__main__":
analytics_dashboard()