Skip to content

Conversation

@MatMoore
Copy link
Contributor

@MatMoore MatMoore commented Feb 5, 2026

Description

Currently, if you return to "Take images" from "check information", all the study data is wiped, and the previously entered values are not pre-filled.

This branch changes that so that study data is only deleted if "No images taken" is selected. If "No, add additional information" is selected, and the user has previously filled out that information, redirect them to the next form with the information pre-filled.

When revisiting the additional image details form, we now prefill the existing values. Further work is needed to prefill the other forms within "take images", but I want to split this into multiple PRs to avoid too many conflicts.

Jira link

#989

Review notes

Review checklist

  • Check database queries are correctly scoped to current_provider

@MatMoore MatMoore force-pushed the DTOSS-12180-study-outcome branch from e876203 to 582e81a Compare February 5, 2026 16:01
Base automatically changed from DTOSS-12180-study-outcome to main February 5, 2026 16:28
@MatMoore MatMoore force-pushed the dont-delete-data-when-revisiting-take-images branch from 1779991 to bd76c56 Compare February 9, 2026 09:34
@MatMoore MatMoore changed the title Don't delete data unnecessarily when revisiting the "take images" part of the workflow Don't delete data unnecessarily when revisiting additional image details Feb 9, 2026
@MatMoore MatMoore marked this pull request as ready for review February 9, 2026 09:40
"rcc_count": series_counts.get(("CC", "R"), 1),
"lcc_count": series_counts.get(("CC", "L"), 1),
"right_eklund_count": series_counts.get(("EKLAND", "R"), 1),
"left_eklund_count": series_counts.get(("EKLAND", "L"), 1),
Copy link
Contributor

@swebberuk swebberuk Feb 9, 2026

Choose a reason for hiding this comment

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

Is it correct that we default to 1? I wonder if this should be changed to default to 0, and for the other five image types?

Suggested change
"left_eklund_count": series_counts.get(("EKLAND", "L"), 1),
"left_eklund_count": series_counts.get(("EKLAND", "L"), 0),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh no, the EKLUND should both be 0. 🤦🏻 this line is full of typos.

"lmlo_count": series_counts.get(("MLO", "L"), 1),
"rcc_count": series_counts.get(("CC", "R"), 1),
"lcc_count": series_counts.get(("CC", "L"), 1),
"right_eklund_count": series_counts.get(("EKLAND", "R"), 1),
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo on lines 198 and 199 - EKLAND should be EKLUND

Suggested change
"right_eklund_count": series_counts.get(("EKLAND", "R"), 1),
"right_eklund_count": series_counts.get(("EKLUND", "R"), 1),

When revisiting take images, we don't want to lose notes added
to the study.

Therefore, we shouldn't delete anything if the first step is resubmitted
and the answer is NO_ADD_ADDITIONAL.
@MatMoore MatMoore force-pushed the dont-delete-data-when-revisiting-take-images branch 2 times, most recently from 3e7ef85 to 47a4959 Compare February 9, 2026 15:34
@MatMoore
Copy link
Contributor Author

MatMoore commented Feb 9, 2026

@swebberuk thanks for the review. I've just corrected the handling of EKLUND views.

should_recall = None

kwargs["initial"] = {
"rmlo_count": series_counts.get(("MLO", "R"), 1),
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it is just EKLUND image types that should default to 0, I think they all should.

If user selects 0 for RMLO then no record will be inserted into it, as StudyService.create_or_update only inserts record for series when count > 0. If user returns to page then, if we default to 1, 1 will be shown for RMLO rather than 0.

When instance is None, because there is not an existing study for the appointment, then the form will still default to 1 for CC and MLO, and 0 for EKLUND - as that is controlled by the initial argument of IntegerField.

Suggested change
"rmlo_count": series_counts.get(("MLO", "R"), 1),
"rmlo_count": series_counts.get(("MLO", "R"), 0),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, you're right, I was thinking it would default to the standard set of images (as it does if there is no study instance) but if there's an instance we need to treat missing as 0.

@MatMoore MatMoore force-pushed the dont-delete-data-when-revisiting-take-images branch from 47a4959 to 4c10b50 Compare February 9, 2026 17:01
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 9, 2026

Copy link
Contributor

@swebberuk swebberuk left a comment

Choose a reason for hiding this comment

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

👍

@MatMoore MatMoore merged commit 874aff1 into main Feb 10, 2026
19 of 20 checks passed
@MatMoore MatMoore deleted the dont-delete-data-when-revisiting-take-images branch February 10, 2026 08:54
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.

2 participants