-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PRMP-839] Fixed suspended patient is active logic & added unit test (#…
…416) * [PRMP-839] Fixed suspended patient is active logic & added unit test * [PRMP-839] Added ODS code validation for inactive statuses * PRMP-839 fix tests and format add method to PDS model * PRMP-839 add return type and remove SUSP string from tests * PRMP-839 remove invalid code --------- Co-authored-by: Andy Flint <[email protected]> Co-authored-by: NogaNHS <[email protected]>
- Loading branch information
1 parent
adb9dde
commit 5fa3eaf
Showing
8 changed files
with
124 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from enum import StrEnum | ||
|
||
|
||
class PatientOdsInactiveStatus(StrEnum): | ||
SUSPENDED = "SUSP" | ||
DECEASED = "DECE" | ||
|
||
@staticmethod | ||
def list() -> list[str]: | ||
return list(PatientOdsInactiveStatus.__members__.values()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import pytest | ||
from enums.patient_ods_inactive_status import PatientOdsInactiveStatus | ||
from utils.ods_utils import is_ods_code_active | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"ods_code,expected", | ||
[ | ||
["H81109", True], | ||
[PatientOdsInactiveStatus.SUSPENDED, False], | ||
[PatientOdsInactiveStatus.DECEASED, False], | ||
["", False], | ||
[None, False], | ||
], | ||
) | ||
def test_is_ods_code_active(ods_code, expected): | ||
actual = is_ods_code_active(ods_code) | ||
|
||
assert actual == expected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from enums.patient_ods_inactive_status import PatientOdsInactiveStatus | ||
|
||
""" | ||
On PDS, GP ODS codes must be 6 characters long, see the 'epraccur' document here for info: | ||
https://digital.nhs.uk/services/organisation-data-service/export-data-files/csv-downloads/gp-and-gp-practice-related-data | ||
Sometimes, a patient will not have a generalPractitioner on PDS. Internally, we can also add codes to mark inactive | ||
patients for reporting purposes. The only values that should be considered 'active' are valid ODS codes. | ||
""" | ||
|
||
|
||
def is_ods_code_active(gp_ods) -> bool: | ||
if gp_ods in PatientOdsInactiveStatus.list(): | ||
return False | ||
|
||
return len(gp_ods or "") == 6 |