Skip to content

Add the post-conversation form tables and option APIs (W4-08) - #104

Merged
calebyhan merged 12 commits into
mainfrom
96/report-options
Nov 1, 2026
Merged

calebyhan merged 12 commits into
mainfrom
96/report-options

Conversation

@sliu382

@sliu382 sliu382 commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

After every conversation, the responder files a short form: topics, an outcome, and how confident they felt (TDD 4.3.2). It has no free text, so it can feed analytics without holding anything a student wrote. Coordinators manage the topic and outcome choices, and choices get retired instead of deleted so old reports stay valid. This ticket adds all three tables and the routes for the options. Submitting a report comes later.

Changes:

  • Added ReportOption, ConversationReport, and ConversationReportTopic models plus ReportOptionKind enum in models/report.py
  • ConversationReport has a check that confidence is between 1 and 5. ConversationReport.conversation_id is also unique
  • Made a migration for new models
  • Added a GET report-options in portal for staff. Returns only active options and is ordered by display_order
  • Added admin routes for GET, POST, and PATCH. Did not add DELETE.
  • Added schema for report options
  • Added a Dev seed with 8 topics and 4 outcomes
  • Tested that retired options are hidden from the portal but all options are listed for admins.
  • Tested that the ordering was correct based on display_order.
  • Tested that the database will only accept one report per conversation and also tested that the database rejects confidence ratings outside of 1-5.

Follow-up: In the report submission POST, need to verify that the selected outcome has kind "OUTCOME". The current foreign key only verifies that the option exists. Codex says application validation would be the simplest fit based on the current schema

Closes #96

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Backend Test Results

331 tests  +18   331 ✅ +18   9s ⏱️ +2s
  1 suites ± 0     0 💤 ± 0 
  1 files   ± 0     0 ❌ ± 0 

Results for commit 7a3a6c3. ± Comparison against base commit 4b88c3a.

♻️ This comment has been updated with latest results.

@sliu382
sliu382 requested a review from calebyhan November 1, 2026 19:06
@sliu382 sliu382 changed the title 96/report options Add the post-conversation form tables and option APIs (W4-08) #96 Nov 1, 2026
@sliu382 sliu382 changed the title Add the post-conversation form tables and option APIs (W4-08) #96 Add the post-conversation form tables and option APIs (W4-08) Nov 1, 2026

@calebyhan calebyhan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything in #96 is covered, and tests, alembic check, mypy and ruff all pass. One blocking issue in the migration's downgrade, noted inline.

@sliu382
sliu382 requested a review from calebyhan November 1, 2026 19:45

@calebyhan calebyhan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@calebyhan
calebyhan merged commit d2e398e into main Nov 1, 2026
4 checks passed
@calebyhan
calebyhan deleted the 96/report-options branch November 1, 2026 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add the post-conversation form tables and option APIs (W4-08)

2 participants