Skip to content

Commit f4f94c2

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

6 files changed

Lines changed: 109 additions & 11 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: 80 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@
3131

3232
@pytest.mark.django_db
3333
class TestRecordMedicalInformationPresenter:
34-
def test_formats_symptoms_summary_list(self):
35-
appointment = AppointmentFactory.create()
36-
34+
def _create_default_symptoms(self, appointment):
3735
symptom1 = SymptomFactory.create(
3836
lump=True,
3937
appointment=appointment,
@@ -43,22 +41,19 @@ def test_formats_symptoms_summary_list(self):
4341
when_resolved="resolved date",
4442
additional_information="abc",
4543
)
46-
4744
symptom2 = SymptomFactory.create(
4845
swelling_or_shape_change=True,
4946
appointment=appointment,
5047
when_started=RelativeDateChoices.LESS_THAN_THREE_MONTHS,
5148
area=SymptomAreas.BOTH_BREASTS,
5249
)
53-
5450
symptom3 = SymptomFactory.create(
5551
other=True,
5652
appointment=appointment,
5753
when_started=RelativeDateChoices.LESS_THAN_THREE_MONTHS,
5854
area=SymptomAreas.RIGHT_BREAST,
5955
symptom_sub_type_details="abc",
6056
)
61-
6257
symptom4 = SymptomFactory.create(
6358
other=True,
6459
appointment=appointment,
@@ -67,6 +62,13 @@ def test_formats_symptoms_summary_list(self):
6762
highlight_to_readers=False,
6863
symptom_sub_type_details="xyz",
6964
)
65+
return symptom1, symptom2, symptom3, symptom4
66+
67+
def test_symptom_rows(self):
68+
appointment = AppointmentFactory.create()
69+
symptom1, symptom2, symptom3, symptom4 = self._create_default_symptoms(
70+
appointment
71+
)
7072

7173
presenter = MedicalInformationPresenter(appointment)
7274

@@ -143,6 +145,78 @@ def test_formats_symptoms_summary_list(self):
143145
},
144146
]
145147

148+
def test_read_only_symptom_rows(self):
149+
appointment = AppointmentFactory.create()
150+
self._create_default_symptoms(appointment)
151+
152+
presenter = MedicalInformationPresenter(appointment)
153+
154+
assert presenter.read_only_symptom_rows == [
155+
{
156+
"key": {
157+
"html": 'Lump<br><strong class="nhsuk-tag app-nowrap nhsuk-tag--yellow">Highlight to image readers</strong>',
158+
},
159+
"value": {
160+
"html": "Left breast<br>Not sure<br>Symptom is intermittent<br>Stopped: resolved date<br>Not investigated<br>Additional information: abc",
161+
},
162+
},
163+
{
164+
"key": {
165+
"html": 'Other<br><strong class="nhsuk-tag app-nowrap nhsuk-tag--yellow">Highlight to image readers</strong>'
166+
},
167+
"value": {
168+
"html": "Description: abc<br>Right breast<br>Less than 3 months ago<br>Not investigated"
169+
},
170+
},
171+
{
172+
"key": {"text": "Other"},
173+
"value": {
174+
"html": "Description: xyz<br>Left breast<br>Less than 3 months ago<br>Not investigated"
175+
},
176+
},
177+
{
178+
"key": {
179+
"html": 'Swelling or shape change<br><strong class="nhsuk-tag app-nowrap nhsuk-tag--yellow">Highlight to image readers</strong>',
180+
},
181+
"value": {
182+
"html": "Both breasts<br>Less than 3 months ago<br>Not investigated",
183+
},
184+
},
185+
]
186+
187+
def test_significant_symptom_rows(self):
188+
appointment = AppointmentFactory.create()
189+
self._create_default_symptoms(appointment)
190+
191+
presenter = MedicalInformationPresenter(appointment)
192+
193+
assert presenter.significant_symptom_rows == [
194+
{
195+
"key": {
196+
"html": 'Lump<br><strong class="nhsuk-tag app-nowrap nhsuk-tag--yellow">Highlight to image readers</strong>',
197+
},
198+
"value": {
199+
"html": "Left breast<br>Not sure<br>Symptom is intermittent<br>Stopped: resolved date<br>Not investigated<br>Additional information: abc",
200+
},
201+
},
202+
{
203+
"key": {
204+
"html": 'Other<br><strong class="nhsuk-tag app-nowrap nhsuk-tag--yellow">Highlight to image readers</strong>'
205+
},
206+
"value": {
207+
"html": "Description: abc<br>Right breast<br>Less than 3 months ago<br>Not investigated"
208+
},
209+
},
210+
{
211+
"key": {
212+
"html": 'Swelling or shape change<br><strong class="nhsuk-tag app-nowrap nhsuk-tag--yellow">Highlight to image readers</strong>',
213+
},
214+
"value": {
215+
"html": "Both breasts<br>Less than 3 months ago<br>Not investigated",
216+
},
217+
},
218+
]
219+
146220
def test_add_lump_button(self):
147221
appointment = AppointmentFactory()
148222

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)