Skip to content

ADR-150 — Class insights: a staff read of how a class evolves and what goes with its grades, computed at read time

Status

Proposed (2026-11-29). Decisions 1 to 3 and 12 are the product owner's (2026-11-29); decisions 4 to 11 are defaults taken by the orchestrator within them, which the product owner may revisit. Decision 13 lists what the product owner decided for a later change, which will amend this record.

Scope: a read-only page of a classroom for its course's staff, reached from the Grades tab, and its one route, GET /app/api/classrooms/:id/insights (F-STAT-07).

Relations: amends ADR-122 §4 ("counts nowhere … the class statistics") for this page only (§1). Reads the mean of ADR-074 and ADR-131, the indicative exercise score of ADR-124 §1, the drill's teacher view of ADR-041 §8 and §15, the staff seat of ADR-018 and the staff roles of ADR-068. Leaves ADR-085 §8, ADR-088 and ADR-107 unchanged.

Context

A teacher reads a classroom one evaluation at a time (F-RES-01), one gradebook row at a time (F-GBOOK-01), and the drill per student (F-DRILL-04). Nothing shows how the class evolves across the semester, who works, and whether the practice the platform offers — exercises, their retakes, practice after the due date (ADR-122), the drill — goes with the graded tests. The data is all there; what is missing is one read over it with rules a teacher can trust: the same mean as the gradebook, no staff seat, no unreleased grade, and associations that do not overclaim.

Two risks shape the rules. A class is small (20 to 100 students), so a correlation is noisy and a p-value would lend it a weight it does not have. And a page projected in class names its students unless it hides them.

