From f8c7cf7ef3cbb3d12076cf66ffd8c50d5a0b244f Mon Sep 17 00:00:00 2001 From: Simon Whatley Date: Fri, 29 May 2026 15:44:00 +0100 Subject: [PATCH 01/22] Fix education question label --- app/prototype_v4/views/questions/education.html | 2 +- app/prototype_v4_1/data/questions.yaml | 2 +- app/prototype_v4_1/docs/question-schema.md | 2 +- app/prototype_v4_2/data/questions.yaml | 2 +- app/prototype_v4_2/docs/question-schema.md | 2 +- app/prototype_v4_3/docs/question-schema.md | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/prototype_v4/views/questions/education.html b/app/prototype_v4/views/questions/education.html index 4b473e4..d04c4ae 100644 --- a/app/prototype_v4/views/questions/education.html +++ b/app/prototype_v4/views/questions/education.html @@ -31,7 +31,7 @@ name: "answers[education]", fieldset: { legend: { - text: "What is the highest level of education have you completed?", + text: "What is the highest level of education you have completed?", isPageHeading: false, classes: "nhsuk-fieldset__legend--m" } diff --git a/app/prototype_v4_1/data/questions.yaml b/app/prototype_v4_1/data/questions.yaml index e94fbbe..981d7db 100644 --- a/app/prototype_v4_1/data/questions.yaml +++ b/app/prototype_v4_1/data/questions.yaml @@ -462,7 +462,7 @@ questions: If your qualification is not shown choose the closest level. input: - label: What is the highest level of education have you completed? + label: What is the highest level of education you have completed? options: - label: I finished school before the age of 15 value: before_15 diff --git a/app/prototype_v4_1/docs/question-schema.md b/app/prototype_v4_1/docs/question-schema.md index 84e1c03..85db6b4 100644 --- a/app/prototype_v4_1/docs/question-schema.md +++ b/app/prototype_v4_1/docs/question-schema.md @@ -19,7 +19,7 @@ questions: description: | We ask this question because education is linked to other factors that may impact your chances of developing lung cancer. input: - label: What is the highest level of education have you completed? + label: What is the highest level of education you have completed? options: - label: GCSEs hint: Previously O-levels diff --git a/app/prototype_v4_2/data/questions.yaml b/app/prototype_v4_2/data/questions.yaml index 1edbcf0..4468d30 100644 --- a/app/prototype_v4_2/data/questions.yaml +++ b/app/prototype_v4_2/data/questions.yaml @@ -356,7 +356,7 @@ questions: type: single answerKey: education input: - label: What is the highest level of education have you completed? + label: What is the highest level of education you have completed? options: - label: I finished school before the age of 15 value: before_15 diff --git a/app/prototype_v4_2/docs/question-schema.md b/app/prototype_v4_2/docs/question-schema.md index 5e4cc0e..8573436 100644 --- a/app/prototype_v4_2/docs/question-schema.md +++ b/app/prototype_v4_2/docs/question-schema.md @@ -16,7 +16,7 @@ questions: type: single answerKey: education input: - label: What is the highest level of education have you completed? + label: What is the highest level of education you have completed? options: - label: GCSEs hint: Previously O-levels diff --git a/app/prototype_v4_3/docs/question-schema.md b/app/prototype_v4_3/docs/question-schema.md index 6cd0ef0..f4aaf43 100644 --- a/app/prototype_v4_3/docs/question-schema.md +++ b/app/prototype_v4_3/docs/question-schema.md @@ -16,7 +16,7 @@ questions: type: single answerKey: education input: - label: What is the highest level of education have you completed? + label: What is the highest level of education you have completed? options: - label: GCSEs hint: Previously O-levels From 401a21edac913dee6b2a8462bccab7b8e039c40e Mon Sep 17 00:00:00 2001 From: Simon Whatley Date: Mon, 1 Jun 2026 11:51:05 +0100 Subject: [PATCH 02/22] Update frequency questions --- app/prototype_v4_2/data/questions.yaml | 30 ++++++++++++++------------ 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/app/prototype_v4_2/data/questions.yaml b/app/prototype_v4_2/data/questions.yaml index 4468d30..1a49a26 100644 --- a/app/prototype_v4_2/data/questions.yaml +++ b/app/prototype_v4_2/data/questions.yaml @@ -685,16 +685,17 @@ questions: input: label: How often do you smoke? options: - - label: Daily + - label: Every day + hint: You smoke on most days, for example, 5 or more days a week value: daily - - label: Weekly - hint: For example, on the weekend + - label: Most weeks + hint: You smoke at least once a week, but not on most days, for example, at weekends only value: weekly - - label: Monthly - hint: Select this option if you smoke at least once a month + - label: Most months + hint: You smoke at least once a month, but less than once a week value: monthly - - label: Yearly - hint: For example, 2 to 3 times a year or fewer + - label: Rarely + hint: You smoke less than once a month, for example, a few times a year value: yearly validation: required: true @@ -797,16 +798,17 @@ questions: input: label: How often did you smoke? options: - - label: Daily + - label: Every day + hint: You smoke on most days, for example, 5 or more days a week value: daily - - label: Weekly - hint: For example, on the weekend + - label: Most weeks + hint: You smoke at least once a week, but not on most days, for example, at weekends only value: weekly - - label: Monthly - hint: Select this option if you smoked at least once a month + - label: Most months + hint: You smoke at least once a month, but less than once a week value: monthly - - label: Yearly - hint: For example, 2 to 3 times a year or fewer + - label: Rarely + hint: You smoke less than once a month, for example, a few times a year value: yearly validation: required: true From d44ca5395bfc069edc8d5aff7b52253514712211 Mon Sep 17 00:00:00 2001 From: Simon Whatley Date: Mon, 1 Jun 2026 12:24:22 +0100 Subject: [PATCH 03/22] Use option hint text --- app/prototype_v4_2/lib/tobacco-flow.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/prototype_v4_2/lib/tobacco-flow.js b/app/prototype_v4_2/lib/tobacco-flow.js index 8d98a48..786b585 100644 --- a/app/prototype_v4_2/lib/tobacco-flow.js +++ b/app/prototype_v4_2/lib/tobacco-flow.js @@ -825,9 +825,7 @@ const getSmokingContentQuestionOverrides = ({ name: `answers[${step.type}][smokingFrequency]` }, value: answer.smokingFrequency, - items: getQuestionItemsWithLabels('smoking-frequency', {}, { - monthly: `Select this option if you ${isPastSmokingType ? 'smoked' : 'smoke'} at least once a month` - }) + items: getQuestionItemsWithLabels('smoking-frequency') } } From 4d1ffcac354d44a93009bda52389f23991eb6741 Mon Sep 17 00:00:00 2001 From: Simon Whatley Date: Mon, 1 Jun 2026 22:23:37 +0100 Subject: [PATCH 04/22] Update content --- app/prototype_v4_2/data/pages.yaml | 15 ++++++++++----- app/prototype_v4_2/data/questions.yaml | 18 +++++++++--------- .../views/check-your-answers.html | 2 +- app/prototype_v4_2/views/start.html | 2 +- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/app/prototype_v4_2/data/pages.yaml b/app/prototype_v4_2/data/pages.yaml index 6e020da..6d39c6f 100644 --- a/app/prototype_v4_2/data/pages.yaml +++ b/app/prototype_v4_2/data/pages.yaml @@ -22,14 +22,14 @@ pages: - your education - if you have ever had a cancer diagnosis - if your parents, siblings, or children have ever had a lung cancer diagnosis - - your smoking habits + - Your smoking history - id: smoker questions: - smoker heading: title: Tobacco smoking description: | - We will ask you questions about your smoking habits. This includes different types of tobacco smoking such as: + We will ask you questions about Your smoking history. This includes different types of tobacco smoking such as: - cigarettes from a packet - rolling tobacco, or roll ups @@ -40,6 +40,8 @@ pages: It does not currently include vaping or e-cigarettes. - id: date-of-birth + heading: + caption: Eligibilty questions: - date-of-birth - id: face-to-face-appointment @@ -47,6 +49,7 @@ pages: - face-to-face-appointment heading: title: Check if you need a face-to-face appointment + caption: Eligibilty description: | This online service uses automatic calculations based on your height and weight. This means it is not suitable for everyone. @@ -184,7 +187,7 @@ pages: - id: smoking-duration heading: title: Smoking duration - caption: Your smoking habits + caption: Your smoking history questions: - age-started-smoking - id: age-stopped-smoking @@ -200,7 +203,7 @@ pages: - smoking-type heading: title: The type of tobacco you smoke or used to smoke - caption: Your smoking habits + caption: Your smoking history description: | Smoking affects your health in different ways depending on what you smoke. @@ -223,12 +226,14 @@ pages: - id: tobacco-smoking heading: title: Tobacco smoking + caption: Your smoking history questions: - smoking-frequency - smoking-quantity - id: tobacco-smoking-change heading: - title: Tobacco smoking change + title: Tobacco smoking + caption: Your smoking history questions: - smoking-frequency-change - smoking-quantity-change diff --git a/app/prototype_v4_2/data/questions.yaml b/app/prototype_v4_2/data/questions.yaml index 1a49a26..03136a1 100644 --- a/app/prototype_v4_2/data/questions.yaml +++ b/app/prototype_v4_2/data/questions.yaml @@ -539,18 +539,18 @@ questions: text: Age you started smoking must be 1 or older max: text: Age you started smoking must be 120 or younger - caption: Your smoking habits + caption: Your smoking history - id: age-stopped-smoking type: text answerKey: ageStoppedSmoking input: - label: How old were you when you stopped smoking? + label: How old were you when you quit smoking? hint: Give an estimate if you are not sure prefix: Age inputmode: numeric classes: nhsuk-input--width-2 summary: - label: Age you stopped smoking + label: Age you quit smoking validation: required: true type: number @@ -558,14 +558,14 @@ questions: max: 120 errors: required: - text: Enter the age you stopped smoking + text: Enter the age you quit smoking invalid: - text: Enter the age you stopped smoking using numbers + text: Enter the age you quit smoking using numbers min: - text: Age you stopped smoking must be 1 or older + text: Age you quit smoking must be 1 or older max: - text: Age you stopped smoking must be 120 or younger - caption: Your smoking habits + text: Age you quit smoking must be 120 or younger + caption: Your smoking history - id: periods-stopped-smoking type: single answerKey: periodsStoppedSmoking @@ -863,7 +863,7 @@ questions: input: id: smoking-years-change label: How many years did you smoke this amount? - hint: Give a rough estimate + hint: Give an estimate if you are not sure suffix: years inputmode: numeric classes: nhsuk-input--width-4 diff --git a/app/prototype_v4_2/views/check-your-answers.html b/app/prototype_v4_2/views/check-your-answers.html index f541116..2bd87ef 100644 --- a/app/prototype_v4_2/views/check-your-answers.html +++ b/app/prototype_v4_2/views/check-your-answers.html @@ -56,7 +56,7 @@

