ProfessorLeVesseur commited on
Commit
b47d895
1 Parent(s): f2086cb

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +0 -168
main.py CHANGED
@@ -1,171 +1,3 @@
1
- # import streamlit as st
2
- # import pandas as pd
3
- # from app_config import AppConfig # Import the configurations class
4
- # from data_processor import DataProcessor # Import the data analysis class
5
- # from visualization import Visualization # Import the data viz class
6
- # from ai_analysis import AIAnalysis # Import the ai analysis class
7
- # from sidebar import Sidebar # Import the Sidebar class
8
-
9
-
10
- # def main():
11
- # # Initialize the app configuration
12
- # app_config = AppConfig()
13
-
14
- # # Initialize the sidebar
15
- # sidebar = Sidebar()
16
- # sidebar.display()
17
-
18
- # # Initialize the data processor
19
- # data_processor = DataProcessor()
20
-
21
- # # Initialize the visualization handler
22
- # visualization = Visualization()
23
-
24
- # # Initialize the AI analysis handler
25
- # ai_analysis = AIAnalysis(data_processor.client)
26
-
27
- # st.title("Literacy Implementation Record Data Analysis")
28
-
29
- # # Add the descriptive text
30
- # st.markdown("""
31
- # This tool summarizes implementation record data for student attendance, engagement, and intervention dosage to address hypothesis #1: Have Students Received Adequate Instruction?
32
- # """)
33
-
34
- # # Date selection option
35
- # date_option = st.radio(
36
- # "Select data range:",
37
- # ("All Data", "Date Range")
38
- # )
39
-
40
- # # Initialize start and end date variables
41
- # start_date = None
42
- # end_date = None
43
-
44
- # if date_option == "Date Range":
45
- # # Prompt user to enter start and end dates
46
- # start_date = st.date_input("Start Date")
47
- # end_date = st.date_input("End Date")
48
-
49
- # # Ensure start date is before end date
50
- # if start_date > end_date:
51
- # st.error("Start date must be before end date.")
52
- # return
53
-
54
- # # File uploader
55
- # uploaded_file = st.file_uploader("Upload your Excel file", type=["xlsx"])
56
-
57
- # if uploaded_file is not None:
58
- # try:
59
- # # Read the Excel file into a DataFrame
60
- # df = data_processor.read_excel(uploaded_file)
61
-
62
- # # Format the session data
63
- # df = data_processor.format_session_data(df)
64
-
65
- # # Replace student names with initials
66
- # df = data_processor.replace_student_names_with_initials(df)
67
-
68
- # # Filter data if date range is selected
69
- # if date_option == "Date Range":
70
- # # Convert start_date and end_date to datetime
71
- # start_date = pd.to_datetime(start_date).date()
72
- # end_date = pd.to_datetime(end_date).date()
73
-
74
- # # Filter the DataFrame based on the selected date range
75
- # df = df[(df['Date of Session'] >= start_date) & (df['Date of Session'] <= end_date)]
76
-
77
-
78
- # st.subheader("Uploaded Data")
79
- # st.write(df)
80
-
81
- # # Ensure expected column is available
82
- # if DataProcessor.INTERVENTION_COLUMN not in df.columns:
83
- # st.error(f"Expected column '{DataProcessor.INTERVENTION_COLUMN}' not found.")
84
- # return
85
-
86
-
87
- # #MOVE
88
- # # Compute Intervention Session Statistics
89
- # intervention_stats = data_processor.compute_intervention_statistics(df)
90
- # st.subheader("Intervention Dosage")
91
- # st.write(intervention_stats)
92
-
93
- # # Plot and download intervention statistics
94
- # # intervention_fig = visualization.plot_intervention_statistics(intervention_stats)
95
- # # visualization.download_chart(intervention_fig, "intervention_statistics_chart.png")
96
-
97
- # # Plot and download intervention statistics: Two-column layout for the visualization and intervention frequency
98
- # col1, col2 = st.columns([3, 1]) # Set the column width ratio
99
-
100
- # with col1:
101
- # intervention_fig = visualization.plot_intervention_statistics(intervention_stats)
102
-
103
- # with col2:
104
- # intervention_frequency = intervention_stats['Intervention Dosage (%)'].values[0]
105
- # # Display the "Intervention Frequency (%)" text
106
- # st.markdown("<h3 style='color: #358E66;'>Intervention Dosage</h3>", unsafe_allow_html=True)
107
- # # Display the frequency value below it
108
- # st.markdown(f"<h1 style='color: #358E66;'>{intervention_frequency}%</h1>", unsafe_allow_html=True)
109
-
110
- # visualization.download_chart(intervention_fig, "intervention_statistics_chart.png")
111
-
112
- # # Compute Student Metrics
113
- # student_metrics_df = data_processor.compute_student_metrics(df)
114
- # st.subheader("Student Attendance and Engagement")
115
- # st.write(student_metrics_df)
116
-
117
- # # Compute Student Metric Averages
118
- # attendance_avg_stats, engagement_avg_stats = data_processor.compute_average_metrics(student_metrics_df)
119
-
120
- # # Plot and download student metrics
121
- # student_metrics_fig = visualization.plot_student_metrics(student_metrics_df, attendance_avg_stats, engagement_avg_stats)
122
- # visualization.download_chart(student_metrics_fig, "student_metrics_chart.png")
123
-
124
- # # Evaluate each student and build decision tree diagrams
125
- # student_metrics_df['Evaluation'] = student_metrics_df.apply(
126
- # lambda row: data_processor.evaluate_student(row), axis=1
127
- # )
128
- # st.subheader("Student Evaluations")
129
- # st.write(student_metrics_df[['Student', 'Evaluation']])
130
-
131
- # # # Build and display decision tree diagrams for each student
132
- # # for index, row in student_metrics_df.iterrows():
133
- # # tree_diagram = visualization.build_tree_diagram(row)
134
- # # st.graphviz_chart(tree_diagram.source)
135
-
136
- # # Build and display decision tree diagrams for each student
137
- # for index, row in student_metrics_df.iterrows():
138
- # tree_diagram = visualization.build_tree_diagram(row)
139
-
140
- # # Get the student's name from the DataFrame
141
- # student_name = row['Student']
142
-
143
- # # Use st.expander to wrap the graphviz chart with the student's name
144
- # with st.expander(f"{student_name} Decision Tree", expanded=False):
145
- # st.graphviz_chart(tree_diagram.source)
146
-
147
- # # Prepare input for the language model
148
- # llm_input = ai_analysis.prepare_llm_input(student_metrics_df)
149
-
150
- # # Generate Notes and Recommendations using Hugging Face LLM
151
- # with st.spinner("Generating AI analysis..."):
152
- # recommendations = ai_analysis.prompt_response_from_hf_llm(llm_input)
153
-
154
- # st.subheader("AI Analysis")
155
- # st.markdown(recommendations)
156
-
157
- # # Download AI output
158
- # ai_analysis.download_llm_output(recommendations, "llm_output.txt")
159
-
160
- # except Exception as e:
161
- # st.error(f"Error processing the file: {str(e)}")
162
-
163
- # if __name__ == '__main__':
164
- # main()
165
-
166
-
167
-
168
-
169
  import streamlit as st
170
  import pandas as pd
171
  from app_config import AppConfig # Import the configurations class
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
  import pandas as pd
3
  from app_config import AppConfig # Import the configurations class