Skip to content

Commit d366b34

Browse files
Skip injection question for nasal sprays (#451)
This updates the logic for the flow of the record vaccination journey so that, if the vaccine product is a nasal spray, the 'injection site' question is skipped and instead the 'Was a full dose given?' question is shown.
1 parent ac3bdec commit d366b34

File tree

5 files changed

+78
-39
lines changed

5 files changed

+78
-39
lines changed

app/data/vaccines.js

Lines changed: 50 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,109 +3,134 @@ module.exports = [
33
name: "COVID-19",
44
products: [
55
{
6-
name: "Comirnaty 30 JN.1"
6+
name: "Comirnaty 30 JN.1",
7+
type: "injection"
78
},
89
{
9-
name: "Comirnaty 10 JN.1"
10+
name: "Comirnaty 10 JN.1",
11+
type: "injection"
1012
},
1113
{
12-
name: "Comirnaty 3 JN.1"
14+
name: "Comirnaty 3 JN.1",
15+
type: "injection"
1316
},
1417
{
15-
name: "Spikevax JN.1"
18+
name: "Spikevax JN.1",
19+
type: "injection"
1620
}
1721
]
1822
},
1923
{
2024
name: "flu",
2125
products: [
2226
{
23-
name: "Adjuvanted Trivalent Influenza Vaccine (aTIV)"
27+
name: "Adjuvanted Trivalent Influenza Vaccine (aTIV)",
28+
type: "injection"
2429
},
2530
{
26-
name: "Cell-based Trivalent Influenza Vaccine (TIVc)"
31+
name: "Cell-based Trivalent Influenza Vaccine (TIVc)",
32+
type: "injection"
2733
},
2834
{
29-
name: "Efluelda (TIV-HD)"
35+
name: "Efluelda (TIV-HD)",
36+
type: "injection"
3037
},
3138
{
32-
name: "Fluenz (LAIV)"
39+
name: "Fluenz (LAIV)",
40+
type: "nasal spray"
3341
},
3442
{
35-
name: "Influvac (TIVe)"
43+
name: "Influvac (TIVe)",
44+
type: "injection"
3645
},
3746
{
38-
name: "Supemtek (TIVr)"
47+
name: "Supemtek (TIVr)",
48+
type: "injection"
3949
},
4050
{
41-
name: "Vaxigrip (TIVe)"
51+
name: "Vaxigrip (TIVe)",
52+
type: "injection"
4253
}
4354
]
4455
},
4556
{
4657
name: "flu (London service)",
4758
products: [
4859
{
49-
name: "Adjuvanted Trivalent Influenza Vaccine (aTIV)"
60+
name: "Adjuvanted Trivalent Influenza Vaccine (aTIV)",
61+
type: "injection"
5062
},
5163
{
52-
name: "Cell-based Trivalent Influenza Vaccine (TIVc)"
64+
name: "Cell-based Trivalent Influenza Vaccine (TIVc)",
65+
type: "injection"
5366
},
5467
{
55-
name: "Efluelda (TIV-HD)"
68+
name: "Efluelda (TIV-HD)",
69+
type: "injection"
5670
},
5771
{
58-
name: "Fluenz (LAIV)"
72+
name: "Fluenz (LAIV)",
73+
type: "nasal spray"
5974
},
6075
{
61-
name: "Influvac (TIVe)"
76+
name: "Influvac (TIVe)",
77+
type: "injection"
6278
},
6379
{
64-
name: "Supemtek (TIVr)"
80+
name: "Supemtek (TIVr)",
81+
type: "injection"
6582
},
6683
{
67-
name: "Vaxigrip (TIVe)"
84+
name: "Vaxigrip (TIVe)",
85+
type: "injection"
6886
}
6987
]
7088
},
7189
{
7290
name: "pertussis",
7391
products: [
7492
{
75-
name: "Adacel vaccine suspension"
93+
name: "Adacel vaccine suspension",
94+
type: "injection"
7695
},
7796
{
78-
name: "Boostrix-IPV suspension"
97+
name: "Boostrix-IPV suspension",
98+
type: "injection"
7999
},
80100
{
81-
name: "Repevax vaccine suspension"
101+
name: "Repevax vaccine suspension",
102+
type: "injection"
82103
}
83104
]
84105
},
85106
{
86107
name: "MMR",
87108
products: [
88109
{
89-
name: "MMRVaXPro"
110+
name: "MMRVaXPro",
111+
type: "injection"
90112
},
91113
{
92-
name: "Priorix"
114+
name: "Priorix",
115+
type: "injection"
93116
}
94117
]
95118
},
96119
{
97120
name: "pneumococcal",
98121
products: [
99122
{
100-
name: "Pneumovax"
123+
name: "Pneumovax",
124+
type: "injection"
101125
}
102126
]
103127
},
104128
{
105129
name: "RSV",
106130
products: [
107131
{
108-
name: "Abrysvo"
132+
name: "Abrysvo",
133+
type: "injection"
109134
}
110135
]
111136
}

app/filters.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ module.exports = function (env) { /* eslint-disable-line no-unused-vars */
3636
}
3737

3838
filters.capitaliseFirstLetter = function(string) {
39-
return string.charAt(0) .toUpperCase() + string.slice(1)
39+
if (string) {
40+
return string.charAt(0) .toUpperCase() + string.slice(1)
41+
} else {
42+
return null
43+
}
4044
}
4145

4246
/* ------------------------------------------------------------------

app/routes/record-vaccinations.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -629,8 +629,6 @@ module.exports = router => {
629629
const healthcareWorker = data.healthcareWorker
630630
let nextPage
631631

632-
console.log(healthcareWorker)
633-
634632
if (healthcareWorker && healthcareWorker != '') {
635633
nextPage = '/record-vaccinations/location'
636634
} else {
@@ -930,6 +928,8 @@ module.exports = router => {
930928
const consentDeputyRelationship = data.consentDeputyRelationship
931929
const consentAttorneyRelationship = data.consentAttorneyRelationship
932930

931+
const vaccineProduct = data.vaccines.find((vaccine) => vaccine.name === data.vaccine)?.products.find((vaccineProduct) => vaccineProduct.name === data.vaccineProduct)
932+
933933
if (
934934
(consent === "patient") ||
935935
(consent === "Clinician acting in the patient’s best interests" && consentClinicianName != '') ||
@@ -938,7 +938,13 @@ module.exports = router => {
938938
(consent === "Independent mental capacity advocate" && consentAdvocateName != '') ||
939939
(consent === "Court appointed deputy" && consentDeputyName != '' && consentDeputyRelationship != "")
940940
) {
941-
res.redirect('/record-vaccinations/injection-site')
941+
942+
if (vaccineProduct?.type === "nasal spray") {
943+
res.redirect('/record-vaccinations/dose-amount')
944+
} else {
945+
res.redirect('/record-vaccinations/injection-site')
946+
}
947+
942948
} else {
943949
res.redirect('/record-vaccinations/consent?showErrors=yes')
944950
}
@@ -978,12 +984,16 @@ module.exports = router => {
978984
})
979985
})
980986

981-
router.get('/record-vaccinations/check', (req, res) => {
987+
router.get('/record-vaccinations/check', (req, res) => {
982988
const data = req.session.data
983989
const vaccinator = data.users.find((user) => user.id === data.vaccinatorId)
984990

991+
// Get the details of the vaccine product
992+
const vaccineProduct = data.vaccines.find((vaccine) => vaccine.name === data.vaccine)?.products.find((vaccineProduct) => vaccineProduct.name === data.vaccineProduct)
993+
985994
res.render('record-vaccinations/check', {
986-
vaccinator
995+
vaccinator,
996+
vaccineProduct
987997
})
988998
})
989999

@@ -1006,10 +1016,6 @@ router.get('/record-vaccinations/check', (req, res) => {
10061016

10071017
if (!injectionSite || (injectionSite === "other" && !otherInjectionSite)) {
10081018
redirectPath = "/record-vaccinations/injection-site?showErrors=yes"
1009-
} else if (data.vaccineProduct == "Fluenz (LAIV)") {
1010-
1011-
// Fluenz is a nasal spray which gets an extra question
1012-
redirectPath = "/record-vaccinations/dose-amount"
10131019
}
10141020

10151021
res.redirect(redirectPath)

app/views/record-vaccinations/check.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
{% set currentSection = "vaccinate" %}
66

77
{% block beforeContent %}
8-
{{ backLink({ href: "/record-vaccinations/injection-site" }) }}
8+
{% if vaccineProduct.type == "nasal spray" %}
9+
{{ backLink({ href: "/record-vaccinations/dose-amount" }) }}
10+
{% else %}
11+
{{ backLink({ href: "/record-vaccinations/injection-site" }) }}
12+
{% endif %}
913
{% endblock %}
1014

1115
{% set consentHtml %}
@@ -350,7 +354,7 @@ <h2 class="nhsuk-heading-m">Vaccination</h2>
350354
}
351355
]
352356
}
353-
},
357+
} if (vaccineProduct.type == "injection"),
354358
{
355359
key: {
356360
text: "Dose"
@@ -367,7 +371,7 @@ <h2 class="nhsuk-heading-m">Vaccination</h2>
367371
}
368372
]
369373
}
370-
} if data.doseAmount
374+
} if (vaccineProduct.type == "nasal spray")
371375
]
372376
}) }}
373377

app/views/record-vaccinations/dose-amount.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{% set currentSection = "vaccinate" %}
66

77
{% block beforeContent %}
8-
{{ backLink({ href: "/record-vaccinations/injection-site" }) }}
8+
{{ backLink({ href: "/record-vaccinations/consent" }) }}
99
{% endblock %}
1010

1111
{% block content %}

0 commit comments

Comments
 (0)