Skip to content

First click-through of the parents' clinic booking journey#223

Open
malross wants to merge 52 commits intomainfrom
clinic-booking
Open

First click-through of the parents' clinic booking journey#223
malross wants to merge 52 commits intomainfrom
clinic-booking

Conversation

@malross
Copy link
Collaborator

@malross malross commented Mar 17, 2026

Parents' booking journey is in the /book-into-a-clinic route. Other, earlier routes /clinic-booking and /clinic-appointment will likely be dropped in favour of that but are kept for reference for now.

Note: various aspects are currently hard-coded, including:

  • the lack of iteration for multiple children
  • the lack of matching to existing child records (or listing of eligible vaccinations)
  • the set of health questions presented
  • the details in the check answers page

Some of these things are part-coded, but need debugging.

Next steps planned:

  • Generate the appointment sub-journey in a method, similar to the health question one, creating steps for all N appointments in one go
    • Create all appointment models themselves in advance (culling existing ones or creating new ones as needed)
    • getAppointmentQuestionPaths(booking_uuid, data.wizard)
      • This will see how many appointments are on the context and have that booking ID and loop to generate the wizard paths for them
    • Reintroduce the update method to respond to confirmed submission from the check-answers page, putting the appointments into the booking at that point (if not at the point of their creation?) and the booking into the global context
  • Do the same for the health questions, generating the paths for all appointments
  • Make better use of existing classes e.g. replace the unmatchedXxxx fields in ClinicAppointment with a Child object

@malross malross requested a review from paulrobertlloyd March 17, 2026 14:26
@paulrobertlloyd paulrobertlloyd temporarily deployed to mavis-protot-clinic-boo-i8zvab March 17, 2026 14:28 Inactive
@paulrobertlloyd
Copy link
Collaborator

Once you’re happy with the clinic booking flow, you can pop a link to it on the prototype homepage.


