Skip to content

Feature/remove ResponseAnnotations model#1162

Open
gecBurton wants to merge 18 commits intomainfrom
feature/move-themes-from-annotations-to-responses
Open

Feature/remove ResponseAnnotations model#1162
gecBurton wants to merge 18 commits intomainfrom
feature/move-themes-from-annotations-to-responses

Conversation

@gecBurton
Copy link
Copy Markdown
Contributor

@gecBurton gecBurton commented Feb 4, 2026

Context

The ResponseAnnotation model was a 1:1 relationship with Response, acting as a thin wrapper with no independent lifecycle. Flattening it into Response simplifies queries, reduces joins, removes the need to manage annotation creation separately from responses, and makes the data model more intuitive.

Changes proposed in this pull request

  • Removes the ResponseAnnotation model and consolidates all annotation fields (sentiment, evidence_rich, human_reviewed, reviewed_by, reviewed_at, flagged_by, themes) directly onto the Response model
  • Migrates ResponseAnnotationTheme through-table to reference Response directly instead of ResponseAnnotation
  • Adds history tracking (django-simple-history) to Response itself
  • Updates all dependent code (serializers, views, filters, services, export, data pipeline sync, admin, factories, tests) to reference fields on Response rather than via response.annotation.*

Migrations

Four sequential migrations handle the data migration safely:

  • 0094: Adds response FK to ResponseAnnotationTheme; back-populates from response_annotation.response
  • 0095: Adds HistoricalResponse, moves themes M2M to Response, removes old response_annotation FK from through-table
  • 0096: Adds annotation fields (sentiment, evidence_rich, human_reviewed, etc.) to Response; back-populates from existing ResponseAnnotation records
  • 0097: Drops ResponseAnnotation and HistoricalResponseAnnotation models entirely

Guidance to review

Link to Trello ticket

https://incubatorforartificialintelligence.atlassian.net/wiki/spaces/Consult/pages/25559057/Tech+Debt#Add-ResponseAnnotation.is_edited-field

Things to check

  • I have added any new ENV vars in all deployed environments and updated the .env.test files in the repo

@gecBurton gecBurton marked this pull request as draft February 4, 2026 13:05
@gecBurton gecBurton marked this pull request as draft February 4, 2026 13:05
@gecBurton gecBurton marked this pull request as ready for review February 9, 2026 07:48
@gecBurton gecBurton changed the title Feature/move themes from annotations to responses Feature/remove ResponseAnnotations model Feb 10, 2026
@gecBurton gecBurton mentioned this pull request Feb 13, 2026
1 task
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.

1 participant