Skip to content

Commit 5249a52

Browse files
authored
Merge pull request #191 from NHSDigital/DTOSS-9816-screening-protocol
[DTOSS-9816] Add screening protocol
2 parents 93b839d + f952943 commit 5249a52

10 files changed

Lines changed: 68 additions & 3 deletions

File tree

docs/diagrams/erd.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ ScreeningEpisode {
123123
DateTimeField created_at
124124
DateTimeField updated_at
125125
ForeignKey participant
126+
CharField protocol
126127
}
127128
Appointment {
128129
UUIDField id

manage_breast_screening/mammograms/jinja2/mammograms/start_screening.jinja

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@
5656
{{ card({
5757
"headingHtml": " ",
5858
"headingLevel": "2",
59-
"descriptionHtml": participant_details(presented_participant=presented_participant, presented_mammograms=presented_mammograms, return_url=request.path)
59+
"descriptionHtml": participant_details(
60+
presented_participant=presented_participant,
61+
return_url=request.path,
62+
screening_protocol=presented_appointment.screening_protocol,
63+
)
6064
}) }}
6165
{% endblock %}

manage_breast_screening/mammograms/presenters.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def __init__(self, appointment):
3333
self.participant = ParticipantPresenter(
3434
appointment.screening_episode.participant
3535
)
36+
self.screening_protocol = appointment.screening_episode.get_protocol_display()
3637

3738
@cached_property
3839
def participant_url(self):

manage_breast_screening/mammograms/tests/test_presenters.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ def test_participant_url(self, mock_appointment):
8282
== "/participants/ac1b68ec-06a4-40a0-a016-7108dffe4397/"
8383
)
8484

85+
def test_screening_protocol(self, mock_appointment):
86+
mock_appointment.screening_episode.get_protocol_display.return_value = (
87+
"Family history"
88+
)
89+
90+
result = AppointmentPresenter(mock_appointment)
91+
92+
assert result.screening_protocol == "Family history"
93+
8594

8695
class TestLastKnownMammogramPresenter:
8796
@pytest.fixture()

manage_breast_screening/participants/jinja2/components/participant-details/macro.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% macro participant_details(presented_participant, presented_mammograms, return_url=none, full_details=false) %}
1+
{% macro participant_details(presented_participant, presented_mammograms, return_url=none, full_details=false, screening_protocol=none) %}
22
{% if return_url is none %}
33
{{ raise('return_url is required') }}
44
{% endif %}

manage_breast_screening/participants/jinja2/components/participant-details/template.jinja

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,14 @@
113113
"html": presented_participant.phone
114114
}
115115
},
116+
{
117+
"key": {
118+
"text": "Screening protocol"
119+
},
120+
"value": {
121+
"html": screening_protocol
122+
}
123+
} if screening_protocol else undefined,
116124
{
117125
"key": {
118126
"text": "Email"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 5.2.3 on 2025-07-08 08:03
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('participants', '0016_participant_any_other_background_details'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='screeningepisode',
15+
name='protocol',
16+
field=models.CharField(choices=[('FAMILY_HISTORY', 'Family history')], default='FAMILY_HISTORY', max_length=50),
17+
),
18+
]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Generated by Django 5.2.3 on 2025-07-08 10:15
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('participants', '0017_merge_20250707_0856'),
10+
('participants', '0017_screeningepisode_protocol'),
11+
]
12+
13+
operations = [
14+
]

manage_breast_screening/participants/models.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,17 @@ class ParticipantAddress(models.Model):
160160

161161

162162
class ScreeningEpisode(BaseModel):
163+
class Protocol:
164+
FAMILY_HISTORY = "FAMILY_HISTORY"
165+
166+
PROTOCOL_CHOICES = {
167+
Protocol.FAMILY_HISTORY: "Family history",
168+
}
169+
163170
participant = models.ForeignKey(Participant, on_delete=models.PROTECT)
171+
protocol = models.CharField(
172+
choices=PROTOCOL_CHOICES, default=Protocol.FAMILY_HISTORY, max_length=50
173+
)
164174

165175
def screening_history(self):
166176
"""

manage_breast_screening/participants/tests/test_forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def test_no_provider_selected(self, participant, current_provider):
162162
)
163163
assert not form.is_valid()
164164
assert form.errors == {
165-
"provider": ["Select another brest screening unit."],
165+
"provider": ["Select another breast screening unit"],
166166
}
167167

168168
def test_mammogram_in_same_provider(self, participant, current_provider):

0 commit comments

Comments
 (0)