Skip to content

Conversation

@MatMoore
Copy link
Contributor

@MatMoore MatMoore commented Jan 27, 2026

Description

This is the first step for recording images. It replaces the awaiting images page, since we're assuming we won't have automatic recording of images ready for the pilot.

Screenshot of new form

Jira link

https://nhsd-jira.digital.nhs.uk/browse/DTOSS-11825

(note the screenshot in the Jira looks to be out of date - I used the copy from the prototype instead)

Review notes

This is intended to link up with the additional details step to be added in #938. For now I put in a placeholder view.

Because you can go back to this step after reaching the check information page, I've made it so that when the form is submitted, it clears the existing study and series. We might need similar logic on the following forms depending on whether it's possible to revisit them without going back to this form.

Some other things I noticed not specific to this step:

  • There is a back link above every workflow step at the moment, but it's not in the prototype. Should we remove it? You can still navigate via the sidebar, and I don't think we want the user to go back out of the workflow once they're in it.
  • We're not checking at each step that the previous steps are actually complete, only when deciding whether to make the sidebar link available. I'm thinking this should be addressed in a separate PR.
  • Record medical info page is missing the continue button at the top of the page, it only appears at the bottom

Review checklist

  • Check database queries are correctly scoped to current_provider

@MatMoore MatMoore force-pushed the DTOSS-11825-record-images-taken branch 7 times, most recently from d166a22 to 091b00c Compare January 28, 2026 10:17
@MatMoore MatMoore marked this pull request as ready for review January 28, 2026 10:22
@MatMoore MatMoore mentioned this pull request Jan 28, 2026
1 task
@github-actions
Copy link

github-actions bot commented Jan 28, 2026

The review app at this URL has been deleted:
https://pr-943.manage-breast-screening.non-live.screening.nhs.uk


@transaction.atomic
def remove_existing_study_and_series(self):
if hasattr(self.appointment, "study"):
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we be creating audit records of the deletes here, just as we do above for the creates?

Something like: self.auditor.audit_bulk_delete(self.appointment.study.series_set.all())

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 I think so - I've added it in.


match form.cleaned_data["standard_images"]:
case form.StandardImagesChoices.YES_TWO_CC_AND_TWO_MLO:
self.mark_workflow_step_complete()
Copy link
Contributor

Choose a reason for hiding this comment

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

On StudyService we've added @transaction.atomic so all database operations in create_with_default_series are executed inside a single transaction. Does that mean the database operation in mark_workflow_step_complete will happen in a different transaction and, if so, does it matter?

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 it will.

I kept the AppointmentWorkflowStepCompletion bit outside of the StudyService as it felt quite unrelated - it belongs to a different app, and we already have other views creating these records from the view class so I thought I'd keep it consistent with that.

It probably doesn't matter, although I've just added @atomic to the view's form_valid method to bring everything into the same transaction. (We have ATOMIC_REQUESTS off so the default will be to autocommit)

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.

Looks good to me. I've added separate comments about auditing and transactions, but they're questions rather than suggestions.

Otherwise we get a `study_set` attribute on the appointment
rather than a singular `study`.
Previously we add a hint param to our custom form fields for the overall
field. In the case of choice fields, we also want to  be able to add hints
to the individual choices.

This gets passed as the hint param within in params.items.
This used to be "awaiting images" but the connectivity with the PACS
is coming later, so for now entering the details is completely manual.
Redirects to one of the folliowing:
- appointment cannot continue
- additional images step
- check information

Creation of AppointmentWorkflowStepCompletion record

Creation of study and series.
This allows AppointmentWorkflowStepCompletion and Study updates to
participate in the same database transaction.

I decided against moving the step completion code into the StudyService
as logically they are unrelated, and they belong to separate apps.
Doing the former update in the view is also more consistent with what
the other views are already doing.
@MatMoore MatMoore force-pushed the DTOSS-11825-record-images-taken branch from 091b00c to 229a4e5 Compare January 29, 2026 11:04
@sonarqubecloud
Copy link

@MatMoore MatMoore merged commit 7df895a into main Jan 29, 2026
15 checks passed
@MatMoore MatMoore deleted the DTOSS-11825-record-images-taken branch January 29, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants