diff --git a/sandbox/api/app.py b/sandbox/api/app.py index 744c3cf..4daeaaa 100644 --- a/sandbox/api/app.py +++ b/sandbox/api/app.py @@ -38,19 +38,20 @@ def get_related_persons() -> Union[dict, tuple]: if ( request.args.get("identifier") and request.args.get("patient") - and request.args.get("_include") == "patient" + and request.args.get("_include") == "RelatedPerson:patient" ): # Request with identifier, patient and _include=patient return get_response( - "./api/responses/GET_RelatedPerson/identifier_and_patient_include.json" + "./api/responses/GET_RelatedPerson/identifier_and_patient_identifier_include.json" ) elif request.args.get("identifier") and request.args.get("patient"): # Request with identifier and patient return get_response( - "./api/responses/GET_RelatedPerson/identifier_and_patient.json" + "./api/responses/GET_RelatedPerson/identifier_and_patient_identifier.json" ) elif ( - request.args.get("identifier") and request.args.get("_include") == "patient" + request.args.get("identifier") + and request.args.get("_include") == "RelatedPerson:patient" ): # Request with identifier and _include=patient return get_response( diff --git a/sandbox/api/responses/GET_RelatedPerson/identifier.json b/sandbox/api/responses/GET_RelatedPerson/identifier.json index a0d5d98..b59161e 100644 --- a/sandbox/api/responses/GET_RelatedPerson/identifier.json +++ b/sandbox/api/responses/GET_RelatedPerson/identifier.json @@ -24,11 +24,6 @@ "code": "MTH", "display": "mother", "system": "http://hl7.org/fhir/ValueSet/relatedperson-relationshiptype" - }, - { - "code": "Personal", - "display": "Personal relationship with the patient", - "system": "https://fhir.nhs.uk/R4/CodeSystem/UKCore-AdditionalRelatedPersonRole" } ] } diff --git a/sandbox/api/responses/GET_RelatedPerson/identifier_and_patient.json b/sandbox/api/responses/GET_RelatedPerson/identifier_and_patient_identifier.json similarity index 80% rename from sandbox/api/responses/GET_RelatedPerson/identifier_and_patient.json rename to sandbox/api/responses/GET_RelatedPerson/identifier_and_patient_identifier.json index 2419477..2f12d24 100644 --- a/sandbox/api/responses/GET_RelatedPerson/identifier_and_patient.json +++ b/sandbox/api/responses/GET_RelatedPerson/identifier_and_patient_identifier.json @@ -24,11 +24,6 @@ "code": "MTH", "display": "mother", "system": "http://hl7.org/fhir/ValueSet/relatedperson-relationshiptype" - }, - { - "code": "Personal", - "display": "Personal relationship with the patient", - "system": "https://fhir.nhs.uk/R4/CodeSystem/UKCore-AdditionalRelatedPersonRole" } ] } @@ -61,11 +56,6 @@ "code": "MTH", "display": "mother", "system": "http://hl7.org/fhir/ValueSet/relatedperson-relationshiptype" - }, - { - "code": "Personal", - "display": "Personal relationship with the patient", - "system": "https://fhir.nhs.uk/R4/CodeSystem/UKCore-AdditionalRelatedPersonRole" } ] } diff --git a/sandbox/api/responses/GET_RelatedPerson/identifier_and_patient_include.json b/sandbox/api/responses/GET_RelatedPerson/identifier_and_patient_identifier_include.json similarity index 87% rename from sandbox/api/responses/GET_RelatedPerson/identifier_and_patient_include.json rename to sandbox/api/responses/GET_RelatedPerson/identifier_and_patient_identifier_include.json index dbe6774..0ea0639 100644 --- a/sandbox/api/responses/GET_RelatedPerson/identifier_and_patient_include.json +++ b/sandbox/api/responses/GET_RelatedPerson/identifier_and_patient_identifier_include.json @@ -49,11 +49,6 @@ "code": "MTH", "display": "mother", "system": "http://hl7.org/fhir/ValueSet/relatedperson-relationshiptype" - }, - { - "code": "Personal", - "display": "Personal relationship with the patient", - "system": "https://fhir.nhs.uk/R4/CodeSystem/UKCore-AdditionalRelatedPersonRole" } ] } @@ -111,11 +106,6 @@ "code": "MTH", "display": "mother", "system": "http://hl7.org/fhir/ValueSet/relatedperson-relationshiptype" - }, - { - "code": "Personal", - "display": "Personal relationship with the patient", - "system": "https://fhir.nhs.uk/R4/CodeSystem/UKCore-AdditionalRelatedPersonRole" } ] } diff --git a/sandbox/api/responses/GET_RelatedPerson/identifier_include.json b/sandbox/api/responses/GET_RelatedPerson/identifier_include.json index 5274cc6..293fd65 100644 --- a/sandbox/api/responses/GET_RelatedPerson/identifier_include.json +++ b/sandbox/api/responses/GET_RelatedPerson/identifier_include.json @@ -49,11 +49,6 @@ "code": "MTH", "display": "mother", "system": "http://hl7.org/fhir/ValueSet/relatedperson-relationshiptype" - }, - { - "code": "Personal", - "display": "Personal relationship with the patient", - "system": "https://fhir.nhs.uk/R4/CodeSystem/UKCore-AdditionalRelatedPersonRole" } ] } diff --git a/sandbox/api/tests/test_app.py b/sandbox/api/tests/test_app.py index 300cb06..fbb40b4 100644 --- a/sandbox/api/tests/test_app.py +++ b/sandbox/api/tests/test_app.py @@ -26,15 +26,23 @@ def test_health_check(client: object, endpoint: str) -> None: ("identifier=1234567890", "./api/responses/GET_RelatedPerson/identifier.json"), ( "identifier=1234567890&patient=0987654321", - "./api/responses/GET_RelatedPerson/identifier_and_patient.json", + "./api/responses/GET_RelatedPerson/identifier_and_patient_identifier.json", ), ( - "identifier=1234567890&_include=patient", + "identifier=1234567890&_include=RelatedPerson:patient", "./api/responses/GET_RelatedPerson/identifier_include.json", ), ( - "identifier=1234567890&patient=0987654321&_include=patient", - "./api/responses/GET_RelatedPerson/identifier_and_patient_include.json", + "identifier=1234567890&patient=0987654321&_include=RelatedPerson:patient", + "./api/responses/GET_RelatedPerson/identifier_and_patient_identifier_include.json", + ), + ( + "identifier=1234567890&_include=any", + "./api/responses/GET_RelatedPerson/identifier.json", + ), + ( + "identifier=1234567890&patient=0987654321&_include=any", + "./api/responses/GET_RelatedPerson/identifier_and_patient_identifier.json", ), ], )