Decision

  1. Exercise effort is three counters (product owner). Per student, each a correlation axis of its own: the exercises handed in as an official attempt (officialAttempt); the retakes, each official attempt after the student's first on an exercise (the attempts numbered above 1; a paper copy that replaced an attempt, ADR-125 §12, is no retake); the practice attempts after the due date (practiceAttempt, ADR-122). Only a finished attempt counts (submitted or expired), timed by its end. This amends ADR-122 §4 for this page only: a practice attempt is counted here as effort, never as a grade, a kept attempt or a class figure of the evaluation. An exercise's score stays indicative (ADR-124 §1): it is never an outcome and never shown here. The rules are exerciseSignals and exerciseFigures (@quiz/domain, insights.ts).
  2. An association is a scatter, two groups and Spearman's coefficient (product owner). The coefficient (spearman: Pearson's of the average ranks, two decimals) is given from 15 pairs on (ASSOCIATION_MIN_PAIRS) and is null without variance; it always comes with its n and the count of the students left out, by reason. The two groups split the pairs at the median of the signal, a tie at the median going below, each side with its n and its mean outcome to the tenth (compareGroups; null when a side is empty). Never a p-value. The page says a signal "goes with" an outcome, never that it causes it.
  3. Nothing new for the students (product owner). No student route, no student screen. The page (a later change) shows the names by default and has a "hide names" switch for projecting it (product owner, 2026-11-29); every student row therefore carries a stable opaque handle (§11). The "Data and privacy" page says that what a teacher shows in class is "without names unless the teacher chooses to show them" (apps/web/src/privacy/privacy.md, "In short"): the web change binds itself to state clearly that this page shows names until they are hidden.
  4. Population and columns. The classroom's claimed student seats, as the gradebook lists them; a staff seat is in no figure (ADR-018, F-GBOOK-01). Only released columns appear, never an unreleased grade. The outcomes an association may read: the overall mean, each component's mean (ADR-131), each released exam. A project column is shown in the class's evolution (its distribution) but is never an outcome on its own, since a group shares its grade; it weighs in through the means. A column's distribution counts an absence as 1.0, as the gradebook's class mean does, and counts the absences and the excused cells apart (columnFigures).
  5. Who is a pair, over which period. On a single exam, an absent or excused student is left out of the pairs and counted apart: an absence counts 1.0 in the mean, and on one exam it would manufacture the effect. A mean outcome is the mean as the gradebook computes it (staffGradebook, one definition). When the outcome is one exam, the effort is measured up to that exam's start — its first run (evaluations.started_at), or its gradebook date when it never ran —, since practice after it cannot explain it; for a mean, over the whole period up to the read (insightPairs).
  6. The drill's signals. Only when the classroom has the drill (on, or a review ever counted): the distinct drill days with a review and the reviews, over the whole period and over the 30 days before its end. They are read through the drill module's staff reader (classroomActivityBefore, drill/teacher.ts), so its cuts hold (the classroom's cards, its current student seats, nothing after an opt-out: ADR-041 §8, §15). A student who opted out is MISSING from every drill association (left out, counted), never zero. Never a stated confidence (F-STAT-06), never a time per question, never the platform's presence hours (ADR-107), never the integrity journal (ADR-088), never commits.
  7. No home and class split. No timetable exists; the generic weekday 08:00–18:00 window of the drill's heatmap would label an evening lab "home" and a free morning "class". The page does not split.
  8. No rank, no percentile. Nowhere in the payload; rows come in roster order.
  9. Nothing stored. Every figure is computed at read time, in a bounded number of queries that does not grow with the roster: no table, no migration, no job, no audit entry (a read).
  10. Access. The classroom is loaded through staffAccess (portalClassroom, guards.ts) behind the teacher guard, never through readableClassroom: there is no student payload. A student and an impersonation session get the role's 403, as on every staff route (accessSweep.db.test.ts), and anyone off the staff the 404 of a missing classroom. Any member of the staff reads it, an assistant included (ADR-068). Which sessions it admits: §12.
  11. The handle. Four characters of an alphabet without look-alikes (no 0/O, 1/I/L): an HMAC-SHA-256 of the enrollment id under a key derived by HKDF from the server's COOKIE_SECRET with an info of its own (the motif of llm/crypto.ts), so it is neither computable from a seat's id nor derived from the roster's order. Unique in the classroom, a collision taking the seat's next candidate in enrollment-id order (insights/handle.ts). Stable while the roster is: a seat that arrives or leaves can move the handle of a seat it collides with (about one chance in a million per pair), and rotating the secret renews every handle, which only changes labels.
  12. Portal sessions only (product owner, 2026-11-29). The route admits the caller's own portal session alone (admit: "portal", the loader portalClassroom of guards.ts), not the default any the gradebook's staff table takes: the payload names the students beside their grades and effort, and a token that reached it — a personal token of any scope, the help assistant's own, a later MCP tool calling it in process — would make any later unlock of the per-student rows decorative. A personal token of scope quiz or quiz:read gets the 403 of its route list (ADR-113); an api token and the assistant's the 404 of a missing classroom. The cost: for this page, "everything the interface does, the API does" (08 §8.1 principle 4) holds only under its own reservation that a session-only route is not an API token's: an api token does not get this page, although it already reads the gradebook whose figures it is computed from; the guide will say so. A token-facing projection is a second route, never this one (the motif of GET /evaluations/:id/contestations/open beside the portal-only staff route).
  13. Decided for a later change (product owner, 2026-11-29), not built here; it will amend this record:
    • the MCP server gets the class's aggregates (class) without an unlock, readable by any assistant token, with no consent revision bump;
    • the per-student rows only under an unlock the course owner gives in the web app, bound to one classroom and one connection, for 1 h, 24 h or 7 d (24 h preselected), audited;
    • under the unlock, the rows under their handle only, no named level in its first version;
    • on a second, token-facing route; this route stays portal-only (§12).

Consequences

  • The teacher sees the semester in one place: each released exam's and project's distribution in date order, each exercise's take-up, the drill's reach, and which effort goes with which result.
  • ONE definition each: the mean is the gradebook's, the exercise counters and the association rules are @quiz/domain's, read by the API and by the page's scatter plots alike; the drill keeps its own cuts.
  • A new reader of attempts counts practice attempts: this one, and only for this page, names them apart; every other reader keeps officialAttempt (ADR-122 §4).
  • The per-student effort is new staff-visible data about each student, though every part of it was already visible to the same staff (the attempts of each evaluation, the drill per student). The "Data and privacy" page already tells students that the course's staff see everything they do in the course, grades and drill activity included (apps/web/src/privacy/privacy.md, N-DATA-07): the product owner judged that enough on 2026-11-29, and the page gains no sentence for this read.
  • With fewer than 15 pairs, the coefficient is absent and only the scatter and the groups speak; a class of 20 with absences often stays below.

Alternatives considered

  • A leaderboard, or a rank per student. Ranks invite comparison between students and are exactly what a projected page must not show; settled question 6 already keeps the ranking from students.
  • P-values or confidence intervals. On 20 to 100 students and dozens of signal × outcome pairs, a p-value invites reading noise as findings; the coefficient with its n and the scatter tell what there is.
  • A home and class split. It needs a timetable the platform does not have; the generic class-hours window would mislabel (§7).
  • Correlating exercise scores. An exercise's score is indicative, done with help at hand and its correction shown at once (ADR-124 §1): it measures the help as much as the student.
  • Storing the statistics. A stored figure goes stale with every regrade, mark or release, and needs its own retention; computed at read time, it follows the gradebook.
  • The dashboard's pseudonyms (D20, uniquePseudonyms of packages/domain/src/pseudonym.ts) as the handle. They are computable from the ids alone, unkeyed, and a token holder under the later unlock (§13) may know the enrollment ids.
  • Pearson's coefficient on the counts. Effort counts are skewed (many zeros, a few large values); ranks resist that skew.