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/controllers/question.js b/app/prototype_v4_2/controllers/question.js index f1cd34c..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` +} + /// ------------------------------------------------------------------------ /// /// /// ------------------------------------------------------------------------ /// @@ -281,7 +294,7 @@ exports.weightMetric_post = (req, res) => { }, errors) } else { delete answers.weight?.imperial - res.redirect(`/prototype_${version}/about-you`) + res.redirect(`/prototype_${version}/gender`) } } @@ -310,152 +323,129 @@ 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}/smoking-duration`) + } +} /// ------------------------------------------------------------------------ /// /// Your health /// ------------------------------------------------------------------------ /// 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}/about-you`, + 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}/about-you`, + back, cancel: `/prototype_${version}/` }, errors) } else { @@ -538,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`) } } } @@ -562,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`) } } @@ -572,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 { @@ -761,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/data/pages.yaml b/app/prototype_v4_2/data/pages.yaml index 6e020da..91effdf 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. @@ -96,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 @@ -148,8 +142,31 @@ pages: - respiratory-conditions - id: asbestos heading: - title: Exposure to asbestos + 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. + + 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:

+ +

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 @@ -157,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. @@ -165,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. @@ -183,8 +200,8 @@ pages: If you do not know or cannot remember, select 'I do not know'. - id: smoking-duration heading: - title: Smoking duration - caption: Your smoking habits + title: When you smoked tobacco + caption: Your smoking history questions: - age-started-smoking - id: age-stopped-smoking @@ -196,15 +213,15 @@ 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 habits + caption: Your smoking history + questions: + - smoking-type 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: @@ -223,12 +240,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 1edbcf0..9f278b6 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 @@ -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 @@ -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 @@ -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? hint: Select all that apply options: - label: Cigarettes @@ -686,15 +686,16 @@ questions: label: How often do you smoke? options: - label: Daily + hint: You smoke on most days, for example, 5 or more days a week value: daily - label: Weekly - hint: For example, on the weekend + hint: You smoke at least once a week, but not on most days, for example, on weekends only value: weekly - label: Monthly - hint: Select this option if you smoke at least once a month + 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 + hint: You smoke less than once a month, for example, a few times a year value: yearly validation: required: true @@ -798,15 +799,16 @@ questions: label: How often did you smoke? options: - label: Daily + hint: You smoke on most days, for example, 5 or more days a week value: daily - label: Weekly - hint: For example, on the weekend + hint: You smoke at least once a week, but not on most days, for example, on weekends only value: weekly - label: Monthly - hint: Select this option if you smoked at least once a month + 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 + hint: You smoke less than once a month, for example, a few times a year value: yearly validation: required: true @@ -861,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/data/tobacco.yaml b/app/prototype_v4_2/data/tobacco.yaml index 0e2d145..b714c1c 100644 --- a/app/prototype_v4_2/data/tobacco.yaml +++ b/app/prototype_v4_2/data/tobacco.yaml @@ -9,11 +9,11 @@ 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? - 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: @@ -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,11 +39,11 @@ 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? - 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: @@ -55,11 +55,11 @@ 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? - 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: @@ -71,11 +71,11 @@ 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? - 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: @@ -87,11 +87,11 @@ 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? - 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: @@ -103,11 +103,11 @@ 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? - 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: @@ -119,10 +119,10 @@ 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? + quantity: How long did you smoke shisha? smokingChangeTypes: greater: diff --git a/app/prototype_v4_2/docs/question-flow.md b/app/prototype_v4_2/docs/question-flow.md index a5546d6..ca25a7b 100644 --- a/app/prototype_v4_2/docs/question-flow.md +++ b/app/prototype_v4_2/docs/question-flow.md @@ -30,24 +30,27 @@ 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 --> 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"] + 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"] ``` @@ -91,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/docs/question-schema.md b/app/prototype_v4_2/docs/question-schema.md index 5e4cc0e..ac82bc7 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 @@ -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/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? 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/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/lib/tobacco-flow.js b/app/prototype_v4_2/lib/tobacco-flow.js index 8d98a48..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 { @@ -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, @@ -474,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. * @@ -482,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] @@ -494,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 baseHeading ? `${baseHeading.replace('?', '')} ${comparisonText}?` : '' + 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 includeComparison && comparisonText ? `${baseHeading.replace('?', '')} ${comparisonText}?` : normalHeading } if (page === 'smoking-years-change') { @@ -701,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. * @@ -714,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 ') @@ -806,7 +846,7 @@ const getSmokingContentQuestionOverrides = ({ return { heading: { title: smokingType.statusHeading, - caption: smokingType.caption + caption: 'Your smoking history' }, input: { name: `answers[${step.type}][smokingStatus]` @@ -825,9 +865,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') } } @@ -848,7 +886,7 @@ const getSmokingContentQuestionOverrides = ({ return { heading: { title: smokingType.changeHeading, - caption: smokingType.caption + caption: 'Your smoking history' }, input: { name: `answers[${step.type}][smokingChange]` @@ -861,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]` @@ -876,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, @@ -889,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', @@ -926,10 +964,17 @@ 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' + } + } + + if (page === 'tobacco-smoking') { + return { + title: smokingType.pageHeading || smokingType.caption } } @@ -955,7 +1000,7 @@ const getSmokingContentPageOverrides = (req, page, step) => { }, {}) return { - heading: getSmokingTypePageHeading(page, context.smokingType), + heading: getSmokingTypePageHeading(page, context.smokingType, step, context.answer), questions } } 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/check-your-answers.html b/app/prototype_v4_2/views/check-your-answers.html index f541116..ee18046 100644 --- a/app/prototype_v4_2/views/check-your-answers.html +++ b/app/prototype_v4_2/views/check-your-answers.html @@ -39,24 +39,8 @@

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 habits

+

Your smoking history

{% if checkYourAnswers.smokingHabits.length %} {{ summaryList({ @@ -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 cd08438..3d4006d 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

@@ -56,29 +56,15 @@

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

- - -

Your family history

- - -

Your smoking habits

+

Your smoking history

@@ -92,6 +78,19 @@

Tobacco smoking

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

Your health

+ + +

Your family history

+ +

Check and confirmation

{{ button({ diff --git a/app/prototype_v4_3/data/pages.yaml b/app/prototype_v4_3/data/pages.yaml index fbdd28d..a4fc535 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 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. + + 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 @@ -151,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. @@ -159,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. 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 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