Update main.py
Browse files
main.py
CHANGED
@@ -5,6 +5,7 @@ from visualization import Visualization # Import the data viz class
|
|
5 |
from ai_analysis import AIAnalysis # Import the ai analysis class
|
6 |
from sidebar import Sidebar # Import the Sidebar class
|
7 |
|
|
|
8 |
def main():
|
9 |
# Initialize the app configuration
|
10 |
app_config = AppConfig()
|
@@ -24,6 +25,26 @@ def main():
|
|
24 |
|
25 |
st.title("Intervention Program Analysis")
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
# File uploader
|
28 |
uploaded_file = st.file_uploader("Upload your Excel file", type=["xlsx"])
|
29 |
|
@@ -38,22 +59,8 @@ def main():
|
|
38 |
# Replace student names with initials
|
39 |
df = data_processor.replace_student_names_with_initials(df)
|
40 |
|
41 |
-
#
|
42 |
-
date_option = st.radio(
|
43 |
-
"Select data range:",
|
44 |
-
("All Data", "Date Range")
|
45 |
-
)
|
46 |
-
|
47 |
if date_option == "Date Range":
|
48 |
-
# Get the min and max dates from the data
|
49 |
-
min_date = df['Date of Session'].min()
|
50 |
-
max_date = df['Date of Session'].max()
|
51 |
-
|
52 |
-
# Date input for start and end date
|
53 |
-
start_date = st.date_input("Start Date", min_value=min_date, max_value=max_date, value=min_date)
|
54 |
-
end_date = st.date_input("End Date", min_value=min_date, max_value=max_date, value=max_date)
|
55 |
-
|
56 |
-
# Filter the DataFrame based on the selected date range
|
57 |
df = df[(df['Date of Session'] >= pd.to_datetime(start_date)) & (df['Date of Session'] <= pd.to_datetime(end_date))]
|
58 |
|
59 |
st.subheader("Uploaded Data")
|
|
|
5 |
from ai_analysis import AIAnalysis # Import the ai analysis class
|
6 |
from sidebar import Sidebar # Import the Sidebar class
|
7 |
|
8 |
+
|
9 |
def main():
|
10 |
# Initialize the app configuration
|
11 |
app_config = AppConfig()
|
|
|
25 |
|
26 |
st.title("Intervention Program Analysis")
|
27 |
|
28 |
+
# Date selection option
|
29 |
+
date_option = st.radio(
|
30 |
+
"Select data range:",
|
31 |
+
("All Data", "Date Range")
|
32 |
+
)
|
33 |
+
|
34 |
+
# Initialize start and end date variables
|
35 |
+
start_date = None
|
36 |
+
end_date = None
|
37 |
+
|
38 |
+
if date_option == "Date Range":
|
39 |
+
# Prompt user to enter start and end dates
|
40 |
+
start_date = st.date_input("Start Date")
|
41 |
+
end_date = st.date_input("End Date")
|
42 |
+
|
43 |
+
# Ensure start date is before end date
|
44 |
+
if start_date > end_date:
|
45 |
+
st.error("Start date must be before end date.")
|
46 |
+
return
|
47 |
+
|
48 |
# File uploader
|
49 |
uploaded_file = st.file_uploader("Upload your Excel file", type=["xlsx"])
|
50 |
|
|
|
59 |
# Replace student names with initials
|
60 |
df = data_processor.replace_student_names_with_initials(df)
|
61 |
|
62 |
+
# Filter data if date range is selected
|
|
|
|
|
|
|
|
|
|
|
63 |
if date_option == "Date Range":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
df = df[(df['Date of Session'] >= pd.to_datetime(start_date)) & (df['Date of Session'] <= pd.to_datetime(end_date))]
|
65 |
|
66 |
st.subheader("Uploaded Data")
|