Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,6 @@ import matplotlib.pyplot as plt
|
|
5 |
import os
|
6 |
|
7 |
# Function to load data from the local CSV file
|
8 |
-
@st.cache_data
|
9 |
def load_data():
|
10 |
df = pd.read_csv('patient_data.csv')
|
11 |
df['Date of Birth'] = pd.to_datetime(df['Date of Birth'], format='%Y-%m-%d', errors='coerce')
|
@@ -13,14 +12,14 @@ def load_data():
|
|
13 |
df['Age'] = df['Date of Birth'].apply(lambda dob: (dt.datetime.now() - dob).days // 365)
|
14 |
return df
|
15 |
|
16 |
-
# Load data from the CSV file
|
17 |
-
df = load_data()
|
18 |
-
|
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"])
|
26 |
|
|
|
5 |
import os
|
6 |
|
7 |
# Function to load data from the local CSV file
|
|
|
8 |
def load_data():
|
9 |
df = pd.read_csv('patient_data.csv')
|
10 |
df['Date of Birth'] = pd.to_datetime(df['Date of Birth'], format='%Y-%m-%d', errors='coerce')
|
|
|
12 |
df['Age'] = df['Date of Birth'].apply(lambda dob: (dt.datetime.now() - dob).days // 365)
|
13 |
return df
|
14 |
|
|
|
|
|
|
|
15 |
# Function to save data to the local CSV file
|
16 |
def save_data(df):
|
17 |
df.to_csv('patient_data.csv', index=False)
|
18 |
st.write("Data saved successfully.")
|
19 |
|
20 |
+
# Load data from the CSV file
|
21 |
+
df = load_data()
|
22 |
+
|
23 |
# Sidebar: Select or create patient
|
24 |
action = st.sidebar.selectbox("Action", ["Select Patient", "Create New Patient"])
|
25 |
|