ProfessorLeVesseur commited on
Commit
73b2f83
1 Parent(s): c60d2d1

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +103 -1
main.py CHANGED
@@ -1,3 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
  from app_config import AppConfig
3
  from data_processor import DataProcessor
@@ -60,6 +149,19 @@ def main():
60
  st.subheader("Student Metrics")
61
  st.write(student_metrics_df)
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  # Compute Student Metric Averages
64
  attendance_avg_stats, engagement_avg_stats = data_processor.compute_average_metrics(student_metrics_df)
65
 
@@ -84,4 +186,4 @@ def main():
84
  st.error(f"Error reading the file: {str(e)}")
85
 
86
  if __name__ == '__main__':
87
- main()
 
1
+ # import streamlit as st
2
+ # from app_config import AppConfig
3
+ # from data_processor import DataProcessor
4
+ # from visualization import Visualization
5
+ # from ai_analysis import AIAnalysis
6
+ # from sidebar import Sidebar # Import the Sidebar class
7
+
8
+ # def main():
9
+ # # Initialize the app configuration
10
+ # app_config = AppConfig()
11
+
12
+ # # Initialize the sidebar
13
+ # sidebar = Sidebar()
14
+ # sidebar.display() # Display the sidebar
15
+
16
+ # # Initialize the data processor
17
+ # data_processor = DataProcessor()
18
+
19
+ # # Initialize the visualization handler
20
+ # visualization = Visualization()
21
+
22
+ # # Initialize the AI analysis handler
23
+ # ai_analysis = AIAnalysis(data_processor.client)
24
+
25
+ # st.title("Intervention Program Analysis")
26
+
27
+ # # File uploader
28
+ # uploaded_file = st.file_uploader("Upload your Excel file", type=["xlsx"])
29
+
30
+ # if uploaded_file is not None:
31
+ # try:
32
+ # # Read the Excel file into a DataFrame
33
+ # df = data_processor.read_excel(uploaded_file)
34
+
35
+ # # Format the session data
36
+ # df = data_processor.format_session_data(df)
37
+
38
+ # # Replace student names with initials
39
+ # df = data_processor.replace_student_names_with_initials(df)
40
+
41
+ # st.subheader("Uploaded Data")
42
+ # st.write(df)
43
+
44
+ # # Ensure expected column is available
45
+ # if DataProcessor.INTERVENTION_COLUMN not in df.columns:
46
+ # st.error(f"Expected column '{DataProcessor.INTERVENTION_COLUMN}' not found.")
47
+ # return
48
+
49
+ # # Compute Intervention Session Statistics
50
+ # intervention_stats = data_processor.compute_intervention_statistics(df)
51
+ # st.subheader("Intervention Session Statistics")
52
+ # st.write(intervention_stats)
53
+
54
+ # # Plot and download intervention statistics
55
+ # intervention_fig = visualization.plot_intervention_statistics(intervention_stats)
56
+ # visualization.download_chart(intervention_fig, "intervention_statistics_chart.png")
57
+
58
+ # # Compute Student Metrics
59
+ # student_metrics_df = data_processor.compute_student_metrics(df)
60
+ # st.subheader("Student Metrics")
61
+ # st.write(student_metrics_df)
62
+
63
+ # # Compute Student Metric Averages
64
+ # attendance_avg_stats, engagement_avg_stats = data_processor.compute_average_metrics(student_metrics_df)
65
+
66
+ # # Plot and download student metrics
67
+ # student_metrics_fig = visualization.plot_student_metrics(student_metrics_df, attendance_avg_stats, engagement_avg_stats)
68
+ # visualization.download_chart(student_metrics_fig, "student_metrics_chart.png")
69
+
70
+ # # Prepare input for the language model
71
+ # llm_input = ai_analysis.prepare_llm_input(student_metrics_df)
72
+
73
+ # # Generate Notes and Recommendations using Hugging Face LLM
74
+ # with st.spinner("Generating AI analysis..."):
75
+ # recommendations = ai_analysis.prompt_response_from_hf_llm(llm_input)
76
+
77
+ # st.subheader("AI Analysis")
78
+ # st.markdown(recommendations)
79
+
80
+ # # Download AI output
81
+ # ai_analysis.download_llm_output(recommendations, "llm_output.txt")
82
+
83
+ # except Exception as e:
84
+ # st.error(f"Error reading the file: {str(e)}")
85
+
86
+ # if __name__ == '__main__':
87
+ # main()
88
+
89
+
90
  import streamlit as st
91
  from app_config import AppConfig
92
  from data_processor import DataProcessor
 
149
  st.subheader("Student Metrics")
150
  st.write(student_metrics_df)
151
 
152
+ # Display decision tree diagrams for each student
153
+ st.subheader("Decision Path for Each Student")
154
+ for index, row in student_metrics_df.iterrows():
155
+ st.write(f"Decision Tree for Student {row['Student']}:")
156
+
157
+ # Generate and display the tree diagram
158
+ try:
159
+ dot = data_processor.build_tree_diagram(row)
160
+ st.graphviz_chart(dot)
161
+ st.write(f"Outcome: {row.get('Outcome', 'No outcome data')}")
162
+ except Exception as e:
163
+ st.error(f"Error generating decision tree for {row['Student']}: {str(e)}")
164
+
165
  # Compute Student Metric Averages
166
  attendance_avg_stats, engagement_avg_stats = data_processor.compute_average_metrics(student_metrics_df)
167
 
 
186
  st.error(f"Error reading the file: {str(e)}")
187
 
188
  if __name__ == '__main__':
189
+ main()