File size: 2,300 Bytes
40cbaf1
 
 
0a5028c
 
 
 
40cbaf1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0a5028c
40cbaf1
0a5028c
 
 
 
 
 
 
 
 
 
40cbaf1
 
 
0a5028c
 
 
 
 
 
 
 
 
 
40cbaf1
 
0a5028c
40cbaf1
0a5028c
40cbaf1
 
 
 
 
 
 
 
 
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
import streamlit as st
import pandas as pd
import plotly.express as px
import matplotlib.pyplot as plt

# Load patient data
df = pd.read_csv('patient_data.csv')

# Title and Description
st.title('Patient Data Dashboard')
st.write("""
This dashboard provides an overview of patient health metrics for better monitoring and decision-making.
""")

# Sidebar for Patient Selection
st.sidebar.header('Select Patient')
patient_id = st.sidebar.selectbox('Patient ID', df['patient_id'].unique())

# Filter Data for Selected Patient
patient_data = df[df['patient_id'] == patient_id]

# Display Patient Profile
st.header('Patient Profile')
st.write(f"Name: {patient_data['name'].values[0]}")
st.write(f"Age: {patient_data['age'].values[0]}")
st.write(f"Gender: {patient_data['gender'].values[0]}")
st.write(f"Medical History: {patient_data['medical_history'].values[0]}")

# Visualization of Vital Signs
st.header('Vital Signs Over Time')

# Line Chart for Heart Rate
fig = px.line(patient_data, x='date', y='heart_rate', title='Heart Rate Over Time')
st.plotly_chart(fig)

# Line Chart for Blood Pressure
fig = px.line(patient_data, x='date', y='blood_pressure', title='Blood Pressure Over Time')
st.plotly_chart(fig)

# Line Chart for Blood Glucose
fig = px.line(patient_data, x='date', y='blood_glucose', title='Blood Glucose Over Time')
st.plotly_chart(fig)

# Dropdown for selecting specific visit details
st.header('Previous Visit Details')
selected_date = st.selectbox('Select Visit Date', patient_data['date'].unique())
selected_visit = patient_data[patient_data['date'] == selected_date]

st.write(f"**Visit Date:** {selected_date}")
st.write(f"Heart Rate: {selected_visit['heart_rate'].values[0]}")
st.write(f"Blood Pressure: {selected_visit['blood_pressure'].values[0]}")
st.write(f"Blood Glucose: {selected_visit['blood_glucose'].values[0]}")

# Alerts and Notifications
st.header('Alerts')
if selected_visit['heart_rate'].values[0] > 100:
    st.error('High heart rate detected!')
if selected_visit['blood_pressure'].values[0] > 140:
    st.error('High blood pressure detected!')

# Download Button for Patient Data
st.download_button(
    label="Download Patient Data as CSV",
    data=patient_data.to_csv().encode('utf-8'),
    file_name=f'patient_{patient_id}_data.csv',
    mime='text/csv',
)