Skip to content

Commit ff38833

Browse files
committed
Show significant symptoms reported
1 parent 194faa5 commit ff38833

6 files changed

Lines changed: 168 additions & 6 deletions

File tree

manage_breast_screening/mammograms/jinja2/mammograms/medical_information/section_cards.jinja

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@
9393
{% endif %}
9494
{% endmacro %}
9595

96-
{% macro symptoms_content(presented_medical_info, read_only=false) %}
97-
{% set symptom_rows = presented_medical_info.read_only_symptom_rows if read_only else presented_medical_info.symptom_rows %}
98-
<p {%- if not read_only and not symptom_rows %} class="nhsuk-u-margin-bottom-3"{% endif %}>Any problems or symptoms, including lumps, swelling, rashes or nipple changes</p>
96+
{% macro symptoms_content(presented_medical_info, read_only=false, significant_only=false) %}
97+
{% set symptom_rows = presented_medical_info.significant_symptom_rows if significant_only else presented_medical_info.read_only_symptom_rows if read_only else presented_medical_info.symptom_rows %}
98+
{%- if not significant_only %}<p {%- if not read_only and not symptom_rows %} class="nhsuk-u-margin-bottom-3"{% endif %}>Any problems or symptoms, including lumps, swelling, rashes or nipple changes</p>{% endif %}
9999
{% if symptom_rows %}
100100
{{ summaryList({
101101
"rows": symptom_rows

manage_breast_screening/mammograms/presenters/medical_information_presenter.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,14 @@ def read_only_symptom_rows(self):
175175
for symptom in self.symptoms
176176
]
177177

178+
@property
179+
def significant_symptom_rows(self):
180+
return [
181+
symptom.build_summary_list_row(include_actions=False)
182+
for symptom in self.symptoms
183+
if symptom.highlight_to_readers
184+
]
185+
178186
@property
179187
def symptom_buttons(self):
180188
return [

manage_breast_screening/mammograms/presenters/symptom_presenter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
class SymptomPresenter:
2020
def __init__(self, symptom):
2121
self._symptom = symptom
22+
self.highlight_to_readers = symptom.highlight_to_readers
2223

2324
@property
2425
def area_line(self):

manage_breast_screening/mammograms/tests/presenters/test_medical_information_presenter.py

Lines changed: 139 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
@pytest.mark.django_db
3333
class TestRecordMedicalInformationPresenter:
34-
def test_formats_symptoms_summary_list(self):
34+
def test_symptom_rows(self):
3535
appointment = AppointmentFactory.create()
3636

3737
symptom1 = SymptomFactory.create(
@@ -143,6 +143,144 @@ def test_formats_symptoms_summary_list(self):
143143
},
144144
]
145145

146+
def test_read_only_symptom_rows(self):
147+
appointment = AppointmentFactory.create()
148+
149+
SymptomFactory.create(
150+
lump=True,
151+
appointment=appointment,
152+
when_started=RelativeDateChoices.NOT_SURE,
153+
area=SymptomAreas.LEFT_BREAST,
154+
intermittent=True,
155+
when_resolved="resolved date",
156+
additional_information="abc",
157+
)
158+
159+
SymptomFactory.create(
160+
swelling_or_shape_change=True,
161+
appointment=appointment,
162+
when_started=RelativeDateChoices.LESS_THAN_THREE_MONTHS,
163+
area=SymptomAreas.BOTH_BREASTS,
164+
)
165+
166+
SymptomFactory.create(
167+
other=True,
168+
appointment=appointment,
169+
when_started=RelativeDateChoices.LESS_THAN_THREE_MONTHS,
170+
area=SymptomAreas.RIGHT_BREAST,
171+
symptom_sub_type_details="abc",
172+
)
173+
174+
SymptomFactory.create(
175+
other=True,
176+
appointment=appointment,
177+
when_started=RelativeDateChoices.LESS_THAN_THREE_MONTHS,
178+
area=SymptomAreas.LEFT_BREAST,
179+
highlight_to_readers=False,
180+
symptom_sub_type_details="xyz",
181+
)
182+
183+
presenter = MedicalInformationPresenter(appointment)
184+
185+
assert presenter.read_only_symptom_rows == [
186+
{
187+
"key": {
188+
"html": 'Lump<br><strong class="nhsuk-tag app-nowrap nhsuk-tag--yellow">Highlight to image readers</strong>',
189+
},
190+
"value": {
191+
"html": "Left breast<br>Not sure<br>Symptom is intermittent<br>Stopped: resolved date<br>Not investigated<br>Additional information: abc",
192+
},
193+
},
194+
{
195+
"key": {
196+
"html": 'Other<br><strong class="nhsuk-tag app-nowrap nhsuk-tag--yellow">Highlight to image readers</strong>'
197+
},
198+
"value": {
199+
"html": "Description: abc<br>Right breast<br>Less than 3 months ago<br>Not investigated"
200+
},
201+
},
202+
{
203+
"key": {"text": "Other"},
204+
"value": {
205+
"html": "Description: xyz<br>Left breast<br>Less than 3 months ago<br>Not investigated"
206+
},
207+
},
208+
{
209+
"key": {
210+
"html": 'Swelling or shape change<br><strong class="nhsuk-tag app-nowrap nhsuk-tag--yellow">Highlight to image readers</strong>',
211+
},
212+
"value": {
213+
"html": "Both breasts<br>Less than 3 months ago<br>Not investigated",
214+
},
215+
},
216+
]
217+
218+
def test_significant_symptom_rows(self):
219+
appointment = AppointmentFactory.create()
220+
221+
SymptomFactory.create(
222+
lump=True,
223+
appointment=appointment,
224+
when_started=RelativeDateChoices.NOT_SURE,
225+
area=SymptomAreas.LEFT_BREAST,
226+
intermittent=True,
227+
when_resolved="resolved date",
228+
additional_information="abc",
229+
)
230+
231+
SymptomFactory.create(
232+
swelling_or_shape_change=True,
233+
appointment=appointment,
234+
when_started=RelativeDateChoices.LESS_THAN_THREE_MONTHS,
235+
area=SymptomAreas.BOTH_BREASTS,
236+
)
237+
238+
SymptomFactory.create(
239+
other=True,
240+
appointment=appointment,
241+
when_started=RelativeDateChoices.LESS_THAN_THREE_MONTHS,
242+
area=SymptomAreas.RIGHT_BREAST,
243+
symptom_sub_type_details="abc",
244+
)
245+
246+
SymptomFactory.create(
247+
other=True,
248+
appointment=appointment,
249+
when_started=RelativeDateChoices.LESS_THAN_THREE_MONTHS,
250+
area=SymptomAreas.LEFT_BREAST,
251+
highlight_to_readers=False,
252+
symptom_sub_type_details="xyz",
253+
)
254+
255+
presenter = MedicalInformationPresenter(appointment)
256+
257+
assert presenter.significant_symptom_rows == [
258+
{
259+
"key": {
260+
"html": 'Lump<br><strong class="nhsuk-tag app-nowrap nhsuk-tag--yellow">Highlight to image readers</strong>',
261+
},
262+
"value": {
263+
"html": "Left breast<br>Not sure<br>Symptom is intermittent<br>Stopped: resolved date<br>Not investigated<br>Additional information: abc",
264+
},
265+
},
266+
{
267+
"key": {
268+
"html": 'Other<br><strong class="nhsuk-tag app-nowrap nhsuk-tag--yellow">Highlight to image readers</strong>'
269+
},
270+
"value": {
271+
"html": "Description: abc<br>Right breast<br>Less than 3 months ago<br>Not investigated"
272+
},
273+
},
274+
{
275+
"key": {
276+
"html": 'Swelling or shape change<br><strong class="nhsuk-tag app-nowrap nhsuk-tag--yellow">Highlight to image readers</strong>',
277+
},
278+
"value": {
279+
"html": "Both breasts<br>Less than 3 months ago<br>Not investigated",
280+
},
281+
},
282+
]
283+
146284
def test_add_lump_button(self):
147285
appointment = AppointmentFactory()
148286

manage_breast_screening/reading/jinja2/read_image.jinja

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
{% from "nhsuk/components/inset-text/macro.jinja" import insetText %}
44
{% from "nhsuk/components/summary-list/macro.jinja" import summaryList %}
55
{% from "nhsuk/components/tag/macro.jinja" import tag %}
6+
{% from "nhsuk/components/warning-callout/macro.jinja" import warningCallout %}
67
{% from "mammograms/check_information/medical_information_card.jinja" import medical_summary_card %}
8+
{% from "mammograms/medical_information/section_cards.jinja" import symptoms_content %}
79

810
{# djlint:off H006 #}
911

@@ -56,6 +58,13 @@
5658
</div>
5759
</div>
5860

61+
{% if medical_information_presenter.significant_symptom_rows %}
62+
{{ warningCallout({
63+
"heading": "Significant symptoms reported",
64+
"html": symptoms_content(medical_information_presenter, significant_only=True, read_only=True),
65+
}) }}
66+
{% endif %}
67+
5968
<div class="nhsuk-grid-row">
6069
<div class="nhsuk-grid-column-one-third nhsuk-u-margin-bottom-4">
6170
<h2 class="nhsuk-heading-s">Image thumbnails ({{ images | length }})</h2>
@@ -112,7 +121,7 @@
112121
}) }}
113122
{% endif %}
114123

115-
{{ medical_summary_card(presented_medical_information) }}
124+
{{ medical_summary_card(check_medical_information_presenter) }}
116125
</div>
117126
</div>
118127
{% endblock %}

manage_breast_screening/reading/views.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
from manage_breast_screening.mammograms.presenters.medical_history.check_medical_information_presenter import (
1111
CheckMedicalInformationPresenter,
1212
)
13+
from manage_breast_screening.mammograms.presenters.medical_information_presenter import (
14+
MedicalInformationPresenter,
15+
)
1316
from manage_breast_screening.participants.models import Appointment
1417

1518
logger = getLogger(__name__)
@@ -39,7 +42,10 @@ def get_context_data(self, **kwargs):
3942
"heading": participant.full_name,
4043
"caption": "Review images",
4144
"images": images,
42-
"presented_medical_information": CheckMedicalInformationPresenter(
45+
"check_medical_information_presenter": CheckMedicalInformationPresenter(
46+
appointment
47+
),
48+
"medical_information_presenter": MedicalInformationPresenter(
4349
appointment
4450
),
4551
"notes_for_reader": appointment.study.additional_details,

0 commit comments

Comments
 (0)