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
| Widget | Description | Audience |
|---|---|---|
| Class Performance | Average scores by subject for a class/period | All roles |
| Student Progress | Score trends across periods for a student | Teacher (own class), Admin/Principal (all) |
| Completion Rate | Percentage of scores entered per assessment | Scoped per role |
| Grade Distribution | Histogram of grades per grade boundary | Admin/Principal |
| Staff Workload | Assessment count per staff member | Admin/Principal/VP only |
API Endpoints
| Method | Path | Purpose |
|---|---|---|
| GET | /api/dashboard/class-performance | Class performance by subject |
| GET | /api/dashboard/student-progress | Student score trends |
| GET | /api/dashboard/completion-rate | Score entry completion rates |
| GET | /api/dashboard/grade-distribution | Grade distribution histogram |
| GET | /api/dashboard/staff-workload | Staff assessment workload |
| GET | /api/admin/dashboard/grade-distribution | Admin-scoped grade distribution |
Permission Model
Each endpoint enforces role-scoped access:
- ADMIN/PRINCIPAL/VP: Access any class or school-wide data.
- TEACHER: Scoped to
classIdinsession.classIds. - AHOD: Scoped to classes within their department.
Key Files
src/lib/db-views.ts-- Materialized view SQL and refresh helpersrc/app/api/dashboard/-- Dashboard API routessrc/app/dashboard/page.tsx-- Server-rendered dashboard with 5 widgets