Skip to main content

Phase 6: Dashboard

Phase 6 delivers the analytics dashboard. No new Prisma models are added -- all data aggregates from existing tables.

Purpose

Provide school-wide and role-scoped analytics: class performance, student progress, completion rates, grade distributions, and staff workload.

Dashboard Widgets

WidgetDescriptionAudience
Class PerformanceAverage scores by subject for a class/periodAll roles
Student ProgressScore trends across periods for a studentTeacher (own class), Admin/Principal (all)
Completion RatePercentage of scores entered per assessmentScoped per role
Grade DistributionHistogram of grades per grade boundaryAdmin/Principal
Staff WorkloadAssessment count per staff memberAdmin/Principal/VP only

API Endpoints

MethodPathPurpose
GET/api/dashboard/class-performanceClass performance by subject
GET/api/dashboard/student-progressStudent score trends
GET/api/dashboard/completion-rateScore entry completion rates
GET/api/dashboard/grade-distributionGrade distribution histogram
GET/api/dashboard/staff-workloadStaff assessment workload
GET/api/admin/dashboard/grade-distributionAdmin-scoped grade distribution

Permission Model

Each endpoint enforces role-scoped access:

  • ADMIN/PRINCIPAL/VP: Access any class or school-wide data.
  • TEACHER: Scoped to classId in session.classIds.
  • AHOD: Scoped to classes within their department.

Key Files

  • src/lib/db-views.ts -- Materialized view SQL and refresh helper
  • src/app/api/dashboard/ -- Dashboard API routes
  • src/app/dashboard/page.tsx -- Server-rendered dashboard with 5 widgets