-
Notifications
You must be signed in to change notification settings - Fork 5
[wip] Allow symptoms to be highlighted to image readers #1385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,6 +51,23 @@ def test_formats_symptoms_summary_list(self): | |
| 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, | ||
| when_started=RelativeDateChoices.LESS_THAN_THREE_MONTHS, | ||
| area=SymptomAreas.LEFT_BREAST, | ||
| highlight_to_readers=False, | ||
| symptom_sub_type_details="xyz", | ||
| ) | ||
|
|
||
| presenter = MedicalInformationPresenter(appointment) | ||
|
|
||
| assert presenter.symptom_rows == [ | ||
|
|
@@ -66,12 +83,46 @@ def test_formats_symptoms_summary_list(self): | |
| ], | ||
| }, | ||
| "key": { | ||
| "text": "Lump", | ||
| "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", | ||
| }, | ||
| }, | ||
| { | ||
| "actions": { | ||
| "items": [ | ||
| { | ||
| "text": "Change", | ||
| "classes": "nhsuk-link--no-visited-state", | ||
| "visuallyHiddenText": "other", | ||
| "href": f"/mammograms/{appointment.id}/record-medical-information/other/{symptom3.id}/", | ||
| }, | ||
| ], | ||
| }, | ||
| "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" | ||
| }, | ||
| }, | ||
| { | ||
| "actions": { | ||
| "items": [ | ||
| { | ||
| "text": "Change", | ||
| "classes": "nhsuk-link--no-visited-state", | ||
| "visuallyHiddenText": "other", | ||
| "href": f"/mammograms/{appointment.id}/record-medical-information/other/{symptom4.id}/", | ||
| } | ||
| ] | ||
| }, | ||
| "key": {"text": "Other"}, | ||
| "value": { | ||
| "html": "Description: xyz<br>Left breast<br>Less than 3 months ago<br>Not investigated" | ||
| }, | ||
| }, | ||
| { | ||
| "actions": { | ||
| "items": [ | ||
|
|
@@ -84,7 +135,7 @@ def test_formats_symptoms_summary_list(self): | |
| ], | ||
| }, | ||
| "key": { | ||
| "text": "Swelling or shape change", | ||
| "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", | ||
|
Comment on lines
83
to
141
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -135,7 +135,7 @@ def test_formats_intermittent_stopped_and_additional_information(self): | |
| assert presenter.intermittent_line == "Symptom is intermittent" | ||
| assert presenter.additional_information_line == "Additional information: abc" | ||
|
|
||
| def test_formats_for_summary_list(self): | ||
| def test_formats_lump_for_summary_list(self): | ||
| symptom = SymptomFactory.create( | ||
| lump=True, | ||
| when_started=RelativeDateChoices.NOT_SURE, | ||
|
|
@@ -159,13 +159,48 @@ def test_formats_for_summary_list(self): | |
| ], | ||
| }, | ||
| "key": { | ||
| "text": "Lump", | ||
| "html": 'Lump<br><strong class="nhsuk-tag app-nowrap nhsuk-tag--yellow">Highlight to image readers</strong>', | ||
| }, | ||
|
Comment on lines
159
to
163
|
||
| "value": { | ||
| "html": "Left breast<br>Not sure<br>Symptom is intermittent<br>Stopped: resolved date<br>Not investigated<br>Additional information: abc", | ||
| }, | ||
| } | ||
|
|
||
| @pytest.mark.parametrize("highlight_to_readers", [True, False]) | ||
| def test_formats_other_for_summary_list(self, highlight_to_readers): | ||
| symptom = SymptomFactory.create( | ||
| breast_pain=True, | ||
| when_started=RelativeDateChoices.LESS_THAN_THREE_MONTHS, | ||
| area=SymptomAreas.LEFT_BREAST, | ||
| highlight_to_readers=highlight_to_readers, | ||
| ) | ||
|
|
||
| presenter = SymptomPresenter(symptom) | ||
|
|
||
| if highlight_to_readers: | ||
| expected_key = { | ||
| "html": 'Breast pain<br><strong class="nhsuk-tag app-nowrap nhsuk-tag--yellow">Highlight to image readers</strong>', | ||
| } | ||
| else: | ||
| expected_key = {"text": "Breast pain"} | ||
|
|
||
| assert presenter.summary_list_row == { | ||
| "actions": { | ||
| "items": [ | ||
| { | ||
| "text": "Change", | ||
| "classes": "nhsuk-link--no-visited-state", | ||
| "visuallyHiddenText": "breast pain", | ||
| "href": f"/mammograms/{symptom.appointment_id}/record-medical-information/breast-pain/{symptom.id}/", | ||
| } | ||
| ] | ||
| }, | ||
| "key": expected_key, | ||
| "value": { | ||
| "html": "Left breast<br>Less than 3 months ago<br>Not investigated" | ||
| }, | ||
| } | ||
|
|
||
| def test_delete_message_html(self): | ||
| lump = SymptomFactory.create(lump=True) | ||
| presenter = SymptomPresenter(lump) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The summary-list key HTML concatenates the symptom name directly with the tag with no separator. Unless CSS is adding spacing, this will render as a single joined string (e.g.
LumpHighlight to image readers). Consider inserting whitespace and/or a margin utility class between the label and tag, and usingformat_html()instead ofmark_safe()to avoid hand-building safe HTML.