ProfessorLeVesseur commited on
Commit
85e50b1
·
verified ·
1 Parent(s): 284bc13

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -211,9 +211,11 @@ def main():
211
  with col2:
212
  intervention_frequency = intervention_stats['Intervention Frequency (%)'].values[0]
213
  # Display the "Intervention Frequency (%)" text
214
- st.markdown("<h3 style='color: #358E66;'>Intervention Frequency</h3>", unsafe_allow_html=True)
 
215
  # Display the frequency value below it
216
- st.markdown(f"<h1 style='color: #358E66;'>{intervention_frequency}%</h1>", unsafe_allow_html=True)
 
217
 
218
  # Add download button for Intervention Session Statistics chart
219
  download_chart(intervention_fig, "intervention_statistics_chart.png")
@@ -226,7 +228,6 @@ def main():
226
  # Visualization for Student Metrics
227
  student_metrics_fig = plot_student_metrics(student_metrics_df)
228
 
229
- # NEW Expanded version of Visualization for Student Metrics
230
  # Compute Student Metric Averages
231
  attendance_avg_stats, engagement_avg_stats = compute_average_metrics(student_metrics_df)
232
 
@@ -240,14 +241,14 @@ def main():
240
  # Display the "Attendance Average (%)" text and value
241
  st.markdown("<h4 style='color: #358E66;'>Attendance Average (%)</h4>", unsafe_allow_html=True)
242
  if attendance_avg_stats is not None:
243
- st.markdown(f"<h2 style='color: #358E66;'>{attendance_avg_stats}%</h2>", unsafe_allow_html=True)
244
  else:
245
  st.markdown("<h2 style='color: #358E66;'>N/A</h2>", unsafe_allow_html=True)
246
 
247
  # Display the "Engagement Average (%)" text and value
248
  st.markdown("<h4 style='color: #358E66;'>Engagement Average (%)</h4>", unsafe_allow_html=True)
249
  if engagement_avg_stats is not None:
250
- st.markdown(f"<h2 style='color: #358E66;'>{engagement_avg_stats}%</h2>", unsafe_allow_html=True)
251
  else:
252
  st.markdown("<h2 style='color: #358E66;'>N/A</h2>", unsafe_allow_html=True)
253
 
@@ -432,7 +433,6 @@ def compute_student_metrics(df):
432
  student_metrics_df.rename(columns={'index': 'Student'}, inplace=True)
433
  return student_metrics_df
434
 
435
- #NEW
436
  def compute_average_metrics(student_metrics_df):
437
  # Calculate the attendance and engagement average percentages across students
438
  attendance_avg_stats = student_metrics_df['Attendance (%)'].mean() # Calculate the average attendance percentage
@@ -444,7 +444,6 @@ def compute_average_metrics(student_metrics_df):
444
 
445
  return attendance_avg_stats, engagement_avg_stats
446
 
447
-
448
  def plot_student_metrics(student_metrics_df):
449
  # Create the figure and axis
450
  fig, ax = plt.subplots(figsize=(10, 6)) # Increased figure size for better readability
 
211
  with col2:
212
  intervention_frequency = intervention_stats['Intervention Frequency (%)'].values[0]
213
  # Display the "Intervention Frequency (%)" text
214
+ # st.markdown("<h3 style='color: #358E66;'>Intervention Frequency</h3>", unsafe_allow_html=True)
215
+ st.markdown("<h3 style='color: #358E66; margin-bottom: 0px;'>Intervention Frequency</h3>",unsafe_allow_html=True)
216
  # Display the frequency value below it
217
+ # st.markdown(f"<h1 style='color: #358E66;'>{intervention_frequency}%</h1>", unsafe_allow_html=True)
218
+ st.markdown(f"<h1 style='color: #358E66; margin-top: 0px;'>{intervention_frequency}%</h1>", unsafe_allow_html=True)
219
 
220
  # Add download button for Intervention Session Statistics chart
221
  download_chart(intervention_fig, "intervention_statistics_chart.png")
 
228
  # Visualization for Student Metrics
229
  student_metrics_fig = plot_student_metrics(student_metrics_df)
230
 
 
231
  # Compute Student Metric Averages
232
  attendance_avg_stats, engagement_avg_stats = compute_average_metrics(student_metrics_df)
233
 
 
241
  # Display the "Attendance Average (%)" text and value
242
  st.markdown("<h4 style='color: #358E66;'>Attendance Average (%)</h4>", unsafe_allow_html=True)
243
  if attendance_avg_stats is not None:
244
+ st.markdown(f"<h2 style='color: #358E66; margin-top: 0px;'>{attendance_avg_stats}%</h2>", unsafe_allow_html=True)
245
  else:
246
  st.markdown("<h2 style='color: #358E66;'>N/A</h2>", unsafe_allow_html=True)
247
 
248
  # Display the "Engagement Average (%)" text and value
249
  st.markdown("<h4 style='color: #358E66;'>Engagement Average (%)</h4>", unsafe_allow_html=True)
250
  if engagement_avg_stats is not None:
251
+ st.markdown(f"<h2 style='color: #358E66; margin-top: 0px;'>{engagement_avg_stats}%</h2>", unsafe_allow_html=True)
252
  else:
253
  st.markdown("<h2 style='color: #358E66;'>N/A</h2>", unsafe_allow_html=True)
254
 
 
433
  student_metrics_df.rename(columns={'index': 'Student'}, inplace=True)
434
  return student_metrics_df
435
 
 
436
  def compute_average_metrics(student_metrics_df):
437
  # Calculate the attendance and engagement average percentages across students
438
  attendance_avg_stats = student_metrics_df['Attendance (%)'].mean() # Calculate the average attendance percentage
 
444
 
445
  return attendance_avg_stats, engagement_avg_stats
446
 
 
447
  def plot_student_metrics(student_metrics_df):
448
  # Create the figure and axis
449
  fig, ax = plt.subplots(figsize=(10, 6)) # Increased figure size for better readability