Skip to content

Commit 9dc1a12

Browse files
Split Eklund in to four views (#265)
1 parent e9c9d03 commit 9dc1a12

8 files changed

Lines changed: 223 additions & 73 deletions

File tree

app/lib/utils/referrers.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ const parseReferrerChain = (referrerChain) => {
137137
* @param {string|false} [scrollToId] - Optional element ID to scroll to on return
138138
* @returns {string} URL to use for back link
139139
* @example
140-
* // In templates:
141140
* <a href="{{ '/default-path' | getReturnUrl(referrerChain) }}">Back</a>
142141
*
143142
* // In routes with scrollTo:
@@ -220,7 +219,6 @@ const getReturnUrl = function (url, referrerChain, scrollToId = false) {
220219
* @param {string} [scrollToId] - Optional element ID to scroll to on return
221220
* @returns {string} URL with referrer query param and optional scrollTo
222221
* @example
223-
* // In templates:
224222
* <a href="{{ '/next-page' | urlWithReferrer(referrer) }}">Continue</a>
225223
* <a href="{{ '/next-page' | urlWithReferrer(referrer, 'current-symptoms') }}">Continue</a>
226224
*/
@@ -246,7 +244,6 @@ const urlWithReferrer = (url, referrerChain, scrollToId = false) => {
246244
* @param {string} newUrl - URL to append
247245
* @returns {string} Combined referrer chain
248246
* @example
249-
* // In templates:
250247
* {% set updatedReferrer = referrerChain | appendReferrer(currentUrl) %}
251248
*/
252249
const appendReferrer = (existingReferrerChain, newUrl) => {

app/routes/events.js

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2166,7 +2166,7 @@ module.exports = (router) => {
21662166
*/
21672167
function needsRepeatQuestions(mammogramDataTemp) {
21682168
const views = ['viewsRightBreast', 'viewsLeftBreast']
2169-
const viewTypes = ['CC', 'MLO', 'Eklund']
2169+
const viewTypes = ['CC', 'MLO', 'CCID', 'MLOID']
21702170

21712171
for (const breastView of views) {
21722172
if (!mammogramDataTemp[breastView]) continue
@@ -2295,9 +2295,16 @@ module.exports = (router) => {
22952295
{
22962296
side: 'right',
22972297
sideCode: 'R',
2298-
viewType: 'Eklund',
2299-
viewName: 'Eklund',
2300-
viewKey: 'rightEklund'
2298+
viewType: 'CCID',
2299+
viewName: 'craniocaudal implant displaced',
2300+
viewKey: 'rightCCID'
2301+
},
2302+
{
2303+
side: 'right',
2304+
sideCode: 'R',
2305+
viewType: 'MLOID',
2306+
viewName: 'mediolateral oblique implant displaced',
2307+
viewKey: 'rightMLOID'
23012308
},
23022309
{
23032310
side: 'left',
@@ -2316,9 +2323,16 @@ module.exports = (router) => {
23162323
{
23172324
side: 'left',
23182325
sideCode: 'L',
2319-
viewType: 'Eklund',
2320-
viewName: 'Eklund',
2321-
viewKey: 'leftEklund'
2326+
viewType: 'CCID',
2327+
viewName: 'craniocaudal implant displaced',
2328+
viewKey: 'leftCCID'
2329+
},
2330+
{
2331+
side: 'left',
2332+
sideCode: 'L',
2333+
viewType: 'MLOID',
2334+
viewName: 'mediolateral oblique implant displaced',
2335+
viewKey: 'leftMLOID'
23222336
}
23232337
]
23242338

@@ -2332,12 +2346,8 @@ module.exports = (router) => {
23322346

23332347
// Only add view if count > 0
23342348
if (count > 0) {
2335-
// For Eklund views, use full form like "Right Eklund" or "Left Eklund"
2336-
// For standard views, use abbreviated form like "RCC" or "LMLO"
2337-
const code =
2338-
config.viewType === 'Eklund'
2339-
? `${config.side.charAt(0).toUpperCase() + config.side.slice(1)} ${config.viewType}`
2340-
: `${config.sideCode}${config.viewType}`
2349+
// Use abbreviated form like "RCC", "LMLO", "RCCID", "LMLOID"
2350+
const code = `${config.sideCode}${config.viewType}`
23412351

23422352
// Get repeat data if this view has count > 1
23432353
let repeatCount = 0
@@ -2536,7 +2546,7 @@ module.exports = (router) => {
25362546
const formData = data.event?.mammogramDataTemp || {}
25372547

25382548
// Validate at least one view has a count > 0
2539-
const viewTypes = ['CC', 'MLO', 'Eklund']
2549+
const viewTypes = ['CC', 'MLO', 'CCID', 'MLOID']
25402550
const breasts = ['Right', 'Left']
25412551
let hasAnyImages = false
25422552

@@ -2607,10 +2617,12 @@ module.exports = (router) => {
26072617
const viewCodes = [
26082618
'RCC',
26092619
'RMLO',
2610-
'Right Eklund',
2620+
'RCCID',
2621+
'RMLOID',
26112622
'LCC',
26122623
'LMLO',
2613-
'Left Eklund'
2624+
'LCCID',
2625+
'LMLOID'
26142626
]
26152627

26162628
viewCodes.forEach((code) => {

app/views/_includes/reading/opinion-ui.njk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@
113113
}
114114
],
115115
value: existingOpinion or data.imageReadingTemp.opinion
116-
} | decorateAttributes(data, "imageReadingTemp.opinion" )) }}
117-
116+
}) }}
118117
{{ button({
119118
text: "Update opinion"
120119
}) }}

app/views/_includes/summary-lists/medical-information/mammogram-image-data.njk

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66
{% set isManualEntry = event.mammogramData.isManualEntry %}
77
{% set mammogramViews = event.mammogramData.views | getObjectValues %}
88

9-
{# Define view order for consistent display (CC, MLO, Eklund) #}
10-
{% set viewOrder = ['CC', 'MLO', 'Eklund'] %}
9+
{# Define view order based on config - groups implant displaced views next to their regular counterpart #}
10+
{% if data.settings.mammogramViewOrder == 'mlo-first' %}
11+
{% set viewOrder = ['MLO', 'MLOID', 'CC', 'CCID'] %}
12+
{% else %}
13+
{% set viewOrder = ['CC', 'CCID', 'MLO', 'MLOID'] %}
14+
{% endif %}
1115

1216
{# Group views by side and sort by standard order #}
1317
{% set rightViewsUnsorted = [] %}

app/views/events/images-manual-details.html

Lines changed: 154 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ <h1>{{ pageHeading }}</h1>
2929

3030
{% set viewsRightBreastCCCount = mammogramTemp.viewsRightBreastCCCount or mammogramViews.rightCraniocaudal.count or "1" %}
3131
{% set viewsRightBreastMLOCount = mammogramTemp.viewsRightBreastMLOCount or mammogramViews.rightMediolateralOblique.count or "1" %}
32-
{% set viewsRightBreastEklundCount = mammogramTemp.viewsRightBreastEklundCount or mammogramViews.rightEklund.count or "0" %}
32+
{% set viewsRightBreastCCIDCount = mammogramTemp.viewsRightBreastCCIDCount or mammogramViews.rightCCID.count or "0" %}
33+
{% set viewsRightBreastMLOIDCount = mammogramTemp.viewsRightBreastMLOIDCount or mammogramViews.rightMLOID.count or "0" %}
3334
{% set viewsLeftBreastCCCount = mammogramTemp.viewsLeftBreastCCCount or mammogramViews.leftCraniocaudal.count or "1" %}
3435
{% set viewsLeftBreastMLOCount = mammogramTemp.viewsLeftBreastMLOCount or mammogramViews.leftMediolateralOblique.count or "1" %}
35-
{% set viewsLeftBreastEklundCount = mammogramTemp.viewsLeftBreastEklundCount or mammogramViews.leftEklund.count or "0" %}
36+
{% set viewsLeftBreastCCIDCount = mammogramTemp.viewsLeftBreastCCIDCount or mammogramViews.leftCCID.count or "0" %}
37+
{% set viewsLeftBreastMLOIDCount = mammogramTemp.viewsLeftBreastMLOIDCount or mammogramViews.leftMLOID.count or "0" %}
3638
{% set additionalDetails = mammogramTemp.additionalDetails or event.mammogramData.additionalDetails or "" %}
3739
{% set notesForReader = mammogramTemp.notesForReader or event.mammogramData.notesForReader or "" %}
3840

@@ -115,23 +117,9 @@ <h2 aria-hidden="true">{{ viewsQuestionText }}?</h2>
115117
max: 9
116118
}) }}
117119
{% endif %}
118-
119-
{{ appStepperInput({
120-
label: {
121-
text: "Right Eklund"
122-
},
123-
hint: {
124-
text: "Used with breast implants"
125-
},
126-
name: "event[mammogramDataTemp][viewsRightBreastEklundCount]",
127-
value: viewsRightBreastEklundCount | default("0"),
128-
id: "views-right-breast-eklund-count",
129-
min: 0,
130-
max: 9
131-
}) }}
132120
</fieldset>
133121
</div>
134-
122+
135123
<div class="nhsuk-grid-column-one-half">
136124
<fieldset class="nhsuk-fieldset">
137125
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--s">
@@ -195,32 +183,161 @@ <h2 aria-hidden="true">{{ viewsQuestionText }}?</h2>
195183
max: 9
196184
}) }}
197185
{% endif %}
198-
199-
{{ appStepperInput({
200-
label: {
201-
text: "Left Eklund"
202-
},
203-
hint: {
204-
text: "Used with breast implants"
205-
},
206-
name: "event[mammogramDataTemp][viewsLeftBreastEklundCount]",
207-
value: viewsLeftBreastEklundCount | default("0"),
208-
id: "views-left-breast-eklund-count",
209-
min: 0,
210-
max: 9
211-
}) }}
212186
</fieldset>
213187
</div>
214188
</div>
215189

190+
{# Implant displaced (Eklund) views – collapsible, open if any data already present #}
191+
{% set hasImplantDisplacedData = (viewsRightBreastCCIDCount | int) > 0 or (viewsRightBreastMLOIDCount | int) > 0 or (viewsLeftBreastCCIDCount | int) > 0 or (viewsLeftBreastMLOIDCount | int) > 0 %}
192+
{% call details({
193+
summaryText: "Other views",
194+
open: hasImplantDisplacedData
195+
}) %}
196+
<div class="nhsuk-grid-row">
197+
<div class="nhsuk-grid-column-one-half">
198+
<fieldset class="nhsuk-fieldset">
199+
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--s">
200+
{{ (viewsQuestionText + " for the") | asVisuallyHiddenText }} Right breast
201+
</legend>
202+
203+
{% if data.settings.mammogramViewOrder == 'mlo-first' %}
204+
{{ appStepperInput({
205+
label: {
206+
text: "RMLOID"
207+
},
208+
_hint: {
209+
text: "Eklund RMLO"
210+
},
211+
name: "event[mammogramDataTemp][viewsRightBreastMLOIDCount]",
212+
value: viewsRightBreastMLOIDCount | default("0"),
213+
id: "views-right-breast-mloid-count",
214+
min: 0,
215+
max: 9
216+
}) }}
217+
218+
{{ appStepperInput({
219+
label: {
220+
text: "RCCID"
221+
},
222+
_hint: {
223+
text: "Eklund RCC"
224+
},
225+
name: "event[mammogramDataTemp][viewsRightBreastCCIDCount]",
226+
value: viewsRightBreastCCIDCount | default("0"),
227+
id: "views-right-breast-ccid-count",
228+
min: 0,
229+
max: 9
230+
}) }}
231+
{% else %}
232+
{{ appStepperInput({
233+
label: {
234+
text: "RCCID"
235+
},
236+
_hint: {
237+
text: "Eklund RCC"
238+
},
239+
name: "event[mammogramDataTemp][viewsRightBreastCCIDCount]",
240+
value: viewsRightBreastCCIDCount | default("0"),
241+
id: "views-right-breast-ccid-count",
242+
min: 0,
243+
max: 9
244+
}) }}
245+
246+
{{ appStepperInput({
247+
label: {
248+
text: "RMLOID"
249+
},
250+
_hint: {
251+
text: "Eklund RMLO"
252+
},
253+
name: "event[mammogramDataTemp][viewsRightBreastMLOIDCount]",
254+
value: viewsRightBreastMLOIDCount | default("0"),
255+
id: "views-right-breast-mloid-count",
256+
min: 0,
257+
max: 9
258+
}) }}
259+
{% endif %}
260+
</fieldset>
261+
</div>
262+
263+
<div class="nhsuk-grid-column-one-half">
264+
<fieldset class="nhsuk-fieldset">
265+
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--s">
266+
{{ (viewsQuestionText + " for the") | asVisuallyHiddenText }} Left breast
267+
</legend>
268+
269+
{% if data.settings.mammogramViewOrder == 'mlo-first' %}
270+
{{ appStepperInput({
271+
label: {
272+
text: "LMLOID"
273+
},
274+
_hint: {
275+
text: "Eklund LMLO"
276+
},
277+
name: "event[mammogramDataTemp][viewsLeftBreastMLOIDCount]",
278+
value: viewsLeftBreastMLOIDCount | default("0"),
279+
id: "views-left-breast-mloid-count",
280+
min: 0,
281+
max: 9
282+
}) }}
283+
284+
{{ appStepperInput({
285+
label: {
286+
text: "LCCID"
287+
},
288+
_hint: {
289+
text: "Eklund LCC"
290+
},
291+
name: "event[mammogramDataTemp][viewsLeftBreastCCIDCount]",
292+
value: viewsLeftBreastCCIDCount | default("0"),
293+
id: "views-left-breast-ccid-count",
294+
min: 0,
295+
max: 9
296+
}) }}
297+
{% else %}
298+
{{ appStepperInput({
299+
label: {
300+
text: "LCCID"
301+
},
302+
_hint: {
303+
text: "Eklund LCC"
304+
},
305+
name: "event[mammogramDataTemp][viewsLeftBreastCCIDCount]",
306+
value: viewsLeftBreastCCIDCount | default("0"),
307+
id: "views-left-breast-ccid-count",
308+
min: 0,
309+
max: 9
310+
}) }}
311+
312+
{{ appStepperInput({
313+
label: {
314+
text: "LMLOID"
315+
},
316+
_hint: {
317+
text: "Eklund LMLO"
318+
},
319+
name: "event[mammogramDataTemp][viewsLeftBreastMLOIDCount]",
320+
value: viewsLeftBreastMLOIDCount | default("0"),
321+
id: "views-left-breast-mloid-count",
322+
min: 0,
323+
max: 9
324+
}) }}
325+
{% endif %}
326+
</fieldset>
327+
</div>
328+
</div>
329+
{% endcall %}
330+
216331
{# Calculate initial total count from form data #}
217332
{% set initialTotalCount = 0 %}
218333
{% set initialTotalCount = initialTotalCount + (viewsRightBreastCCCount | int(0)) %}
219334
{% set initialTotalCount = initialTotalCount + (viewsRightBreastMLOCount | int(0)) %}
220-
{% set initialTotalCount = initialTotalCount + (viewsRightBreastEklundCount | int(0)) %}
335+
{% set initialTotalCount = initialTotalCount + (viewsRightBreastCCIDCount | int(0)) %}
336+
{% set initialTotalCount = initialTotalCount + (viewsRightBreastMLOIDCount | int(0)) %}
221337
{% set initialTotalCount = initialTotalCount + (viewsLeftBreastCCCount | int(0)) %}
222338
{% set initialTotalCount = initialTotalCount + (viewsLeftBreastMLOCount | int(0)) %}
223-
{% set initialTotalCount = initialTotalCount + (viewsLeftBreastEklundCount | int(0)) %}
339+
{% set initialTotalCount = initialTotalCount + (viewsLeftBreastCCIDCount | int(0)) %}
340+
{% set initialTotalCount = initialTotalCount + (viewsLeftBreastMLOIDCount | int(0)) %}
224341

225342
<p class="_nhsuk-u-font-weight-bold app-js-only app-text-grey nhsuk-u-margin-bottom-4 nhsuk-u-font-size-22" id="total-images-count">
226343
Images taken: <span data-total-count>{{ initialTotalCount }}</span>
@@ -266,10 +383,12 @@ <h2>Additional details</h2>
266383
return [
267384
document.getElementById('views-right-breast-cc-count'),
268385
document.getElementById('views-right-breast-mlo-count'),
269-
document.getElementById('views-right-breast-eklund-count'),
386+
document.getElementById('views-right-breast-ccid-count'),
387+
document.getElementById('views-right-breast-mloid-count'),
270388
document.getElementById('views-left-breast-cc-count'),
271389
document.getElementById('views-left-breast-mlo-count'),
272-
document.getElementById('views-left-breast-eklund-count')
390+
document.getElementById('views-left-breast-ccid-count'),
391+
document.getElementById('views-left-breast-mloid-count')
273392
].filter(Boolean) // Remove any null values
274393
}
275394

0 commit comments

Comments
 (0)