Skip to content

Enable SAIS team to extend clinic appointments during and after booking - #427

Open
malross wants to merge 43 commits into
mainfrom
edit-clinic-appointment
Open

malross wants to merge 43 commits into
mainfrom
edit-clinic-appointment

Conversation

@malross

@malross malross commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

MAV-10701 Can extend appointments to cover multiple slots

Context

While the settings on the session relating to double-slot appointments will cover a lot of the need for variable length appointments, there will be times when the SAIS team wants to extend – or possibly even shorten – an appointment, typically when they know the child has extra support needs that can affect the time it takes to vaccinate. So while the session's rules for double-slot appointments will still be honoured, this PR adds the ability to extend an appointment during the team's booking process, or change the length of an appointment arbitrarily thereafter.

The changes

There are two main parts to this, giving the SAIS team control over an appointment's length:

  • during booking, the team can opt to extend an appointment by an extra slot based on the child's support needs
  • after booking, the team can change the length of the appointment, either reverting it to its default length or setting a precise number of slots that it should occupy

In both cases, the inability to fit the desired length into the session will result in the team being offered a shortened appointment and flagging the potential for overrun (which research suggests SAIS teams are very good at accommodating).

Screenshots

During booking, the team is offered the chance to extend the appointment for support needs:
image

Appointment length shown explicitly on the check answers page, support needs in the Child details:
image

The Edit Appointment page, with the new Appointment length property and Change link:
image

The appointment length page in the appointment editing journey:
image

The same page, showing the option to enter a specific length:
image

An optional page following the appointment length page, offering to shorten the appointment to fit the session:
image

@malross
malross temporarily deployed to mavis-protot-edit-clini-2oom8h October 1, 2026 16:24 Inactive
malross added 29 commits October 1, 2026 17:36
…andler

I may choose to change the order of the route handlers and this gives me more freedom to do so (and reduces the complex dependencies between handlers)
As well as reducing repetition, this will come in handy later when reusing the book-into-a-clinic controller for routes that don't necessarily include a booking UUID.
The route here uses a cleaner URL that needs just the session ID and the appointment UUID. Arguably, it didn't even need the session ID, but that's been kept in the route to clarify the context from which the user's chosen to edit the appointment. Anyway, this required a new param handler to dig the booking UUID out of the appointment and then call the existing param handlers for booking UUID and appointment UUID separately.
Previously, we were trying to access the patient on the wizard context when deciding where to fork from the team-facing page that offers to record health answers. And that resulted in a server error.
Previously, for the edit action, we'd been saving the copy from the global context i.e. the original.
…and time

This has none of the complexity of the new appointment journey re running out of space across all clinics (the 'fully-booked' forks), but that's probably ok to just demonstrate the flow.
This is to match what we currently show on the live service's page.
The link destination isn't coded yet; coming soon.
This is a very naïve initial implementation, as it doesn't attempt to check whether there's space for the appointment.
malross added 14 commits October 1, 2026 17:36
PatientSessions weren't previously being moved across and nothing was being added to the patient's programme activity.
Appointment cancellation now lives at  /sessions/:id/appointments/:appointment_uuid/cancel, to be consistent with the edit route, which is /sessions/:id/appointments/:appointment_uuid/edit
Previously, was sometimes redirecting to /availability rather than the intended relative path.
This looks at all possible times in the session, not just the time at which the appointment is currently sat. Maybe it should be clearer that you might be about to change the appointment time though...?
…nt.js

There were two functions in utils/clinic-appointment.js that were doing conceptually very similar things. They now both use the new Session.canFitSlotCount
Previously, the check to see whether an appointment had been shortened was only comparing the current length to the default length for the appointment, which didn't take account of extension for support needs (whether in the creation of the appointment or during editing).
Only set the new appointment's path on booking routes, and rename it to newAppointmentPath, just to make it doubly clear that it's not used in any appointment editing routes/journeys.
@paulrobertlloyd

paulrobertlloyd commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator
  • On check and confirm page, the time summary row appears before that for appointment length, but when editing appointment length appears before time; these should be the same
  • For appointment length, should we also (and always) indicate how many slots that is (i.e. ‘30 minutes (3 slots)’)
  • We should also be consistent in how we order time and slots. Is it:
    • 30 minutes (3 slots)
    • 3 slots (30 minutes)

@malross

malross commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator Author

@paulrobertlloyd

  • On check and confirm page, the time summary row appears before that for appointment length, but when editing appointment length appears before time; these should be the same

Yeah, that's something I was aware of, but wasn't sure it was right to make consistent.

How religiously do you make the order of the properties on a check-answers page match the order of the pages in the journey? I feel like it's quite important and that's why the appointment length comes before the appointment time in the editing journey's check answers page. In the booking journey, there's no explicit choose-an-appointment-length page, so I felt more free to choose where that value went in the check answers page – and it felt weird putting it in the middle of the location > date > time range > time sequence of pages.

@malross

malross commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator Author

@paulrobertlloyd

  • For appointment length, should we also (and always) indicate how many slots that is (i.e. ‘30 minutes (3 slots)’)
  • We should also be consistent in how we order time and slots. Is it:
    • 30 minutes (3 slots)
    • 3 slots (30 minutes)

Regarding showing the appointment length, do you reckon it's still valuable to show the start and end times? For example, in check-answers for the booking journey, you'd get something like the following:

Appointment length: 20 minutes (2 slots)
Time: 2:45pm to 3:05pm

I feel like I'm duplicating information. 😐 Some options, for the booking journeys, might be:

  • stop showing the Appointment length property completely (it has no Change link anyway)
  • stop showing the end time in the Time property e.g. Time: 2:45pm

Thoughts?

(Oh, and I'll never include the bit about slots in parent-facing pages.)

This branch was successfully deployed

1 active deployment
mavis-protot-edit-clini-2oom8h — c8957067 Deployed Oct 1, 2026 by malross
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