diff --git a/manage_breast_screening/mammograms/presenters/medical_information_presenter.py b/manage_breast_screening/mammograms/presenters/medical_information_presenter.py index 85d4dde8a..29a7ee451 100644 --- a/manage_breast_screening/mammograms/presenters/medical_information_presenter.py +++ b/manage_breast_screening/mammograms/presenters/medical_information_presenter.py @@ -175,6 +175,14 @@ def read_only_symptom_rows(self): for symptom in self.symptoms ] + @property + def significant_symptom_rows(self): + return [ + symptom.build_summary_list_row(include_actions=False) + for symptom in self.symptoms + if symptom.highlight_to_readers + ] + @property def symptom_buttons(self): return [ diff --git a/manage_breast_screening/mammograms/presenters/symptom_presenter.py b/manage_breast_screening/mammograms/presenters/symptom_presenter.py index 0db9e1d9a..ed4270d2f 100644 --- a/manage_breast_screening/mammograms/presenters/symptom_presenter.py +++ b/manage_breast_screening/mammograms/presenters/symptom_presenter.py @@ -19,6 +19,7 @@ class SymptomPresenter: def __init__(self, symptom): self._symptom = symptom + self.highlight_to_readers = symptom.highlight_to_readers @property def area_line(self): diff --git a/manage_breast_screening/mammograms/tests/presenters/test_medical_information_presenter.py b/manage_breast_screening/mammograms/tests/presenters/test_medical_information_presenter.py index e0b2a12ed..e03c64eb9 100644 --- a/manage_breast_screening/mammograms/tests/presenters/test_medical_information_presenter.py +++ b/manage_breast_screening/mammograms/tests/presenters/test_medical_information_presenter.py @@ -31,9 +31,7 @@ @pytest.mark.django_db class TestRecordMedicalInformationPresenter: - def test_formats_symptoms_summary_list(self): - appointment = AppointmentFactory.create() - + def _create_default_symptoms(self, appointment): symptom1 = SymptomFactory.create( lump=True, appointment=appointment, @@ -43,14 +41,12 @@ def test_formats_symptoms_summary_list(self): when_resolved="resolved date", additional_information="abc", ) - symptom2 = SymptomFactory.create( swelling_or_shape_change=True, appointment=appointment, when_started=RelativeDateChoices.LESS_THAN_THREE_MONTHS, area=SymptomAreas.BOTH_BREASTS, ) - symptom3 = SymptomFactory.create( other=True, appointment=appointment, @@ -58,7 +54,6 @@ def test_formats_symptoms_summary_list(self): area=SymptomAreas.RIGHT_BREAST, symptom_sub_type_details="abc", ) - symptom4 = SymptomFactory.create( other=True, appointment=appointment, @@ -67,6 +62,13 @@ def test_formats_symptoms_summary_list(self): highlight_to_readers=False, symptom_sub_type_details="xyz", ) + return symptom1, symptom2, symptom3, symptom4 + + def test_symptom_rows(self): + appointment = AppointmentFactory.create() + symptom1, symptom2, symptom3, symptom4 = self._create_default_symptoms( + appointment + ) presenter = MedicalInformationPresenter(appointment) @@ -143,6 +145,78 @@ def test_formats_symptoms_summary_list(self): }, ] + def test_read_only_symptom_rows(self): + appointment = AppointmentFactory.create() + self._create_default_symptoms(appointment) + + presenter = MedicalInformationPresenter(appointment) + + assert presenter.read_only_symptom_rows == [ + { + "key": { + "html": 'Lump
Highlight to image readers', + }, + "value": { + "html": "Left breast
Not sure
Symptom is intermittent
Stopped: resolved date
Not investigated
Additional information: abc", + }, + }, + { + "key": { + "html": 'Other
Highlight to image readers' + }, + "value": { + "html": "Description: abc
Right breast
Less than 3 months ago
Not investigated" + }, + }, + { + "key": {"text": "Other"}, + "value": { + "html": "Description: xyz
Left breast
Less than 3 months ago
Not investigated" + }, + }, + { + "key": { + "html": 'Swelling or shape change
Highlight to image readers', + }, + "value": { + "html": "Both breasts
Less than 3 months ago
Not investigated", + }, + }, + ] + + def test_significant_symptom_rows(self): + appointment = AppointmentFactory.create() + self._create_default_symptoms(appointment) + + presenter = MedicalInformationPresenter(appointment) + + assert presenter.significant_symptom_rows == [ + { + "key": { + "html": 'Lump
Highlight to image readers', + }, + "value": { + "html": "Left breast
Not sure
Symptom is intermittent
Stopped: resolved date
Not investigated
Additional information: abc", + }, + }, + { + "key": { + "html": 'Other
Highlight to image readers' + }, + "value": { + "html": "Description: abc
Right breast
Less than 3 months ago
Not investigated" + }, + }, + { + "key": { + "html": 'Swelling or shape change
Highlight to image readers', + }, + "value": { + "html": "Both breasts
Less than 3 months ago
Not investigated", + }, + }, + ] + def test_add_lump_button(self): appointment = AppointmentFactory() diff --git a/manage_breast_screening/reading/jinja2/read_image.jinja b/manage_breast_screening/reading/jinja2/read_image.jinja index e0d7aeba4..1b4eb004a 100644 --- a/manage_breast_screening/reading/jinja2/read_image.jinja +++ b/manage_breast_screening/reading/jinja2/read_image.jinja @@ -3,6 +3,7 @@ {% from "nhsuk/components/inset-text/macro.jinja" import insetText %} {% from "nhsuk/components/summary-list/macro.jinja" import summaryList %} {% from "nhsuk/components/tag/macro.jinja" import tag %} +{% from "nhsuk/components/warning-callout/macro.jinja" import warningCallout %} {% from "mammograms/check_information/medical_information_card.jinja" import medical_summary_card %} {# djlint:off H006 #} @@ -56,6 +57,15 @@ + {% if medical_information_presenter.significant_symptom_rows %} + {{ warningCallout({ + "heading": "Significant symptoms reported", + "html": summaryList({ + "rows": medical_information_presenter.significant_symptom_rows + }), + }) }} + {% endif %} +

Image thumbnails ({{ images | length }})

@@ -112,7 +122,7 @@ }) }} {% endif %} - {{ medical_summary_card(presented_medical_information) }} + {{ medical_summary_card(check_medical_information_presenter) }}
{% endblock %} diff --git a/manage_breast_screening/reading/views.py b/manage_breast_screening/reading/views.py index 682a1cad7..530d6455f 100644 --- a/manage_breast_screening/reading/views.py +++ b/manage_breast_screening/reading/views.py @@ -10,6 +10,9 @@ from manage_breast_screening.mammograms.presenters.medical_history.check_medical_information_presenter import ( CheckMedicalInformationPresenter, ) +from manage_breast_screening.mammograms.presenters.medical_information_presenter import ( + MedicalInformationPresenter, +) from manage_breast_screening.participants.models import Appointment logger = getLogger(__name__) @@ -39,7 +42,10 @@ def get_context_data(self, **kwargs): "heading": participant.full_name, "caption": "Review images", "images": images, - "presented_medical_information": CheckMedicalInformationPresenter( + "check_medical_information_presenter": CheckMedicalInformationPresenter( + appointment + ), + "medical_information_presenter": MedicalInformationPresenter( appointment ), "notes_for_reader": appointment.study.additional_details,