Conversation
6b67fbd to
e68c11b
Compare
| choices=HormoneReplacementTherapy.Status, | ||
| label=f"Is {participant.full_name} currently taking HRT?", | ||
| label_classes="nhsuk-fieldset__legend--l", | ||
| page_heading=True, |
There was a problem hiding this comment.
Set page_heading=True as want the label to be <h1>. Required as pages must have a level-one heading and, unlike other pages, this page does not have a separate title.
e68c11b to
f5e6970
Compare
| visually_hidden_label_suffix=None, | ||
| classes=None, | ||
| choice_hints=None, | ||
| page_heading=False, |
There was a problem hiding this comment.
Added page_heading so can be used by label.jinja to determine if label should be wrapped in <h1>.
| NO_BUT_STOPPED_RECENTLY = "NO_BUT_STOPPED_RECENTLY", "No, but stopped recently" | ||
| NO = "NO", "No" | ||
|
|
||
| appointment = models.OneToOneField(Appointment, on_delete=models.PROTECT) |
There was a problem hiding this comment.
Have defined relationship with appointment as one-to-one.
This is consistent with what we've done for Study.
This is different to what we've done for CystHistoryItem, even though we also restrict that to one per appointment.
appointment = models.ForeignKey(
Appointment,
on_delete=models.PROTECT,
related_name="cyst_history_items",
)
scripts/lint_model_usage_in_views.py
Outdated
| "MastectomyOrLumpectomyHistoryItem", # Temporarily allowed | ||
| "OtherProcedureHistoryItem", # Temporarily allowed | ||
| "ParticipantReportedMammogram", # Temporarily allowed | ||
| "HormoneReplacementTherapy", # Temporarily allowed |
There was a problem hiding this comment.
Added this to avoid:
Disallowed references detected:
- manage_breast_screening/mammograms/views/other_relevant_information/hormone_replacement_therapy_views.py:64 -> model.objects
return HormoneReplacementTherapy.objects.get(
make: *** [Makefile:110: test-lint] Error 1
Have followed same approach as used in other views, e.g. UpdateOtherProcedureHistoryView.
Don't know what the preferred solution for this is?
When we agree on a solution then should also fix for the other items in this list.
There was a problem hiding this comment.
We shouldn't be adding to this list, the linter is here to avoid us unintentionally exposing data from other providers.
Instead of HormoneReplacmentTherapy.objects.get you can access it via the Appointment instance, and this will ensure that access is scoped to the user's allowed providers (as the appointment is already provider scoped).
You could add a filter to the .objects.get call to accomplish the same thing, but the linter is not smart enough to detect that.
| {% macro label_html(field) %} | ||
| {% set unbound_field = field.field %} | ||
| {% if unbound_field.page_heading -%} | ||
| <h1 class="nhsuk-fieldset__heading"> |
There was a problem hiding this comment.
I'm a bit confused by this - that text is the legend, not a label.
I'd expect isPageHeading or similar to be set on a legend property. @MatMoore does our radio component support isPageHeading?
There was a problem hiding this comment.
This macro name is a bit misleading as it can be used with both labels and legends. The naming follows the Django form field naming, and the form field abstraction doesn't care about the tags used in the html.
We are calling it like this in nhsuk_forms/jinja2/forms/radios.jinja:
"legend": {
"html": label_html(field),
"classes": unbound_field.label_classes
}The jinja component does support isPageHeading, but the above macro that converts between Django form field and component params doesn't pass it through.
It looks like this diff is producing the correct HTML, but we could equivalently add "isPageHeading": unbound_field.page_heading to the legend params above, and then we wouldn't need the extra conditional here (correct me if I'm wrong.)
If that's the case, then I think using that param would be preferable. The more we depend on nhsuk-frontend-jinja for our templating, the easier it will be to stay in sync with the design system.
c58ae3a to
a526e0f
Compare
|
Mentioned via slack, but we've slightly tweaked the hint text for these fields to be more specific. |
| self.fields["status"] = ChoiceField( | ||
| choices=HormoneReplacementTherapy.Status, | ||
| label=f"Is {participant.full_name} currently taking HRT?", | ||
| label_classes="nhsuk-label--l", |
There was a problem hiding this comment.
As a sidenote, something I noticed recently is that at the component level, you can pass a size param (l/m/s) instead of specifying classes. So at some point it may be worth switching all the Field classes to that approach, to simplify the forms a bit further.
There was a problem hiding this comment.
We only added the feature recently - but yes probably good to adopt.
| "value" : { | ||
| "html": hormone_replacement_therapy_details(presenter) | ||
| }, | ||
| "actions": { |
There was a problem hiding this comment.
We could maybe make this whole actions object an attribute of the presenter, since there's no html involved here.
There was a problem hiding this comment.
Have made this change.
| appointment.hormone_replacement_therapy | ||
| if hasattr(appointment, "hormone_replacement_therapy") | ||
| else None | ||
| ) |
There was a problem hiding this comment.
can this be shortened to self.hormone_replacement_therapy = getattr(appointment, "hormone_replacement_therapy", None)?
| ) | ||
|
|
||
| status = models.CharField(choices=Status) | ||
| start_date = models.CharField(blank=True, null=False, default="") |
There was a problem hiding this comment.
I wonder if we should name this approx_start_date or something like that so it's clearer this is a free text value rather than an exact date? Maybe have a look at what we've done on the forms for previous mammograms and symptoms as they are similar I think.
There was a problem hiding this comment.
Strong agree for explicit naming where these are approximate things
| status = models.CharField(choices=Status) | ||
| start_date = models.CharField(blank=True, null=False, default="") | ||
| end_date = models.CharField(blank=True, null=False, default="") | ||
| previous_duration = models.CharField(blank=True, null=False, default="") |
There was a problem hiding this comment.
Same here, duration makes it sound more precise than it is.
scripts/lint_model_usage_in_views.py
Outdated
| "MastectomyOrLumpectomyHistoryItem", # Temporarily allowed | ||
| "OtherProcedureHistoryItem", # Temporarily allowed | ||
| "ParticipantReportedMammogram", # Temporarily allowed | ||
| "HormoneReplacementTherapy", # Temporarily allowed |
There was a problem hiding this comment.
We shouldn't be adding to this list, the linter is here to avoid us unintentionally exposing data from other providers.
Instead of HormoneReplacmentTherapy.objects.get you can access it via the Appointment instance, and this will ensure that access is scoped to the user's allowed providers (as the appointment is already provider scoped).
You could add a filter to the .objects.get call to accomplish the same thing, but the linter is not smart enough to detect that.
3194a9a to
8bf7c43
Compare
b46e353 to
7eb6deb
Compare
86bfc87 to
16332eb
Compare
16332eb to
e22578e
Compare
e22578e to
350f380
Compare
|
The review app at this URL has been deleted: |
350f380 to
1ff8273
Compare
2f76958 to
4353abe
Compare
4353abe to
cee1422
Compare
to
|
cee1422 to
c6b1b8f
Compare
|




Added page to record details of hormone replacement therapy.
Page can be accessed from the 'record medical information' page.
Description
Jira link
https://nhsd-jira.digital.nhs.uk/browse/DTOSS-12223
Review notes
Review checklist