Reporting & Feedback Implementation Plan (Backend)
We’re structurally ready (snapshots, structured tags, feedbackTagKeys, frozen feedbackTags, item responses, archive/gating). The remaining work is additive: outcomes, feedback visibility, metrics, cohort hooks, and admin reporting surfaces.
Schema Changes (step 1)
evaluation_versions: addfeedback_mode text CHECK (feedback_mode IN ('none','overall','tags','items')),pass_mark_percent numeric CHECK (pass_mark_percent BETWEEN 0 AND 100)(nullable).submissions: addcompleted_at timestamptz,score numeric,max_score numeric,outcome_code text CHECK (outcome_code IN ('pass','fail','incomplete')),outcome_label text,assignment_id uuid NULL,run_label text NULL.submission_items: addis_correct boolean,score numeric,max_score numeric,time_spent_ms bigint NULL.
Metrics & Outcomes (step 2)
- In
SubmitSession, compute for MCQ:- per-item:
is_correct,score(weight if correct, else 0),max_score(start with 1), leavetime_spent_msNULL for now. - submission: sum item scores to
score/max_score, setcompleted_at, derivepercent, setoutcome_codeviapass_mark_percenton evaluation version (pass/failelse default), setoutcome_label(Pass/Fail/Incompletedefaults).
- per-item:
- Freeze
feedbackTagKeysandfeedbackTagsper submission as now.
Feedback Visibility (step 3)
- Store
feedback_modeonevaluation_versionsand include in snapshot. - Candidate views obey
feedback_mode:none: no outcome/feedback.overall: outcome + score only.tags: outcome + tag-level feedback (feedbackTags).items: outcome + tag-level + per-item feedback.
- Admin views: always full structured tags and all metrics.
Cohort Hooks (step 3)
- Populate
assignment_id/run_labelon sessions/submissions when assignments/schedules land; nullable until then.
Admin Reporting Endpoints (step 4)
- Implemented:
GET /api/v1/evaluations/\{evalId\}/submissionswith page/limit + status/outcome filters; returns submission summaries (id, userId, completedAt, score/maxScore, outcome_code/label, frozen feedbackTags). Snapshots are omitted in the list for brevity—fetch/submissions/\{id\}for detail. - Implemented:
GET /api/v1/users/\{userId\}/submissionswith the same pagination/filters and summary shape. - Candidate vs admin enforcement relies on auth/roles; candidate detail view continues to use
view=candidateon/submissions/\{id\}which respectsfeedback_mode.
Reporting View (optional, step 5)
- Pending: add a DB view (or materialized view if needed) flattening submission + item metrics + structured tags + feedbackTags + cohort fields for BI/exports. Start with a plain VIEW; materialize only if performance requires it.
Already Done (no changes)
- Immutable
versionSnapshotwith sections/items/questions/answers/navigation. - Structured tags per question version captured in snapshot.
- Feedback config endpoint
PATCH /evaluations/\{evalId\}/versions/\{versionId\}/feedbackfreezesfeedbackTagKeysper submission. feedbackTagsderived from structured tags + frozen keys.- Admin vs candidate tags: admin sees full tags; candidate sees
feedbackTags. - Archive-on-delete and session gating.
Implementation Order
- Apply schema changes (evaluation_versions, submissions, submission_items).
- Implement metrics/outcomes in
SubmitSession. - Apply
feedback_modefiltering for candidate views. - Add admin reporting endpoints.
- (Optional) Add the reporting view.