export const bookIntoClinicController = {
// Load the preset into locals
read(request, response, next, session_preset_slug) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Worth taking a look at

const serviceName = 'Give or refuse consent for vaccinations'
response.locals.assetsName = 'public'
response.locals.serviceName = serviceName
response.locals.headerOptions = {
service: {
text: serviceName
}
}

Setting the serviceName and assetsName means you can give this parent facing flow it’s own name, use the standard (narrower) page width, and not show SAIS-facing navigation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, thanks. Hadn't got to that, but was wondering why I had the SAIS team's navigation in the header.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@paulrobertlloyd does the service name need to be non-localised?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It could be, but so far this service name is not used in many other places.

@paulrobertlloyd paulrobertlloyd temporarily deployed to mavis-protot-clinic-boo-i8zvab March 18, 2026 10:59 Inactive
@paulrobertlloyd paulrobertlloyd temporarily deployed to mavis-protot-clinic-boo-i8zvab March 18, 2026 11:24 Inactive
{{ checkboxes({
fieldset: {
legend: {
text: __("clinicBooking.vaccinationChoice.vaccinations.label", firstName)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps add size: "m" to increase the prominence of this legend on the page

hits: {
label: 'Choose one of the following:'
},
tryAgain: 'None of these - try another town, city, or postcode'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
tryAgain: 'None of these - try another town, city, or postcode'
tryAgain: 'None of these try another town, city, or postcode'

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is that an em dash replacing a hyphen? Hard to tell in a monospace font.

@paulrobertlloyd paulrobertlloyd temporarily deployed to mavis-protot-clinic-boo-i8zvab March 18, 2026 13:31 Inactive
@paulrobertlloyd paulrobertlloyd temporarily deployed to mavis-protot-clinic-boo-i8zvab March 18, 2026 15:43 Inactive
malross added a commit that referenced this pull request Mar 19, 2026
@paulrobertlloyd paulrobertlloyd temporarily deployed to mavis-protot-clinic-boo-i8zvab March 19, 2026 12:10 Inactive
@paulrobertlloyd paulrobertlloyd temporarily deployed to mavis-protot-clinic-boo-i8zvab March 20, 2026 15:22 Inactive
malross added a commit that referenced this pull request Mar 20, 2026
@paulrobertlloyd paulrobertlloyd temporarily deployed to mavis-protot-clinic-boo-i8zvab March 20, 2026 15:51 Inactive
@paulrobertlloyd paulrobertlloyd temporarily deployed to mavis-protot-clinic-boo-i8zvab March 20, 2026 19:01 Inactive
@paulrobertlloyd paulrobertlloyd temporarily deployed to mavis-protot-clinic-boo-i8zvab March 23, 2026 09:18 Inactive
@paulrobertlloyd paulrobertlloyd temporarily deployed to mavis-protot-clinic-boo-i8zvab March 23, 2026 10:21 Inactive
malross added 12 commits March 23, 2026 10:34
Each booking, which will have a unique booking reference number, has one or more appointments. This corresponds to one or more children being booked into a clinic by the same parent and in the same booking flow.

Models are not yet hooked up to anything.
Various aspects of the appointments could still be improved (e.g. choice of programmes), but some of it is limited by the lack of clinic session details in the models (e.g. start and end times, slot lengths, etc.)
Squash this commit. As it stands, data file generation fails with a circular reference. This is because I made the mistake of composing the objects I was creating in a hierarchy rather than using IDs as foreign keys.

I'll fix that in the next commit.
In short, npm run create-data now runs without encountering infinite loops. Replaced aggregation of actual model objects with use of object IDs and getters to return the actual objects.

Also in this commit, have improved the logic for matching children's ages to the clinic's programme(s) and choosing non-surprising parental relationships (albeit without attempting to make siblings have the same last name).
This replaces the previous use of Other to indicate foster carer status.
This is jsut based on the Move class/controller, so nothing major yet. Plus, I've commented out the Update method for now.

Not sure yet whether I need to do the clinic appointments too. Suspect I will, of course, but need to get more comfortable with relative routes first.
Nothing more than a call to inspect on the response.locals
To be honest, not sure we should be using faker calls in the model or that we even need to pass the booking reference as a parameter to the constructor, but that tidy up can come later, if at all.
Previously, any pages trying to list the full set of records of a given type would most likely fall over when attempting to stringify the json, as no context was found in the array itself.
Dummy view only at this point, dumping the JSON to the page.
malross added 22 commits March 23, 2026 10:34
Yes, it's only hard-coded, but it's needed for a research session.
One link per primary programme (aka session preset).
This commit is the start of work to support iteration through multiple children (or appointments) in the parents' clinic booking journey. It will allow us to map out the full wizard journey but still needs to be supported by dynamic generation of the appointment journey pages for each of the appointments we create (as well as dynamic generation of the health question pages for each of those appointments).
This commit moves the Parent object to the ClinicBooking, removing it from the ClinicAppointment (but adding parental relationship properties to the appointment). This should simplify various areas, removing the need to propagate contact details to multiple appointments in the same booking.

The changes here required changes to the generation of fake data too and triggered a bit of fixing.
This isn't the best solution, but is only intended as a quick way to address the need for parental responsibility. See the comment in parental-responsibility.njk for a better proposed solution.
The dates are still hard-coded, but at least make sense now (copy-paste error spotted by a parent in a research call).
Still need to do the same for the health questions, but there are other missing pieces of the puzzle to address before I can get that working.
This means swapping individual checkbox values for a Boolean or taking _checked out of arrays where there are multiple checkboxes - in both the booking and appointment models.
…nic booking

Prior to this, the health questions presented were:
 - a hard-coded set of questions
 - shown for only one appointment
 - not attributed to a specific child
…next child

Changes in this commit include:
 - confirmation button text of "Continue to next child" when entering the final detail of the previous child
 - change of title to mention "your next child" when entering chiuld details for 2nd and subsequent children

Also got rid of some old, unused entries in en.js.
Apostrophes, curly quotes and em dashes in the clinic booking strings.
Start page and final confirmation page have XL-sized main headings, so the subheadings are accordingly L-sized. Elsewhere, it's L-size at the top level.
The heading text and the caption vary based on number of children and the number of the current child. The previous code worked fine locally, but initially had both of those values still set to zero on Heroku resulting in being asked for the "next child" on the first time through. As I couldn't quickly work out why the values weren't making it through (logging showed they always were coming through, on localhost), I've changed the logic slightly to avoid obviously wrong text in the page title.
@paulrobertlloyd paulrobertlloyd had a problem deploying to mavis-protot-clinic-boo-i8zvab March 23, 2026 10:59 Failure
Prior to this, values being set on response.locals in readForm (where the values were taken from the models on the wizard context) weren't coming through until one page later than expected. At least, not on heroku; it was fine on localhost. It seems the session data wasn't being fully flushed to the store on heroku before the next HTTP GET came through, so now I'm not performing the redirect until the session data has been fully saved.
@paulrobertlloyd paulrobertlloyd had a problem deploying to mavis-protot-clinic-boo-i8zvab March 23, 2026 11:33 Failure
Specifically, if we can't find any clinic sessions whose session presets match the clinic booking we've created, don't try to make any appointments in that booking (as the appointments would need a suitable session ID to hook up to).
@paulrobertlloyd paulrobertlloyd temporarily deployed to mavis-protot-clinic-boo-i8zvab March 23, 2026 12:27 Inactive
Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com>
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