Repository navigation
PM-6643 - let's talk automated ai classification - #10
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
It introduces a production database migration and changes the submissions report/CSV API contract, which warrant final human review.
1 open issue
What changed in this PR
This PR (PM-6643) introduces AI-powered classification of form submissions, focused on the "Let's talk" form, and wires the result through the data model, reporting API, and documentation. It adds a new SubmissionClassification table (populated externally by forms-processor-v6), appends classification columns to the cross-version submissions report/CSV export for forms that have an ai-classify processor flow, and adds an optional classification label filter. A migration also seeds the Let's talk classify/label-routing flows (all disabled) for a staged rollout.
Changes:
- New
SubmissionClassificationmodel + migration with label/status/confidence constraints and alabelindex, cascading on submission delete. reportFormappends fiveclassification_*columns/labels and supports a validatedclassificationfilter (withUNKNOWNmatching unclassified rows) only for forms with anai-classifyflow; the CSV export inherits this viaReportDatesDto.- Documentation (api.md, data-model.md, lets-talk.md) and an integration test covering reporting, filtering, CSV export, and cascade deletion.
| File | Description |
|---|---|
| prisma/schema.prisma | Adds SubmissionClassification model and the Submission back-relation. |
| prisma/migrations/20261022010000_lets_talk_classification/migration.sql | Creates the table with CHECK constraints/index and seeds seven disabled Let's talk flows. |
| src/forms/forms.service.ts | Adds classificationCells/classificationFilter helpers and integrates columns, labels, and filtering into reportForm. |
| src/forms/dto.ts | Adds CLASSIFICATION_LABEL_PATTERN and the optional classification filter field on ReportDatesDto. |
| docs/api.md | Documents the classification columns and filter for report/export routes. |
| docs/data-model.md | Documents the new entity, relation, and classification-rule routing. |
| docs/lets-talk.md | Describes the classification feature and rollout (trigger wording flagged). |
| test/forms.integration.spec.ts | Adds integration coverage for seeded flows, columns, filtering, CSV export, and cascade; minor formatting. |
Review effort: Balanced
| others reply or forward by label. It does not change `lets-talk-sales-email`. Once the | ||
| processor enables classification, the reports UI and CSV show a `classification` | ||
| column (`UNKNOWN` until classified) and accept a `classification` filter. The rollout |

This pull request introduces AI-powered classification of form submissions, primarily for the "Let's talk" form, and integrates this feature throughout the data model, API, and reporting. It adds a new
SubmissionClassificationtable, enables filtering and reporting by classification label, and updates documentation and migration files accordingly.AI Classification Feature:
SubmissionClassificationtable to store AI classification results for each submission, including label, status, confidence, review flag, language, rationale, workflow IDs, attempts, and error details, with appropriate constraints and indexing. [1] [2]SubmissiontoSubmissionClassificationand document the new entity and its fields. [1] [2] [3]API and Reporting Enhancements:
classificationlabel filter (includingUNKNOWNfor unclassified submissions). [1] [2] [3] [4] [5] [6] [7] [8]Documentation:
Testing: