Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,7 @@ import streamlit as st
|
|
| 2 |
import pandas as pd
|
| 3 |
import datetime as dt
|
| 4 |
import matplotlib.pyplot as plt
|
| 5 |
-
import
|
| 6 |
|
| 7 |
# Function to load data from the local CSV file
|
| 8 |
@st.cache_data
|
|
@@ -19,6 +19,7 @@ df = load_data()
|
|
| 19 |
# Function to save data to the local CSV file
|
| 20 |
def save_data(df):
|
| 21 |
df.to_csv('patient_data.csv', index=False)
|
|
|
|
| 22 |
|
| 23 |
# Sidebar: Select or create patient
|
| 24 |
action = st.sidebar.selectbox("Action", ["Select Patient", "Create New Patient"])
|
|
@@ -86,6 +87,7 @@ if action == "Select Patient":
|
|
| 86 |
"Other Notes": other_notes,
|
| 87 |
}
|
| 88 |
df = pd.concat([df, pd.DataFrame([new_entry])], ignore_index=True)
|
|
|
|
| 89 |
|
| 90 |
# Save the updated data to CSV
|
| 91 |
save_data(df)
|
|
@@ -146,6 +148,7 @@ elif action == "Create New Patient":
|
|
| 146 |
"Other Notes": None,
|
| 147 |
}
|
| 148 |
df = pd.concat([df, pd.DataFrame([new_patient])], ignore_index=True)
|
|
|
|
| 149 |
|
| 150 |
# Save the updated data to CSV
|
| 151 |
save_data(df)
|
|
|
|
| 2 |
import pandas as pd
|
| 3 |
import datetime as dt
|
| 4 |
import matplotlib.pyplot as plt
|
| 5 |
+
import os
|
| 6 |
|
| 7 |
# Function to load data from the local CSV file
|
| 8 |
@st.cache_data
|
|
|
|
| 19 |
# Function to save data to the local CSV file
|
| 20 |
def save_data(df):
|
| 21 |
df.to_csv('patient_data.csv', index=False)
|
| 22 |
+
st.write("Data saved successfully.")
|
| 23 |
|
| 24 |
# Sidebar: Select or create patient
|
| 25 |
action = st.sidebar.selectbox("Action", ["Select Patient", "Create New Patient"])
|
|
|
|
| 87 |
"Other Notes": other_notes,
|
| 88 |
}
|
| 89 |
df = pd.concat([df, pd.DataFrame([new_entry])], ignore_index=True)
|
| 90 |
+
st.write("New entry added to DataFrame.")
|
| 91 |
|
| 92 |
# Save the updated data to CSV
|
| 93 |
save_data(df)
|
|
|
|
| 148 |
"Other Notes": None,
|
| 149 |
}
|
| 150 |
df = pd.concat([df, pd.DataFrame([new_patient])], ignore_index=True)
|
| 151 |
+
st.write("New patient added to DataFrame.")
|
| 152 |
|
| 153 |
# Save the updated data to CSV
|
| 154 |
save_data(df)
|