Skip to content

Commit

Permalink
RMP-751 add SUSP to PDS model (#410)
Browse files Browse the repository at this point in the history
  • Loading branch information
NogaNHS authored Aug 14, 2024
1 parent 455a373 commit e23c2e8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions lambdas/models/pds_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ def get_active_ods_code_for_gp(self) -> str:
gp_end_date = period.end
if not gp_end_date or gp_end_date >= date.today():
return entry.identifier.value

death_notification_status = self.get_death_notification_status()
if not is_deceased(death_notification_status) and self.is_unrestricted():
return "SUSP"
return ""

def get_is_active_status(self) -> bool:
Expand Down
6 changes: 3 additions & 3 deletions lambdas/tests/unit/models/test_pds_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,20 @@ def test_get_patient_details_for_deceased_patient():


@freeze_time("2024-12-31")
def test_gp_ods_empty_when_gp_end_date_indicates_inactive():
def test_gp_ods_susp_when_gp_end_date_indicates_inactive():
patient = create_patient(PDS_PATIENT_WITH_GP_END_DATE)

response = patient.get_minimum_patient_details(patient.id)

assert response.general_practice_ods == ""
assert response.general_practice_ods == "SUSP"


def test_not_raise_error_when_no_gp_in_response():
patient = create_patient(PDS_PATIENT_WITHOUT_ACTIVE_GP)

response = patient.get_minimum_patient_details(patient.id)

assert response.general_practice_ods == ""
assert response.general_practice_ods == "SUSP"


@freeze_time("2021-12-31")
Expand Down

0 comments on commit e23c2e8

Please sign in to comment.