Skip to content

Reorganise the prototype to use a central file for question data#70

Merged
simonwhatley merged 36 commits into
mainfrom
centralise-question-data
May 19, 2026
Merged

Reorganise the prototype to use a central file for question data#70
simonwhatley merged 36 commits into
mainfrom
centralise-question-data

Conversation

@simonwhatley
Copy link
Copy Markdown
Collaborator

@simonwhatley simonwhatley commented May 14, 2026

Updated the prototype (v4.1) to use YAML-based question content and a shared question renderer. This means there is a central place where all content can be managed.

A future piece of work may introduce a YAML-based rules file so that we can manage the logic in YAML rather than JavaScript.

View deployment: https://lung-health-check-pr-70.herokuapp.com/

Details of the changes:

  • Added central question content in app/prototype_v4_1/data/questions.yaml.
  • Added tobacco-specific content in app/prototype_v4_1/data/tobacco.yaml.
  • Added a shared question loader in app/prototype_v4_1/lib/questions.js.
  • Added reusable validation in app/prototype_v4_1/lib/question-validator.js.
  • Added support for:
    • radios
    • checkboxes
    • text inputs
    • date inputs
    • grouped inputs
    • conditional reveal inputs
    • contextual error messages
  • Moved question pages to the shared _question.html renderer.
  • Removed old question templates that are now rendered from YAML.
  • Kept only bespoke templates for pages that are not standard questions, such as exit and not eligible pages.
  • Split controller helper logic into smaller files:
    • eligibility.js
    • question-renderer.js
    • summary.js
    • tobacco-flow.js
    • unit-navigation.js
  • Refactored question.js so it mainly contains route handlers.
  • Moved tobacco type content, smoking change content, and shisha setting content out of the controller.
  • Replaced string-based tobacco tense logic with explicit current and past content variants.
  • Added contextual tobacco headings and errors for each tobacco type.
  • Added frequency-aware wording for tobacco quantity questions, such as day, week, month or year.
  • Added JSDoc comments to the main controller and library files.

@simonwhatley simonwhatley requested a review from selina-dxw May 14, 2026 15:24
@simonwhatley simonwhatley temporarily deployed to lung-health-check-pr-70 May 14, 2026 15:24 Inactive
@simonwhatley simonwhatley temporarily deployed to lung-health-check-pr-70 May 14, 2026 15:54 Inactive
@simonwhatley simonwhatley temporarily deployed to lung-health-check-pr-70 May 14, 2026 16:03 Inactive
@simonwhatley simonwhatley temporarily deployed to lung-health-check-pr-70 May 15, 2026 08:39 Inactive
@simonwhatley simonwhatley temporarily deployed to lung-health-check-pr-70 May 15, 2026 08:43 Inactive
@simonwhatley simonwhatley temporarily deployed to lung-health-check-pr-70 May 15, 2026 08:52 Inactive
@simonwhatley simonwhatley temporarily deployed to lung-health-check-pr-70 May 15, 2026 09:41 Inactive
@simonwhatley simonwhatley temporarily deployed to lung-health-check-pr-70 May 18, 2026 16:20 Inactive
@simonwhatley simonwhatley temporarily deployed to lung-health-check-pr-70 May 18, 2026 21:11 Inactive
@simonwhatley simonwhatley requested a review from nataliariley May 19, 2026 10:01
Copy link
Copy Markdown
Collaborator

@nataliariley nataliariley left a comment

Choose a reason for hiding this comment

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

Looks great thanks Simon

@simonwhatley simonwhatley merged commit d18808c into main May 19, 2026
1 check passed
@simonwhatley simonwhatley deleted the centralise-question-data branch May 19, 2026 10:55
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