Skip to content
Merged
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 @@ -68,7 +68,7 @@ clinic:
diagnosis_year: 2024
left_breast_procedure: NO_PROCEDURE
right_breast_procedure: LUMPECTOMY
systemic_treatments: NO_RADIOTHERAPY
systemic_treatments: [NO_SYSTEMIC_TREATMENTS]
intervention_location: NHS_HOSPITAL
intervention_location_details: East Tester Hospital

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ clinic:
diagnosis_year: 2024
left_breast_procedure: NO_PROCEDURE
right_breast_procedure: LUMPECTOMY
systemic_treatments: NO_SYSTEMIC_TREATMENTS
systemic_treatments: [NO_SYSTEMIC_TREATMENTS]
intervention_location: NHS_HOSPITAL
intervention_location_details: East Tester Hospital
implanted_medical_device_history_items:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ def __init__(self, breast_cancer_history_item):
self.left_breast_treatment = self._format_multiple_choices(
self._item.left_breast_treatment, BreastCancerHistoryItem.Treatment
)
self.systemic_treatments = self._item.get_systemic_treatments_display()
self.systemic_treatments = self._format_multiple_choices(
self._item.systemic_treatments,
BreastCancerHistoryItem.SystemicTreatment,
)
self.additional_details = nl2br(self._item.additional_details)

@property
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Generated by Django 5.2.8 on 2025-11-17 16:08

import django.contrib.postgres.fields
from django.db import migrations, models

import manage_breast_screening.nhsuk_forms.validators


class Migration(migrations.Migration):

dependencies = [
("participants", "0042_alter_implantedmedicaldevicehistoryitem_device"),
]

operations = [
migrations.AddField(
model_name="breastcancerhistoryitem",
name="systemic_treatments2",
field=django.contrib.postgres.fields.ArrayField(
base_field=models.CharField(
choices=[
("CHEMOTHERAPY", "Chemotherapy"),
("HORMONE_THERAPY", "Hormone therapy"),
("OTHER", "Other"),
("NO_SYSTEMIC_TREATMENTS", "No systemic treatments"),
]
),
default=list,
size=None,
validators=[
manage_breast_screening.nhsuk_forms.validators.ExcludesOtherOptionsValidator(
"NO_SYSTEMIC_TREATMENTS", "No systemic treatments"
)
],
),
),
migrations.AlterField(
model_name="breastcancerhistoryitem",
name="systemic_treatments",
field=models.CharField(
choices=[
("CHEMOTHERAPY", "Chemotherapy"),
("HORMONE_THERAPY", "Hormone therapy"),
("OTHER", "Other"),
("NO_SYSTEMIC_TREATMENTS", "No systemic treatments"),
],
db_default="NO_SYSTEMIC_TREATMENTS", # add a default so the migration is reversable
),
),
migrations.RunSQL(
sql="update participants_breastcancerhistoryitem set systemic_treatments2 = ARRAY[systemic_treatments]",
reverse_sql="update participants_breastcancerhistoryitem set systemic_treatments = systemic_treatments2[1]",
),
migrations.RemoveField(
model_name="breastcancerhistoryitem", name="systemic_treatments"
),
migrations.RenameField(
model_name="breastcancerhistoryitem",
old_name="systemic_treatments2",
new_name="systemic_treatments",
),
]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0042_alter_implantedmedicaldevicehistoryitem_device
0043_alter_breastcancerhistoryitem_systemic_treatments
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,16 @@ class InterventionLocation(models.TextChoices):
],
)

systemic_treatments = models.CharField(choices=SystemicTreatment)
systemic_treatments = ArrayField(
base_field=models.CharField(choices=SystemicTreatment),
default=list,
validators=[
ExcludesOtherOptionsValidator(
SystemicTreatment.NO_SYSTEMIC_TREATMENTS.value,
SystemicTreatment.NO_SYSTEMIC_TREATMENTS.label,
Copy link
Contributor

Choose a reason for hiding this comment

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

Duplicate line?

)
],
)
systemic_treatments_other_treatment_details = models.CharField(
blank=True, null=False, default=""
)
Expand Down
5 changes: 3 additions & 2 deletions manage_breast_screening/participants/tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ class Meta:
right_breast_other_surgery = [BreastCancerHistoryItem.Surgery.NO_SURGERY]
left_breast_treatment = [BreastCancerHistoryItem.Treatment.NO_RADIOTHERAPY]
right_breast_treatment = [BreastCancerHistoryItem.Treatment.NO_RADIOTHERAPY]
systemic_treatments = (
systemic_treatments = [
BreastCancerHistoryItem.SystemicTreatment.NO_SYSTEMIC_TREATMENTS
)
]

intervention_location = (
BreastCancerHistoryItem.InterventionLocation.EXACT_LOCATION_UNKNOWN
Expand All @@ -195,6 +195,7 @@ class Meta:
surgery_reason = MastectomyOrLumpectomyHistoryItem.SurgeryReason.OTHER_REASON
additional_details = ""


class CystHistoryItemFactory(DjangoModelFactory):
class Meta:
model = models.CystHistoryItem
Expand Down