Your family history

{% endif %} {% if checkYourAnswers.smokingHabits.length or checkYourAnswers.tobaccoRows.length %} -

Your smoking habits

+

Your smoking history

{% if checkYourAnswers.smokingHabits.length %} {{ summaryList({ diff --git a/app/prototype_v4_2/views/start.html b/app/prototype_v4_2/views/start.html index 95b3248..08fdee5 100644 --- a/app/prototype_v4_2/views/start.html +++ b/app/prototype_v4_2/views/start.html @@ -38,7 +38,7 @@

What to expect in the online service

  • your education
  • if you have ever had a cancer diagnosis
  • if your parents, siblings, or children have ever had a lung cancer diagnosis
  • -
  • your smoking habits
  • +
  • your smoking history
  • {{ button({ From 8658753add5b8343c2b7fffe5631dec9b6eb27bb Mon Sep 17 00:00:00 2001 From: Simon Whatley Date: Tue, 2 Jun 2026 14:03:55 +0100 Subject: [PATCH 05/22] Separate out the about you questions onto single pages --- app/prototype_v4_2/controllers/question.js | 191 +++++++++------------ app/prototype_v4_2/data/pages.yaml | 11 +- app/prototype_v4_2/docs/question-flow.md | 9 +- app/prototype_v4_2/docs/question-schema.md | 12 +- app/prototype_v4_2/lib/summary.js | 8 +- app/prototype_v4_2/routes.js | 19 +- app/prototype_v4_2/views/index.html | 5 +- 7 files changed, 108 insertions(+), 147 deletions(-) diff --git a/app/prototype_v4_2/controllers/question.js b/app/prototype_v4_2/controllers/question.js index f1cd34c..b7983e6 100644 --- a/app/prototype_v4_2/controllers/question.js +++ b/app/prototype_v4_2/controllers/question.js @@ -281,7 +281,7 @@ exports.weightMetric_post = (req, res) => { }, errors) } else { delete answers.weight?.imperial - res.redirect(`/prototype_${version}/about-you`) + res.redirect(`/prototype_${version}/gender`) } } @@ -310,131 +310,104 @@ exports.weightImperial_post = (req, res) => { }, errors) } else { delete answers.weight?.metric - res.redirect(`/prototype_${version}/about-you`) + res.redirect(`/prototype_${version}/gender`) } } -exports.aboutYou_get = (req, res) => { +exports.gender_get = (req, res) => { const back = getWeightBack(req) - const { answers } = req.session.data - renderQuestionPage(res, 'about-you', { - next: `/prototype_${version}/about-you`, + renderQuestion(res, 'gender', { + next: `/prototype_${version}/gender`, back, cancel: `/prototype_${version}/` - }, [], answers) + }) } -exports.aboutYou_post = (req, res) => { +exports.gender_post = (req, res) => { const { answers } = req.session.data const back = getWeightBack(req) - const errors = validateQuestions(answers, getQuestionPageIds('about-you', answers)) + const errors = validateQuestion(answers, 'gender') if (errors.length) { - renderQuestionPage(res, 'about-you', { - next: `/prototype_${version}/about-you`, + renderQuestion(res, 'gender', { + next: `/prototype_${version}/gender`, back, cancel: `/prototype_${version}/` - }, errors, answers) + }, errors) } else { - res.redirect(`/prototype_${version}/respiratory-conditions`) + res.redirect(`/prototype_${version}/sex`) } } -// exports.gender_get = (req, res) => { -// const back = getWeightBack(req) - -// renderQuestion(res, 'gender', { -// next: `/prototype_${version}/gender`, -// back, -// cancel: `/prototype_${version}/` -// }) -// } - -// exports.gender_post = (req, res) => { -// const { answers } = req.session.data -// const back = getWeightBack(req) -// const errors = validateQuestion(answers, 'gender') - -// if (errors.length) { -// renderQuestion(res, 'gender', { -// next: `/prototype_${version}/gender`, -// back, -// cancel: `/prototype_${version}/` -// }, errors) -// } else { -// res.redirect(`/prototype_${version}/sex`) -// } -// } - -// exports.sex_get = (req, res) => { -// renderQuestion(res, 'sex', { -// next: `/prototype_${version}/sex`, -// back: `/prototype_${version}/gender`, -// cancel: `/prototype_${version}/` -// }) -// } - -// exports.sex_post = (req, res) => { -// const { answers } = req.session.data -// const errors = validateQuestion(answers, 'sex') - -// if (errors.length) { -// renderQuestion(res, 'sex', { -// next: `/prototype_${version}/sex`, -// back: `/prototype_${version}/gender`, -// cancel: `/prototype_${version}/` -// }, errors) -// } else { -// res.redirect(`/prototype_${version}/ethnicity`) -// } -// } - -// exports.ethnicity_get = (req, res) => { -// renderQuestion(res, 'ethnicity', { -// next: `/prototype_${version}/ethnicity`, -// back: `/prototype_${version}/sex`, -// cancel: `/prototype_${version}/` -// }) -// } - -// exports.ethnicity_post = (req, res) => { -// const { answers } = req.session.data -// const errors = validateQuestion(answers, 'ethnicity') - -// if (errors.length) { -// renderQuestion(res, 'ethnicity', { -// next: `/prototype_${version}/ethnicity`, -// back: `/prototype_${version}/sex`, -// cancel: `/prototype_${version}/` -// }, errors) -// } else { -// res.redirect(`/prototype_${version}/education`) -// } -// } - -// exports.education_get = (req, res) => { -// renderQuestion(res, 'education', { -// next: `/prototype_${version}/education`, -// back: `/prototype_${version}/ethnicity`, -// cancel: `/prototype_${version}/` -// }) -// } - -// exports.education_post = (req, res) => { -// const { answers } = req.session.data -// const errors = validateQuestion(answers, 'education') - -// if (errors.length) { -// renderQuestion(res, 'education', { -// next: `/prototype_${version}/education`, -// back: `/prototype_${version}/ethnicity`, -// cancel: `/prototype_${version}/` -// }, errors) -// } else { -// res.redirect(`/prototype_${version}/respiratory-conditions`) -// } -// } +exports.sex_get = (req, res) => { + renderQuestion(res, 'sex', { + next: `/prototype_${version}/sex`, + back: `/prototype_${version}/gender`, + cancel: `/prototype_${version}/` + }) +} + +exports.sex_post = (req, res) => { + const { answers } = req.session.data + const errors = validateQuestion(answers, 'sex') + + if (errors.length) { + renderQuestion(res, 'sex', { + next: `/prototype_${version}/sex`, + back: `/prototype_${version}/gender`, + cancel: `/prototype_${version}/` + }, errors) + } else { + res.redirect(`/prototype_${version}/ethnicity`) + } +} + +exports.ethnicity_get = (req, res) => { + renderQuestion(res, 'ethnicity', { + next: `/prototype_${version}/ethnicity`, + back: `/prototype_${version}/sex`, + cancel: `/prototype_${version}/` + }) +} + +exports.ethnicity_post = (req, res) => { + const { answers } = req.session.data + const errors = validateQuestion(answers, 'ethnicity') + + if (errors.length) { + renderQuestion(res, 'ethnicity', { + next: `/prototype_${version}/ethnicity`, + back: `/prototype_${version}/sex`, + cancel: `/prototype_${version}/` + }, errors) + } else { + res.redirect(`/prototype_${version}/education`) + } +} + +exports.education_get = (req, res) => { + renderQuestion(res, 'education', { + next: `/prototype_${version}/education`, + back: `/prototype_${version}/ethnicity`, + cancel: `/prototype_${version}/` + }) +} + +exports.education_post = (req, res) => { + const { answers } = req.session.data + const errors = validateQuestion(answers, 'education') + + if (errors.length) { + renderQuestion(res, 'education', { + next: `/prototype_${version}/education`, + back: `/prototype_${version}/ethnicity`, + cancel: `/prototype_${version}/` + }, errors) + } else { + res.redirect(`/prototype_${version}/respiratory-conditions`) + } +} /// ------------------------------------------------------------------------ /// /// Your health @@ -443,7 +416,7 @@ exports.aboutYou_post = (req, res) => { exports.respiratoryConditions_get = (req, res) => { renderQuestion(res, 'respiratory-conditions', { next: `/prototype_${version}/respiratory-conditions`, - back: `/prototype_${version}/about-you`, + back: `/prototype_${version}/education`, cancel: `/prototype_${version}/` }) } @@ -455,7 +428,7 @@ exports.respiratoryConditions_post = (req, res) => { if (errors.length) { renderQuestion(res, 'respiratory-conditions', { next: `/prototype_${version}/respiratory-conditions`, - back: `/prototype_${version}/about-you`, + back: `/prototype_${version}/education`, cancel: `/prototype_${version}/` }, errors) } else { diff --git a/app/prototype_v4_2/data/pages.yaml b/app/prototype_v4_2/data/pages.yaml index 6d39c6f..bc697a3 100644 --- a/app/prototype_v4_2/data/pages.yaml +++ b/app/prototype_v4_2/data/pages.yaml @@ -99,15 +99,6 @@ pages: An accurate measurement is important. If you have digital scales, use these to check your weight. Some pharmacies and gyms have scales where you can check for free. - - id: about-you - heading: - title: About you - questions: - - gender - - sex - - ethnicity - - education - description: The answers you submit will not be shared with your patient care advisor during your phone appointment, or with your GP. - id: gender questions: - gender @@ -207,7 +198,7 @@ pages: description: | Smoking affects your health in different ways depending on what you smoke. - We need to know what you smoke, or used to smoke, frequently. For example, if you have smoked a pipe on a weekly basis for a year or longer. + We need to know what you smoke, or used to smoke, for a period of 1 year or longer. This does not include vaping or e-cigarettes. You do not need to tell us about less frequent forms of smoking. For example, a cigar on special occasions. variants: diff --git a/app/prototype_v4_2/docs/question-flow.md b/app/prototype_v4_2/docs/question-flow.md index a5546d6..bded35a 100644 --- a/app/prototype_v4_2/docs/question-flow.md +++ b/app/prototype_v4_2/docs/question-flow.md @@ -30,10 +30,13 @@ flowchart TD weight{"Weight"} -- Metric --> weightMetric["Weight - metric"] weight -- Imperial --> weightImperial["Weight - imperial"] - weightMetric --> aboutYou["About you
    Gender, sex, ethnicity and education"] - weightImperial --> aboutYou + weightMetric --> gender["Gender identity"] + weightImperial --> gender + gender --> sex["Sex at birth"] + sex --> ethnicity["Ethnic background"] + ethnicity --> education["Education"] - aboutYou --> respiratory["Respiratory conditions"] + education --> respiratory["Respiratory conditions"] respiratory --> asbestos["Asbestos
    At work, at home"] asbestos --> cancerDiagnosis["Cancer diagnosis"] cancerDiagnosis --> relatives{"Close relative had
    lung cancer?"} diff --git a/app/prototype_v4_2/docs/question-schema.md b/app/prototype_v4_2/docs/question-schema.md index 8573436..ac82bc7 100644 --- a/app/prototype_v4_2/docs/question-schema.md +++ b/app/prototype_v4_2/docs/question-schema.md @@ -53,15 +53,13 @@ Define each individual form control in `questions.yaml`, then compose one or mor ```yaml pages: - - id: about-you + - id: asbestos heading: - title: About you - description: The answers you submit will not be shared with your patient care advisor during your phone appointment, or with your GP. + title: Exposure to asbestos + caption: Your health questions: - - gender - - sex - - ethnicity - - education + - asbestos-at-work + - asbestos-at-home ``` Grouped pages use the same question definitions, answer keys and validation rules as single-question pages. This means check-your-answers and later flow logic can keep reading answers from the same session keys, regardless of whether the answers came from one page or several pages. diff --git a/app/prototype_v4_2/lib/summary.js b/app/prototype_v4_2/lib/summary.js index 61caa87..dd5e70b 100644 --- a/app/prototype_v4_2/lib/summary.js +++ b/app/prototype_v4_2/lib/summary.js @@ -315,22 +315,22 @@ const getCheckYourAnswers = (answers = {}) => { makeSummaryRow({ key: 'Gender identity', value: formatValue(answers.gender, valueLabels.gender), - href: `/prototype_${version}/about-you` + href: `/prototype_${version}/gender` }), makeSummaryRow({ key: 'Sex at birth', value: formatValue(answers.sex, valueLabels.sex), - href: `/prototype_${version}/about-you` + href: `/prototype_${version}/sex` }), makeSummaryRow({ key: 'Ethnic background', value: formatValue(answers.ethnicity, valueLabels.ethnicity), - href: `/prototype_${version}/about-you` + href: `/prototype_${version}/ethnicity` }), makeSummaryRow({ key: 'Education', value: formatValue(answers.education, valueLabels.education), - href: `/prototype_${version}/about-you` + href: `/prototype_${version}/education` }) ]), health: makeSummaryRows([ diff --git a/app/prototype_v4_2/routes.js b/app/prototype_v4_2/routes.js index 02dad54..fe7ff38 100644 --- a/app/prototype_v4_2/routes.js +++ b/app/prototype_v4_2/routes.js @@ -109,20 +109,17 @@ router.post(`/prototype_${version}/weight-metric`, questionController.weightMetr router.get(`/prototype_${version}/weight-imperial`, questionController.weightImperial_get) router.post(`/prototype_${version}/weight-imperial`, questionController.weightImperial_post) -router.get(`/prototype_${version}/about-you`, questionController.aboutYou_get) -router.post(`/prototype_${version}/about-you`, questionController.aboutYou_post) +router.get(`/prototype_${version}/gender`, questionController.gender_get) +router.post(`/prototype_${version}/gender`, questionController.gender_post) -// router.get(`/prototype_${version}/sex`, questionController.sex_get) -// router.post(`/prototype_${version}/sex`, questionController.sex_post) +router.get(`/prototype_${version}/sex`, questionController.sex_get) +router.post(`/prototype_${version}/sex`, questionController.sex_post) -// router.get(`/prototype_${version}/gender`, questionController.gender_get) -// router.post(`/prototype_${version}/gender`, questionController.gender_post) +router.get(`/prototype_${version}/ethnicity`, questionController.ethnicity_get) +router.post(`/prototype_${version}/ethnicity`, questionController.ethnicity_post) -// router.get(`/prototype_${version}/ethnicity`, questionController.ethnicity_get) -// router.post(`/prototype_${version}/ethnicity`, questionController.ethnicity_post) - -// router.get(`/prototype_${version}/education`, questionController.education_get) -// router.post(`/prototype_${version}/education`, questionController.education_post) +router.get(`/prototype_${version}/education`, questionController.education_get) +router.post(`/prototype_${version}/education`, questionController.education_post) /// Your health ------------------------------------------------------------ /// diff --git a/app/prototype_v4_2/views/index.html b/app/prototype_v4_2/views/index.html index cd08438..e340128 100644 --- a/app/prototype_v4_2/views/index.html +++ b/app/prototype_v4_2/views/index.html @@ -56,11 +56,10 @@

    About you

    {{ pageLink("/height-imperial", "Your height - imperial") }} {{ pageLink("/weight-metric", "Your weight - metric") }} {{ pageLink("/weight-imperial", "Your weight - imperial") }} - {{ pageLink("/about-you", "About you") }} - {# {{ pageLink("/gender", "Your gender identity") }} + {{ pageLink("/gender", "Your gender identity") }} {{ pageLink("/sex", "Your sex at birth") }} {{ pageLink("/ethnicity", "Your ethnic background") }} - {{ pageLink("/education", "Your education") }} #} + {{ pageLink("/education", "Your education") }}

    Your health

    From adc5436eba23968607cb1dea7dbda010cd0327d9 Mon Sep 17 00:00:00 2001 From: Simon Whatley Date: Tue, 2 Jun 2026 16:32:11 +0100 Subject: [PATCH 06/22] Update tobacco flow --- app/prototype_v4_2/lib/tobacco-flow.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/app/prototype_v4_2/lib/tobacco-flow.js b/app/prototype_v4_2/lib/tobacco-flow.js index 786b585..29a91bd 100644 --- a/app/prototype_v4_2/lib/tobacco-flow.js +++ b/app/prototype_v4_2/lib/tobacco-flow.js @@ -93,6 +93,16 @@ const getQuestionVariantValueLabels = (id, type) => { }, {}) } +/** + * Get the display label for a tobacco type. + * + * @param {string} type - Tobacco type key. + * @returns {string} Tobacco type label. + */ +const getSmokingTypeLabel = (type) => { + return (getValueLabels().smokingType[type] || '').replace(', or ', ' or ') +} + /** * Get selected tobacco types in tobacco.yaml order. * @@ -371,6 +381,7 @@ const getSmokingTypeHeadings = (type, isPast = false) => { return { ...smokingType, + pageHeading: getSmokingTypeLabel(type), statusHeading: currentHeadings.status, frequencyHeading: tenseHeadings.frequency, quantityHeading: tenseHeadings.quantity, @@ -806,7 +817,7 @@ const getSmokingContentQuestionOverrides = ({ return { heading: { title: smokingType.statusHeading, - caption: smokingType.caption + caption: 'Your smoking history' }, input: { name: `answers[${step.type}][smokingStatus]` @@ -846,7 +857,7 @@ const getSmokingContentQuestionOverrides = ({ return { heading: { title: smokingType.changeHeading, - caption: smokingType.caption + caption: 'Your smoking history' }, input: { name: `answers[${step.type}][smokingChange]` @@ -931,6 +942,12 @@ const getSmokingTypePageHeading = (page, smokingType = {}) => { } } + if (page === 'tobacco-smoking') { + return { + title: smokingType.pageHeading || smokingType.caption + } + } + return { title: smokingType.caption } From 011d7fdfe8a71e2de520f09d7a5ba15101c5f8cd Mon Sep 17 00:00:00 2001 From: Simon Whatley Date: Tue, 2 Jun 2026 16:40:17 +0100 Subject: [PATCH 07/22] Update tobacco flow --- app/prototype_v4_2/lib/tobacco-flow.js | 56 ++++++++++++++++++++------ 1 file changed, 43 insertions(+), 13 deletions(-) diff --git a/app/prototype_v4_2/lib/tobacco-flow.js b/app/prototype_v4_2/lib/tobacco-flow.js index 29a91bd..93e16e9 100644 --- a/app/prototype_v4_2/lib/tobacco-flow.js +++ b/app/prototype_v4_2/lib/tobacco-flow.js @@ -485,6 +485,20 @@ const getSmokingChangeComparisonText = (type, change, answer = {}) => { return `when you smoked ${changeLabel} than ${amount}` } +/** + * Build the heading for a changed-smoking grouped page. + * + * @param {string} type - Tobacco type key. + * @param {string} change - Smoking change key. + * @param {Object} answer - Answer object for one tobacco type. + * @returns {string} Contextual page heading. + */ +const getSmokingChangePageHeading = (type, change, answer = {}) => { + const comparisonText = getSmokingChangeComparisonText(type, change, answer) + + return comparisonText ? upperFirst(comparisonText) : '' +} + /** * Build the heading for changed-smoking frequency, quantity and years pages. * @@ -493,9 +507,10 @@ const getSmokingChangeComparisonText = (type, change, answer = {}) => { * @param {string} change - Smoking change key. * @param {Object} changeAnswer - Change-specific answer object. * @param {Object} answer - Answer object for one tobacco type. + * @param {boolean} includeComparison - Whether to include the more/fewer comparison text. * @returns {string} Contextual page heading. */ -const getSmokingChangeHeading = (page, type, change, changeAnswer = {}, answer = {}) => { +const getSmokingChangeHeading = (page, type, change, changeAnswer = {}, answer = {}, includeComparison = true) => { const smokingType = smokingTypes[type] const smokingChange = smokingChangeTypes[change] @@ -505,11 +520,20 @@ const getSmokingChangeHeading = (page, type, change, changeAnswer = {}, answer = const comparisonText = getSmokingChangeComparisonText(type, change, answer) - if (page === 'smoking-frequency-change' || page === 'smoking-quantity-change') { - const headingType = page === 'smoking-frequency-change' ? 'frequencyHeading' : 'quantityHeading' - const baseHeading = applySmokingFrequencyPeriod(getSmokingTypeHeadings(type, true)[headingType], answer.smokingFrequency) + if (page === 'smoking-frequency-change') { + const baseHeading = applySmokingFrequencyPeriod(getSmokingTypeHeadings(type, true).frequencyHeading, answer.smokingFrequency) + + return includeComparison && comparisonText ? `${baseHeading.replace('?', '')} ${comparisonText}?` : baseHeading + } + + if (page === 'smoking-quantity-change') { + const baseHeading = applySmokingFrequencyPeriod(getSmokingTypeHeadings(type, true).quantityHeading, answer.smokingFrequency) + const normalHeading = baseHeading + .replace(' did you smoke ', ' did you normally smoke ') + .replace(' did you smoke?', ' did you normally smoke?') + .replace(/ in a normal (day|week|month|year)\?$/, '?') - return baseHeading ? `${baseHeading.replace('?', '')} ${comparisonText}?` : '' + return includeComparison && comparisonText ? `${baseHeading.replace('?', '')} ${comparisonText}?` : normalHeading } if (page === 'smoking-years-change') { @@ -712,6 +736,10 @@ const lowerFirst = (value = '') => { return value ? `${value.charAt(0).toLowerCase()}${value.slice(1)}` : '' } +const upperFirst = (value = '') => { + return value ? `${value.charAt(0).toUpperCase()}${value.slice(1)}` : '' +} + /** * Convert a question heading into an error-message answer phrase. * @@ -725,6 +753,7 @@ const getAnswerPhraseFromHeading = (heading = '') => { .replace(/^how long did you smoke /, 'how long you smoked ') .replace(/^how long do you currently smoke /, 'how long you currently smoke ') .replace(/^how long do you smoke /, 'how long you smoke ') + .replace(/^(how (?:much|many|long) .+?) did you normally smoke/, '$1 you normally smoked') .replace(/^(how (?:much|many|long) .+?) did you smoke /, '$1 you smoked ') .replace(/^(how (?:much|many|long) .+?) do you currently smoke /, '$1 you currently smoke ') .replace(/^(how (?:much|many|long) .+?) do you smoke /, '$1 you smoke ') @@ -870,8 +899,8 @@ const getSmokingContentQuestionOverrides = ({ if (page === 'smoking-frequency-change') { return { heading: { - title: getSmokingChangeHeading(page, step.type, step.change, changeAnswer, answer), - caption: smokingType.caption + title: getSmokingChangeHeading(page, step.type, step.change, changeAnswer, answer, false), + caption: 'Your smoking history' }, input: { name: `answers[${step.type}][${smokingChange.answerKey}][frequency]` @@ -885,8 +914,8 @@ const getSmokingContentQuestionOverrides = ({ return getSmokingQuantityQuestionOverrides({ page, step, - heading: getSmokingChangeHeading(page, step.type, step.change, changeAnswer, answer), - caption: smokingType.caption, + heading: getSmokingChangeHeading(page, step.type, step.change, changeAnswer, answer, false), + caption: 'Your smoking history', name: `answers[${step.type}][${smokingChange.answerKey}][quantity]`, value: changeAnswer.quantity, conditionalValue: changeAnswer.smokingQuantityOther, @@ -898,7 +927,7 @@ const getSmokingContentQuestionOverrides = ({ return { heading: { title: getSmokingChangeHeading(page, step.type, step.change, changeAnswer, answer), - caption: smokingType.caption + caption: 'Your smoking history' }, input: { id: 'smoking-years-change', @@ -935,10 +964,11 @@ const getSmokingTypePageAnswers = (step) => { } } -const getSmokingTypePageHeading = (page, smokingType = {}) => { +const getSmokingTypePageHeading = (page, smokingType = {}, step = {}, answer = {}) => { if (page === 'tobacco-smoking-change') { return { - title: `${smokingType.caption} change` + title: getSmokingChangePageHeading(step.type, step.change, answer), + caption: 'Your smoking history' } } @@ -970,7 +1000,7 @@ const getSmokingContentPageOverrides = (req, page, step) => { }, {}) return { - heading: getSmokingTypePageHeading(page, context.smokingType), + heading: getSmokingTypePageHeading(page, context.smokingType, step, context.answer), questions } } From bcf1f54c668d64cd7767412645765f0725ab05f4 Mon Sep 17 00:00:00 2001 From: Simon Whatley Date: Tue, 2 Jun 2026 16:43:38 +0100 Subject: [PATCH 08/22] Update tobacco type question --- app/prototype_v4_2/data/pages.yaml | 4 ++-- app/prototype_v4_2/data/questions.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/prototype_v4_2/data/pages.yaml b/app/prototype_v4_2/data/pages.yaml index bc697a3..9dbb17f 100644 --- a/app/prototype_v4_2/data/pages.yaml +++ b/app/prototype_v4_2/data/pages.yaml @@ -190,11 +190,11 @@ pages: is: no - periods-stopped-smoking - id: smoking-type - questions: - - smoking-type heading: title: The type of tobacco you smoke or used to smoke caption: Your smoking history + questions: + - smoking-type description: | Smoking affects your health in different ways depending on what you smoke. diff --git a/app/prototype_v4_2/data/questions.yaml b/app/prototype_v4_2/data/questions.yaml index 03136a1..ff90d5c 100644 --- a/app/prototype_v4_2/data/questions.yaml +++ b/app/prototype_v4_2/data/questions.yaml @@ -618,7 +618,7 @@ questions: type: multiple answerKey: smokingType input: - label: What do you or have you smoked? + label: Have you ever smoked any of the following types of tobacco for a period of 1 year or longer? hint: Select all that apply options: - label: Cigarettes From 2452635ae56d45739423598ab4b61d2207b50b2b Mon Sep 17 00:00:00 2001 From: Simon Whatley Date: Tue, 2 Jun 2026 17:03:22 +0100 Subject: [PATCH 09/22] Update the question flow --- app/prototype_v4_2/controllers/question.js | 38 +++++++++++++------ app/prototype_v4_2/docs/question-flow.md | 18 ++++----- app/prototype_v4_2/lib/page-index.js | 14 +++---- app/prototype_v4_2/lib/tobacco-flow.js | 2 +- .../views/check-your-answers.html | 32 ++++++++-------- app/prototype_v4_2/views/index.html | 30 +++++++-------- 6 files changed, 74 insertions(+), 60 deletions(-) diff --git a/app/prototype_v4_2/controllers/question.js b/app/prototype_v4_2/controllers/question.js index b7983e6..b8504a9 100644 --- a/app/prototype_v4_2/controllers/question.js +++ b/app/prototype_v4_2/controllers/question.js @@ -25,6 +25,19 @@ const getQuestionPageIds = (id, answers = {}) => { return getQuestionPage(id, answers).questions.map((question) => question.id) } +const getLastSmokingTypeStepBack = (answers = {}) => { + const smokingSteps = getSmokingTypeSteps(answers) + const lastSmokingStep = smokingSteps[smokingSteps.length - 1] + + return lastSmokingStep ? getSmokingTypeStepUrl(lastSmokingStep) : `/prototype_${version}/smoking-type` +} + +const getFamilyHistoryBack = (answers = {}) => { + return answers.cancerDiagnosisRelatives === 'yes' + ? `/prototype_${version}/cancer-diagnosis-relatives-age` + : `/prototype_${version}/cancer-diagnosis-relatives` +} + /// ------------------------------------------------------------------------ /// /// /// ------------------------------------------------------------------------ /// @@ -405,7 +418,7 @@ exports.education_post = (req, res) => { cancel: `/prototype_${version}/` }, errors) } else { - res.redirect(`/prototype_${version}/respiratory-conditions`) + res.redirect(`/prototype_${version}/smoking-duration`) } } @@ -414,21 +427,25 @@ exports.education_post = (req, res) => { /// ------------------------------------------------------------------------ /// exports.respiratoryConditions_get = (req, res) => { + const answers = req.session.data.answers || {} + const back = getLastSmokingTypeStepBack(answers) + renderQuestion(res, 'respiratory-conditions', { next: `/prototype_${version}/respiratory-conditions`, - back: `/prototype_${version}/education`, + back, cancel: `/prototype_${version}/` }) } exports.respiratoryConditions_post = (req, res) => { const { answers } = req.session.data + const back = getLastSmokingTypeStepBack(answers) const errors = validateQuestion(answers, 'respiratory-conditions') if (errors.length) { renderQuestion(res, 'respiratory-conditions', { next: `/prototype_${version}/respiratory-conditions`, - back: `/prototype_${version}/education`, + back, cancel: `/prototype_${version}/` }, errors) } else { @@ -511,7 +528,7 @@ exports.cancerDiagnosisRelatives_post = (req, res) => { res.redirect(`/prototype_${version}/cancer-diagnosis-relatives-age`) } else { delete answers.cancerDiagnosisRelativesAge - res.redirect(`/prototype_${version}/smoking-duration`) + res.redirect(`/prototype_${version}/check-your-answers`) } } } @@ -535,7 +552,7 @@ exports.cancerDiagnosisRelativesAge_post = (req, res) => { cancel: `/prototype_${version}/` }, errors) } else { - res.redirect(`/prototype_${version}/smoking-duration`) + res.redirect(`/prototype_${version}/check-your-answers`) } } @@ -545,24 +562,22 @@ exports.cancerDiagnosisRelativesAge_post = (req, res) => { exports.smokingDuration_get = (req, res) => { const answers = req.session.data.answers || {} - const back = answers?.cancerDiagnosisRelativesAge ? `/prototype_${version}/cancer-diagnosis-relatives-age` : `/prototype_${version}/cancer-diagnosis-relatives` renderQuestionPage(res, 'smoking-duration', { next: `/prototype_${version}/smoking-duration`, - back, + back: `/prototype_${version}/education`, cancel: `/prototype_${version}/` }, [], answers) } exports.smokingDuration_post = (req, res) => { const answers = req.session.data.answers || {} - const back = answers?.cancerDiagnosisRelativesAge ? `/prototype_${version}/cancer-diagnosis-relatives-age` : `/prototype_${version}/cancer-diagnosis-relatives` const errors = validateQuestions(answers, getQuestionPageIds('smoking-duration', answers)) if (errors.length) { renderQuestionPage(res, 'smoking-duration', { next: `/prototype_${version}/smoking-duration`, - back, + back: `/prototype_${version}/education`, cancel: `/prototype_${version}/` }, errors, answers) } else { @@ -734,14 +749,13 @@ exports.tobaccoSmokingChange_post = (req, res) => { exports.checkYourAnswers_get = (req, res) => { const { answers } = req.session.data - const smokingSteps = getSmokingTypeSteps(answers) - const lastSmokingStep = smokingSteps[smokingSteps.length - 1] + const back = getFamilyHistoryBack(answers) res.render(view('check-your-answers'), { checkYourAnswers: getCheckYourAnswers(answers), actions: { next: `/prototype_${version}/check-your-answers`, - back: lastSmokingStep ? getSmokingTypeStepUrl(lastSmokingStep) : `/prototype_${version}/smoking-type`, + back, cancel: `/prototype_${version}/` } }) diff --git a/app/prototype_v4_2/docs/question-flow.md b/app/prototype_v4_2/docs/question-flow.md index bded35a..2803f46 100644 --- a/app/prototype_v4_2/docs/question-flow.md +++ b/app/prototype_v4_2/docs/question-flow.md @@ -36,21 +36,21 @@ flowchart TD sex --> ethnicity["Ethnic background"] ethnicity --> education["Education"] - education --> respiratory["Respiratory conditions"] + education --> smokingDuration["Smoking duration
    Age started, age stopped if applicable,
    periods stopped"] + smokingDuration --> smokingType{"Smoking type"} + + smokingType -- None selected --> smokingTypeExit["Smoking type exit
    End"] + smokingType -- One or more tobacco types --> tobaccoLoop["Repeat tobacco questions
    for each selected type"] + + tobaccoLoop --> respiratory["Respiratory conditions"] respiratory --> asbestos["Asbestos
    At work, at home"] asbestos --> cancerDiagnosis["Cancer diagnosis"] cancerDiagnosis --> relatives{"Close relative had
    lung cancer?"} relatives -- Yes --> relativesAge["Relative diagnosed before 60?"] - relatives -- No --> smokingDuration["Smoking duration
    Age started, age stopped if applicable,
    periods stopped"] - relativesAge --> smokingDuration - - smokingDuration --> smokingType{"Smoking type"} - - smokingType -- None selected --> smokingTypeExit["Smoking type exit
    End"] - smokingType -- One or more tobacco types --> tobaccoLoop["Repeat tobacco questions
    for each selected type"] + relatives -- No --> cya["Check your answers"] + relativesAge --> cya - tobaccoLoop --> cya["Check your answers"] cya --> confirmation["Confirmation
    End"] ``` diff --git a/app/prototype_v4_2/lib/page-index.js b/app/prototype_v4_2/lib/page-index.js index 83568f9..6b2d03f 100644 --- a/app/prototype_v4_2/lib/page-index.js +++ b/app/prototype_v4_2/lib/page-index.js @@ -18,12 +18,6 @@ const defaultAnswers = { sex: 'female', ethnicity: 'white', education: 'further_education', - respiratoryConditions: ['no'], - asbestosAtWork: 'no', - asbestosAtHome: 'no', - cancerDiagnosis: 'no', - cancerDiagnosisRelatives: 'yes', - cancerDiagnosisRelativesAge: 'no', ageStartedSmoking: '18', periodsStoppedSmoking: 'no', smokingType: ['cigarettes'], @@ -37,7 +31,13 @@ const defaultAnswers = { quantity: '5', years: '10' } - } + }, + respiratoryConditions: ['no'], + asbestosAtWork: 'no', + asbestosAtHome: 'no', + cancerDiagnosis: 'no', + cancerDiagnosisRelatives: 'yes', + cancerDiagnosisRelativesAge: 'no' } const cloneAnswers = () => JSON.parse(JSON.stringify(defaultAnswers)) diff --git a/app/prototype_v4_2/lib/tobacco-flow.js b/app/prototype_v4_2/lib/tobacco-flow.js index 93e16e9..e96f1a9 100644 --- a/app/prototype_v4_2/lib/tobacco-flow.js +++ b/app/prototype_v4_2/lib/tobacco-flow.js @@ -9,7 +9,7 @@ const { getQuestionPage } = require('./question-pages') const { renderQuestion, renderQuestionPage, version } = require('./question-renderer') const { validateQuestion } = require('./question-validator') -const nextStepAfterSmokingTypes = `/prototype_${version}/check-your-answers` +const nextStepAfterSmokingTypes = `/prototype_${version}/respiratory-conditions` const getValueLabels = () => { return { diff --git a/app/prototype_v4_2/views/check-your-answers.html b/app/prototype_v4_2/views/check-your-answers.html index 2bd87ef..ee18046 100644 --- a/app/prototype_v4_2/views/check-your-answers.html +++ b/app/prototype_v4_2/views/check-your-answers.html @@ -39,22 +39,6 @@

    About you

    }) }} {% endif %} - {% if checkYourAnswers.health.length %} -

    Your health

    - - {{ summaryList({ - rows: checkYourAnswers.health - }) }} - {% endif %} - - {% if checkYourAnswers.familyHistory.length %} -

    Your family history

    - - {{ summaryList({ - rows: checkYourAnswers.familyHistory - }) }} - {% endif %} - {% if checkYourAnswers.smokingHabits.length or checkYourAnswers.tobaccoRows.length %}

    Your smoking history

    @@ -73,6 +57,22 @@

    {{ tobacco.heading }}

    {% endfor %} {% endif %} + {% if checkYourAnswers.health.length %} +

    Your health

    + + {{ summaryList({ + rows: checkYourAnswers.health + }) }} + {% endif %} + + {% if checkYourAnswers.familyHistory.length %} +

    Your family history

    + + {{ summaryList({ + rows: checkYourAnswers.familyHistory + }) }} + {% endif %} + {{ button({ text: "Submit" }) }} diff --git a/app/prototype_v4_2/views/index.html b/app/prototype_v4_2/views/index.html index e340128..99c0e76 100644 --- a/app/prototype_v4_2/views/index.html +++ b/app/prototype_v4_2/views/index.html @@ -25,7 +25,7 @@

    {{ title }}

    -

    Quick navigation to all pages in prototype v4.1.

    +

    Quick navigation to all pages in prototype v4.2.

    Some links set default answers before opening the page, so conditional pages and check your answers have enough data to render.

    Start and sign in

    @@ -62,20 +62,7 @@

    About you

    {{ pageLink("/education", "Your education") }} -

    Your health

    -
      - {{ pageLink("/respiratory-conditions", "Respiratory conditions") }} - {{ pageLink("/asbestos", "Asbestos") }} - {{ pageLink("/cancer-diagnosis", "Cancer diagnosis") }} -
    - -

    Your family history

    -
      - {{ pageLink("/cancer-diagnosis-relatives", "Relatives with lung cancer") }} - {{ seededPageLink("/cancer-diagnosis-relatives-age", "Relatives under 60 when diagnosed") }} -
    - -

    Your smoking habits

    +

    Your smoking history

      {{ pageLink("/smoking-duration", "Smoking duration") }} {{ pageLink("/smoking-type", "The type of tobacco you smoke or used to smoke") }} @@ -91,6 +78,19 @@

      Tobacco smoking

      {{ seededProfilePageLink("/tobacco-smoking?type=shisha", "shisha", "Shisha smoking") }}
    +

    Your health

    +
      + {{ pageLink("/respiratory-conditions", "Respiratory conditions") }} + {{ pageLink("/asbestos", "Asbestos") }} + {{ pageLink("/cancer-diagnosis", "Cancer diagnosis") }} +
    + +

    Your family history

    +
      + {{ pageLink("/cancer-diagnosis-relatives", "Relatives with lung cancer") }} + {{ seededPageLink("/cancer-diagnosis-relatives-age", "Relatives under 60 when diagnosed") }} +
    +

    Check and confirmation

      {{ seededPageLink("/check-your-answers", "Check your answers - with default answers") }} From 561b910b868c3dd00fdfba4af635fff3328e3c3a Mon Sep 17 00:00:00 2001 From: Simon Whatley Date: Tue, 2 Jun 2026 17:23:50 +0100 Subject: [PATCH 10/22] Update page title --- app/prototype_v4_2/data/pages.yaml | 2 +- app/prototype_v4_2/docs/question-flow.md | 6 +++--- app/prototype_v4_2/views/index.html | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/prototype_v4_2/data/pages.yaml b/app/prototype_v4_2/data/pages.yaml index 9dbb17f..46ba9f6 100644 --- a/app/prototype_v4_2/data/pages.yaml +++ b/app/prototype_v4_2/data/pages.yaml @@ -177,7 +177,7 @@ pages: If you do not know or cannot remember, select 'I do not know'. - id: smoking-duration heading: - title: Smoking duration + title: When you smoked tobacco caption: Your smoking history questions: - age-started-smoking diff --git a/app/prototype_v4_2/docs/question-flow.md b/app/prototype_v4_2/docs/question-flow.md index 2803f46..ca25a7b 100644 --- a/app/prototype_v4_2/docs/question-flow.md +++ b/app/prototype_v4_2/docs/question-flow.md @@ -36,7 +36,7 @@ flowchart TD sex --> ethnicity["Ethnic background"] ethnicity --> education["Education"] - education --> smokingDuration["Smoking duration
      Age started, age stopped if applicable,
      periods stopped"] + education --> smokingDuration["When you smoked tobacco
      Age started, age stopped if applicable,
      periods stopped"] smokingDuration --> smokingType{"Smoking type"} smokingType -- None selected --> smokingTypeExit["Smoking type exit
      End"] @@ -94,8 +94,8 @@ flowchart TD ## Notes - Height and weight unit pages can be switched manually using the unit-switch links. -- `Smoking duration` combines age started smoking, age stopped smoking and periods stopped smoking. -- `Age stopped smoking` is shown on `Smoking duration` when the `smoker` answer is `yes_previous`. It can also be shown again from check your answers if a tobacco-specific `Smoking status` answer is `no`. +- `When you smoked tobacco` combines age started smoking, age stopped smoking and periods stopped smoking. +- `Age stopped smoking` is shown on `When you smoked tobacco` when the `smoker` answer is `yes_previous`. It can also be shown again from check your answers if a tobacco-specific `Smoking status` answer is `no`. - `Tobacco smoking` combines smoking frequency and smoking quantity. - `Tobacco smoking change` combines changed-smoking frequency, quantity and years. - The tobacco subflow uses query strings such as `/prototype_v4_2/smoking-status?type=cigarettes` and `/prototype_v4_2/tobacco-smoking-change?type=cigarettes&change=greater`. diff --git a/app/prototype_v4_2/views/index.html b/app/prototype_v4_2/views/index.html index 99c0e76..3d4006d 100644 --- a/app/prototype_v4_2/views/index.html +++ b/app/prototype_v4_2/views/index.html @@ -64,7 +64,7 @@

      About you

      Your smoking history

        - {{ pageLink("/smoking-duration", "Smoking duration") }} + {{ pageLink("/smoking-duration", "When you smoked tobacco") }} {{ pageLink("/smoking-type", "The type of tobacco you smoke or used to smoke") }} {{ pageLink("/smoking-type-exit", "You are not eligible for lung cancer screening") }}
      From bf33f8a2ee948cc196a39dc8926f6af42c6df173 Mon Sep 17 00:00:00 2001 From: Simon Whatley Date: Wed, 3 Jun 2026 19:29:26 +0100 Subject: [PATCH 11/22] Update asbestos page --- app/prototype_v4_2/data/pages.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/prototype_v4_2/data/pages.yaml b/app/prototype_v4_2/data/pages.yaml index 46ba9f6..ca41354 100644 --- a/app/prototype_v4_2/data/pages.yaml +++ b/app/prototype_v4_2/data/pages.yaml @@ -144,6 +144,8 @@ pages: heading: title: Exposure to asbestos caption: Your health + description: | + You may have been exposed to asbestos if you worked or lived with someone in an industry such as building or construction, particularly from the 1950s to the 1990s. questions: - asbestos-at-work - asbestos-at-home From f203c07e95e5fc9f6e5594cf7df3cf9c7b97fbf4 Mon Sep 17 00:00:00 2001 From: Simon Whatley Date: Thu, 4 Jun 2026 09:15:55 +0100 Subject: [PATCH 12/22] Update asbestos page --- app/prototype_v4_2/data/pages.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app/prototype_v4_2/data/pages.yaml b/app/prototype_v4_2/data/pages.yaml index ca41354..dcddcff 100644 --- a/app/prototype_v4_2/data/pages.yaml +++ b/app/prototype_v4_2/data/pages.yaml @@ -146,6 +146,24 @@ pages: caption: Your health description: | You may have been exposed to asbestos if you worked or lived with someone in an industry such as building or construction, particularly from the 1950s to the 1990s. +
      + + + What is asbestos? + + +
      +

      Asbestos was used in a number of building materials and products. For example:

      +
        +
      • boilers and pipes
      • +
      • car brakes
      • +
      • cement for roofing sheets
      • +
      • floor tiles
      • +
      • insulating board to protect buildings and ships against fire
      • +
      +

      If you worked in an industry such as building or construction, you are more likely to have come into contact with damaged asbestos.

      +
      +
      questions: - asbestos-at-work - asbestos-at-home From e0fed559a3065b25afc25f74b534f945649c137d Mon Sep 17 00:00:00 2001 From: Simon Whatley Date: Thu, 4 Jun 2026 14:45:17 +0100 Subject: [PATCH 13/22] Remove "in a normal day" --- app/prototype_v4_2/data/tobacco.yaml | 16 ++++++++-------- app/prototype_v4_2/docs/tobacco-schema.md | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/prototype_v4_2/data/tobacco.yaml b/app/prototype_v4_2/data/tobacco.yaml index 0e2d145..6916d2e 100644 --- a/app/prototype_v4_2/data/tobacco.yaml +++ b/app/prototype_v4_2/data/tobacco.yaml @@ -9,7 +9,7 @@ tobaccoTypes: current: status: Do you currently smoke cigarettes? frequency: How often do you smoke cigarettes? - quantity: How many cigarettes do you currently smoke in a normal day? + quantity: How many cigarettes do you currently smoke? change: Has the number of cigarettes you normally smoke changed over time? past: frequency: How often did you smoke cigarettes? @@ -23,7 +23,7 @@ tobaccoTypes: current: status: Do you currently smoke rolling tobacco or roll-ups? frequency: How often do you smoke rolling tobacco or roll-ups? - quantity: How much rolling tobacco do you currently smoke in a normal week? + quantity: How much rolling tobacco do you currently smoke? change: Has the amount of rolling tobacco you normally smoke changed over time? past: frequency: How often did you smoke rolling tobacco or roll-ups? @@ -39,7 +39,7 @@ tobaccoTypes: current: status: Do you currently smoke a pipe? frequency: How often do you smoke a pipe? - quantity: How many full pipe loads do you currently smoke in a normal day? + quantity: How many full pipe loads do you currently smoke? change: Has the number of full pipe loads you normally smoke changed over time? past: frequency: How often did you smoke a pipe? @@ -55,7 +55,7 @@ tobaccoTypes: current: status: Do you currently smoke small cigars? frequency: How often do you smoke small cigars? - quantity: How many small cigars do you currently smoke in a normal day? + quantity: How many small cigars do you currently smoke? change: Has the number of small cigars you normally smoke changed over time? past: frequency: How often did you smoke small cigars? @@ -71,7 +71,7 @@ tobaccoTypes: current: status: Do you currently smoke medium cigars? frequency: How often do you smoke medium cigars? - quantity: How many medium cigars do you currently smoke in a normal day? + quantity: How many medium cigars do you currently smoke? change: Has the number of medium cigars you normally smoke changed over time? past: frequency: How often did you smoke medium cigars? @@ -87,7 +87,7 @@ tobaccoTypes: current: status: Do you currently smoke large cigars? frequency: How often do you smoke large cigars? - quantity: How many large cigars do you currently smoke in a normal day? + quantity: How many large cigars do you currently smoke? change: Has the number of large cigars you normally smoke changed over time? past: frequency: How often did you smoke large cigars? @@ -103,7 +103,7 @@ tobaccoTypes: current: status: Do you currently smoke cigarillos? frequency: How often do you smoke cigarillos? - quantity: How many cigarillos do you currently smoke in a normal day? + quantity: How many cigarillos do you currently smoke? change: Has the number of cigarillos you normally smoke changed over time? past: frequency: How often did you smoke cigarillos? @@ -119,7 +119,7 @@ tobaccoTypes: current: status: Do you currently smoke shisha? frequency: How often do you smoke shisha? - quantity: How long do you currently smoke shisha in a normal day? + quantity: How long do you currently smoke shisha? past: frequency: How often did you smoke shisha? quantity: How long did you smoke shisha in a normal day? diff --git a/app/prototype_v4_2/docs/tobacco-schema.md b/app/prototype_v4_2/docs/tobacco-schema.md index c2532a5..a375e93 100644 --- a/app/prototype_v4_2/docs/tobacco-schema.md +++ b/app/prototype_v4_2/docs/tobacco-schema.md @@ -26,7 +26,7 @@ tobaccoTypes: current: status: Do you currently smoke cigarettes? frequency: How often do you smoke cigarettes? - quantity: How many cigarettes do you currently smoke in a normal day? + quantity: How many cigarettes do you currently smoke? change: Has the number of cigarettes you normally smoke changed over time? past: frequency: How often did you smoke cigarettes? From 6801ee1346bf102f7ff5e867a7fc5aa6490d5a8c Mon Sep 17 00:00:00 2001 From: Simon Whatley Date: Thu, 4 Jun 2026 16:04:52 +0100 Subject: [PATCH 14/22] Update smoking type question --- app/prototype_v4_2/data/questions.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/prototype_v4_2/data/questions.yaml b/app/prototype_v4_2/data/questions.yaml index ff90d5c..9d05d8a 100644 --- a/app/prototype_v4_2/data/questions.yaml +++ b/app/prototype_v4_2/data/questions.yaml @@ -618,7 +618,7 @@ questions: type: multiple answerKey: smokingType input: - label: Have you ever smoked any of the following types of tobacco for a period of 1 year or longer? + label: Have you ever smoked any of the following types of tobacco? hint: Select all that apply options: - label: Cigarettes From e4e9aa678c870116a0e11eb5c67cb9879d6cfd96 Mon Sep 17 00:00:00 2001 From: Simon Whatley Date: Fri, 5 Jun 2026 10:12:17 +0100 Subject: [PATCH 15/22] Remove "Tell us" --- app/prototype_v4_2/data/pages.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/prototype_v4_2/data/pages.yaml b/app/prototype_v4_2/data/pages.yaml index dcddcff..b4931d4 100644 --- a/app/prototype_v4_2/data/pages.yaml +++ b/app/prototype_v4_2/data/pages.yaml @@ -171,7 +171,7 @@ pages: questions: - cancer-diagnosis heading: - title: Tell us if you have ever been diagnosed with cancer + title: If you have ever been diagnosed with cancer caption: Your health description: | If you have ever been diagnosed with any type of cancer it may impact your chances of developing lung cancer. @@ -179,7 +179,7 @@ pages: questions: - cancer-diagnosis-relatives heading: - title: Tell us if your parents, siblings or children have ever been diagnosed with lung cancer + title: If your parents, siblings or children have ever been diagnosed with lung cancer caption: Your family history description: | If any of your parents, siblings or children have ever been diagnosed with lung cancer it may impact your chances of developing lung cancer. From 4bbf9f5a50284ab2a8f7008b9796c26cb7400abf Mon Sep 17 00:00:00 2001 From: Simon Whatley Date: Fri, 5 Jun 2026 10:13:07 +0100 Subject: [PATCH 16/22] Remove "in a normal day" --- app/prototype_v4_2/data/tobacco.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/prototype_v4_2/data/tobacco.yaml b/app/prototype_v4_2/data/tobacco.yaml index 6916d2e..b714c1c 100644 --- a/app/prototype_v4_2/data/tobacco.yaml +++ b/app/prototype_v4_2/data/tobacco.yaml @@ -13,7 +13,7 @@ tobaccoTypes: change: Has the number of cigarettes you normally smoke changed over time? past: frequency: How often did you smoke cigarettes? - quantity: How many cigarettes did you smoke in a normal day? + quantity: How many cigarettes did you smoke? change: Did the number of cigarettes you normally smoked change over time? rolling_tobacco: @@ -43,7 +43,7 @@ tobaccoTypes: change: Has the number of full pipe loads you normally smoke changed over time? past: frequency: How often did you smoke a pipe? - quantity: How many full pipe loads did you smoke in a normal day? + quantity: How many full pipe loads did you smoke? change: Did the number of full pipe loads you normally smoked change over time? small_cigars: @@ -59,7 +59,7 @@ tobaccoTypes: change: Has the number of small cigars you normally smoke changed over time? past: frequency: How often did you smoke small cigars? - quantity: How many small cigars did you smoke in a normal day? + quantity: How many small cigars did you smoke? change: Did the number of small cigars you normally smoked change over time? medium_cigars: @@ -75,7 +75,7 @@ tobaccoTypes: change: Has the number of medium cigars you normally smoke changed over time? past: frequency: How often did you smoke medium cigars? - quantity: How many medium cigars did you smoke in a normal day? + quantity: How many medium cigars did you smoke? change: Did the number of medium cigars you normally smoked change over time? large_cigars: @@ -91,7 +91,7 @@ tobaccoTypes: change: Has the number of large cigars you normally smoke changed over time? past: frequency: How often did you smoke large cigars? - quantity: How many large cigars did you smoke in a normal day? + quantity: How many large cigars did you smoke? change: Did the number of large cigars you normally smoked change over time? cigarillos: @@ -107,7 +107,7 @@ tobaccoTypes: change: Has the number of cigarillos you normally smoke changed over time? past: frequency: How often did you smoke cigarillos? - quantity: How many cigarillos did you smoke in a normal day? + quantity: How many cigarillos did you smoke? change: Did the number of cigarillos you normally smoked change over time? shisha: @@ -122,7 +122,7 @@ tobaccoTypes: quantity: How long do you currently smoke shisha? past: frequency: How often did you smoke shisha? - quantity: How long did you smoke shisha in a normal day? + quantity: How long did you smoke shisha? smokingChangeTypes: greater: From aa3fd5104b7d7f874157f67729b1d82badb7a0f7 Mon Sep 17 00:00:00 2001 From: Simon Whatley Date: Fri, 5 Jun 2026 10:16:17 +0100 Subject: [PATCH 17/22] Update asbestos page --- app/prototype_v4_2/data/pages.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/prototype_v4_2/data/pages.yaml b/app/prototype_v4_2/data/pages.yaml index b4931d4..c8e2382 100644 --- a/app/prototype_v4_2/data/pages.yaml +++ b/app/prototype_v4_2/data/pages.yaml @@ -142,10 +142,13 @@ pages: - respiratory-conditions - id: asbestos heading: - title: Exposure to asbestos + title: If you worked with asbestos or might have been exposed at work caption: Your health description: | - You may have been exposed to asbestos if you worked or lived with someone in an industry such as building or construction, particularly from the 1950s to the 1990s. + You may have been exposed to asbestos if you worked in an industry such as building or construction, particularly from the 1950s to the 1990s. + + You might also have been exposed if you lived with someone who worked with asbestos. +
      @@ -161,7 +164,7 @@ pages:
    • floor tiles
    • insulating board to protect buildings and ships against fire
    -

    If you worked in an industry such as building or construction, you are more likely to have come into contact with damaged asbestos.

    +

    If you or someone you lived with worked in an industry such as building or construction you are more likely to have come into contact with damaged asbestos materials and products.

    questions: From e1c3013e6dcd341069505eb25ff59a747513bb50 Mon Sep 17 00:00:00 2001 From: Simon Whatley Date: Fri, 5 Jun 2026 10:20:01 +0100 Subject: [PATCH 18/22] Update phone questionnaire question and options --- app/prototype_v4_2/data/questions.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/prototype_v4_2/data/questions.yaml b/app/prototype_v4_2/data/questions.yaml index 9d05d8a..3712b92 100644 --- a/app/prototype_v4_2/data/questions.yaml +++ b/app/prototype_v4_2/data/questions.yaml @@ -17,9 +17,9 @@ questions: type: single answerKey: phoneQuestionnaire options: - - label: Yes + - label: Yes, I have completed a lung cancer risk questionnaire value: yes - - label: No + - label: No, I can continue online value: no validation: required: true @@ -27,7 +27,7 @@ questions: required: text: Select whether you have previously completed a lung cancer risk questionnaire by phone input: - label: Have you previously completed a lung cancer risk questionnaire by phone? + label: Have you previously completed a lung cancer risk questionnaire by phone in the last 12 months? - id: smoker type: single answerKey: smoker From cccd25d2186fcecdd8c94b0ff314609aa20fbdc5 Mon Sep 17 00:00:00 2001 From: Simon Whatley Date: Fri, 5 Jun 2026 10:35:18 +0100 Subject: [PATCH 19/22] Bring v4.3 in line with v4.2 --- app/prototype_v4_3/data/pages.yaml | 25 ++++++++++++++++++++++++- app/prototype_v4_3/data/questions.yaml | 6 +++--- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/app/prototype_v4_3/data/pages.yaml b/app/prototype_v4_3/data/pages.yaml index fbdd28d..e2d2e8f 100644 --- a/app/prototype_v4_3/data/pages.yaml +++ b/app/prototype_v4_3/data/pages.yaml @@ -142,8 +142,31 @@ pages: - respiratory-conditions - id: asbestos heading: - title: Exposure to asbestos + title: If you worked with asbestos or might have been exposed at work caption: Your health + description: | + You may have been exposed to asbestos if you worked in an industry such as building or construction, particularly from the 1950s to the 1990s. + + You might also have been exposed if you lived with someone who worked with asbestos. + +
    + + + What is asbestos? + + +
    +

    Asbestos was used in a number of building materials and products. For example:

    +
      +
    • boilers and pipes
    • +
    • car brakes
    • +
    • cement for roofing sheets
    • +
    • floor tiles
    • +
    • insulating board to protect buildings and ships against fire
    • +
    +

    If you or someone you lived with worked in an industry such as building or construction you are more likely to have come into contact with damaged asbestos materials and products.

    +
    +
    questions: - asbestos-at-work - asbestos-at-home diff --git a/app/prototype_v4_3/data/questions.yaml b/app/prototype_v4_3/data/questions.yaml index a310a76..581d423 100644 --- a/app/prototype_v4_3/data/questions.yaml +++ b/app/prototype_v4_3/data/questions.yaml @@ -17,9 +17,9 @@ questions: type: single answerKey: phoneQuestionnaire options: - - label: Yes + - label: Yes, I have completed a lung cancer risk questionnaire value: yes - - label: No + - label: No, I can continue online value: no validation: required: true @@ -27,7 +27,7 @@ questions: required: text: Select whether you have previously completed a lung cancer risk questionnaire by phone input: - label: Have you previously completed a lung cancer risk questionnaire by phone? + label: Have you previously completed a lung cancer risk questionnaire by phone in the last 12 months? - id: smoker type: single answerKey: smoker From be9c9c256395f5d2fbe04db8e7ddff3ede7e9adc Mon Sep 17 00:00:00 2001 From: Simon Whatley Date: Fri, 5 Jun 2026 10:42:45 +0100 Subject: [PATCH 20/22] Remove "Tell us" from v4.3 --- app/prototype_v4_3/data/pages.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/prototype_v4_3/data/pages.yaml b/app/prototype_v4_3/data/pages.yaml index e2d2e8f..9bfca9e 100644 --- a/app/prototype_v4_3/data/pages.yaml +++ b/app/prototype_v4_3/data/pages.yaml @@ -174,7 +174,7 @@ pages: questions: - cancer-diagnosis heading: - title: Tell us if you have ever been diagnosed with cancer + title: If you have ever been diagnosed with cancer caption: Your health description: | If you have ever been diagnosed with any type of cancer it may impact your chances of developing lung cancer. @@ -182,7 +182,7 @@ pages: questions: - cancer-diagnosis-relatives heading: - title: Tell us if your parents, siblings or children have ever been diagnosed with lung cancer + title: If your parents, siblings or children have ever been diagnosed with lung cancer caption: Your family history description: | If any of your parents, siblings or children have ever been diagnosed with lung cancer it may impact your chances of developing lung cancer. From cff3d42f2bcfb2ea512173e85e58a8e51681690f Mon Sep 17 00:00:00 2001 From: Simon Whatley Date: Fri, 5 Jun 2026 11:09:52 +0100 Subject: [PATCH 21/22] Update asbestos page heading --- app/prototype_v4_2/data/pages.yaml | 2 +- app/prototype_v4_3/data/pages.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/prototype_v4_2/data/pages.yaml b/app/prototype_v4_2/data/pages.yaml index c8e2382..91effdf 100644 --- a/app/prototype_v4_2/data/pages.yaml +++ b/app/prototype_v4_2/data/pages.yaml @@ -142,7 +142,7 @@ pages: - respiratory-conditions - id: asbestos heading: - title: If you worked with asbestos or might have been exposed at work + title: If you have been exposed to asbestos caption: Your health description: | You may have been exposed to asbestos if you worked in an industry such as building or construction, particularly from the 1950s to the 1990s. diff --git a/app/prototype_v4_3/data/pages.yaml b/app/prototype_v4_3/data/pages.yaml index 9bfca9e..a4fc535 100644 --- a/app/prototype_v4_3/data/pages.yaml +++ b/app/prototype_v4_3/data/pages.yaml @@ -142,7 +142,7 @@ pages: - respiratory-conditions - id: asbestos heading: - title: If you worked with asbestos or might have been exposed at work + title: If you have been exposed to asbestos caption: Your health description: | You may have been exposed to asbestos if you worked in an industry such as building or construction, particularly from the 1950s to the 1990s. From 7eae493d696a80035f6fc17408bec0bb04bafd25 Mon Sep 17 00:00:00 2001 From: Simon Whatley Date: Fri, 5 Jun 2026 11:18:51 +0100 Subject: [PATCH 22/22] Change frequency labels back to daily/weekly/monthly/yearly --- app/prototype_v4_2/data/questions.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/prototype_v4_2/data/questions.yaml b/app/prototype_v4_2/data/questions.yaml index 3712b92..9f278b6 100644 --- a/app/prototype_v4_2/data/questions.yaml +++ b/app/prototype_v4_2/data/questions.yaml @@ -685,16 +685,16 @@ questions: input: label: How often do you smoke? options: - - label: Every day + - label: Daily hint: You smoke on most days, for example, 5 or more days a week value: daily - - label: Most weeks - hint: You smoke at least once a week, but not on most days, for example, at weekends only + - label: Weekly + hint: You smoke at least once a week, but not on most days, for example, on weekends only value: weekly - - label: Most months + - label: Monthly hint: You smoke at least once a month, but less than once a week value: monthly - - label: Rarely + - label: Yearly hint: You smoke less than once a month, for example, a few times a year value: yearly validation: @@ -798,16 +798,16 @@ questions: input: label: How often did you smoke? options: - - label: Every day + - label: Daily hint: You smoke on most days, for example, 5 or more days a week value: daily - - label: Most weeks - hint: You smoke at least once a week, but not on most days, for example, at weekends only + - label: Weekly + hint: You smoke at least once a week, but not on most days, for example, on weekends only value: weekly - - label: Most months + - label: Monthly hint: You smoke at least once a month, but less than once a week value: monthly - - label: Rarely + - label: Yearly hint: You smoke less than once a month, for example, a few times a year value: yearly validation: