Repository navigation
feat(cardiology): reset the rhythm classification and captions from the patient page - #110
Merged
Merged
Conversation
…he patient page A red Reset button in the Classification tab withdraws the rhythm call; one in the Captions tab deletes the user's own captions (every caption for a project admin). Both ask for confirmation in a modal first. Clearing the call records an empty revision rather than deleting rows, so the audit trail survives, the raw-ECG lock stays on, and a stale reset is refused with 409 like a stale save. The caption reset is a shared view in common/domain_views/voice_captions.py, routed only by cardiology for now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
theElandor
requested review from
Morelli-01,
homarone00 and
lorenzobrg
as code owners
October 12, 2026 08:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
In production we need a quick way to remove annotations that are wrong, or that were made only for demo purposes. Today the cardiology rhythm call can be changed but never withdrawn, and captions can only be deleted one at a time. This PR adds a Reset action for both on the cardiology patient page, so a patient can be put back to "unannotated" in one step.
What changes
How it fits the existing rules
annotations.services.ecg_rhythm.clear_ecg_rhythm, which records a new empty revision rather than deleting rows:ever_annotatedis monotonic.reset_voice_captions, incommon/domain_views/voice_captions.pynext to the other caption views, but only cardiology routes it for now. Extending reset to the other domains needs decisions we haven't made yet: maxillo's occlusion is legacy-only storage and interacts with the raw-data lock, and laparoscopy has no captions panel. That is left for a follow-up.makemigrations --check: no changes).Tests
6 new tests in
cardiology/tests.py(ResetTests):The new URLs are covered automatically by
common.tests_cross_project_matrix.cardiology,annotations,common.tests_cross_project_matrixandcommon.tests_domain_registrypass against MySQL (527 tests).ruffandlint-importswere not run locally; CI runs them.Manual test
🤖 Generated with Claude Code