Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this function so could share between tests of test_symptom_rows, test_read_only_symptom_rows and test_significant_symptom_rows.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If they don't depend on each other, you could make each one a fixture. Then pull them in as needed. It's a bit more concise that way.

symptom1 = SymptomFactory.create(
lump=True,
appointment=appointment,
Expand All @@ -43,22 +41,19 @@ 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,
when_started=RelativeDateChoices.LESS_THAN_THREE_MONTHS,
area=SymptomAreas.RIGHT_BREAST,
symptom_sub_type_details="abc",
)

symptom4 = SymptomFactory.create(
other=True,
appointment=appointment,
Expand All @@ -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)

Expand Down Expand Up @@ -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<br><strong class="nhsuk-tag app-nowrap nhsuk-tag--yellow">Highlight to image readers</strong>',
},
"value": {
"html": "Left breast<br>Not sure<br>Symptom is intermittent<br>Stopped: resolved date<br>Not investigated<br>Additional information: abc",
},
},
{
"key": {
"html": 'Other<br><strong class="nhsuk-tag app-nowrap nhsuk-tag--yellow">Highlight to image readers</strong>'
},
"value": {
"html": "Description: abc<br>Right breast<br>Less than 3 months ago<br>Not investigated"
},
},
{
"key": {"text": "Other"},
"value": {
"html": "Description: xyz<br>Left breast<br>Less than 3 months ago<br>Not investigated"
},
},
{
"key": {
"html": 'Swelling or shape change<br><strong class="nhsuk-tag app-nowrap nhsuk-tag--yellow">Highlight to image readers</strong>',
},
"value": {
"html": "Both breasts<br>Less than 3 months ago<br>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<br><strong class="nhsuk-tag app-nowrap nhsuk-tag--yellow">Highlight to image readers</strong>',
},
"value": {
"html": "Left breast<br>Not sure<br>Symptom is intermittent<br>Stopped: resolved date<br>Not investigated<br>Additional information: abc",
},
},
{
"key": {
"html": 'Other<br><strong class="nhsuk-tag app-nowrap nhsuk-tag--yellow">Highlight to image readers</strong>'
},
"value": {
"html": "Description: abc<br>Right breast<br>Less than 3 months ago<br>Not investigated"
},
},
{
"key": {
"html": 'Swelling or shape change<br><strong class="nhsuk-tag app-nowrap nhsuk-tag--yellow">Highlight to image readers</strong>',
},
"value": {
"html": "Both breasts<br>Less than 3 months ago<br>Not investigated",
},
},
]

def test_add_lump_button(self):
appointment = AppointmentFactory()

Expand Down
12 changes: 11 additions & 1 deletion manage_breast_screening/reading/jinja2/read_image.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -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 #}
Expand Down Expand Up @@ -56,6 +57,15 @@
</div>
</div>

{% if medical_information_presenter.significant_symptom_rows %}
{{ warningCallout({
"heading": "Significant symptoms reported",
"html": summaryList({
"rows": medical_information_presenter.significant_symptom_rows
}),
}) }}
{% endif %}

<div class="nhsuk-grid-row">
<div class="nhsuk-grid-column-one-third nhsuk-u-margin-bottom-4">
<h2 class="nhsuk-heading-s">Image thumbnails ({{ images | length }})</h2>
Expand Down Expand Up @@ -112,7 +122,7 @@
}) }}
{% endif %}

{{ medical_summary_card(presented_medical_information) }}
{{ medical_summary_card(check_medical_information_presenter) }}
</div>
</div>
{% endblock %}
8 changes: 7 additions & 1 deletion manage_breast_screening/reading/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down Expand Up @@ -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(
Copy link
Copy Markdown
Contributor Author

@swebberuk swebberuk Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Template uses CheckMedicalInformationPresenter for "Medical summary" and MedicalInformationPresenter for "Significant symptoms reported". Renamed presented_medical_information to check_medical_information_presenter to make clearer.

appointment
),
"medical_information_presenter": MedicalInformationPresenter(
appointment
),
"notes_for_reader": appointment.study.additional_details,
Expand Down
Loading