Tesneem commited on
Commit
fc21243
·
verified ·
1 Parent(s): b7c835c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +46 -0
app.py CHANGED
@@ -473,6 +473,52 @@ if mongo_uri and student_choice != "(All)" and source_choice != "(All)":
473
  for q in (summary.get("notable_quotes") or [])[:3]:
474
  st.markdown(f"> {q}")
475
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
476
 
477
  # # app.py — Student Skill Radar (MongoDB, secrets-based, no CSV)
478
  # import os
 
473
  for q in (summary.get("notable_quotes") or [])[:3]:
474
  st.markdown(f"> {q}")
475
 
476
+ # === Toggle for trend mode ===
477
+ trend_mode = st.checkbox("Show Average Stage Trends", value=False)
478
+
479
+ if trend_mode:
480
+ # Group by stage and average the skill group scores
481
+ stage_avg = df_final.groupby("stage")[list(SKILL_GROUPS.keys())].mean().reset_index()
482
+
483
+ # Radar plot for each stage
484
+ fig = go.Figure()
485
+ for _, row in stage_avg.iterrows():
486
+ stage_name = row["stage"]
487
+ values = row[list(SKILL_GROUPS.keys())].tolist()
488
+
489
+ fig.add_trace(go.Scatterpolar(
490
+ r=values,
491
+ theta=list(SKILL_GROUPS.keys()),
492
+ fill='toself',
493
+ name=stage_name
494
+ ))
495
+
496
+ fig.update_layout(
497
+ polar=dict(radialaxis=dict(visible=True, range=[0, 1])),
498
+ showlegend=True,
499
+ title="Average Skill Group Scores by Stage"
500
+ )
501
+
502
+ else:
503
+ # Your existing per-student radar chart plotting code
504
+ fig = go.Figure()
505
+ for _, row in df_final.iterrows():
506
+ values = row[list(SKILL_GROUPS.keys())].tolist()
507
+
508
+ fig.add_trace(go.Scatterpolar(
509
+ r=values,
510
+ theta=list(SKILL_GROUPS.keys()),
511
+ fill='toself',
512
+ name=row["label"]
513
+ ))
514
+
515
+ fig.update_layout(
516
+ polar=dict(radialaxis=dict(visible=True, range=[0, 1])),
517
+ showlegend=True,
518
+ title="Student Skill Radar"
519
+ )
520
+
521
+ st.plotly_chart(fig, use_container_width=True)
522
 
523
  # # app.py — Student Skill Radar (MongoDB, secrets-based, no CSV)
524
  # import os