Skip to content

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

Merged
malross merged 60 commits intomainfrom
clinic-booking
Mar 26, 2026
Merged

First click-through of the parents' clinic booking journey#223
malross merged 60 commits intomainfrom
clinic-booking

Conversation

@malross
Copy link
Copy Markdown
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
Copy Markdown
Collaborator

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

Comment thread app/controllers/book-into-a-clinic.js
@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
Comment thread app/views/book-into-a-clinic/form/vaccination-choice.njk Outdated
Comment thread app/locales/en.js Outdated
@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 a commit that referenced this pull request Mar 23, 2026
@paulrobertlloyd paulrobertlloyd had a problem deploying to mavis-protot-clinic-boo-i8zvab March 23, 2026 10:59 Failure
@paulrobertlloyd paulrobertlloyd had a problem deploying to mavis-protot-clinic-boo-i8zvab March 23, 2026 11:33 Failure
@paulrobertlloyd paulrobertlloyd temporarily deployed to mavis-protot-clinic-boo-i8zvab March 23, 2026 12:27 Inactive
@paulrobertlloyd paulrobertlloyd temporarily deployed to mavis-protot-clinic-boo-i8zvab March 23, 2026 16:32 Inactive
@paulrobertlloyd paulrobertlloyd had a problem deploying to mavis-protot-clinic-boo-i8zvab March 25, 2026 11:34 Failure
Copy link
Copy Markdown
Collaborator

@paulrobertlloyd paulrobertlloyd left a comment

Choose a reason for hiding this comment

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

Looking good! Just a few nit-picky details to resolve then this is good to merge!

Comment thread app/controllers/book-into-a-clinic.js Outdated
Comment thread app/controllers/book-into-a-clinic.js
Comment thread app/controllers/book-into-a-clinic.js Outdated
Comment thread app/controllers/book-into-a-clinic.js Outdated
Comment thread app/controllers/book-into-a-clinic.js Outdated
Comment thread app/models/clinic-booking.js Outdated
Comment thread app/models/clinic-booking.js Outdated
Comment thread app/routes/book-into-a-clinic.js Outdated
Comment thread app/views/book-into-a-clinic/form/check-answers.njk
Comment thread app/views/book-into-a-clinic/form/check-answers.njk Outdated
malross added 4 commits March 26, 2026 10:29
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).
malross and others added 14 commits March 26, 2026 10:29
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.
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.
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).
Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com>
* Fix generateClinicAppointment

* Move the check answers page before the health questions.

* Fix dob decoration in clinic booking

* Allow use of a previously entered address in clinic booking

This commit also introduces the Child object (without a context) on the ClinicAppointment object, replacing the unmatchedXxxx properties.

---------

Co-authored-by: Paul Robert Lloyd <me+git@paulrobertlloyd.com>
@paulrobertlloyd paulrobertlloyd temporarily deployed to mavis-protot-clinic-boo-i8zvab March 26, 2026 10:34 Inactive
malross and others added 2 commits March 26, 2026 10:44
Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com>
Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com>
@paulrobertlloyd paulrobertlloyd temporarily deployed to mavis-protot-clinic-boo-i8zvab March 26, 2026 10:44 Inactive
Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com>
@paulrobertlloyd paulrobertlloyd temporarily deployed to mavis-protot-clinic-boo-i8zvab March 26, 2026 10:46 Inactive
Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com>
@paulrobertlloyd paulrobertlloyd temporarily deployed to mavis-protot-clinic-boo-i8zvab March 26, 2026 11:03 Inactive
Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com>
@paulrobertlloyd paulrobertlloyd temporarily deployed to mavis-protot-clinic-boo-i8zvab March 26, 2026 11:07 Inactive
Also fix errors from suggested changes commited in PR #223
@paulrobertlloyd paulrobertlloyd temporarily deployed to mavis-protot-clinic-boo-i8zvab March 26, 2026 11:14 Inactive
@malross malross merged commit bb3be4b into main Mar 26, 2026
1 check passed
@malross malross deleted the clinic-booking branch March 26, 2026 11:21
@paulrobertlloyd paulrobertlloyd self-requested a review March 26, 2026 11:21
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