From 656cfdcba9d4f67f8cacfded8601f584fb545000 Mon Sep 17 00:00:00 2001 From: adamclarkson Date: Thu, 5 Jun 2025 17:55:03 +0100 Subject: [PATCH 1/9] npa-5087 - Added get consent by ID to sandbox --- sandbox/api/app.py | 11 +++ sandbox/api/constants.py | 13 ++++ sandbox/api/get_consent_by_id.py | 58 +++++++++++++++ ...ng-adult-relationship-include-patient.yaml | 73 +++++++++++++++++++ ...-adult-relationship-include-performer.yaml | 67 +++++++++++++++++ ...er-child-relationship-include-patient.yaml | 69 ++++++++++++++++++ ...elationship-include-performer-patient.yaml | 2 +- ...-child-relationship-include-performer.yaml | 62 ++++++++++++++++ .../validated-relationships-service-api.yaml | 16 ++++ 9 files changed, 370 insertions(+), 1 deletion(-) create mode 100644 sandbox/api/get_consent_by_id.py create mode 100644 specification/examples/responses/GET_Consent/single-consenting-adult-relationship-include-patient.yaml create mode 100644 specification/examples/responses/GET_Consent/single-consenting-adult-relationship-include-performer.yaml create mode 100644 specification/examples/responses/GET_Consent/single-mother-child-relationship-include-patient.yaml create mode 100644 specification/examples/responses/GET_Consent/single-mother-child-relationship-include-performer.yaml diff --git a/sandbox/api/app.py b/sandbox/api/app.py index a7740a03..699fe8ab 100644 --- a/sandbox/api/app.py +++ b/sandbox/api/app.py @@ -4,6 +4,7 @@ from flask import Flask from .get_consent import get_consent_response +from .get_consent_by_id import get_consent_by_id_response from .get_questionnaire_response import get_questionnaire_response_response from .get_related_person import get_related_person_response from .patch_consent import patch_consent_response @@ -68,6 +69,16 @@ def get_consent() -> Union[dict, tuple]: return get_consent_response() +@app.route(f"/{COMMON_PATH}/Consent/", methods=["GET"]) +def get_consent_by_id(identifier: str) -> Union[dict, tuple]: + """Sandbox API for GET /Consent/{id} + + Returns: + Union[dict, tuple]: Response for GET /Consent/{id} + """ + return get_consent_by_id_response(identifier) + + @app.route(f"/{COMMON_PATH}/Consent", methods=["POST"]) def post_consent() -> Union[dict, tuple]: """Sandbox API for POST /Consent diff --git a/sandbox/api/constants.py b/sandbox/api/constants.py index adfd45a9..543f54a1 100644 --- a/sandbox/api/constants.py +++ b/sandbox/api/constants.py @@ -41,10 +41,18 @@ GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_BOTH = ( f"{GET_CONSENT__DIRECTORY}single-consenting-adult-relationship-include-performer-patient.yaml" ) +GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_PATIENT = f"{GET_CONSENT__DIRECTORY}single-consenting-adult-relationship-include-patient.yaml" +GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_PERFORMER = ( + f"{GET_CONSENT__DIRECTORY}single-consenting-adult-relationship-include-performer.yaml" +) GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP = f"{GET_CONSENT__DIRECTORY}single-mother-child-relationship.yaml" GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_BOTH = ( f"{GET_CONSENT__DIRECTORY}single-mother-child-relationship-include-performer-patient.yaml" ) +GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PATIENT = f"{GET_CONSENT__DIRECTORY}single-mother-child-relationship-include-patient.yaml" +GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PERFORMER = ( + f"{GET_CONSENT__DIRECTORY}single-mother-child-relationship-include-performer.yaml" +) GET_CONSENT__STATUS_PARAM_INVALID = f"{GET_CONSENT__DIRECTORY}errors/invalid-status-parameter.yaml" GET_CONSENT__MULTIPLE_RELATIONSHIPS_SINGLE_PATIENT = ( f"{GET_CONSENT__DIRECTORY}multiple-relationships-single-patient.yaml" @@ -58,6 +66,11 @@ GET_CONSENT__MULTIPLE_RELATIONSHIPS_SINGLE_PATIENT_INCLUDE_BOTH = ( f"{GET_CONSENT__DIRECTORY}multiple-relationships-single-patient-include-performer-patient.yaml" ) + +# GET Consent by ID +GET_CONSENT_BY_ID__INVALID_ID_ERROR = f"{GET_CONSENT__DIRECTORY}/ID/errors/invalid-id.yaml" +GET_CONSENT_BY_ID__MISSING_ID_ERROR = f"{GET_CONSENT__DIRECTORY}/ID/errors/missing-id.yaml" + # POST Consent POST_CONSENT__DIRECTORY = "./api/examples/POST_Consent/" POST_CONSENT__SUCCESS = f"{POST_CONSENT__DIRECTORY}success.yaml" diff --git a/sandbox/api/get_consent_by_id.py b/sandbox/api/get_consent_by_id.py new file mode 100644 index 00000000..cc25c3a4 --- /dev/null +++ b/sandbox/api/get_consent_by_id.py @@ -0,0 +1,58 @@ +from logging import INFO, basicConfig, getLogger +from typing import Union + +from flask import request + +logger = getLogger(__name__) + +from .constants import ( + INTERNAL_SERVER_ERROR_EXAMPLE, + GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP, + GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_BOTH, + GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_PATIENT, + GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_PERFORMER, + GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP, + GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_BOTH, + GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PATIENT, + GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PERFORMER, + GET_CONSENT_BY_ID__INVALID_ID_ERROR, + GET_CONSENT_BY_ID__MISSING_ID_ERROR +) +from .utils import ( + generate_response_from_example, + check_for_consent_include_params +) + +def get_consent_by_id_response(identifier: str) -> Union[dict, tuple]: + """Sandbox API for GET /Consent/{id} + + Returns: + Union[dict, tuple]: Response for GET /Consent/{id} + """ + try: + _include = request.args.getlist("_include") + + if identifier == "74eed847-ca25-4e76-8cf2-f2c2d7842a7a": + return check_for_consent_include_params( + _include, + GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP, + GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_BOTH, + GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_PATIENT, + GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_PERFORMER + ) + elif identifier == "39df03a2-1b14-4d19-b1dc-d5d8cbf96948": + return check_for_consent_include_params( + _include, + GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP, + GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_BOTH, + GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PATIENT, + GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PERFORMER + ) + elif identifier == "" or identifier is None: + return generate_response_from_example(GET_CONSENT_BY_ID__MISSING_ID_ERROR) + else: + return generate_response_from_example(GET_CONSENT_BY_ID__INVALID_ID_ERROR) + + except Exception: + logger.exception("An error occurred while processing the request") + return generate_response_from_example(INTERNAL_SERVER_ERROR_EXAMPLE, 500) diff --git a/specification/examples/responses/GET_Consent/single-consenting-adult-relationship-include-patient.yaml b/specification/examples/responses/GET_Consent/single-consenting-adult-relationship-include-patient.yaml new file mode 100644 index 00000000..051408a7 --- /dev/null +++ b/specification/examples/responses/GET_Consent/single-consenting-adult-relationship-include-patient.yaml @@ -0,0 +1,73 @@ +ConsentSingleConsentingAdultRelationshipIncludePatientBundle: + summary: Single consenting adult proxy relationship with patient details + description: + A Bundle containing a single proxy relationship between consenting adults including the patient details. + value: + resourceType: Bundle + timestamp: '2020-08-26T14:00:00+00:00' + total: 3 + type: searchset + entry: + - fullUrl: https://api.service.nhs.uk/validated-relationships/FHIR/R4/Patient/DFCC67F5 + resource: + resourceType: Patient + id: DFCC67F5 + identifier: + - system: 'https://fhir.nhs.uk/Id/nhs-number' + value: '9000000005' + - system: 'https://placeholder.fhir.nhs.uk/Id/local-gp-patient-identifier' + value: ABC1234567 + name: + - id: '123456' + use: usual + period: + start: '2020-01-01' + end: '2021-12-31' + given: + - Sally + family: Evans + prefix: + - Mrs + birthDate: '1995-10-22' + generalPractitioner: + - type: Organization + identifier: + value: ODS12345 + system: 'https://fhir.nhs.uk/Id/ods-organization-code' + search: + mode: include + - fullUrl: https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/WWCC67T1 + resource: + resourceType: Consent + id: WWCC67T1 + status: active + scope: + coding: + - system: 'http://terminology.hl7.org/CodeSystem/consentscope' + code: patient-privacy + display: Privacy Consent + text: Patient Privacy Consent + category: + - coding: + - system: 'http://terminology.hl7.org/CodeSystem/v3-ActCode' + code: INFA + display: Information Access + text: Information Access Consent + patient: + identifier: + system: 'https://fhir.nhs.uk/Id/nhs-number' + value: '9000000005' + dateTime: '2024-07-21T17:32:28Z' + performer: + - identifier: + system: 'https://fhir.nhs.uk/Id/nhs-number' + value: '9000000010' + verification: + - verified: true + verifiedWith: + identifier: + system: 'https://fhir.nhs.uk/Id/nhs-number' + value: '9000000005' + verificationDate: '2024-07-21T17:32:28Z' + search: + mode: match diff --git a/specification/examples/responses/GET_Consent/single-consenting-adult-relationship-include-performer.yaml b/specification/examples/responses/GET_Consent/single-consenting-adult-relationship-include-performer.yaml new file mode 100644 index 00000000..55283215 --- /dev/null +++ b/specification/examples/responses/GET_Consent/single-consenting-adult-relationship-include-performer.yaml @@ -0,0 +1,67 @@ +ConsentSingleConsentingAdultRelationshipIncludePerformerBundle: + summary: Single consenting adult proxy relationship with performer details + description: + A Bundle containing a single proxy relationship between consenting adults including the performer details. + value: + resourceType: Bundle + timestamp: '2020-08-26T14:00:00+00:00' + total: 3 + type: searchset + entry: + - fullUrl: https://api.service.nhs.uk/validated-relationships/FHIR/R4/RelatedPerson/RP974720 + resource: + resourceType: RelatedPerson + id: RP974720 + identifier: + - system: 'https://fhir.nhs.uk/Id/nhs-number' + value: '9000000010' + - system: 'https://placeholder.fhir.nhs.uk/Id/local-gp-patient-identifier' + value: ABC0000008 + patient: + type: Patient + identifier: + system: 'https://fhir.nhs.uk/Id/nhs-number' + value: '9000000005' + relationship: + - coding: + - system: >- + https://fhir.hl7.org.uk/CodeSystem/UKCore-AdditionalPersonRelationshipRole + code: Personal + display: Personal relationship with the patient + search: + mode: include + - fullUrl: https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/WWCC67T1 + resource: + resourceType: Consent + id: WWCC67T1 + status: active + scope: + coding: + - system: 'http://terminology.hl7.org/CodeSystem/consentscope' + code: patient-privacy + display: Privacy Consent + text: Patient Privacy Consent + category: + - coding: + - system: 'http://terminology.hl7.org/CodeSystem/v3-ActCode' + code: INFA + display: Information Access + text: Information Access Consent + patient: + identifier: + system: 'https://fhir.nhs.uk/Id/nhs-number' + value: '9000000005' + dateTime: '2024-07-21T17:32:28Z' + performer: + - identifier: + system: 'https://fhir.nhs.uk/Id/nhs-number' + value: '9000000010' + verification: + - verified: true + verifiedWith: + identifier: + system: 'https://fhir.nhs.uk/Id/nhs-number' + value: '9000000005' + verificationDate: '2024-07-21T17:32:28Z' + search: + mode: match diff --git a/specification/examples/responses/GET_Consent/single-mother-child-relationship-include-patient.yaml b/specification/examples/responses/GET_Consent/single-mother-child-relationship-include-patient.yaml new file mode 100644 index 00000000..f671ccb4 --- /dev/null +++ b/specification/examples/responses/GET_Consent/single-mother-child-relationship-include-patient.yaml @@ -0,0 +1,69 @@ +ConsentSingleAdultChildRelationshipIncludePatientBundle: + summary: Single adult child proxy relationship with patient details + description: + A Bundle containing a single proxy relationship between an adult and child including the patient details. + value: + resourceType: Bundle + timestamp: '2020-08-26T14:00:00+00:00' + total: 3 + type: searchset + entry: + - fullUrl: https://api.service.nhs.uk/validated-relationships/FHIR/R4/Patient/A3CC67E2 + resource: + resourceType: Patient + id: A3CC67E2 + identifier: + - system: 'https://fhir.nhs.uk/Id/nhs-number' + value: '9000000009' + - system: 'https://placeholder.fhir.nhs.uk/Id/local-gp-patient-identifier' + value: ABC1234556 + name: + - id: '123456' + use: usual + period: + start: '2020-01-01' + end: '2021-12-31' + given: + - Jane Marie Anne + family: Smith + prefix: + - Mrs + suffix: + - MBE + - PhD + birthDate: '2022-10-22' + generalPractitioner: + - type: Organization + identifier: + value: ODS12345 + system: 'https://fhir.nhs.uk/Id/ods-organization-code' + search: + mode: include + - fullUrl: https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/BBCC67E9 + resource: + resourceType: Consent + id: BBCC67E9 + status: active + scope: + coding: + - system: 'http://terminology.hl7.org/CodeSystem/consentscope' + code: patient-privacy + display: Privacy Consent + text: Patient Privacy Consent + category: + - coding: + - system: 'http://terminology.hl7.org/CodeSystem/v3-ActCode' + code: INFA + display: Information Access + text: Information Access Consent + patient: + identifier: + system: 'https://fhir.nhs.uk/Id/nhs-number' + value: '9000000009' + dateTime: '2024-07-21T17:32:28Z' + performer: + - identifier: + system: 'https://fhir.nhs.uk/Id/nhs-number' + value: '9000000019' + search: + mode: match diff --git a/specification/examples/responses/GET_Consent/single-mother-child-relationship-include-performer-patient.yaml b/specification/examples/responses/GET_Consent/single-mother-child-relationship-include-performer-patient.yaml index faf0e7d5..1fd91025 100644 --- a/specification/examples/responses/GET_Consent/single-mother-child-relationship-include-performer-patient.yaml +++ b/specification/examples/responses/GET_Consent/single-mother-child-relationship-include-performer-patient.yaml @@ -2,7 +2,7 @@ ConsentSingleAdultChildRelationshipIncludePerformerPatientBundle: summary: Single adult child proxy relationship with performer and patient details description: A Bundle containing a single proxy relationship between an adult and child including the performer - and proxy details. + and patient details. value: resourceType: Bundle timestamp: '2020-08-26T14:00:00+00:00' diff --git a/specification/examples/responses/GET_Consent/single-mother-child-relationship-include-performer.yaml b/specification/examples/responses/GET_Consent/single-mother-child-relationship-include-performer.yaml new file mode 100644 index 00000000..5ad13fe6 --- /dev/null +++ b/specification/examples/responses/GET_Consent/single-mother-child-relationship-include-performer.yaml @@ -0,0 +1,62 @@ +ConsentSingleAdultChildRelationshipIncludePerformerBundle: + summary: Single adult child proxy relationship with performer details + description: + A Bundle containing a single proxy relationship between an adult and child including the performer details. + value: + resourceType: Bundle + timestamp: '2020-08-26T14:00:00+00:00' + total: 3 + type: searchset + entry: + - fullUrl: https://api.service.nhs.uk/validated-relationships/FHIR/R4/RelatedPerson/BE974742 + resource: + resourceType: RelatedPerson + id: BE974742 + identifier: + - system: 'https://fhir.nhs.uk/Id/nhs-number' + value: '9000000019' + - system: 'https://placeholder.fhir.nhs.uk/Id/local-gp-patient-identifier' + value: ABC0000001 + patient: + type: Patient + identifier: + system: 'https://fhir.nhs.uk/Id/nhs-number' + value: '9000000009' + relationship: + - coding: + - system: 'http://terminology.hl7.org/CodeSystem/v3-RoleCode' + code: PRN + display: parent + - system: 'http://terminology.hl7.org/CodeSystem/v3-RoleCode' + code: MTH + display: mother + search: + mode: include + - fullUrl: https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/BBCC67E9 + resource: + resourceType: Consent + id: BBCC67E9 + status: active + scope: + coding: + - system: 'http://terminology.hl7.org/CodeSystem/consentscope' + code: patient-privacy + display: Privacy Consent + text: Patient Privacy Consent + category: + - coding: + - system: 'http://terminology.hl7.org/CodeSystem/v3-ActCode' + code: INFA + display: Information Access + text: Information Access Consent + patient: + identifier: + system: 'https://fhir.nhs.uk/Id/nhs-number' + value: '9000000009' + dateTime: '2024-07-21T17:32:28Z' + performer: + - identifier: + system: 'https://fhir.nhs.uk/Id/nhs-number' + value: '9000000019' + search: + mode: match diff --git a/specification/validated-relationships-service-api.yaml b/specification/validated-relationships-service-api.yaml index 18ed08fb..9c584d8e 100644 --- a/specification/validated-relationships-service-api.yaml +++ b/specification/validated-relationships-service-api.yaml @@ -744,6 +744,22 @@ paths: You can (optionally) include the `_include=Consent:patient` request parameter to include the patient's details in the response. + ## Sandbox test scenarios + + The sandbox supports a limited number of scenarios, and does not attempt to validate requests. The returned result is dependant on the `ID` for the consent resource. + + See the postman collection for an example request body. + | Scenario | Request | Response | + | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | + | Retrieve single consenting adult relationship | Valid request with ID `74eed847-ca25-4e76-8cf2-f2c2d7842a7a` | HTTP Status 200 Bundle containing a single active proxy relationship | + | Retrieve single consenting adult relationship with patient details | Valid request with ID `74eed847-ca25-4e76-8cf2-f2c2d7842a7a` with parameter `_include=Consent:patient` | HTTP Status 200 Bundle containing a single active proxy relationship with patient details | + | Retrieve single consenting adult relationship with performer details | Valid request with ID `74eed847-ca25-4e76-8cf2-f2c2d7842a7a` with parameter `_include=Consent:performer` | HTTP Status 200 Bundle containing a single active proxy relationship with performer details | + | Retrieve single consenting adult relationship with performer and patient details | Valid request with ID `74eed847-ca25-4e76-8cf2-f2c2d7842a7a` with parameters `_include=Consent:performer` and `_include=Consent:patient` | HTTP Status 200 Bundle containing a single active proxy relationship with performer details and patient details | + | Retrieve single mother-child relationship | Valid request with ID `39df03a2-1b14-4d19-b1dc-d5d8cbf96948` | HTTP Status 200 Bundle containing a single active proxy relationship | + | Retrieve single mother-child relationship with patient details | Valid request with ID `39df03a2-1b14-4d19-b1dc-d5d8cbf96948` with parameter `_include=Consent:patient` | HTTP Status 200 Bundle containing a single active proxy relationship with patient details | + | Retrieve single mother-child relationship with performer details | Valid request with ID `39df03a2-1b14-4d19-b1dc-d5d8cbf96948` with parameter `_include=Consent:performer` | HTTP Status 200 Bundle containing a single active proxy relationship with performer details | + | Retrieve single mother-child relationship with performer and patient details | Valid request with ID `39df03a2-1b14-4d19-b1dc-d5d8cbf96948` with parameters `_include=Consent:performer` and `_include=Consent:patient` | HTTP Status 200 Bundle containing a single active proxy relationship with performer details and patient details | + operationId: get-consent-by-id parameters: - $ref: "#/components/parameters/BearerAuthorization" From 267b450c2186c375851e7f5a63f655e70ba0b540 Mon Sep 17 00:00:00 2001 From: adamclarkson Date: Thu, 5 Jun 2025 18:01:49 +0100 Subject: [PATCH 2/9] npa-5087 - Added invalid and missing ID routes --- sandbox/api/constants.py | 4 ++-- sandbox/api/get_consent_by_id.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sandbox/api/constants.py b/sandbox/api/constants.py index 543f54a1..aaeaf192 100644 --- a/sandbox/api/constants.py +++ b/sandbox/api/constants.py @@ -68,8 +68,8 @@ ) # GET Consent by ID -GET_CONSENT_BY_ID__INVALID_ID_ERROR = f"{GET_CONSENT__DIRECTORY}/ID/errors/invalid-id.yaml" -GET_CONSENT_BY_ID__MISSING_ID_ERROR = f"{GET_CONSENT__DIRECTORY}/ID/errors/missing-id.yaml" +GET_CONSENT_BY_ID__INVALID_ID_ERROR = f"{GET_CONSENT__DIRECTORY}ID/errors/invalid-id.yaml" +GET_CONSENT_BY_ID__MISSING_ID_ERROR = f"{GET_CONSENT__DIRECTORY}ID/errors/missing-id.yaml" # POST Consent POST_CONSENT__DIRECTORY = "./api/examples/POST_Consent/" diff --git a/sandbox/api/get_consent_by_id.py b/sandbox/api/get_consent_by_id.py index cc25c3a4..3a34df28 100644 --- a/sandbox/api/get_consent_by_id.py +++ b/sandbox/api/get_consent_by_id.py @@ -48,10 +48,10 @@ def get_consent_by_id_response(identifier: str) -> Union[dict, tuple]: GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PATIENT, GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PERFORMER ) - elif identifier == "" or identifier is None: - return generate_response_from_example(GET_CONSENT_BY_ID__MISSING_ID_ERROR) + elif identifier == " " or identifier is None: + return generate_response_from_example(GET_CONSENT_BY_ID__MISSING_ID_ERROR, 400) else: - return generate_response_from_example(GET_CONSENT_BY_ID__INVALID_ID_ERROR) + return generate_response_from_example(GET_CONSENT_BY_ID__INVALID_ID_ERROR, 400) except Exception: logger.exception("An error occurred while processing the request") From 7004d12db693971dbd00ef1cc09e5d4143e067f6 Mon Sep 17 00:00:00 2001 From: adamclarkson Date: Fri, 6 Jun 2025 13:35:15 +0100 Subject: [PATCH 3/9] npa-5087 - Added sandbox tests for get consent by id --- sandbox/api/tests/test_get_consent_by_id.py | 153 ++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 sandbox/api/tests/test_get_consent_by_id.py diff --git a/sandbox/api/tests/test_get_consent_by_id.py b/sandbox/api/tests/test_get_consent_by_id.py new file mode 100644 index 00000000..4cea1f03 --- /dev/null +++ b/sandbox/api/tests/test_get_consent_by_id.py @@ -0,0 +1,153 @@ +from json import dumps, loads +from unittest.mock import MagicMock, patch + +import pytest +from flask import Response + +CONSENT_API_ENDPOINT = "/FHIR/R4/Consent" +GET_CONSENT_BY_ID_FILE_PATH = "sandbox.api.get_consent_by_id" + + +@pytest.mark.parametrize( + ("consent_id", "include_params", "response_file_name", "status_code"), + [ + ( + "a0922245-1072-40c3-8f4e-a7490c10d365", # Invalid parameters + "_invalid=test", + "./api/examples/errors/invalid-include-parameter.yaml", + 422, + ), + ( + "a0922245-1072-40c3-8f4e-a7490c10d365", # No proxy-role record found error + "", + "./api/examples/errors/invalidated-resource.yaml", + 404, + ), + ( + " ", # Missing consent ID + "", + "./api/examples/GET_Consent/ID/errors/missing-id.yaml", + 400, + ), + ( + "test", # Invalid consent ID + "", + "./api/examples/GET_Consent/ID/errors/invalid-id.yaml", + 400, + ), + ], +) +@patch("sandbox.api.get_consent_by_id.generate_response_from_example") +def test_get_consent_by_id_returns_expected_responses__mocked_get_consent_by_id( + mock_generate_response_from_example: MagicMock, + consent_id: str, + include_params: str, + response_file_name: str, + status_code: int, + client: object, +) -> None: + """Test GET /Consent/{ID} endpoint.""" + mock_generate_response_from_example.return_value = mocked_response = Response( + dumps({"data": "mocked"}), + status=status_code, + content_type="application/json", + ) + # Act + response = client.get(f"{CONSENT_API_ENDPOINT}/{consent_id}?{include_params}") + # import pdb; pdb.set_trace() + # Assert + mock_generate_response_from_example.assert_called_once_with(response_file_name, status_code) + assert response.status_code == status_code + assert response.json == loads(mocked_response.get_data(as_text=True)) + + +@pytest.mark.parametrize( + ("consent_id", "include_params", "response_file_name", "status_code"), + [ + ( + "74eed847-ca25-4e76-8cf2-f2c2d7842a7a", # Single consenting adult relationship no include + "", + "./api/examples/GET_Consent/single-consenting-adult-relationship.yaml", + 200, + ), + ( + "74eed847-ca25-4e76-8cf2-f2c2d7842a7a", # Single consenting adult relationship with include performer + "_include=Consent:performer", + "./api/examples/GET_Consent/single-consenting-adult-relationship-include-performer.yaml", + 200, + ), + ( + "74eed847-ca25-4e76-8cf2-f2c2d7842a7a", # Single consenting adult relationship with include patient + "_include=Consent:patient", + "./api/examples/GET_Consent/single-consenting-adult-relationship-include-patient.yaml", + 200, + ), + ( + "74eed847-ca25-4e76-8cf2-f2c2d7842a7a", # Single consenting adult relationship with include performer and patient + "_include=Consent:performer&_include=Consent:patient", + "./api/examples/GET_Consent/single-consenting-adult-relationship-include-performer-patient.yaml", + 200, + ), + ( + "39df03a2-1b14-4d19-b1dc-d5d8cbf96948", # Single adult-child relationship no include + "", + "./api/examples/GET_Consent/single-mother-child-relationship.yaml", + 200, + ), + ( + "39df03a2-1b14-4d19-b1dc-d5d8cbf96948", # Single adult-child relationship with include performer + "_include=Consent:performer", + "./api/examples/GET_Consent/single-mother-child-relationship-include-performer.yaml", + 200, + ), + ( + "39df03a2-1b14-4d19-b1dc-d5d8cbf96948", # Single adult-child relationship with include patient + "_include=Consent:patient", + "./api/examples/GET_Consent/single-mother-child-relationship-include-patient.yaml", + 200, + ), + ( + "39df03a2-1b14-4d19-b1dc-d5d8cbf96948", # Single adult-child relationship with include performer and patient + "_include=Consent:performer&_include=Consent:patient", + "./api/examples/GET_Consent/single-mother-child-relationship-include-performer-patient.yaml", + 200, + ), + ], +) +@patch("sandbox.api.utils.generate_response_from_example") +def test_get_consent_by_id_returns_expected_responses__mocked_utils( + mock_generate_response_from_example: MagicMock, + consent_id: str, + include_params: str, + response_file_name: str, + status_code: int, + client: object, +) -> None: + """Test GET /Consent/{ID} endpoint.""" + mock_generate_response_from_example.return_value = mocked_response = Response( + dumps({"data": "mocked"}), + status=status_code, + content_type="application/json", + ) + # Act + response = client.get(f"{CONSENT_API_ENDPOINT}/{consent_id}?{include_params}") + # import pdb; pdb.set_trace() + # Assert + mock_generate_response_from_example.assert_called_once_with(response_file_name, status_code) + assert response.status_code == status_code + assert response.json == loads(mocked_response.get_data(as_text=True)) + + +@patch(f"{GET_CONSENT_BY_ID_FILE_PATH}.check_for_consent_include_params") +@patch(f"{GET_CONSENT_BY_ID_FILE_PATH}.generate_response_from_example") +def test_get_consent_by_id__500_internal_server_error( + mock_generate_response_from_example: MagicMock, + mock_check_for_consent_include_params: MagicMock, + client: object, +) -> None: + """Test GET /Consent/{ID} endpoint.""" + mock_check_for_consent_include_params.side_effect = Exception("Test exception") + # Act + client.get(f"{CONSENT_API_ENDPOINT}/74eed847-ca25-4e76-8cf2-f2c2d7842a7a") + # Assert + mock_generate_response_from_example.assert_called_once_with("./api/examples/errors/internal-server-error.yaml", 500) From 70ac859dcf15bbdd4595e452de40e7d6bb9e11cb Mon Sep 17 00:00:00 2001 From: adamclarkson Date: Fri, 6 Jun 2025 13:37:03 +0100 Subject: [PATCH 4/9] npa-5087 - Updated sandbox --- sandbox/api/get_consent_by_id.py | 15 ++++++++++++--- sandbox/api/tests/test_get_consent_by_id.py | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/sandbox/api/get_consent_by_id.py b/sandbox/api/get_consent_by_id.py index 3a34df28..3802b1f5 100644 --- a/sandbox/api/get_consent_by_id.py +++ b/sandbox/api/get_consent_by_id.py @@ -1,4 +1,4 @@ -from logging import INFO, basicConfig, getLogger +from logging import getLogger from typing import Union from flask import request @@ -16,13 +16,16 @@ GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PATIENT, GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PERFORMER, GET_CONSENT_BY_ID__INVALID_ID_ERROR, - GET_CONSENT_BY_ID__MISSING_ID_ERROR + GET_CONSENT_BY_ID__MISSING_ID_ERROR, + BAD_REQUEST_INCLUDE_PARAM_INVALID, + INVALIDATED_RESOURCE ) from .utils import ( generate_response_from_example, check_for_consent_include_params ) + def get_consent_by_id_response(identifier: str) -> Union[dict, tuple]: """Sandbox API for GET /Consent/{id} @@ -30,7 +33,11 @@ def get_consent_by_id_response(identifier: str) -> Union[dict, tuple]: Union[dict, tuple]: Response for GET /Consent/{id} """ try: - _include = request.args.getlist("_include") + params = request.args.to_dict() + if not "_include" in params and len(params) > 0: + return generate_response_from_example(BAD_REQUEST_INCLUDE_PARAM_INVALID, 422) + else: + _include = request.args.getlist("_include") if identifier == "74eed847-ca25-4e76-8cf2-f2c2d7842a7a": return check_for_consent_include_params( @@ -48,6 +55,8 @@ def get_consent_by_id_response(identifier: str) -> Union[dict, tuple]: GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PATIENT, GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PERFORMER ) + elif identifier == "a0922245-1072-40c3-8f4e-a7490c10d365": + return generate_response_from_example(INVALIDATED_RESOURCE, 404) elif identifier == " " or identifier is None: return generate_response_from_example(GET_CONSENT_BY_ID__MISSING_ID_ERROR, 400) else: diff --git a/sandbox/api/tests/test_get_consent_by_id.py b/sandbox/api/tests/test_get_consent_by_id.py index 4cea1f03..395e3d56 100644 --- a/sandbox/api/tests/test_get_consent_by_id.py +++ b/sandbox/api/tests/test_get_consent_by_id.py @@ -37,7 +37,7 @@ ), ], ) -@patch("sandbox.api.get_consent_by_id.generate_response_from_example") +@patch(f"{GET_CONSENT_BY_ID_FILE_PATH}.generate_response_from_example") def test_get_consent_by_id_returns_expected_responses__mocked_get_consent_by_id( mock_generate_response_from_example: MagicMock, consent_id: str, From bce601d71b36100fe918240944f900be63dac21f Mon Sep 17 00:00:00 2001 From: adamclarkson Date: Fri, 6 Jun 2025 14:29:09 +0100 Subject: [PATCH 5/9] npa-5087 - Update postman collection --- ...ip Service Sandbox.postman_collection.json | 1522 ++++++++++++++++- 1 file changed, 1518 insertions(+), 4 deletions(-) diff --git a/postman/Validate Relationship Service Sandbox.postman_collection.json b/postman/Validate Relationship Service Sandbox.postman_collection.json index 1ee64f1f..6bc192c0 100644 --- a/postman/Validate Relationship Service Sandbox.postman_collection.json +++ b/postman/Validate Relationship Service Sandbox.postman_collection.json @@ -1,10 +1,10 @@ { "info": { - "_postman_id": "de538326-5564-4efd-9ed2-d1c64142fcfe", - "name": "Validate Relationship Service Sandbox 04/06/25", + "_postman_id": "110252c4-5fa1-46ca-a08d-b5ce96e28fde", + "name": "Validate Relationship Service Sandbox 06/06/25", "description": "Example usage of the Validate Relationship Service (VRS) sandbox.\n\nFull specification is available at [https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service](https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service)", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "_exporter_id": "44536620" + "_exporter_id": "18067099" }, "item": [ { @@ -6023,6 +6023,1520 @@ ], "description": "# Get proxy relationships (consent)\n\nThe GET /Consent is for retrieving confirmed proxy relationships via the Validated Relationships Service.\n\nThis folder contains requests covering different scenarios for users with different types of proxy relationship. Also includes error scenarios.\n\nFor more details please see the [OAS page for Validated Relationships Service consent on the NHS England website.](https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service#get-/Consent)" }, + { + "name": "Get proxy relationship (Consent)", + "item": [ + { + "name": "Retrieve consenting adult relationship", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const expectedResponseBody = {", + " \"resourceType\": \"Bundle\",", + " \"timestamp\": \"2020-08-26T14:00:00+00:00\",", + " \"total\": 1,", + " \"type\": \"searchset\",", + " \"entry\": [", + " {", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/WWCC67T1\",", + " \"resource\": {", + " \"resourceType\": \"Consent\",", + " \"id\": \"WWCC67T1\",", + " \"status\": \"active\",", + " \"scope\": {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",", + " \"code\": \"patient-privacy\",", + " \"display\": \"Privacy Consent\"", + " }", + " ],", + " \"text\": \"Patient Privacy Consent\"", + " },", + " \"category\": [", + " {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",", + " \"code\": \"INFA\",", + " \"display\": \"Information Access\"", + " }", + " ],", + " \"text\": \"Information Access Consent\"", + " }", + " ],", + " \"patient\": {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000005\"", + " }", + " },", + " \"dateTime\": \"2024-07-21T17:32:28Z\",", + " \"performer\": [", + " {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000010\"", + " }", + " }", + " ],", + " \"verification\": [", + " {", + " \"verified\": true,", + " \"verifiedWith\": {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000005\"", + " }", + " },", + " \"verificationDate\": \"2024-07-21T17:32:28Z\"", + " }", + " ]", + " },", + " \"search\": {", + " \"mode\": \"match\"", + " }", + " }", + " ]", + "}", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Should have correct response body\", () => {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson).to.eql(expectedResponseBody);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{api_base_url}}/Consent/74eed847-ca25-4e76-8cf2-f2c2d7842a7a", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent", + "74eed847-ca25-4e76-8cf2-f2c2d7842a7a" + ] + } + }, + "response": [] + }, + { + "name": "Retrieve consenting adult relationship with patient details", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const expectedResponseBody = {", + " \"resourceType\": \"Bundle\",", + " \"timestamp\": \"2020-08-26T14:00:00+00:00\",", + " \"total\": 3,", + " \"type\": \"searchset\",", + " \"entry\": [", + " {", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Patient/DFCC67F5\",", + " \"resource\": {", + " \"resourceType\": \"Patient\",", + " \"id\": \"DFCC67F5\",", + " \"identifier\": [", + " {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000005\"", + " },", + " {", + " \"system\": \"https://placeholder.fhir.nhs.uk/Id/local-gp-patient-identifier\",", + " \"value\": \"ABC1234567\"", + " }", + " ],", + " \"name\": [", + " {", + " \"id\": \"123456\",", + " \"use\": \"usual\",", + " \"period\": {", + " \"start\": \"2020-01-01\",", + " \"end\": \"2021-12-31\"", + " },", + " \"given\": [", + " \"Sally\"", + " ],", + " \"family\": \"Evans\",", + " \"prefix\": [", + " \"Mrs\"", + " ]", + " }", + " ],", + " \"birthDate\": \"1995-10-22\",", + " \"generalPractitioner\": [", + " {", + " \"type\": \"Organization\",", + " \"identifier\": {", + " \"value\": \"ODS12345\",", + " \"system\": \"https://fhir.nhs.uk/Id/ods-organization-code\"", + " }", + " }", + " ]", + " },", + " \"search\": {", + " \"mode\": \"include\"", + " }", + " },", + " {", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/WWCC67T1\",", + " \"resource\": {", + " \"resourceType\": \"Consent\",", + " \"id\": \"WWCC67T1\",", + " \"status\": \"active\",", + " \"scope\": {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",", + " \"code\": \"patient-privacy\",", + " \"display\": \"Privacy Consent\"", + " }", + " ],", + " \"text\": \"Patient Privacy Consent\"", + " },", + " \"category\": [", + " {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",", + " \"code\": \"INFA\",", + " \"display\": \"Information Access\"", + " }", + " ],", + " \"text\": \"Information Access Consent\"", + " }", + " ],", + " \"patient\": {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000005\"", + " }", + " },", + " \"dateTime\": \"2024-07-21T17:32:28Z\",", + " \"performer\": [", + " {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000010\"", + " }", + " }", + " ],", + " \"verification\": [", + " {", + " \"verified\": true,", + " \"verifiedWith\": {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000005\"", + " }", + " },", + " \"verificationDate\": \"2024-07-21T17:32:28Z\"", + " }", + " ]", + " },", + " \"search\": {", + " \"mode\": \"match\"", + " }", + " }", + " ]", + "}", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Should have correct response body\", () => {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson).to.eql(expectedResponseBody);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{api_base_url}}/Consent/74eed847-ca25-4e76-8cf2-f2c2d7842a7a?_include=Consent:patient", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent", + "74eed847-ca25-4e76-8cf2-f2c2d7842a7a" + ], + "query": [ + { + "key": "_include", + "value": "Consent:patient" + } + ] + } + }, + "response": [] + }, + { + "name": "Retrieve consenting adult relationship with performer details", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const expectedResponseBody = {", + " \"resourceType\": \"Bundle\",", + " \"timestamp\": \"2020-08-26T14:00:00+00:00\",", + " \"total\": 3,", + " \"type\": \"searchset\",", + " \"entry\": [", + " {", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/RelatedPerson/RP974720\",", + " \"resource\": {", + " \"resourceType\": \"RelatedPerson\",", + " \"id\": \"RP974720\",", + " \"identifier\": [", + " {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000010\"", + " },", + " {", + " \"system\": \"https://placeholder.fhir.nhs.uk/Id/local-gp-patient-identifier\",", + " \"value\": \"ABC0000008\"", + " }", + " ],", + " \"patient\": {", + " \"type\": \"Patient\",", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000005\"", + " }", + " },", + " \"relationship\": [", + " {", + " \"coding\": [", + " {", + " \"system\": \"https://fhir.hl7.org.uk/CodeSystem/UKCore-AdditionalPersonRelationshipRole\",", + " \"code\": \"Personal\",", + " \"display\": \"Personal relationship with the patient\"", + " }", + " ]", + " }", + " ]", + " },", + " \"search\": {", + " \"mode\": \"include\"", + " }", + " },", + " {", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/WWCC67T1\",", + " \"resource\": {", + " \"resourceType\": \"Consent\",", + " \"id\": \"WWCC67T1\",", + " \"status\": \"active\",", + " \"scope\": {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",", + " \"code\": \"patient-privacy\",", + " \"display\": \"Privacy Consent\"", + " }", + " ],", + " \"text\": \"Patient Privacy Consent\"", + " },", + " \"category\": [", + " {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",", + " \"code\": \"INFA\",", + " \"display\": \"Information Access\"", + " }", + " ],", + " \"text\": \"Information Access Consent\"", + " }", + " ],", + " \"patient\": {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000005\"", + " }", + " },", + " \"dateTime\": \"2024-07-21T17:32:28Z\",", + " \"performer\": [", + " {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000010\"", + " }", + " }", + " ],", + " \"verification\": [", + " {", + " \"verified\": true,", + " \"verifiedWith\": {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000005\"", + " }", + " },", + " \"verificationDate\": \"2024-07-21T17:32:28Z\"", + " }", + " ]", + " },", + " \"search\": {", + " \"mode\": \"match\"", + " }", + " }", + " ]", + "}", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Should have correct response body\", () => {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson).to.eql(expectedResponseBody);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{api_base_url}}/Consent/74eed847-ca25-4e76-8cf2-f2c2d7842a7a?_include=Consent:performer", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent", + "74eed847-ca25-4e76-8cf2-f2c2d7842a7a" + ], + "query": [ + { + "key": "_include", + "value": "Consent:performer" + } + ] + } + }, + "response": [] + }, + { + "name": "Retrieve consenting adult relationship with performer and patient details", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const expectedResponseBody = {", + " \"resourceType\": \"Bundle\",", + " \"timestamp\": \"2020-08-26T14:00:00+00:00\",", + " \"total\": 3,", + " \"type\": \"searchset\",", + " \"entry\": [", + " {", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/RelatedPerson/RP974720\",", + " \"resource\": {", + " \"resourceType\": \"RelatedPerson\",", + " \"id\": \"RP974720\",", + " \"identifier\": [", + " {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000010\"", + " },", + " {", + " \"system\": \"https://placeholder.fhir.nhs.uk/Id/local-gp-patient-identifier\",", + " \"value\": \"ABC0000008\"", + " }", + " ],", + " \"patient\": {", + " \"type\": \"Patient\",", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000005\"", + " }", + " },", + " \"relationship\": [", + " {", + " \"coding\": [", + " {", + " \"system\": \"https://fhir.hl7.org.uk/CodeSystem/UKCore-AdditionalPersonRelationshipRole\",", + " \"code\": \"Personal\",", + " \"display\": \"Personal relationship with the patient\"", + " }", + " ]", + " }", + " ]", + " },", + " \"search\": {", + " \"mode\": \"include\"", + " }", + " },", + " {", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Patient/DFCC67F5\",", + " \"resource\": {", + " \"resourceType\": \"Patient\",", + " \"id\": \"DFCC67F5\",", + " \"identifier\": [", + " {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000005\"", + " },", + " {", + " \"system\": \"https://placeholder.fhir.nhs.uk/Id/local-gp-patient-identifier\",", + " \"value\": \"ABC1234567\"", + " }", + " ],", + " \"name\": [", + " {", + " \"id\": \"123456\",", + " \"use\": \"usual\",", + " \"period\": {", + " \"start\": \"2020-01-01\",", + " \"end\": \"2021-12-31\"", + " },", + " \"given\": [", + " \"Sally\"", + " ],", + " \"family\": \"Evans\",", + " \"prefix\": [", + " \"Mrs\"", + " ]", + " }", + " ],", + " \"birthDate\": \"1995-10-22\",", + " \"generalPractitioner\": [", + " {", + " \"type\": \"Organization\",", + " \"identifier\": {", + " \"value\": \"ODS12345\",", + " \"system\": \"https://fhir.nhs.uk/Id/ods-organization-code\"", + " }", + " }", + " ]", + " },", + " \"search\": {", + " \"mode\": \"include\"", + " }", + " },", + " {", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/WWCC67T1\",", + " \"resource\": {", + " \"resourceType\": \"Consent\",", + " \"id\": \"WWCC67T1\",", + " \"status\": \"active\",", + " \"scope\": {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",", + " \"code\": \"patient-privacy\",", + " \"display\": \"Privacy Consent\"", + " }", + " ],", + " \"text\": \"Patient Privacy Consent\"", + " },", + " \"category\": [", + " {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",", + " \"code\": \"INFA\",", + " \"display\": \"Information Access\"", + " }", + " ],", + " \"text\": \"Information Access Consent\"", + " }", + " ],", + " \"patient\": {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000005\"", + " }", + " },", + " \"dateTime\": \"2024-07-21T17:32:28Z\",", + " \"performer\": [", + " {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000010\"", + " }", + " }", + " ],", + " \"verification\": [", + " {", + " \"verified\": true,", + " \"verifiedWith\": {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000005\"", + " }", + " },", + " \"verificationDate\": \"2024-07-21T17:32:28Z\"", + " }", + " ]", + " },", + " \"search\": {", + " \"mode\": \"match\"", + " }", + " }", + " ]", + "}", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Should have correct response body\", () => {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson).to.eql(expectedResponseBody);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{api_base_url}}/Consent/74eed847-ca25-4e76-8cf2-f2c2d7842a7a?_include=Consent:performer&_include=Consent:patient", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent", + "74eed847-ca25-4e76-8cf2-f2c2d7842a7a" + ], + "query": [ + { + "key": "_include", + "value": "Consent:performer" + }, + { + "key": "_include", + "value": "Consent:patient" + } + ] + } + }, + "response": [] + }, + { + "name": "Retrieve mother-child relationship", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const expectedResponseBody = {", + " \"resourceType\": \"Bundle\",", + " \"timestamp\": \"2020-08-26T14:00:00+00:00\",", + " \"total\": 1,", + " \"type\": \"searchset\",", + " \"entry\": [", + " {", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/BBCC67E9\",", + " \"resource\": {", + " \"resourceType\": \"Consent\",", + " \"id\": \"BBCC67E9\",", + " \"status\": \"active\",", + " \"scope\": {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",", + " \"code\": \"patient-privacy\",", + " \"display\": \"Privacy Consent\"", + " }", + " ],", + " \"text\": \"Patient Privacy Consent\"", + " },", + " \"category\": [", + " {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",", + " \"code\": \"INFA\",", + " \"display\": \"Information Access\"", + " }", + " ],", + " \"text\": \"Information Access Consent\"", + " }", + " ],", + " \"patient\": {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000009\"", + " }", + " },", + " \"dateTime\": \"2024-07-21T17:32:28Z\",", + " \"performer\": [", + " {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000019\"", + " }", + " }", + " ]", + " },", + " \"search\": {", + " \"mode\": \"match\"", + " }", + " }", + " ]", + "}", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Should have correct response body\", () => {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson).to.eql(expectedResponseBody);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{api_base_url}}/Consent/39df03a2-1b14-4d19-b1dc-d5d8cbf96948", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent", + "39df03a2-1b14-4d19-b1dc-d5d8cbf96948" + ] + } + }, + "response": [] + }, + { + "name": "Retrieve mother-child relationship with patient details", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const expectedResponseBody = {", + " \"resourceType\": \"Bundle\",", + " \"timestamp\": \"2020-08-26T14:00:00+00:00\",", + " \"total\": 3,", + " \"type\": \"searchset\",", + " \"entry\": [", + " {", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Patient/A3CC67E2\",", + " \"resource\": {", + " \"resourceType\": \"Patient\",", + " \"id\": \"A3CC67E2\",", + " \"identifier\": [", + " {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000009\"", + " },", + " {", + " \"system\": \"https://placeholder.fhir.nhs.uk/Id/local-gp-patient-identifier\",", + " \"value\": \"ABC1234556\"", + " }", + " ],", + " \"name\": [", + " {", + " \"id\": \"123456\",", + " \"use\": \"usual\",", + " \"period\": {", + " \"start\": \"2020-01-01\",", + " \"end\": \"2021-12-31\"", + " },", + " \"given\": [", + " \"Jane Marie Anne\"", + " ],", + " \"family\": \"Smith\",", + " \"prefix\": [", + " \"Mrs\"", + " ],", + " \"suffix\": [", + " \"MBE\",", + " \"PhD\"", + " ]", + " }", + " ],", + " \"birthDate\": \"2022-10-22\",", + " \"generalPractitioner\": [", + " {", + " \"type\": \"Organization\",", + " \"identifier\": {", + " \"value\": \"ODS12345\",", + " \"system\": \"https://fhir.nhs.uk/Id/ods-organization-code\"", + " }", + " }", + " ]", + " },", + " \"search\": {", + " \"mode\": \"include\"", + " }", + " },", + " {", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/BBCC67E9\",", + " \"resource\": {", + " \"resourceType\": \"Consent\",", + " \"id\": \"BBCC67E9\",", + " \"status\": \"active\",", + " \"scope\": {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",", + " \"code\": \"patient-privacy\",", + " \"display\": \"Privacy Consent\"", + " }", + " ],", + " \"text\": \"Patient Privacy Consent\"", + " },", + " \"category\": [", + " {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",", + " \"code\": \"INFA\",", + " \"display\": \"Information Access\"", + " }", + " ],", + " \"text\": \"Information Access Consent\"", + " }", + " ],", + " \"patient\": {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000009\"", + " }", + " },", + " \"dateTime\": \"2024-07-21T17:32:28Z\",", + " \"performer\": [", + " {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000019\"", + " }", + " }", + " ]", + " },", + " \"search\": {", + " \"mode\": \"match\"", + " }", + " }", + " ]", + "}", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Should have correct response body\", () => {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson).to.eql(expectedResponseBody);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{api_base_url}}/Consent/39df03a2-1b14-4d19-b1dc-d5d8cbf96948?_include=Consent:patient", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent", + "39df03a2-1b14-4d19-b1dc-d5d8cbf96948" + ], + "query": [ + { + "key": "_include", + "value": "Consent:patient" + } + ] + } + }, + "response": [] + }, + { + "name": "Retrieve mother-child relationship with performer details", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const expectedResponseBody = {", + " \"resourceType\": \"Bundle\",", + " \"timestamp\": \"2020-08-26T14:00:00+00:00\",", + " \"total\": 3,", + " \"type\": \"searchset\",", + " \"entry\": [", + " {", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/RelatedPerson/BE974742\",", + " \"resource\": {", + " \"resourceType\": \"RelatedPerson\",", + " \"id\": \"BE974742\",", + " \"identifier\": [", + " {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000019\"", + " },", + " {", + " \"system\": \"https://placeholder.fhir.nhs.uk/Id/local-gp-patient-identifier\",", + " \"value\": \"ABC0000001\"", + " }", + " ],", + " \"patient\": {", + " \"type\": \"Patient\",", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000009\"", + " }", + " },", + " \"relationship\": [", + " {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",", + " \"code\": \"PRN\",", + " \"display\": \"parent\"", + " },", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",", + " \"code\": \"MTH\",", + " \"display\": \"mother\"", + " }", + " ]", + " }", + " ]", + " },", + " \"search\": {", + " \"mode\": \"include\"", + " }", + " },", + " {", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/BBCC67E9\",", + " \"resource\": {", + " \"resourceType\": \"Consent\",", + " \"id\": \"BBCC67E9\",", + " \"status\": \"active\",", + " \"scope\": {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",", + " \"code\": \"patient-privacy\",", + " \"display\": \"Privacy Consent\"", + " }", + " ],", + " \"text\": \"Patient Privacy Consent\"", + " },", + " \"category\": [", + " {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",", + " \"code\": \"INFA\",", + " \"display\": \"Information Access\"", + " }", + " ],", + " \"text\": \"Information Access Consent\"", + " }", + " ],", + " \"patient\": {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000009\"", + " }", + " },", + " \"dateTime\": \"2024-07-21T17:32:28Z\",", + " \"performer\": [", + " {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000019\"", + " }", + " }", + " ]", + " },", + " \"search\": {", + " \"mode\": \"match\"", + " }", + " }", + " ]", + "}", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Should have correct response body\", () => {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson).to.eql(expectedResponseBody);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{api_base_url}}/Consent/39df03a2-1b14-4d19-b1dc-d5d8cbf96948?_include=Consent:performer", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent", + "39df03a2-1b14-4d19-b1dc-d5d8cbf96948" + ], + "query": [ + { + "key": "_include", + "value": "Consent:performer" + } + ] + } + }, + "response": [] + }, + { + "name": "Retrieve mother-child relationship with performer and patient details", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const expectedResponseBody = {", + " \"resourceType\": \"Bundle\",", + " \"timestamp\": \"2020-08-26T14:00:00+00:00\",", + " \"total\": 3,", + " \"type\": \"searchset\",", + " \"entry\": [", + " {", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/RelatedPerson/BE974742\",", + " \"resource\": {", + " \"resourceType\": \"RelatedPerson\",", + " \"id\": \"BE974742\",", + " \"identifier\": [", + " {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000019\"", + " },", + " {", + " \"system\": \"https://placeholder.fhir.nhs.uk/Id/local-gp-patient-identifier\",", + " \"value\": \"ABC0000001\"", + " }", + " ],", + " \"patient\": {", + " \"type\": \"Patient\",", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000009\"", + " }", + " },", + " \"relationship\": [", + " {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",", + " \"code\": \"PRN\",", + " \"display\": \"parent\"", + " },", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",", + " \"code\": \"MTH\",", + " \"display\": \"mother\"", + " }", + " ]", + " }", + " ]", + " },", + " \"search\": {", + " \"mode\": \"include\"", + " }", + " },", + " {", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Patient/A3CC67E2\",", + " \"resource\": {", + " \"resourceType\": \"Patient\",", + " \"id\": \"A3CC67E2\",", + " \"identifier\": [", + " {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000009\"", + " },", + " {", + " \"system\": \"https://placeholder.fhir.nhs.uk/Id/local-gp-patient-identifier\",", + " \"value\": \"ABC1234556\"", + " }", + " ],", + " \"name\": [", + " {", + " \"id\": \"123456\",", + " \"use\": \"usual\",", + " \"period\": {", + " \"start\": \"2020-01-01\",", + " \"end\": \"2021-12-31\"", + " },", + " \"given\": [", + " \"Jane Marie Anne\"", + " ],", + " \"family\": \"Smith\",", + " \"prefix\": [", + " \"Mrs\"", + " ],", + " \"suffix\": [", + " \"MBE\",", + " \"PhD\"", + " ]", + " }", + " ],", + " \"birthDate\": \"2022-10-22\",", + " \"generalPractitioner\": [", + " {", + " \"type\": \"Organization\",", + " \"identifier\": {", + " \"value\": \"ODS12345\",", + " \"system\": \"https://fhir.nhs.uk/Id/ods-organization-code\"", + " }", + " }", + " ]", + " },", + " \"search\": {", + " \"mode\": \"include\"", + " }", + " },", + " {", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/BBCC67E9\",", + " \"resource\": {", + " \"resourceType\": \"Consent\",", + " \"id\": \"BBCC67E9\",", + " \"status\": \"active\",", + " \"scope\": {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",", + " \"code\": \"patient-privacy\",", + " \"display\": \"Privacy Consent\"", + " }", + " ],", + " \"text\": \"Patient Privacy Consent\"", + " },", + " \"category\": [", + " {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",", + " \"code\": \"INFA\",", + " \"display\": \"Information Access\"", + " }", + " ],", + " \"text\": \"Information Access Consent\"", + " }", + " ],", + " \"patient\": {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000009\"", + " }", + " },", + " \"dateTime\": \"2024-07-21T17:32:28Z\",", + " \"performer\": [", + " {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000019\"", + " }", + " }", + " ]", + " },", + " \"search\": {", + " \"mode\": \"match\"", + " }", + " }", + " ]", + "}", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Should have correct response body\", () => {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson).to.eql(expectedResponseBody);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{api_base_url}}/Consent/39df03a2-1b14-4d19-b1dc-d5d8cbf96948?_include=Consent:performer&_include=Consent:patient", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent", + "39df03a2-1b14-4d19-b1dc-d5d8cbf96948" + ], + "query": [ + { + "key": "_include", + "value": "Consent:performer" + }, + { + "key": "_include", + "value": "Consent:patient" + } + ] + } + }, + "response": [] + }, + { + "name": "Invalid consent ID", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const expectedResponseBody = {", + " \"issue\": [", + " {", + " \"code\": \"invalid\",", + " \"diagnostics\": \"Invalid request with error - ID must be a valid UUID.\",", + " \"details\": {", + " \"coding\": [", + " {", + " \"code\": \"INVALID_ID_VALUE\",", + " \"display\": \"Required parameter(s) are invalid.\",", + " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", + " \"version\": \"1\"", + " }", + " ]", + " },", + " \"severity\": \"error\"", + " }", + " ],", + " \"resourceType\": \"OperationOutcome\"", + "}", + "", + "const responseJson = pm.response.json();", + "", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Should have correct response body\", () => {", + " pm.expect(responseJson).to.eql(expectedResponseBody);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{api_base_url}}/Consent/invalid-identifier", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent", + "invalid-identifier" + ] + } + }, + "response": [] + }, + { + "name": "Missing consent ID", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const expectedResponseBody = {", + " \"issue\": [", + " {", + " \"code\": \"invalid\",", + " \"diagnostics\": \"Invalid request with error - ID must be specified in the request path.\",", + " \"details\": {", + " \"coding\": [", + " {", + " \"code\": \"MISSING_ID_VALUE\",", + " \"display\": \"Required parameter(s) are missing.\",", + " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", + " \"version\": \"1\"", + " }", + " ]", + " },", + " \"severity\": \"error\"", + " }", + " ],", + " \"resourceType\": \"OperationOutcome\"", + "}", + "", + "const responseJson = pm.response.json();", + "", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Should have correct response body\", () => {", + " pm.expect(responseJson).to.eql(expectedResponseBody);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{api_base_url}}/Consent/ ", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent", + " " + ] + } + }, + "response": [] + }, + { + "name": "Invalid include parameter", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const expectedResponseBody = {", + " \"resourceType\": \"OperationOutcome\",", + " \"issue\": [", + " {", + " \"code\": \"invalid\",", + " \"details\": {", + " \"coding\": [", + " {", + " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", + " \"version\": \"1\",", + " \"code\": \"INVALID_VALUE\",", + " \"display\": \"Required parameter(s) are invalid.\"", + " }", + " ]", + " },", + " \"severity\": \"error\"", + " }", + " ],", + " \"diagnostics\": \"Invalid request with error - _include parameter is invalid.\"", + "}", + "", + "const responseJson = pm.response.json();", + "", + "pm.test(\"Status code is 422\", function () {", + " pm.response.to.have.status(422);", + "});", + "", + "pm.test(\"Should have correct response body\", () => {", + " pm.expect(responseJson).to.eql(expectedResponseBody);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{api_base_url}}/Consent/39df03a2-1b14-4d19-b1dc-d5d8cbf96948?_include=Consent:invalid", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent", + "39df03a2-1b14-4d19-b1dc-d5d8cbf96948" + ], + "query": [ + { + "key": "_include", + "value": "Consent:invalid" + } + ] + } + }, + "response": [] + }, + { + "name": "Invalid parameters", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const expectedResponseBody = {", + " \"resourceType\": \"OperationOutcome\",", + " \"issue\": [", + " {", + " \"code\": \"invalid\",", + " \"details\": {", + " \"coding\": [", + " {", + " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", + " \"version\": \"1\",", + " \"code\": \"INVALID_VALUE\",", + " \"display\": \"Required parameter(s) are invalid.\"", + " }", + " ]", + " },", + " \"severity\": \"error\"", + " }", + " ],", + " \"diagnostics\": \"Invalid request with error - _include parameter is invalid.\"", + "}", + "", + "const responseJson = pm.response.json();", + "", + "pm.test(\"Status code is 422\", function () {", + " pm.response.to.have.status(422);", + "});", + "", + "pm.test(\"Should have correct response body\", () => {", + " pm.expect(responseJson).to.eql(expectedResponseBody);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{api_base_url}}/Consent/74eed847-ca25-4e76-8cf2-f2c2d7842a7a?_unknown=true", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent", + "74eed847-ca25-4e76-8cf2-f2c2d7842a7a" + ], + "query": [ + { + "key": "_unknown", + "value": "true" + } + ] + } + }, + "response": [] + }, + { + "name": "Proxy role not found", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const expectedResponseBody = {", + " \"issue\": [", + " {", + " \"code\": \"processing\",", + " \"details\": {", + " \"coding\": [", + " {", + " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", + " \"version\": \"1\",", + " \"code\": \"INVALIDATED_RESOURCE\",", + " \"display\": \"Resource that has been marked as invalid was requested - invalid resources cannot be retrieved\"", + " }", + " ]", + " },", + " \"severity\": \"error\"", + " }", + " ],", + " \"resourceType\": \"OperationOutcome\"", + "}", + "", + "const responseJson = pm.response.json();", + "", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});", + "", + "pm.test(\"Should have correct response body\", () => {", + " pm.expect(responseJson).to.eql(expectedResponseBody);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{api_base_url}}/Consent/a0922245-1072-40c3-8f4e-a7490c10d365", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent", + "a0922245-1072-40c3-8f4e-a7490c10d365" + ] + } + }, + "response": [] + } + ], + "description": "The GET /Consent/{ID} is for retrieving the details of a single proxy relationship, including current status, based on a provided id.\n\nThis folder contains requests covering different scenarios for users with different types of proxy relationship. It also includes error scenarios.\n\nFor more details please see the [OAS page for Validated Relationships Service consent on the NHS England website.](https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service#get-/Consent)" + }, { "name": "Create proxy relationship (Consent)", "item": [ @@ -7355,4 +8869,4 @@ "type": "string" } ] -} +} \ No newline at end of file From d4aeccc823195b3fa927bd6e4558bacdc9af92c4 Mon Sep 17 00:00:00 2001 From: adamclarkson Date: Fri, 6 Jun 2025 15:29:27 +0100 Subject: [PATCH 6/9] npa-5087 - Updated OAS and postman collection --- ...ip Service Sandbox.postman_collection.json | 3293 +++++++++-------- ...ng-adult-relationship-include-patient.yaml | 2 +- ...-adult-relationship-include-performer.yaml | 2 +- ...er-child-relationship-include-patient.yaml | 2 +- ...-child-relationship-include-performer.yaml | 2 +- .../validated-relationships-service-api.yaml | 14 +- 6 files changed, 1664 insertions(+), 1651 deletions(-) diff --git a/postman/Validate Relationship Service Sandbox.postman_collection.json b/postman/Validate Relationship Service Sandbox.postman_collection.json index 6bc192c0..3b60744f 100644 --- a/postman/Validate Relationship Service Sandbox.postman_collection.json +++ b/postman/Validate Relationship Service Sandbox.postman_collection.json @@ -2,35 +2,223 @@ "info": { "_postman_id": "110252c4-5fa1-46ca-a08d-b5ce96e28fde", "name": "Validate Relationship Service Sandbox 06/06/25", - "description": "Example usage of the Validate Relationship Service (VRS) sandbox.\n\nFull specification is available at [https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service](https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service)", + "description": "This Postman collection includes example scenarios for each of the Validated Relationship Service (VRS) API endpoints, covering both valid and invalid request scenarios.\n\nThe collection is pointed towards the VRS sandbox environment, which will return a specific example response based on the request sent. All data shown in the requests or responses is test data.\n\nOur sandbox environment only covers the scenarios listed in the Postman collection and is open access. It does not allow you to test authorisation or any scenarios beyond the ones documented.\n\nFull specification is available at [https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service](https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service)", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "_exporter_id": "18067099" + "_exporter_id": "18067099", + "_collection_link": "https://www.postman.com/lunar-crescent-672573/workspace/validated-relationship-service-06-06-25/collection/18067099-110252c4-5fa1-46ca-a08d-b5ce96e28fde?action=share&source=collection_link&creator=18067099" }, "item": [ { - "name": "New access request (Questionnaire Response)", + "name": "Get a proxy access request (Questionnaire Response)", "item": [ { - "name": "Adult to child access request", + "name": "Adult to adult with capacity", "event": [ { "listen": "test", "script": { "exec": [ - "" + "const expectedResponseBody = {", + " \"resourceType\": \"QuestionnaireResponse\",", + " \"status\": \"completed\",", + " \"authored\": \"2024-07-15T09:43:03.280Z\",", + " \"source\": {", + " \"type\": \"RelatedPerson\",", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000005\"", + " }", + " },", + " \"subject\": {", + " \"type\": \"Patient\",", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000006\"", + " }", + " },", + " \"questionnaire\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Questionnaire/01dc6813-3421-4d14-948d-a4888241add1\",", + " \"item\": [", + " {", + " \"linkId\": \"relatedPerson\",", + " \"text\": \"Proxy details\",", + " \"item\": [", + " {", + " \"linkId\": \"relatedPerson_identifier\",", + " \"text\": \"NHS number\",", + " \"answer\": [", + " {", + " \"valueString\": \"9000000005\"", + " }", + " ]", + " },", + " {", + " \"linkId\": \"relatedPerson_name\",", + " \"text\": \"Name\",", + " \"item\": [", + " {", + " \"linkId\": \"relatedPerson_name_first\",", + " \"text\": \"First name\",", + " \"answer\": [", + " {", + " \"valueString\": \"Jack\"", + " }", + " ]", + " },", + " {", + " \"linkId\": \"relatedPerson_name_family\",", + " \"text\": \"Last name\",", + " \"answer\": [", + " {", + " \"valueString\": \"Jones\"", + " }", + " ]", + " }", + " ]", + " },", + " {", + " \"linkId\": \"relatedPerson_birthDate\",", + " \"text\": \"Date of birth\",", + " \"answer\": [", + " {", + " \"valueDate\": \"1970-02-15\"", + " }", + " ]", + " },", + " {", + " \"linkId\": \"relatedPerson_basisForAccess\",", + " \"text\": \"Basis for Access\",", + " \"answer\": [", + " {", + " \"valueCoding\": {", + " \"system\": \"https://fhir.hl7.org.uk/CodeSystem/UKCore-AdditionalPersonRelationshipRole\",", + " \"code\": \"PRN\",", + " \"display\": \"Parent\"", + " }", + " }", + " ]", + " },", + " {", + " \"linkId\": \"relatedPerson_relationship\",", + " \"text\": \"Relationship\",", + " \"answer\": [", + " {", + " \"valueCoding\": {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",", + " \"code\": \"PRN\",", + " \"display\": \"Parent\"", + " }", + " }", + " ]", + " }", + " ]", + " },", + " {", + " \"linkId\": \"patient\",", + " \"text\": \"Patient details\",", + " \"item\": [", + " {", + " \"linkId\": \"patient_identifier\",", + " \"text\": \"NHS number\",", + " \"answer\": [", + " {", + " \"valueString\": \"9000000006\"", + " }", + " ]", + " },", + " {", + " \"linkId\": \"patient_name\",", + " \"text\": \"Name\",", + " \"item\": [", + " {", + " \"linkId\": \"patient_name_first\",", + " \"text\": \"First name\",", + " \"answer\": [", + " {", + " \"valueString\": \"Jill\"", + " }", + " ]", + " },", + " {", + " \"linkId\": \"patient_name_family\",", + " \"text\": \"Last name\",", + " \"answer\": [", + " {", + " \"valueString\": \"Jones\"", + " }", + " ]", + " }", + " ]", + " },", + " {", + " \"linkId\": \"patient_birthDate\",", + " \"text\": \"Date of birth\",", + " \"answer\": [", + " {", + " \"valueDate\": \"1965-01-01\"", + " }", + " ]", + " }", + " ]", + " },", + " {", + " \"linkId\": \"requestedAccess\",", + " \"text\": \"Requested access\",", + " \"item\": [", + " {", + " \"linkId\": \"requestedAccess_accessLevel\",", + " \"text\": \"Requested access level\",", + " \"answer\": [", + " {", + " \"valueCoding\": {", + " \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-RequestedAccess\",", + " \"code\": \"APPT\",", + " \"display\": \"Appointment Booking\"", + " }", + " },", + " {", + " \"valueCoding\": {", + " \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-RequestedAccess\",", + " \"code\": \"VACC\",", + " \"display\": \"Vaccination Records\"", + " }", + " }", + " ]", + " },", + " {", + " \"linkId\": \"requestedAccess_reasonsForAccess\",", + " \"text\": \"Reason for access\",", + " \"answer\": [", + " {", + " \"valueCoding\": {", + " \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-ReasonForAccess\",", + " \"code\": \"PRAC\",", + " \"display\": \"Practical Reasons\"", + " }", + " }", + " ]", + " }", + " ]", + " }", + " ]", + "};", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Should have correct response body\", () => {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson).to.eql(expectedResponseBody);", + "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { - "method": "POST", + "method": "GET", "header": [ - { - "key": "Content-Type", - "value": "application/fhir+json", - "type": "text" - }, { "key": "X-Request-ID", "value": "d967f4c9-8e83-4930-97ab-ae4e122d8ca5", @@ -42,68 +230,80 @@ "type": "text" } ], - "body": { - "mode": "raw", - "raw": "{\n \"resourceType\": \"QuestionnaireResponse\",\n \"status\": \"completed\",\n \"authored\": \"2024-07-15T09:43:03.280Z\",\n \"source\": {\n \"type\": \"RelatedPerson\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000001\"\n }\n },\n \"subject\": {\n \"type\": \"Patient\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000002\"\n }\n },\n \"questionnaire\": \"Questionnaire/01dc6813-3421-4d14-948d-a4888241add1\",\n \"item\": [\n {\n \"linkId\": \"relatedPerson\",\n \"text\": \"relatedPerson\",\n \"item\": [\n {\n \"linkId\": \"relatedPerson_identifier\",\n \"text\": \"NHS Number\",\n \"answer\": [\n {\n \"valueString\": \"9000000001\"\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_name\",\n \"text\": \"relatedPerson_name\",\n \"item\": [\n {\n \"linkId\": \"relatedPerson_name_first\",\n \"text\": \"First name.\",\n \"answer\": [\n {\n \"valueString\": \"Sharon\"\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_name_family\",\n \"text\": \"Family name (often called Surname).\",\n \"answer\": [\n {\n \"valueString\": \"Smith\"\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_birthDate\",\n \"text\": \"Date of Birth\",\n \"answer\": [\n {\n \"valueDate\": \"1994-03-21\"\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_basisForAccess\",\n \"text\": \"Basis For Access\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",\n \"code\": \"PRN\",\n \"display\": \"Parent\"\n }\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_relationship\",\n \"text\": \"Relationship\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",\n \"code\": \"PRN\",\n \"display\": \"Parent\"\n }\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails\",\n \"text\": \"parentalApplicationSupplementaryDetails\",\n \"item\": [\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails_evidenceOfResponsibility\",\n \"text\": \"Evidence of parental responsibility\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-EvidenceOfResponsibility\",\n \"code\": \"BRTH\",\n \"display\": \"Birth certificate\"\n }\n }\n ]\n },\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails_evidenceOfResponsibilityMoreinfo\",\n \"text\": \"Evidence of responsibility - Further Information\",\n \"answer\": [\n {\n \"valueString\": \"Birth Certificate is original\"\n }\n ]\n },\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails_isCurrentAddressConfirmed\",\n \"text\": \"Is current address confirmed?\",\n \"answer\": [\n {\n \"valueString\": \"Yes\"\n }\n ]\n },\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails_newAddress\",\n \"text\": \"parentalApplicationSupplementaryDetails_newAddress\",\n \"item\": [\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails_line1\",\n \"text\": \"Address Line 1\",\n \"answer\": [\n {\n \"valueString\": \"24 Hoves Edge\"\n }\n ]\n },\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails_line2\",\n \"text\": \"Address Line 2\",\n \"answer\": [\n {\n \"valueString\": \"Remington\"\n }\n ]\n },\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails_line3\",\n \"text\": \"Address Line 3\",\n \"answer\": [\n {\n \"valueString\": \"Boroughbridge\"\n }\n ]\n },\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails_city\",\n \"text\": \"Town / City\",\n \"answer\": [\n {\n \"valueString\": \"Leeds\"\n }\n ]\n },\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails_district\",\n \"text\": \"County\",\n \"answer\": [\n {\n \"valueString\": \"West Yorkshire\"\n }\n ]\n },\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails_postalCode\",\n \"text\": \"Postcode\",\n \"answer\": [\n {\n \"valueString\": \"LS1 1DW\"\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails_liveAtSameAddress\",\n \"text\": \"Do the adult and child live at the same address?\",\n \"answer\": [\n {\n \"valueString\": \"Yes\"\n }\n ]\n },\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails_canChildConsent\",\n \"text\": \"Can the child consent?\",\n \"answer\": [\n {\n \"valueString\": \"No\"\n }\n ]\n },\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails_reasonNoChildConsent\",\n \"text\": \"Reason the child cannot consent\",\n \"answer\": [\n {\n \"valueString\": \"Child is too young\"\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"patient\",\n \"text\": \"patient\",\n \"item\": [\n {\n \"linkId\": \"patient_identifier\",\n \"text\": \"NHS Number\",\n \"answer\": [\n {\n \"valueString\": \"9000000002\"\n }\n ]\n },\n {\n \"linkId\": \"patient_name\",\n \"text\": \"patient_name\",\n \"item\": [\n {\n \"linkId\": \"patient_name_first\",\n \"text\": \"First name.\",\n \"answer\": [\n {\n \"valueString\": \"Jane\"\n }\n ]\n },\n {\n \"linkId\": \"patient_name_family\",\n \"text\": \"Family name (often called Surname).\",\n \"answer\": [\n {\n \"valueString\": \"Smith\"\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"patient_birthDate\",\n \"text\": \"Date of Birth\",\n \"answer\": [\n {\n \"valueDate\": \"2020-10-22\"\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"requestedAccess\",\n \"text\": \"requestedAccess\",\n \"item\": [\n {\n \"linkId\": \"requestedAccess_accessLevel\",\n \"text\": \"Requested access level\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-RequestedAccess\",\n \"code\": \"APPT\",\n \"display\": \"Appointment Booking\"\n }\n }\n ]\n },\n {\n \"linkId\": \"requestedAccess_accessLevelMoreinfo\",\n \"text\": \"Requested access level - further information\",\n \"answer\": [\n {\n \"valueString\": \"Access only required to most recent 3 years\"\n }\n ]\n },\n {\n \"linkId\": \"requestedAccess_reasonsForAccess\",\n \"text\": \"Reason for access\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-ReasonForAccess\",\n \"code\": \"COMB\",\n \"display\": \"Communication Barriers\"\n }\n }\n ]\n },\n {\n \"linkId\": \"requestedAccess_reasonsForAccessMoreinfo\",\n \"text\": \"Reason for access - further information\",\n \"answer\": [\n {\n \"valueString\": \"No internet connection\"\n }\n ]\n }\n ]\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{api_base_url}}/QuestionnaireResponse", + "raw": "{{api_base_url}}/QuestionnaireResponse?referenceCode=19318ZGLAB", "host": [ "{{api_base_url}}" ], "path": [ "QuestionnaireResponse" + ], + "query": [ + { + "key": "referenceCode", + "value": "19318ZGLAB" + } ] }, - "description": "Example of an adult to child access request with the reference code returned" + "description": "Example of Questionnaire Response that will be returned" }, "response": [] }, { - "name": "Adult to adult with ability to consent access request", + "name": "Missing Reference Code", "event": [ { "listen": "test", "script": { "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/fhir+json" - }, - { - "key": "X-Request-ID", - "value": "d967f4c9-8e83-4930-97ab-ae4e122d8ca5", - "type": "text" - }, - { - "key": "X-Correlation-ID", - "value": "8717c840-c222-4f84-a880-45bc129f8382", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"resourceType\": \"QuestionnaireResponse\",\n \"status\": \"completed\",\n \"authored\": \"2024-07-15T09:43:03.280Z\",\n \"source\": {\n \"type\": \"RelatedPerson\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000005\"\n }\n },\n \"subject\": {\n \"type\": \"Patient\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000006\"\n }\n },\n \"questionnaire\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Questionnaire/01dc6813-3421-4d14-948d-a4888241add1\",\n \"item\": [\n {\n \"linkId\": \"relatedPerson\",\n \"text\": \"Proxy details\",\n \"item\": [\n {\n \"linkId\": \"relatedPerson_identifier\",\n \"text\": \"NHS number\",\n \"answer\": [\n {\n \"valueString\": \"9000000005\"\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_basisForAccess\",\n \"text\": \"Basis for Access\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.hl7.org.uk/CodeSystem/UKCore-AdditionalPersonRelationshipRole\",\n \"code\": \"Personal\",\n \"display\": \"Personal relationship with the patient\"\n }\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_relationship\",\n \"text\": \"Relationship\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",\n \"code\": \"SPS\",\n \"display\": \"Spouse\"\n }\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"patient\",\n \"text\": \"Patient details\",\n \"item\": [\n {\n \"linkId\": \"patient_identifier\",\n \"text\": \"NHS number\",\n \"answer\": [\n {\n \"valueString\": \"9000000006\"\n }\n ]\n },\n {\n \"linkId\": \"patient_name\",\n \"text\": \"Name\",\n \"item\": [\n {\n \"linkId\": \"patient_name_first\",\n \"text\": \"First name\",\n \"answer\": [\n {\n \"valueString\": \"Jill\"\n }\n ]\n },\n {\n \"linkId\": \"patient_name_family\",\n \"text\": \"Last name\",\n \"answer\": [\n {\n \"valueString\": \"Jones\"\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"patient_birthDate\",\n \"text\": \"Date of birth\",\n \"answer\": [\n {\n \"valueDate\": \"1965-01-01\"\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"requestedAccess\",\n \"text\": \"Requested access\",\n \"item\": [\n {\n \"linkId\": \"requestedAccess_accessLevel\",\n \"text\": \"Requested access level\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-RequestedAccess\",\n \"code\": \"APPT\",\n \"display\": \"Appointment Booking\"\n }\n },\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-RequestedAccess\",\n \"code\": \"VACC\",\n \"display\": \"Vaccination Records\"\n }\n }\n ]\n },\n {\n \"linkId\": \"requestedAccess_reasonsForAccess\",\n \"text\": \"Reason for access\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-ReasonForAccess\",\n \"code\": \"PRAC\",\n \"display\": \"Practical Reasons\"\n }\n }\n ]\n }\n ]\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } + "const expectedResponseBody = {", + " \"resourceType\": \"OperationOutcome\",", + " \"issue\": [", + " {", + " \"severity\": \"error\",", + " \"code\": \"required\",", + " \"details\": {", + " \"coding\": [", + " {", + " \"system\": \"https://fhir.nhs.uk/CodeSystem/Spine-ErrorOrWarningCode\",", + " \"code\": \"MISSING_REFERENCE_CODE\",", + " \"display\": \"Missing reference code\"", + " }", + " ]", + " },", + " \"diagnostics\": \"The reference code parameter is required but was not provided.\"", + " }", + " ]", + "};", + "", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Should have correct response body\", () => {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson).to.eql(expectedResponseBody);", + "});" + ], + "type": "text/javascript", + "packages": {} } - }, + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "X-Request-ID", + "value": "d967f4c9-8e83-4930-97ab-ae4e122d8ca5", + "type": "text" + }, + { + "key": "X-Correlation-ID", + "value": "8717c840-c222-4f84-a880-45bc129f8382", + "type": "text" + } + ], "url": { "raw": "{{api_base_url}}/QuestionnaireResponse", "host": [ @@ -113,12 +313,166 @@ "QuestionnaireResponse" ] }, - "description": "Example of an adult to adult access request where the patient can consent with the reference code returned" + "description": "Example of an error response when reference code is missing from request" }, "response": [] }, { - "name": "Adult to adult without ability to consent access request", + "name": "Invalid Reference Code", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const expectedResponseBody = {", + " \"resourceType\": \"OperationOutcome\",", + " \"issue\": [", + " {", + " \"severity\": \"error\",", + " \"code\": \"invalid\",", + " \"details\": {", + " \"coding\": [", + " {", + " \"system\": \"https://fhir.nhs.uk/CodeSystem/Spine-ErrorOrWarningCode\",", + " \"code\": \"INVALID_REFERENCE_CODE\",", + " \"display\": \"Invalid reference code\"", + " }", + " ]", + " },", + " \"diagnostics\": \"The specified reference code format is invalid. Reference codes must be alphanumeric.\"", + " }", + " ]", + "};", + "", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Should have correct response body\", () => {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson).to.eql(expectedResponseBody);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "X-Request-ID", + "value": "d967f4c9-8e83-4930-97ab-ae4e122d8ca5", + "type": "text" + }, + { + "key": "X-Correlation-ID", + "value": "8717c840-c222-4f84-a880-45bc129f8382", + "type": "text" + } + ], + "url": { + "raw": "{{api_base_url}}/QuestionnaireResponse?referenceCode=INVALID", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "QuestionnaireResponse" + ], + "query": [ + { + "key": "referenceCode", + "value": "INVALID" + } + ] + }, + "description": "Example of an error response when reference code is invalid" + }, + "response": [] + }, + { + "name": "Reference Code Not Found", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const expectedResponseBody = {", + " \"resourceType\": \"OperationOutcome\",", + " \"issue\": [", + " {", + " \"severity\": \"error\",", + " \"code\": \"not-found\",", + " \"details\": {", + " \"coding\": [", + " {", + " \"system\": \"https://fhir.nhs.uk/CodeSystem/Spine-ErrorOrWarningCode\",", + " \"code\": \"QUESTIONNAIRE_RESPONSE_NOT_FOUND\",", + " \"display\": \"Questionnaire response not found\"", + " }", + " ]", + " },", + " \"diagnostics\": \"The Questionnaire response could not be found using the provided reference code.\"", + " }", + " ]", + "};", + "", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});", + "", + "pm.test(\"Should have correct response body\", () => {", + " const responseJson = pm.response.json();", + " pm.expect(responseJson).to.eql(expectedResponseBody);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "X-Request-ID", + "value": "d967f4c9-8e83-4930-97ab-ae4e122d8ca5", + "type": "text" + }, + { + "key": "X-Correlation-ID", + "value": "8717c840-c222-4f84-a880-45bc129f8382", + "type": "text" + } + ], + "url": { + "raw": "{{api_base_url}}/QuestionnaireResponse?referenceCode=ABC123XY", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "QuestionnaireResponse" + ], + "query": [ + { + "key": "referenceCode", + "value": "ABC123XY" + } + ] + }, + "description": "Example of an error response when reference code is not found in database" + }, + "response": [] + } + ], + "description": "The GET Questionnaire Response endpoint is used to retrieve a Questionnaire Response using its unique reference code. This endpoint returns the full Questionnaire Response document that was previously submitted.\n\nThis folder contains requests covering different scenarios of valid and invalid requests.\n\nFor more details, please refer to the [GET Questionnaire Response OAS page for the Validated Relationship Service on the NHS England website.](https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service#get-/QuestionnaireResponse)" + }, + { + "name": "New access request (Questionnaire Response)", + "item": [ + { + "name": "Adult to child access request", "event": [ { "listen": "test", @@ -135,7 +489,8 @@ "header": [ { "key": "Content-Type", - "value": "application/fhir+json" + "value": "application/fhir+json", + "type": "text" }, { "key": "X-Request-ID", @@ -150,7 +505,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"resourceType\": \"QuestionnaireResponse\",\n \"status\": \"completed\",\n \"authored\": \"2024-07-15T09:43:03.280Z\",\n \"source\": {\n \"type\": \"RelatedPerson\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9876543210\"\n }\n },\n \"subject\": {\n \"type\": \"Patient\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000008\"\n }\n },\n \"questionnaire\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Questionnaire/01dc6813-3421-4d14-948d-a4888241add1\",\n \"item\": [\n {\n \"linkId\": \"relatedPerson\",\n \"text\": \"Proxy details\",\n \"item\": [\n {\n \"linkId\": \"relatedPerson_identifier\",\n \"text\": \"NHS number\",\n \"answer\": [\n {\n \"valueString\": \"9876543210\"\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_basisForAccess\",\n \"text\": \"Basis for Access\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.nhs.uk/STU3/CodeSystem/RARecord-ProxyRole-1\",\n \"code\": \"002\",\n \"display\": \"Best interest decision made on behalf of the patient (Mental Capacity Act 2005)\"\n }\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_relationship\",\n \"text\": \"Relationship\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",\n \"code\": \"CHILD\",\n \"display\": \"Child\"\n }\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"patient\",\n \"text\": \"Patient details\",\n \"item\": [\n {\n \"linkId\": \"patient_identifier\",\n \"text\": \"NHS number\",\n \"answer\": [\n {\n \"valueString\": \"9000000008\"\n }\n ]\n },\n {\n \"linkId\": \"patient_name\",\n \"text\": \"Name\",\n \"item\": [\n {\n \"linkId\": \"patient_name_first\",\n \"text\": \"First name\",\n \"answer\": [\n {\n \"valueString\": \"Florence\"\n }\n ]\n },\n {\n \"linkId\": \"patient_name_family\",\n \"text\": \"Last name\",\n \"answer\": [\n {\n \"valueString\": \"Smith\"\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"patient_birthDate\",\n \"text\": \"Date of birth\",\n \"answer\": [\n {\n \"valueDate\": \"1935-01-02\"\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"requestedAccess\",\n \"text\": \"Requested access\",\n \"item\": [\n {\n \"linkId\": \"requestedAccess_accessLevel\",\n \"text\": \"Requested access level\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-RequestedAccess\",\n \"code\": \"APPT\",\n \"display\": \"Appointment Booking\"\n }\n },\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-RequestedAccess\",\n \"code\": \"VACC\",\n \"display\": \"Vaccination Records\"\n }\n }\n ]\n },\n {\n \"linkId\": \"requestedAccess_reasonsForAccess\",\n \"text\": \"Reason for access\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-ReasonForAccess\",\n \"code\": \"TECH\",\n \"display\": \"Technical Barriers\"\n }\n }\n ]\n }\n ]\n }\n ]\n}", + "raw": "{\n \"resourceType\": \"QuestionnaireResponse\",\n \"status\": \"completed\",\n \"authored\": \"2024-07-15T09:43:03.280Z\",\n \"source\": {\n \"type\": \"RelatedPerson\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000001\"\n }\n },\n \"subject\": {\n \"type\": \"Patient\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000002\"\n }\n },\n \"questionnaire\": \"Questionnaire/01dc6813-3421-4d14-948d-a4888241add1\",\n \"item\": [\n {\n \"linkId\": \"relatedPerson\",\n \"text\": \"relatedPerson\",\n \"item\": [\n {\n \"linkId\": \"relatedPerson_identifier\",\n \"text\": \"NHS Number\",\n \"answer\": [\n {\n \"valueString\": \"9000000001\"\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_name\",\n \"text\": \"relatedPerson_name\",\n \"item\": [\n {\n \"linkId\": \"relatedPerson_name_first\",\n \"text\": \"First name.\",\n \"answer\": [\n {\n \"valueString\": \"Sharon\"\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_name_family\",\n \"text\": \"Family name (often called Surname).\",\n \"answer\": [\n {\n \"valueString\": \"Smith\"\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_birthDate\",\n \"text\": \"Date of Birth\",\n \"answer\": [\n {\n \"valueDate\": \"1994-03-21\"\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_basisForAccess\",\n \"text\": \"Basis For Access\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",\n \"code\": \"PRN\",\n \"display\": \"Parent\"\n }\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_relationship\",\n \"text\": \"Relationship\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",\n \"code\": \"PRN\",\n \"display\": \"Parent\"\n }\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails\",\n \"text\": \"parentalApplicationSupplementaryDetails\",\n \"item\": [\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails_evidenceOfResponsibility\",\n \"text\": \"Evidence of parental responsibility\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-EvidenceOfResponsibility\",\n \"code\": \"BRTH\",\n \"display\": \"Birth certificate\"\n }\n }\n ]\n },\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails_evidenceOfResponsibilityMoreinfo\",\n \"text\": \"Evidence of responsibility - Further Information\",\n \"answer\": [\n {\n \"valueString\": \"Birth Certificate is original\"\n }\n ]\n },\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails_isCurrentAddressConfirmed\",\n \"text\": \"Is current address confirmed?\",\n \"answer\": [\n {\n \"valueString\": \"Yes\"\n }\n ]\n },\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails_newAddress\",\n \"text\": \"parentalApplicationSupplementaryDetails_newAddress\",\n \"item\": [\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails_line1\",\n \"text\": \"Address Line 1\",\n \"answer\": [\n {\n \"valueString\": \"24 Hoves Edge\"\n }\n ]\n },\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails_line2\",\n \"text\": \"Address Line 2\",\n \"answer\": [\n {\n \"valueString\": \"Remington\"\n }\n ]\n },\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails_line3\",\n \"text\": \"Address Line 3\",\n \"answer\": [\n {\n \"valueString\": \"Boroughbridge\"\n }\n ]\n },\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails_city\",\n \"text\": \"Town / City\",\n \"answer\": [\n {\n \"valueString\": \"Leeds\"\n }\n ]\n },\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails_district\",\n \"text\": \"County\",\n \"answer\": [\n {\n \"valueString\": \"West Yorkshire\"\n }\n ]\n },\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails_postalCode\",\n \"text\": \"Postcode\",\n \"answer\": [\n {\n \"valueString\": \"LS1 1DW\"\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails_liveAtSameAddress\",\n \"text\": \"Do the adult and child live at the same address?\",\n \"answer\": [\n {\n \"valueString\": \"Yes\"\n }\n ]\n },\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails_canChildConsent\",\n \"text\": \"Can the child consent?\",\n \"answer\": [\n {\n \"valueString\": \"No\"\n }\n ]\n },\n {\n \"linkId\": \"parentalApplicationSupplementaryDetails_reasonNoChildConsent\",\n \"text\": \"Reason the child cannot consent\",\n \"answer\": [\n {\n \"valueString\": \"Child is too young\"\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"patient\",\n \"text\": \"patient\",\n \"item\": [\n {\n \"linkId\": \"patient_identifier\",\n \"text\": \"NHS Number\",\n \"answer\": [\n {\n \"valueString\": \"9000000002\"\n }\n ]\n },\n {\n \"linkId\": \"patient_name\",\n \"text\": \"patient_name\",\n \"item\": [\n {\n \"linkId\": \"patient_name_first\",\n \"text\": \"First name.\",\n \"answer\": [\n {\n \"valueString\": \"Jane\"\n }\n ]\n },\n {\n \"linkId\": \"patient_name_family\",\n \"text\": \"Family name (often called Surname).\",\n \"answer\": [\n {\n \"valueString\": \"Smith\"\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"patient_birthDate\",\n \"text\": \"Date of Birth\",\n \"answer\": [\n {\n \"valueDate\": \"2020-10-22\"\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"requestedAccess\",\n \"text\": \"requestedAccess\",\n \"item\": [\n {\n \"linkId\": \"requestedAccess_accessLevel\",\n \"text\": \"Requested access level\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-RequestedAccess\",\n \"code\": \"APPT\",\n \"display\": \"Appointment Booking\"\n }\n }\n ]\n },\n {\n \"linkId\": \"requestedAccess_accessLevelMoreinfo\",\n \"text\": \"Requested access level - further information\",\n \"answer\": [\n {\n \"valueString\": \"Access only required to most recent 3 years\"\n }\n ]\n },\n {\n \"linkId\": \"requestedAccess_reasonsForAccess\",\n \"text\": \"Reason for access\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-ReasonForAccess\",\n \"code\": \"COMB\",\n \"display\": \"Communication Barriers\"\n }\n }\n ]\n },\n {\n \"linkId\": \"requestedAccess_reasonsForAccessMoreinfo\",\n \"text\": \"Reason for access - further information\",\n \"answer\": [\n {\n \"valueString\": \"No internet connection\"\n }\n ]\n }\n ]\n }\n ]\n}", "options": { "raw": { "language": "json" @@ -166,12 +521,12 @@ "QuestionnaireResponse" ] }, - "description": "Example of an adult to adult access request where the patient cannot consent with the reference code returned" + "description": "Example of an adult to child access request with the reference code returned" }, "response": [] }, { - "name": "Adult nominates adult access request", + "name": "Adult to adult with ability to consent access request", "event": [ { "listen": "test", @@ -203,7 +558,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"resourceType\": \"QuestionnaireResponse\",\n \"status\": \"completed\",\n \"authored\": \"2024-07-15T09:43:03.280Z\",\n \"source\": {\n \"type\": \"Patient\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000006\"\n }\n },\n \"subject\": {\n \"type\": \"Patient\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000006\"\n }\n },\n \"questionnaire\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Questionnaire/01dc6813-3421-4d14-948d-a4888241add1\",\n \"item\": [\n {\n \"linkId\": \"relatedPerson\",\n \"text\": \"Proxy details\",\n \"item\": [\n {\n \"linkId\": \"relatedPerson_identifier\",\n \"text\": \"NHS number\",\n \"answer\": [\n {\n \"valueString\": \"9000000005\"\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_name\",\n \"text\": \"Name\",\n \"item\": [\n {\n \"linkId\": \"relatedPerson_name_first\",\n \"text\": \"First name\",\n \"answer\": [\n {\n \"valueString\": \"Tom\"\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_name_family\",\n \"text\": \"Last name\",\n \"answer\": [\n {\n \"valueString\": \"Jones\"\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_birthDate\",\n \"text\": \"Date of birth\",\n \"answer\": [\n {\n \"valueDate\": \"1970-07-12\"\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_basisForAccess\",\n \"text\": \"Basis for Access\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.hl7.org.uk/CodeSystem/UKCore-AdditionalPersonRelationshipRole\",\n \"code\": \"Personal\",\n \"display\": \"Personal relationship with the patient\"\n }\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_relationship\",\n \"text\": \"Relationship\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",\n \"code\": \"SPS\",\n \"display\": \"Spouse\"\n }\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"patient\",\n \"text\": \"Patient details\",\n \"item\": [\n {\n \"linkId\": \"patient_identifier\",\n \"text\": \"NHS number\",\n \"answer\": [\n {\n \"valueString\": \"9000000006\"\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"requestedAccess\",\n \"text\": \"Requested access\",\n \"item\": [\n {\n \"linkId\": \"requestedAccess_accessLevel\",\n \"text\": \"Requested access level\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-RequestedAccess\",\n \"code\": \"APPT\",\n \"display\": \"Appointment Booking\"\n }\n },\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-RequestedAccess\",\n \"code\": \"VACC\",\n \"display\": \"Vaccination Records\"\n }\n }\n ]\n },\n {\n \"linkId\": \"requestedAccess_reasonsForAccess\",\n \"text\": \"Reason for access\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-ReasonForAccess\",\n \"code\": \"PRAC\",\n \"display\": \"Practical Reasons\"\n }\n }\n ]\n }\n ]\n }\n ]\n}", + "raw": "{\n \"resourceType\": \"QuestionnaireResponse\",\n \"status\": \"completed\",\n \"authored\": \"2024-07-15T09:43:03.280Z\",\n \"source\": {\n \"type\": \"RelatedPerson\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000005\"\n }\n },\n \"subject\": {\n \"type\": \"Patient\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000006\"\n }\n },\n \"questionnaire\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Questionnaire/01dc6813-3421-4d14-948d-a4888241add1\",\n \"item\": [\n {\n \"linkId\": \"relatedPerson\",\n \"text\": \"Proxy details\",\n \"item\": [\n {\n \"linkId\": \"relatedPerson_identifier\",\n \"text\": \"NHS number\",\n \"answer\": [\n {\n \"valueString\": \"9000000005\"\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_basisForAccess\",\n \"text\": \"Basis for Access\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.hl7.org.uk/CodeSystem/UKCore-AdditionalPersonRelationshipRole\",\n \"code\": \"Personal\",\n \"display\": \"Personal relationship with the patient\"\n }\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_relationship\",\n \"text\": \"Relationship\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",\n \"code\": \"SPS\",\n \"display\": \"Spouse\"\n }\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"patient\",\n \"text\": \"Patient details\",\n \"item\": [\n {\n \"linkId\": \"patient_identifier\",\n \"text\": \"NHS number\",\n \"answer\": [\n {\n \"valueString\": \"9000000006\"\n }\n ]\n },\n {\n \"linkId\": \"patient_name\",\n \"text\": \"Name\",\n \"item\": [\n {\n \"linkId\": \"patient_name_first\",\n \"text\": \"First name\",\n \"answer\": [\n {\n \"valueString\": \"Jill\"\n }\n ]\n },\n {\n \"linkId\": \"patient_name_family\",\n \"text\": \"Last name\",\n \"answer\": [\n {\n \"valueString\": \"Jones\"\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"patient_birthDate\",\n \"text\": \"Date of birth\",\n \"answer\": [\n {\n \"valueDate\": \"1965-01-01\"\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"requestedAccess\",\n \"text\": \"Requested access\",\n \"item\": [\n {\n \"linkId\": \"requestedAccess_accessLevel\",\n \"text\": \"Requested access level\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-RequestedAccess\",\n \"code\": \"APPT\",\n \"display\": \"Appointment Booking\"\n }\n },\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-RequestedAccess\",\n \"code\": \"VACC\",\n \"display\": \"Vaccination Records\"\n }\n }\n ]\n },\n {\n \"linkId\": \"requestedAccess_reasonsForAccess\",\n \"text\": \"Reason for access\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-ReasonForAccess\",\n \"code\": \"PRAC\",\n \"display\": \"Practical Reasons\"\n }\n }\n ]\n }\n ]\n }\n ]\n}", "options": { "raw": { "language": "json" @@ -219,46 +574,153 @@ "QuestionnaireResponse" ] }, - "description": "Example of an adult to adult access request where the patient is the applicant with the reference code returned" + "description": "Example of an adult to adult access request where the patient can consent with the reference code returned" }, "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } }, { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "const expectedResponseBody = {", - " \"resourceType\": \"OperationOutcome\",", - " \"issue\": [", - " {", - " \"severity\": \"information\",", - " \"code\": \"informational\",", - " \"details\": {", - " \"coding\": [", - " {", - " \"code\": \"19318ZGLAB\",", - " \"display\": \"19318ZGLAB\"", - " }", - " ]", - " }", - " }", - " ]", - "};", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "name": "Adult to adult without ability to consent access request", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/fhir+json" + }, + { + "key": "X-Request-ID", + "value": "d967f4c9-8e83-4930-97ab-ae4e122d8ca5", + "type": "text" + }, + { + "key": "X-Correlation-ID", + "value": "8717c840-c222-4f84-a880-45bc129f8382", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"resourceType\": \"QuestionnaireResponse\",\n \"status\": \"completed\",\n \"authored\": \"2024-07-15T09:43:03.280Z\",\n \"source\": {\n \"type\": \"RelatedPerson\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9876543210\"\n }\n },\n \"subject\": {\n \"type\": \"Patient\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000008\"\n }\n },\n \"questionnaire\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Questionnaire/01dc6813-3421-4d14-948d-a4888241add1\",\n \"item\": [\n {\n \"linkId\": \"relatedPerson\",\n \"text\": \"Proxy details\",\n \"item\": [\n {\n \"linkId\": \"relatedPerson_identifier\",\n \"text\": \"NHS number\",\n \"answer\": [\n {\n \"valueString\": \"9876543210\"\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_basisForAccess\",\n \"text\": \"Basis for Access\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.nhs.uk/STU3/CodeSystem/RARecord-ProxyRole-1\",\n \"code\": \"002\",\n \"display\": \"Best interest decision made on behalf of the patient (Mental Capacity Act 2005)\"\n }\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_relationship\",\n \"text\": \"Relationship\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",\n \"code\": \"CHILD\",\n \"display\": \"Child\"\n }\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"patient\",\n \"text\": \"Patient details\",\n \"item\": [\n {\n \"linkId\": \"patient_identifier\",\n \"text\": \"NHS number\",\n \"answer\": [\n {\n \"valueString\": \"9000000008\"\n }\n ]\n },\n {\n \"linkId\": \"patient_name\",\n \"text\": \"Name\",\n \"item\": [\n {\n \"linkId\": \"patient_name_first\",\n \"text\": \"First name\",\n \"answer\": [\n {\n \"valueString\": \"Florence\"\n }\n ]\n },\n {\n \"linkId\": \"patient_name_family\",\n \"text\": \"Last name\",\n \"answer\": [\n {\n \"valueString\": \"Smith\"\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"patient_birthDate\",\n \"text\": \"Date of birth\",\n \"answer\": [\n {\n \"valueDate\": \"1935-01-02\"\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"requestedAccess\",\n \"text\": \"Requested access\",\n \"item\": [\n {\n \"linkId\": \"requestedAccess_accessLevel\",\n \"text\": \"Requested access level\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-RequestedAccess\",\n \"code\": \"APPT\",\n \"display\": \"Appointment Booking\"\n }\n },\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-RequestedAccess\",\n \"code\": \"VACC\",\n \"display\": \"Vaccination Records\"\n }\n }\n ]\n },\n {\n \"linkId\": \"requestedAccess_reasonsForAccess\",\n \"text\": \"Reason for access\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-ReasonForAccess\",\n \"code\": \"TECH\",\n \"display\": \"Technical Barriers\"\n }\n }\n ]\n }\n ]\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{api_base_url}}/QuestionnaireResponse", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "QuestionnaireResponse" + ] + }, + "description": "Example of an adult to adult access request where the patient cannot consent with the reference code returned" + }, + "response": [] + }, + { + "name": "Adult nominates adult access request", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/fhir+json" + }, + { + "key": "X-Request-ID", + "value": "d967f4c9-8e83-4930-97ab-ae4e122d8ca5", + "type": "text" + }, + { + "key": "X-Correlation-ID", + "value": "8717c840-c222-4f84-a880-45bc129f8382", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"resourceType\": \"QuestionnaireResponse\",\n \"status\": \"completed\",\n \"authored\": \"2024-07-15T09:43:03.280Z\",\n \"source\": {\n \"type\": \"Patient\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000006\"\n }\n },\n \"subject\": {\n \"type\": \"Patient\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000006\"\n }\n },\n \"questionnaire\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Questionnaire/01dc6813-3421-4d14-948d-a4888241add1\",\n \"item\": [\n {\n \"linkId\": \"relatedPerson\",\n \"text\": \"Proxy details\",\n \"item\": [\n {\n \"linkId\": \"relatedPerson_identifier\",\n \"text\": \"NHS number\",\n \"answer\": [\n {\n \"valueString\": \"9000000005\"\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_name\",\n \"text\": \"Name\",\n \"item\": [\n {\n \"linkId\": \"relatedPerson_name_first\",\n \"text\": \"First name\",\n \"answer\": [\n {\n \"valueString\": \"Tom\"\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_name_family\",\n \"text\": \"Last name\",\n \"answer\": [\n {\n \"valueString\": \"Jones\"\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_birthDate\",\n \"text\": \"Date of birth\",\n \"answer\": [\n {\n \"valueDate\": \"1970-07-12\"\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_basisForAccess\",\n \"text\": \"Basis for Access\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.hl7.org.uk/CodeSystem/UKCore-AdditionalPersonRelationshipRole\",\n \"code\": \"Personal\",\n \"display\": \"Personal relationship with the patient\"\n }\n }\n ]\n },\n {\n \"linkId\": \"relatedPerson_relationship\",\n \"text\": \"Relationship\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",\n \"code\": \"SPS\",\n \"display\": \"Spouse\"\n }\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"patient\",\n \"text\": \"Patient details\",\n \"item\": [\n {\n \"linkId\": \"patient_identifier\",\n \"text\": \"NHS number\",\n \"answer\": [\n {\n \"valueString\": \"9000000006\"\n }\n ]\n }\n ]\n },\n {\n \"linkId\": \"requestedAccess\",\n \"text\": \"Requested access\",\n \"item\": [\n {\n \"linkId\": \"requestedAccess_accessLevel\",\n \"text\": \"Requested access level\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-RequestedAccess\",\n \"code\": \"APPT\",\n \"display\": \"Appointment Booking\"\n }\n },\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-RequestedAccess\",\n \"code\": \"VACC\",\n \"display\": \"Vaccination Records\"\n }\n }\n ]\n },\n {\n \"linkId\": \"requestedAccess_reasonsForAccess\",\n \"text\": \"Reason for access\",\n \"answer\": [\n {\n \"valueCoding\": {\n \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-ReasonForAccess\",\n \"code\": \"PRAC\",\n \"display\": \"Practical Reasons\"\n }\n }\n ]\n }\n ]\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{api_base_url}}/QuestionnaireResponse", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "QuestionnaireResponse" + ] + }, + "description": "Example of an adult to adult access request where the patient is the applicant with the reference code returned" + }, + "response": [] + } + ], + "description": "The POST Questionnaire Response endpoint is used to submit a proxy access request for a given performer and patient.\n\nIt is indended to be used by user facing service e.g. Proxy Access Service, who will collect the necessary information from the user and submit it to VRS as a QuestionnaireResponse.\n\nThis folder contains requests covering different scenarios of valid and invalid requests.\n\nFor more details, please refer to the [POST Questionnaire Response OAS page for the Validated Relationship Service on the NHS England website.](https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service#post-/QuestionnaireResponse)", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "const expectedResponseBody = {", + " \"resourceType\": \"OperationOutcome\",", + " \"issue\": [", + " {", + " \"severity\": \"information\",", + " \"code\": \"informational\",", + " \"details\": {", + " \"coding\": [", + " {", + " \"code\": \"19318ZGLAB\",", + " \"display\": \"19318ZGLAB\"", + " }", + " ]", + " }", + " }", + " ]", + "};", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response has the correct body\", () => {", @@ -1427,10 +1889,10 @@ "response": [] } ], - "description": "Examples of how to utilise the API to list relationships for a given NHS record." + "description": "The GET Related Person endpoint retrieves candidate proxy relationships for a user with a given NHS Number.\n\nThis endpoint should NOT be used to retrieve proxy relationships; these should be queried from the `/Consent` endpoint.\n\nThis folder contains requests covering different scenarios of valid and invalid requests.\n\nFor more details, please refer to the [GET Related Person OAS page for the Validated Relationship Service on the NHS England website.](https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service#get-/RelatedPerson)" }, { - "name": "Get proxy relationships (Consent)", + "name": "Get proxy roles (Consent)", "item": [ { "name": "Filtered proxy relationships by 'active' status include details", @@ -6021,95 +6483,40 @@ "response": [] } ], - "description": "# Get proxy relationships (consent)\n\nThe GET /Consent is for retrieving confirmed proxy relationships via the Validated Relationships Service.\n\nThis folder contains requests covering different scenarios for users with different types of proxy relationship. Also includes error scenarios.\n\nFor more details please see the [OAS page for Validated Relationships Service consent on the NHS England website.](https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service#get-/Consent)" + "description": "The GET /Consent is for retrieving confirmed proxy relationships via the Validated Relationship Service.\n\nThis folder contains requests covering different scenarios for users with different types of proxy relationship. Also includes error scenarios.\n\nFor more details, please refer to the [GET Consent OAS page for the Validated Relationship Service on the NHS England website.](https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service#get-/Consent)" }, { - "name": "Get proxy relationship (Consent)", + "name": "Create a proxy role (Consent)", "item": [ { - "name": "Retrieve consenting adult relationship", + "name": "Parent-child proxy creation", "event": [ { "listen": "test", "script": { "exec": [ "const expectedResponseBody = {", - " \"resourceType\": \"Bundle\",", - " \"timestamp\": \"2020-08-26T14:00:00+00:00\",", - " \"total\": 1,", - " \"type\": \"searchset\",", - " \"entry\": [", + " \"resourceType\": \"OperationOutcome\",", + " \"issue\": [", " {", - " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/WWCC67T1\",", - " \"resource\": {", - " \"resourceType\": \"Consent\",", - " \"id\": \"WWCC67T1\",", - " \"status\": \"active\",", - " \"scope\": {", - " \"coding\": [", - " {", - " \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",", - " \"code\": \"patient-privacy\",", - " \"display\": \"Privacy Consent\"", - " }", - " ],", - " \"text\": \"Patient Privacy Consent\"", - " },", - " \"category\": [", - " {", - " \"coding\": [", - " {", - " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",", - " \"code\": \"INFA\",", - " \"display\": \"Information Access\"", - " }", - " ],", - " \"text\": \"Information Access Consent\"", - " }", - " ],", - " \"patient\": {", - " \"identifier\": {", - " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000005\"", - " }", - " },", - " \"dateTime\": \"2024-07-21T17:32:28Z\",", - " \"performer\": [", - " {", - " \"identifier\": {", - " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000010\"", - " }", - " }", - " ],", - " \"verification\": [", - " {", - " \"verified\": true,", - " \"verifiedWith\": {", - " \"identifier\": {", - " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000005\"", - " }", - " },", - " \"verificationDate\": \"2024-07-21T17:32:28Z\"", - " }", - " ]", - " },", - " \"search\": {", - " \"mode\": \"match\"", - " }", + " \"severity\": \"information\",", + " \"code\": \"informational\"", " }", " ]", "}", "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", "});", "", "pm.test(\"Should have correct response body\", () => {", - " const responseJson = pm.response.json();", + " var responseJson = pm.response.json();", " pm.expect(responseJson).to.eql(expectedResponseBody);", - "});" + "});", + "", + "pm.test(\"Location header is returned\", () => {", + " pm.response.to.have.header(\"Location\", \"https://sandbox.api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/90b9863e-e33c-4895-a333-fd0ea0e23205\")", + "})" ], "type": "text/javascript", "packages": {} @@ -6117,302 +6524,58 @@ } ], "request": { - "method": "GET", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"resourceType\": \"Consent\",\n \"status\": \"active\",\n \"scope\": {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",\n \"code\": \"patient-privacy\",\n \"display\": \"Privacy Consent\"\n }\n ],\n \"text\": \"Patient Privacy Consent\"\n },\n \"category\": [\n {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",\n \"code\": \"INFA\",\n \"display\": \"Information Access\"\n }\n ],\n \"text\": \"Information Access Consent\"\n }\n ],\n \"patient\": {\n \"type\": \"Patient\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000012\"\n }\n },\n \"dateTime\": \"2025-02-11T14:30:00Z\",\n \"performer\": [\n {\n \"type\": \"RelatedPerson\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000009\"\n }\n }\n ],\n \"provision\": {\n \"period\": {\n \"start\": \"2025-02-11\",\n \"end\": \"2026-02-11\"\n },\n \"actor\": [\n {\n \"role\": {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",\n \"code\": \"PRN\",\n \"display\": \"Parent\"\n }\n ]\n },\n \"reference\": {\n \"type\": \"RelatedPerson\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000009\"\n }\n }\n }\n ]\n },\n \"extension\": [\n {\n \"url\": \"https://fhir.hl7.org.uk/StructureDefinition/Extension-statusReason\",\n \"valueCodeableConcept\": {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consent-reason\",\n \"code\": \"TBC\",\n \"display\": \"TBC\"\n }\n ]\n }\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{api_base_url}}/Consent/74eed847-ca25-4e76-8cf2-f2c2d7842a7a", + "raw": "{{api_base_url}}/Consent", "host": [ "{{api_base_url}}" ], "path": [ - "Consent", - "74eed847-ca25-4e76-8cf2-f2c2d7842a7a" + "Consent" ] } }, "response": [] }, { - "name": "Retrieve consenting adult relationship with patient details", + "name": "Adult-adult proxy creation", "event": [ { "listen": "test", "script": { "exec": [ "const expectedResponseBody = {", - " \"resourceType\": \"Bundle\",", - " \"timestamp\": \"2020-08-26T14:00:00+00:00\",", - " \"total\": 3,", - " \"type\": \"searchset\",", - " \"entry\": [", - " {", - " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Patient/DFCC67F5\",", - " \"resource\": {", - " \"resourceType\": \"Patient\",", - " \"id\": \"DFCC67F5\",", - " \"identifier\": [", - " {", - " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000005\"", - " },", - " {", - " \"system\": \"https://placeholder.fhir.nhs.uk/Id/local-gp-patient-identifier\",", - " \"value\": \"ABC1234567\"", - " }", - " ],", - " \"name\": [", - " {", - " \"id\": \"123456\",", - " \"use\": \"usual\",", - " \"period\": {", - " \"start\": \"2020-01-01\",", - " \"end\": \"2021-12-31\"", - " },", - " \"given\": [", - " \"Sally\"", - " ],", - " \"family\": \"Evans\",", - " \"prefix\": [", - " \"Mrs\"", - " ]", - " }", - " ],", - " \"birthDate\": \"1995-10-22\",", - " \"generalPractitioner\": [", - " {", - " \"type\": \"Organization\",", - " \"identifier\": {", - " \"value\": \"ODS12345\",", - " \"system\": \"https://fhir.nhs.uk/Id/ods-organization-code\"", - " }", - " }", - " ]", - " },", - " \"search\": {", - " \"mode\": \"include\"", - " }", - " },", - " {", - " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/WWCC67T1\",", - " \"resource\": {", - " \"resourceType\": \"Consent\",", - " \"id\": \"WWCC67T1\",", - " \"status\": \"active\",", - " \"scope\": {", - " \"coding\": [", - " {", - " \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",", - " \"code\": \"patient-privacy\",", - " \"display\": \"Privacy Consent\"", - " }", - " ],", - " \"text\": \"Patient Privacy Consent\"", - " },", - " \"category\": [", - " {", - " \"coding\": [", - " {", - " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",", - " \"code\": \"INFA\",", - " \"display\": \"Information Access\"", - " }", - " ],", - " \"text\": \"Information Access Consent\"", - " }", - " ],", - " \"patient\": {", - " \"identifier\": {", - " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000005\"", - " }", - " },", - " \"dateTime\": \"2024-07-21T17:32:28Z\",", - " \"performer\": [", - " {", - " \"identifier\": {", - " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000010\"", - " }", - " }", - " ],", - " \"verification\": [", - " {", - " \"verified\": true,", - " \"verifiedWith\": {", - " \"identifier\": {", - " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000005\"", - " }", - " },", - " \"verificationDate\": \"2024-07-21T17:32:28Z\"", - " }", - " ]", - " },", - " \"search\": {", - " \"mode\": \"match\"", - " }", - " }", - " ]", + " \"resourceType\": \"OperationOutcome\",", + " \"issue\": [", + " {", + " \"severity\": \"information\",", + " \"code\": \"informational\"", + " }", + " ]", "}", "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", "});", "", "pm.test(\"Should have correct response body\", () => {", - " const responseJson = pm.response.json();", + " var responseJson = pm.response.json();", " pm.expect(responseJson).to.eql(expectedResponseBody);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{api_base_url}}/Consent/74eed847-ca25-4e76-8cf2-f2c2d7842a7a?_include=Consent:patient", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent", - "74eed847-ca25-4e76-8cf2-f2c2d7842a7a" - ], - "query": [ - { - "key": "_include", - "value": "Consent:patient" - } - ] - } - }, - "response": [] - }, - { - "name": "Retrieve consenting adult relationship with performer details", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "const expectedResponseBody = {", - " \"resourceType\": \"Bundle\",", - " \"timestamp\": \"2020-08-26T14:00:00+00:00\",", - " \"total\": 3,", - " \"type\": \"searchset\",", - " \"entry\": [", - " {", - " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/RelatedPerson/RP974720\",", - " \"resource\": {", - " \"resourceType\": \"RelatedPerson\",", - " \"id\": \"RP974720\",", - " \"identifier\": [", - " {", - " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000010\"", - " },", - " {", - " \"system\": \"https://placeholder.fhir.nhs.uk/Id/local-gp-patient-identifier\",", - " \"value\": \"ABC0000008\"", - " }", - " ],", - " \"patient\": {", - " \"type\": \"Patient\",", - " \"identifier\": {", - " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000005\"", - " }", - " },", - " \"relationship\": [", - " {", - " \"coding\": [", - " {", - " \"system\": \"https://fhir.hl7.org.uk/CodeSystem/UKCore-AdditionalPersonRelationshipRole\",", - " \"code\": \"Personal\",", - " \"display\": \"Personal relationship with the patient\"", - " }", - " ]", - " }", - " ]", - " },", - " \"search\": {", - " \"mode\": \"include\"", - " }", - " },", - " {", - " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/WWCC67T1\",", - " \"resource\": {", - " \"resourceType\": \"Consent\",", - " \"id\": \"WWCC67T1\",", - " \"status\": \"active\",", - " \"scope\": {", - " \"coding\": [", - " {", - " \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",", - " \"code\": \"patient-privacy\",", - " \"display\": \"Privacy Consent\"", - " }", - " ],", - " \"text\": \"Patient Privacy Consent\"", - " },", - " \"category\": [", - " {", - " \"coding\": [", - " {", - " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",", - " \"code\": \"INFA\",", - " \"display\": \"Information Access\"", - " }", - " ],", - " \"text\": \"Information Access Consent\"", - " }", - " ],", - " \"patient\": {", - " \"identifier\": {", - " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000005\"", - " }", - " },", - " \"dateTime\": \"2024-07-21T17:32:28Z\",", - " \"performer\": [", - " {", - " \"identifier\": {", - " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000010\"", - " }", - " }", - " ],", - " \"verification\": [", - " {", - " \"verified\": true,", - " \"verifiedWith\": {", - " \"identifier\": {", - " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000005\"", - " }", - " },", - " \"verificationDate\": \"2024-07-21T17:32:28Z\"", - " }", - " ]", - " },", - " \"search\": {", - " \"mode\": \"match\"", - " }", - " }", - " ]", - "}", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", "});", "", - "pm.test(\"Should have correct response body\", () => {", - " const responseJson = pm.response.json();", - " pm.expect(responseJson).to.eql(expectedResponseBody);", - "});" + "pm.test(\"Location header is returned\", () => {", + " pm.response.to.have.header(\"Location\", \"https://sandbox.api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/90b9863e-e33c-4895-a333-fd0ea0e23205\")", + "})" ], "type": "text/javascript", "packages": {} @@ -6420,196 +6583,66 @@ } ], "request": { - "method": "GET", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"resourceType\": \"Consent\",\n \"status\": \"active\",\n \"scope\": {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",\n \"code\": \"patient-privacy\",\n \"display\": \"Privacy Consent\"\n }\n ],\n \"text\": \"Patient Privacy Consent\"\n },\n \"category\": [\n {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",\n \"code\": \"INFA\",\n \"display\": \"Information Access\"\n }\n ],\n \"text\": \"Information Access Consent\"\n }\n ],\n \"patient\": {\n \"type\": \"Patient\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000012\"\n }\n },\n \"dateTime\": \"2025-02-11T14:30:00Z\",\n \"performer\": [\n {\n \"type\": \"RelatedPerson\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000017\"\n }\n }\n ],\n \"provision\": {\n \"period\": {\n \"start\": \"2025-02-11\"\n },\n \"actor\": [\n {\n \"role\": {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",\n \"code\": \"GUARD\",\n \"display\": \"Guardian\"\n }\n ]\n },\n \"reference\": {\n \"type\": \"RelatedPerson\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000017\"\n }\n }\n }\n ]\n },\n \"extension\": [\n {\n \"url\": \"https://fhir.hl7.org.uk/StructureDefinition/Extension-statusReason\",\n \"valueCodeableConcept\": {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consent-reason\",\n \"code\": \"TBC\",\n \"display\": \"TBC\"\n }\n ]\n }\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{api_base_url}}/Consent/74eed847-ca25-4e76-8cf2-f2c2d7842a7a?_include=Consent:performer", + "raw": "{{api_base_url}}/Consent", "host": [ "{{api_base_url}}" ], "path": [ - "Consent", - "74eed847-ca25-4e76-8cf2-f2c2d7842a7a" - ], - "query": [ - { - "key": "_include", - "value": "Consent:performer" - } + "Consent" ] } }, "response": [] }, { - "name": "Retrieve consenting adult relationship with performer and patient details", + "name": "Invalid performer NHS number", "event": [ { "listen": "test", "script": { "exec": [ "const expectedResponseBody = {", - " \"resourceType\": \"Bundle\",", - " \"timestamp\": \"2020-08-26T14:00:00+00:00\",", - " \"total\": 3,", - " \"type\": \"searchset\",", - " \"entry\": [", - " {", - " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/RelatedPerson/RP974720\",", - " \"resource\": {", - " \"resourceType\": \"RelatedPerson\",", - " \"id\": \"RP974720\",", - " \"identifier\": [", - " {", - " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000010\"", - " },", - " {", - " \"system\": \"https://placeholder.fhir.nhs.uk/Id/local-gp-patient-identifier\",", - " \"value\": \"ABC0000008\"", - " }", - " ],", - " \"patient\": {", - " \"type\": \"Patient\",", - " \"identifier\": {", - " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000005\"", - " }", - " },", - " \"relationship\": [", - " {", - " \"coding\": [", - " {", - " \"system\": \"https://fhir.hl7.org.uk/CodeSystem/UKCore-AdditionalPersonRelationshipRole\",", - " \"code\": \"Personal\",", - " \"display\": \"Personal relationship with the patient\"", - " }", - " ]", - " }", - " ]", - " },", - " \"search\": {", - " \"mode\": \"include\"", - " }", - " },", - " {", - " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Patient/DFCC67F5\",", - " \"resource\": {", - " \"resourceType\": \"Patient\",", - " \"id\": \"DFCC67F5\",", - " \"identifier\": [", - " {", - " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000005\"", - " },", - " {", - " \"system\": \"https://placeholder.fhir.nhs.uk/Id/local-gp-patient-identifier\",", - " \"value\": \"ABC1234567\"", - " }", - " ],", - " \"name\": [", - " {", - " \"id\": \"123456\",", - " \"use\": \"usual\",", - " \"period\": {", - " \"start\": \"2020-01-01\",", - " \"end\": \"2021-12-31\"", - " },", - " \"given\": [", - " \"Sally\"", - " ],", - " \"family\": \"Evans\",", - " \"prefix\": [", - " \"Mrs\"", - " ]", - " }", - " ],", - " \"birthDate\": \"1995-10-22\",", - " \"generalPractitioner\": [", - " {", - " \"type\": \"Organization\",", - " \"identifier\": {", - " \"value\": \"ODS12345\",", - " \"system\": \"https://fhir.nhs.uk/Id/ods-organization-code\"", - " }", - " }", - " ]", - " },", - " \"search\": {", - " \"mode\": \"include\"", - " }", - " },", - " {", - " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/WWCC67T1\",", - " \"resource\": {", - " \"resourceType\": \"Consent\",", - " \"id\": \"WWCC67T1\",", - " \"status\": \"active\",", - " \"scope\": {", - " \"coding\": [", - " {", - " \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",", - " \"code\": \"patient-privacy\",", - " \"display\": \"Privacy Consent\"", - " }", - " ],", - " \"text\": \"Patient Privacy Consent\"", - " },", - " \"category\": [", - " {", - " \"coding\": [", - " {", - " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",", - " \"code\": \"INFA\",", - " \"display\": \"Information Access\"", - " }", - " ],", - " \"text\": \"Information Access Consent\"", - " }", - " ],", - " \"patient\": {", - " \"identifier\": {", - " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000005\"", - " }", - " },", - " \"dateTime\": \"2024-07-21T17:32:28Z\",", - " \"performer\": [", - " {", - " \"identifier\": {", - " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000010\"", - " }", - " }", - " ],", - " \"verification\": [", - " {", - " \"verified\": true,", - " \"verifiedWith\": {", - " \"identifier\": {", - " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000005\"", - " }", + " \"issue\": [", + " {", + " \"code\": \"invalid\",", + " \"diagnostics\": \"Not a valid NHS Number provided for the Performer identifier parameter\",", + " \"details\": {", + " \"coding\": [", + " {", + " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", + " \"version\": \"1\",", + " \"code\": \"INVALID_IDENTIFIER\",", + " \"display\": \"Provided value is invalid\"", + " }", + " ]", " },", - " \"verificationDate\": \"2024-07-21T17:32:28Z\"", - " }", - " ]", - " },", - " \"search\": {", - " \"mode\": \"match\"", - " }", - " }", - " ]", + " \"severity\": \"error\"", + " }", + " ],", + " \"resourceType\": \"OperationOutcome\"", "}", "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"Status code is 422\", function () {", + " pm.response.to.have.status(422);", "});", "", "pm.test(\"Should have correct response body\", () => {", - " const responseJson = pm.response.json();", + " var responseJson = pm.response.json();", " pm.expect(responseJson).to.eql(expectedResponseBody);", - "});" + "});", + "" ], "type": "text/javascript", "packages": {} @@ -6617,93 +6650,176 @@ } ], "request": { - "method": "GET", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"resourceType\": \"Consent\",\n \"status\": \"active\",\n \"scope\": {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",\n \"code\": \"patient-privacy\",\n \"display\": \"Privacy Consent\"\n }\n ],\n \"text\": \"Patient Privacy Consent\"\n },\n \"category\": [\n {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",\n \"code\": \"INFA\",\n \"display\": \"Information Access\"\n }\n ],\n \"text\": \"Information Access Consent\"\n }\n ],\n \"patient\": {\n \"type\": \"Patient\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000012\"\n }\n },\n \"dateTime\": \"2025-02-11T14:30:00Z\",\n \"performer\": [\n {\n \"type\": \"RelatedPerson\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000000\"\n }\n }\n ],\n \"provision\": {\n \"period\": {\n \"start\": \"2025-02-11\"\n },\n \"actor\": [\n {\n \"role\": {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",\n \"code\": \"GUARD\",\n \"display\": \"Guardian\"\n }\n ]\n },\n \"reference\": {\n \"type\": \"RelatedPerson\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000000\"\n }\n }\n }\n ]\n },\n \"extension\": [\n {\n \"url\": \"https://fhir.hl7.org.uk/StructureDefinition/Extension-statusReason\",\n \"valueCodeableConcept\": {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consent-reason\",\n \"code\": \"TBC\",\n \"display\": \"TBC\"\n }\n ]\n }\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{api_base_url}}/Consent/74eed847-ca25-4e76-8cf2-f2c2d7842a7a?_include=Consent:performer&_include=Consent:patient", + "raw": "{{api_base_url}}/Consent", "host": [ "{{api_base_url}}" ], "path": [ - "Consent", - "74eed847-ca25-4e76-8cf2-f2c2d7842a7a" - ], - "query": [ - { - "key": "_include", - "value": "Consent:performer" - }, - { - "key": "_include", - "value": "Consent:patient" - } + "Consent" ] } }, "response": [] }, { - "name": "Retrieve mother-child relationship", + "name": "Duplicate relationship", "event": [ { "listen": "test", "script": { "exec": [ "const expectedResponseBody = {", - " \"resourceType\": \"Bundle\",", - " \"timestamp\": \"2020-08-26T14:00:00+00:00\",", - " \"total\": 1,", - " \"type\": \"searchset\",", - " \"entry\": [", - " {", - " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/BBCC67E9\",", - " \"resource\": {", - " \"resourceType\": \"Consent\",", - " \"id\": \"BBCC67E9\",", - " \"status\": \"active\",", - " \"scope\": {", - " \"coding\": [", - " {", - " \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",", - " \"code\": \"patient-privacy\",", - " \"display\": \"Privacy Consent\"", - " }", - " ],", - " \"text\": \"Patient Privacy Consent\"", - " },", - " \"category\": [", - " {", - " \"coding\": [", - " {", - " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",", - " \"code\": \"INFA\",", - " \"display\": \"Information Access\"", - " }", - " ],", - " \"text\": \"Information Access Consent\"", - " }", - " ],", - " \"patient\": {", - " \"identifier\": {", - " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000009\"", - " }", - " },", - " \"dateTime\": \"2024-07-21T17:32:28Z\",", - " \"performer\": [", - " {", - " \"identifier\": {", - " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000019\"", + " \"issue\": [", + " {", + " \"code\": \"invalid\",", + " \"diagnostics\": \"Proxy role already exists.\",", + " \"details\": {", + " \"coding\": [", + " {", + " \"code\": \"DUPLICATE_RELATIONSHIP\",", + " \"display\": \"Request must be for a new proxy role.\",", + " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", + " \"version\": \"1\"", + " }", + " ]", + " },", + " \"severity\": \"error\"", + " }", + " ],", + " \"resourceType\": \"OperationOutcome\"", + "}", + "", + "pm.test(\"Status code is 409\", function () {", + " pm.response.to.have.status(409);", + "});", + "", + "pm.test(\"Should have correct response body\", () => {", + " var responseJson = pm.response.json();", + " pm.expect(responseJson).to.eql(expectedResponseBody);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"resourceType\": \"Consent\",\n \"status\": \"active\",\n \"scope\": {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",\n \"code\": \"patient-privacy\",\n \"display\": \"Privacy Consent\"\n }\n ],\n \"text\": \"Patient Privacy Consent\"\n },\n \"category\": [\n {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",\n \"code\": \"INFA\",\n \"display\": \"Information Access\"\n }\n ],\n \"text\": \"Information Access Consent\"\n }\n ],\n \"patient\": {\n \"type\": \"Patient\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000000\"\n }\n },\n \"dateTime\": \"2025-02-11T14:30:00Z\",\n \"performer\": [\n {\n \"type\": \"RelatedPerson\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000049\"\n }\n }\n ],\n \"provision\": {\n \"period\": {\n \"start\": \"2025-02-11\"\n },\n \"actor\": [\n {\n \"role\": {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",\n \"code\": \"GUARD\",\n \"display\": \"Guardian\"\n }\n ]\n },\n \"reference\": {\n \"type\": \"RelatedPerson\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000049\"\n }\n }\n }\n ]\n },\n \"extension\": [\n {\n \"url\": \"https://fhir.hl7.org.uk/StructureDefinition/Extension-statusReason\",\n \"valueCodeableConcept\": {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consent-reason\",\n \"code\": \"TBC\",\n \"display\": \"TBC\"\n }\n ]\n }\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{api_base_url}}/Consent", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ] + } + }, + "response": [] + } + ], + "description": "The POST /Consent is for storing confirmed proxy relationships via the Validated Relationships Service.\n\nThis folder contains requests covering different scenarios for users with different types of proxy relationship. Also includes error scenarios.\n\nFor more details, please refer to the [POST Consent OAS page for the Validated Relationship Service on the NHS England website.](https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service#post-/Consent)" + }, + { + "name": "Get proxy role (Consent)", + "item": [ + { + "name": "Retrieve consenting adult relationship", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const expectedResponseBody = {", + " \"resourceType\": \"Bundle\",", + " \"timestamp\": \"2020-08-26T14:00:00+00:00\",", + " \"total\": 1,", + " \"type\": \"searchset\",", + " \"entry\": [", + " {", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/WWCC67T1\",", + " \"resource\": {", + " \"resourceType\": \"Consent\",", + " \"id\": \"WWCC67T1\",", + " \"status\": \"active\",", + " \"scope\": {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",", + " \"code\": \"patient-privacy\",", + " \"display\": \"Privacy Consent\"", + " }", + " ],", + " \"text\": \"Patient Privacy Consent\"", + " },", + " \"category\": [", + " {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",", + " \"code\": \"INFA\",", + " \"display\": \"Information Access\"", + " }", + " ],", + " \"text\": \"Information Access Consent\"", + " }", + " ],", + " \"patient\": {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000005\"", + " }", + " },", + " \"dateTime\": \"2024-07-21T17:32:28Z\",", + " \"performer\": [", + " {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000010\"", + " }", + " }", + " ],", + " \"verification\": [", + " {", + " \"verified\": true,", + " \"verifiedWith\": {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000005\"", + " }", + " },", + " \"verificationDate\": \"2024-07-21T17:32:28Z\"", + " }", + " ]", + " },", + " \"search\": {", + " \"mode\": \"match\"", " }", - " }", - " ]", - " },", - " \"search\": {", - " \"mode\": \"match\"", - " }", - " }", - " ]", + " }", + " ]", "}", "", "pm.test(\"Status code is 200\", function () {", @@ -6724,20 +6840,20 @@ "method": "GET", "header": [], "url": { - "raw": "{{api_base_url}}/Consent/39df03a2-1b14-4d19-b1dc-d5d8cbf96948", + "raw": "{{api_base_url}}/Consent/74eed847-ca25-4e76-8cf2-f2c2d7842a7a", "host": [ "{{api_base_url}}" ], "path": [ "Consent", - "39df03a2-1b14-4d19-b1dc-d5d8cbf96948" + "74eed847-ca25-4e76-8cf2-f2c2d7842a7a" ] } }, "response": [] }, { - "name": "Retrieve mother-child relationship with patient details", + "name": "Retrieve consenting adult relationship with patient details", "event": [ { "listen": "test", @@ -6746,22 +6862,22 @@ "const expectedResponseBody = {", " \"resourceType\": \"Bundle\",", " \"timestamp\": \"2020-08-26T14:00:00+00:00\",", - " \"total\": 3,", + " \"total\": 2,", " \"type\": \"searchset\",", " \"entry\": [", " {", - " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Patient/A3CC67E2\",", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Patient/DFCC67F5\",", " \"resource\": {", " \"resourceType\": \"Patient\",", - " \"id\": \"A3CC67E2\",", + " \"id\": \"DFCC67F5\",", " \"identifier\": [", " {", " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000009\"", + " \"value\": \"9000000005\"", " },", " {", " \"system\": \"https://placeholder.fhir.nhs.uk/Id/local-gp-patient-identifier\",", - " \"value\": \"ABC1234556\"", + " \"value\": \"ABC1234567\"", " }", " ],", " \"name\": [", @@ -6773,19 +6889,15 @@ " \"end\": \"2021-12-31\"", " },", " \"given\": [", - " \"Jane Marie Anne\"", + " \"Sally\"", " ],", - " \"family\": \"Smith\",", + " \"family\": \"Evans\",", " \"prefix\": [", " \"Mrs\"", - " ],", - " \"suffix\": [", - " \"MBE\",", - " \"PhD\"", " ]", " }", " ],", - " \"birthDate\": \"2022-10-22\",", + " \"birthDate\": \"1995-10-22\",", " \"generalPractitioner\": [", " {", " \"type\": \"Organization\",", @@ -6801,10 +6913,10 @@ " }", " },", " {", - " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/BBCC67E9\",", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/WWCC67T1\",", " \"resource\": {", " \"resourceType\": \"Consent\",", - " \"id\": \"BBCC67E9\",", + " \"id\": \"WWCC67T1\",", " \"status\": \"active\",", " \"scope\": {", " \"coding\": [", @@ -6831,7 +6943,7 @@ " \"patient\": {", " \"identifier\": {", " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000009\"", + " \"value\": \"9000000005\"", " }", " },", " \"dateTime\": \"2024-07-21T17:32:28Z\",", @@ -6839,9 +6951,21 @@ " {", " \"identifier\": {", " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000019\"", + " \"value\": \"9000000010\"", " }", " }", + " ],", + " \"verification\": [", + " {", + " \"verified\": true,", + " \"verifiedWith\": {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000005\"", + " }", + " },", + " \"verificationDate\": \"2024-07-21T17:32:28Z\"", + " }", " ]", " },", " \"search\": {", @@ -6869,13 +6993,13 @@ "method": "GET", "header": [], "url": { - "raw": "{{api_base_url}}/Consent/39df03a2-1b14-4d19-b1dc-d5d8cbf96948?_include=Consent:patient", + "raw": "{{api_base_url}}/Consent/74eed847-ca25-4e76-8cf2-f2c2d7842a7a?_include=Consent:patient", "host": [ "{{api_base_url}}" ], "path": [ "Consent", - "39df03a2-1b14-4d19-b1dc-d5d8cbf96948" + "74eed847-ca25-4e76-8cf2-f2c2d7842a7a" ], "query": [ { @@ -6888,7 +7012,7 @@ "response": [] }, { - "name": "Retrieve mother-child relationship with performer details", + "name": "Retrieve consenting adult relationship with performer details", "event": [ { "listen": "test", @@ -6897,43 +7021,38 @@ "const expectedResponseBody = {", " \"resourceType\": \"Bundle\",", " \"timestamp\": \"2020-08-26T14:00:00+00:00\",", - " \"total\": 3,", + " \"total\": 2,", " \"type\": \"searchset\",", " \"entry\": [", " {", - " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/RelatedPerson/BE974742\",", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/RelatedPerson/RP974720\",", " \"resource\": {", " \"resourceType\": \"RelatedPerson\",", - " \"id\": \"BE974742\",", + " \"id\": \"RP974720\",", " \"identifier\": [", " {", " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000019\"", + " \"value\": \"9000000010\"", " },", " {", " \"system\": \"https://placeholder.fhir.nhs.uk/Id/local-gp-patient-identifier\",", - " \"value\": \"ABC0000001\"", + " \"value\": \"ABC0000008\"", " }", " ],", " \"patient\": {", " \"type\": \"Patient\",", " \"identifier\": {", " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000009\"", + " \"value\": \"9000000005\"", " }", " },", " \"relationship\": [", " {", " \"coding\": [", " {", - " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",", - " \"code\": \"PRN\",", - " \"display\": \"parent\"", - " },", - " {", - " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",", - " \"code\": \"MTH\",", - " \"display\": \"mother\"", + " \"system\": \"https://fhir.hl7.org.uk/CodeSystem/UKCore-AdditionalPersonRelationshipRole\",", + " \"code\": \"Personal\",", + " \"display\": \"Personal relationship with the patient\"", " }", " ]", " }", @@ -6944,10 +7063,10 @@ " }", " },", " {", - " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/BBCC67E9\",", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/WWCC67T1\",", " \"resource\": {", " \"resourceType\": \"Consent\",", - " \"id\": \"BBCC67E9\",", + " \"id\": \"WWCC67T1\",", " \"status\": \"active\",", " \"scope\": {", " \"coding\": [", @@ -6974,7 +7093,7 @@ " \"patient\": {", " \"identifier\": {", " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000009\"", + " \"value\": \"9000000005\"", " }", " },", " \"dateTime\": \"2024-07-21T17:32:28Z\",", @@ -6982,9 +7101,21 @@ " {", " \"identifier\": {", " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000019\"", + " \"value\": \"9000000010\"", " }", " }", + " ],", + " \"verification\": [", + " {", + " \"verified\": true,", + " \"verifiedWith\": {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000005\"", + " }", + " },", + " \"verificationDate\": \"2024-07-21T17:32:28Z\"", + " }", " ]", " },", " \"search\": {", @@ -7012,13 +7143,13 @@ "method": "GET", "header": [], "url": { - "raw": "{{api_base_url}}/Consent/39df03a2-1b14-4d19-b1dc-d5d8cbf96948?_include=Consent:performer", + "raw": "{{api_base_url}}/Consent/74eed847-ca25-4e76-8cf2-f2c2d7842a7a?_include=Consent:performer", "host": [ "{{api_base_url}}" ], "path": [ "Consent", - "39df03a2-1b14-4d19-b1dc-d5d8cbf96948" + "74eed847-ca25-4e76-8cf2-f2c2d7842a7a" ], "query": [ { @@ -7031,7 +7162,7 @@ "response": [] }, { - "name": "Retrieve mother-child relationship with performer and patient details", + "name": "Retrieve consenting adult relationship with performer and patient details", "event": [ { "listen": "test", @@ -7044,39 +7175,34 @@ " \"type\": \"searchset\",", " \"entry\": [", " {", - " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/RelatedPerson/BE974742\",", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/RelatedPerson/RP974720\",", " \"resource\": {", " \"resourceType\": \"RelatedPerson\",", - " \"id\": \"BE974742\",", + " \"id\": \"RP974720\",", " \"identifier\": [", " {", " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000019\"", + " \"value\": \"9000000010\"", " },", " {", " \"system\": \"https://placeholder.fhir.nhs.uk/Id/local-gp-patient-identifier\",", - " \"value\": \"ABC0000001\"", + " \"value\": \"ABC0000008\"", " }", " ],", " \"patient\": {", " \"type\": \"Patient\",", " \"identifier\": {", " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000009\"", + " \"value\": \"9000000005\"", " }", " },", " \"relationship\": [", " {", " \"coding\": [", " {", - " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",", - " \"code\": \"PRN\",", - " \"display\": \"parent\"", - " },", - " {", - " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",", - " \"code\": \"MTH\",", - " \"display\": \"mother\"", + " \"system\": \"https://fhir.hl7.org.uk/CodeSystem/UKCore-AdditionalPersonRelationshipRole\",", + " \"code\": \"Personal\",", + " \"display\": \"Personal relationship with the patient\"", " }", " ]", " }", @@ -7087,18 +7213,18 @@ " }", " },", " {", - " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Patient/A3CC67E2\",", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Patient/DFCC67F5\",", " \"resource\": {", " \"resourceType\": \"Patient\",", - " \"id\": \"A3CC67E2\",", + " \"id\": \"DFCC67F5\",", " \"identifier\": [", " {", " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000009\"", + " \"value\": \"9000000005\"", " },", " {", " \"system\": \"https://placeholder.fhir.nhs.uk/Id/local-gp-patient-identifier\",", - " \"value\": \"ABC1234556\"", + " \"value\": \"ABC1234567\"", " }", " ],", " \"name\": [", @@ -7110,19 +7236,15 @@ " \"end\": \"2021-12-31\"", " },", " \"given\": [", - " \"Jane Marie Anne\"", + " \"Sally\"", " ],", - " \"family\": \"Smith\",", + " \"family\": \"Evans\",", " \"prefix\": [", " \"Mrs\"", - " ],", - " \"suffix\": [", - " \"MBE\",", - " \"PhD\"", " ]", " }", " ],", - " \"birthDate\": \"2022-10-22\",", + " \"birthDate\": \"1995-10-22\",", " \"generalPractitioner\": [", " {", " \"type\": \"Organization\",", @@ -7138,10 +7260,10 @@ " }", " },", " {", - " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/BBCC67E9\",", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/WWCC67T1\",", " \"resource\": {", " \"resourceType\": \"Consent\",", - " \"id\": \"BBCC67E9\",", + " \"id\": \"WWCC67T1\",", " \"status\": \"active\",", " \"scope\": {", " \"coding\": [", @@ -7168,7 +7290,7 @@ " \"patient\": {", " \"identifier\": {", " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000009\"", + " \"value\": \"9000000005\"", " }", " },", " \"dateTime\": \"2024-07-21T17:32:28Z\",", @@ -7176,9 +7298,21 @@ " {", " \"identifier\": {", " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000019\"", + " \"value\": \"9000000010\"", " }", " }", + " ],", + " \"verification\": [", + " {", + " \"verified\": true,", + " \"verifiedWith\": {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000005\"", + " }", + " },", + " \"verificationDate\": \"2024-07-21T17:32:28Z\"", + " }", " ]", " },", " \"search\": {", @@ -7206,13 +7340,13 @@ "method": "GET", "header": [], "url": { - "raw": "{{api_base_url}}/Consent/39df03a2-1b14-4d19-b1dc-d5d8cbf96948?_include=Consent:performer&_include=Consent:patient", + "raw": "{{api_base_url}}/Consent/74eed847-ca25-4e76-8cf2-f2c2d7842a7a?_include=Consent:performer&_include=Consent:patient", "host": [ "{{api_base_url}}" ], "path": [ "Consent", - "39df03a2-1b14-4d19-b1dc-d5d8cbf96948" + "74eed847-ca25-4e76-8cf2-f2c2d7842a7a" ], "query": [ { @@ -7229,99 +7363,75 @@ "response": [] }, { - "name": "Invalid consent ID", + "name": "Retrieve mother-child relationship", "event": [ { "listen": "test", "script": { "exec": [ "const expectedResponseBody = {", - " \"issue\": [", + " \"resourceType\": \"Bundle\",", + " \"timestamp\": \"2020-08-26T14:00:00+00:00\",", + " \"total\": 1,", + " \"type\": \"searchset\",", + " \"entry\": [", " {", - " \"code\": \"invalid\",", - " \"diagnostics\": \"Invalid request with error - ID must be a valid UUID.\",", - " \"details\": {", - " \"coding\": [", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/BBCC67E9\",", + " \"resource\": {", + " \"resourceType\": \"Consent\",", + " \"id\": \"BBCC67E9\",", + " \"status\": \"active\",", + " \"scope\": {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",", + " \"code\": \"patient-privacy\",", + " \"display\": \"Privacy Consent\"", + " }", + " ],", + " \"text\": \"Patient Privacy Consent\"", + " },", + " \"category\": [", " {", - " \"code\": \"INVALID_ID_VALUE\",", - " \"display\": \"Required parameter(s) are invalid.\",", - " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", - " \"version\": \"1\"", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",", + " \"code\": \"INFA\",", + " \"display\": \"Information Access\"", + " }", + " ],", + " \"text\": \"Information Access Consent\"", " }", - " ]", - " },", - " \"severity\": \"error\"", - " }", - " ],", - " \"resourceType\": \"OperationOutcome\"", - "}", - "", - "const responseJson = pm.response.json();", - "", - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});", - "", - "pm.test(\"Should have correct response body\", () => {", - " pm.expect(responseJson).to.eql(expectedResponseBody);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{api_base_url}}/Consent/invalid-identifier", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent", - "invalid-identifier" - ] - } - }, - "response": [] - }, - { - "name": "Missing consent ID", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "const expectedResponseBody = {", - " \"issue\": [", - " {", - " \"code\": \"invalid\",", - " \"diagnostics\": \"Invalid request with error - ID must be specified in the request path.\",", - " \"details\": {", - " \"coding\": [", + " ],", + " \"patient\": {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000009\"", + " }", + " },", + " \"dateTime\": \"2024-07-21T17:32:28Z\",", + " \"performer\": [", " {", - " \"code\": \"MISSING_ID_VALUE\",", - " \"display\": \"Required parameter(s) are missing.\",", - " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", - " \"version\": \"1\"", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000019\"", + " }", " }", " ]", " },", - " \"severity\": \"error\"", + " \"search\": {", + " \"mode\": \"match\"", + " }", " }", - " ],", - " \"resourceType\": \"OperationOutcome\"", + " ]", "}", "", - "const responseJson = pm.response.json();", - "", - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Should have correct response body\", () => {", + " const responseJson = pm.response.json();", " pm.expect(responseJson).to.eql(expectedResponseBody);", "});" ], @@ -7334,53 +7444,139 @@ "method": "GET", "header": [], "url": { - "raw": "{{api_base_url}}/Consent/ ", + "raw": "{{api_base_url}}/Consent/39df03a2-1b14-4d19-b1dc-d5d8cbf96948", "host": [ "{{api_base_url}}" ], "path": [ "Consent", - " " + "39df03a2-1b14-4d19-b1dc-d5d8cbf96948" ] } }, "response": [] }, { - "name": "Invalid include parameter", + "name": "Retrieve mother-child relationship with patient details", "event": [ { "listen": "test", "script": { "exec": [ "const expectedResponseBody = {", - " \"resourceType\": \"OperationOutcome\",", - " \"issue\": [", - " {", - " \"code\": \"invalid\",", - " \"details\": {", - " \"coding\": [", - " {", - " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", - " \"version\": \"1\",", - " \"code\": \"INVALID_VALUE\",", - " \"display\": \"Required parameter(s) are invalid.\"", - " }", - " ]", + " \"resourceType\": \"Bundle\",", + " \"timestamp\": \"2020-08-26T14:00:00+00:00\",", + " \"total\": 2,", + " \"type\": \"searchset\",", + " \"entry\": [", + " {", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Patient/A3CC67E2\",", + " \"resource\": {", + " \"resourceType\": \"Patient\",", + " \"id\": \"A3CC67E2\",", + " \"identifier\": [", + " {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000009\"", + " },", + " {", + " \"system\": \"https://placeholder.fhir.nhs.uk/Id/local-gp-patient-identifier\",", + " \"value\": \"ABC1234556\"", + " }", + " ],", + " \"name\": [", + " {", + " \"id\": \"123456\",", + " \"use\": \"usual\",", + " \"period\": {", + " \"start\": \"2020-01-01\",", + " \"end\": \"2021-12-31\"", " },", - " \"severity\": \"error\"", - " }", - " ],", - " \"diagnostics\": \"Invalid request with error - _include parameter is invalid.\"", + " \"given\": [", + " \"Jane Marie Anne\"", + " ],", + " \"family\": \"Smith\",", + " \"prefix\": [", + " \"Mrs\"", + " ],", + " \"suffix\": [", + " \"MBE\",", + " \"PhD\"", + " ]", + " }", + " ],", + " \"birthDate\": \"2022-10-22\",", + " \"generalPractitioner\": [", + " {", + " \"type\": \"Organization\",", + " \"identifier\": {", + " \"value\": \"ODS12345\",", + " \"system\": \"https://fhir.nhs.uk/Id/ods-organization-code\"", + " }", + " }", + " ]", + " },", + " \"search\": {", + " \"mode\": \"include\"", + " }", + " },", + " {", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/BBCC67E9\",", + " \"resource\": {", + " \"resourceType\": \"Consent\",", + " \"id\": \"BBCC67E9\",", + " \"status\": \"active\",", + " \"scope\": {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",", + " \"code\": \"patient-privacy\",", + " \"display\": \"Privacy Consent\"", + " }", + " ],", + " \"text\": \"Patient Privacy Consent\"", + " },", + " \"category\": [", + " {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",", + " \"code\": \"INFA\",", + " \"display\": \"Information Access\"", + " }", + " ],", + " \"text\": \"Information Access Consent\"", + " }", + " ],", + " \"patient\": {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000009\"", + " }", + " },", + " \"dateTime\": \"2024-07-21T17:32:28Z\",", + " \"performer\": [", + " {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000019\"", + " }", + " }", + " ]", + " },", + " \"search\": {", + " \"mode\": \"match\"", + " }", + " }", + " ]", "}", "", - "const responseJson = pm.response.json();", - "", - "pm.test(\"Status code is 422\", function () {", - " pm.response.to.have.status(422);", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Should have correct response body\", () => {", + " const responseJson = pm.response.json();", " pm.expect(responseJson).to.eql(expectedResponseBody);", "});" ], @@ -7393,7 +7589,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{api_base_url}}/Consent/39df03a2-1b14-4d19-b1dc-d5d8cbf96948?_include=Consent:invalid", + "raw": "{{api_base_url}}/Consent/39df03a2-1b14-4d19-b1dc-d5d8cbf96948?_include=Consent:patient", "host": [ "{{api_base_url}}" ], @@ -7404,7 +7600,7 @@ "query": [ { "key": "_include", - "value": "Consent:invalid" + "value": "Consent:patient" } ] } @@ -7412,40 +7608,118 @@ "response": [] }, { - "name": "Invalid parameters", + "name": "Retrieve mother-child relationship with performer details", "event": [ { "listen": "test", "script": { "exec": [ "const expectedResponseBody = {", - " \"resourceType\": \"OperationOutcome\",", - " \"issue\": [", - " {", - " \"code\": \"invalid\",", - " \"details\": {", - " \"coding\": [", - " {", - " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", - " \"version\": \"1\",", - " \"code\": \"INVALID_VALUE\",", - " \"display\": \"Required parameter(s) are invalid.\"", - " }", - " ]", - " },", - " \"severity\": \"error\"", - " }", - " ],", - " \"diagnostics\": \"Invalid request with error - _include parameter is invalid.\"", + " \"resourceType\": \"Bundle\",", + " \"timestamp\": \"2020-08-26T14:00:00+00:00\",", + " \"total\": 2,", + " \"type\": \"searchset\",", + " \"entry\": [", + " {", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/RelatedPerson/BE974742\",", + " \"resource\": {", + " \"resourceType\": \"RelatedPerson\",", + " \"id\": \"BE974742\",", + " \"identifier\": [", + " {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000019\"", + " },", + " {", + " \"system\": \"https://placeholder.fhir.nhs.uk/Id/local-gp-patient-identifier\",", + " \"value\": \"ABC0000001\"", + " }", + " ],", + " \"patient\": {", + " \"type\": \"Patient\",", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000009\"", + " }", + " },", + " \"relationship\": [", + " {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",", + " \"code\": \"PRN\",", + " \"display\": \"parent\"", + " },", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",", + " \"code\": \"MTH\",", + " \"display\": \"mother\"", + " }", + " ]", + " }", + " ]", + " },", + " \"search\": {", + " \"mode\": \"include\"", + " }", + " },", + " {", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/BBCC67E9\",", + " \"resource\": {", + " \"resourceType\": \"Consent\",", + " \"id\": \"BBCC67E9\",", + " \"status\": \"active\",", + " \"scope\": {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",", + " \"code\": \"patient-privacy\",", + " \"display\": \"Privacy Consent\"", + " }", + " ],", + " \"text\": \"Patient Privacy Consent\"", + " },", + " \"category\": [", + " {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",", + " \"code\": \"INFA\",", + " \"display\": \"Information Access\"", + " }", + " ],", + " \"text\": \"Information Access Consent\"", + " }", + " ],", + " \"patient\": {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000009\"", + " }", + " },", + " \"dateTime\": \"2024-07-21T17:32:28Z\",", + " \"performer\": [", + " {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000019\"", + " }", + " }", + " ]", + " },", + " \"search\": {", + " \"mode\": \"match\"", + " }", + " }", + " ]", "}", "", - "const responseJson = pm.response.json();", - "", - "pm.test(\"Status code is 422\", function () {", - " pm.response.to.have.status(422);", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Should have correct response body\", () => {", + " const responseJson = pm.response.json();", " pm.expect(responseJson).to.eql(expectedResponseBody);", "});" ], @@ -7458,18 +7732,18 @@ "method": "GET", "header": [], "url": { - "raw": "{{api_base_url}}/Consent/74eed847-ca25-4e76-8cf2-f2c2d7842a7a?_unknown=true", + "raw": "{{api_base_url}}/Consent/39df03a2-1b14-4d19-b1dc-d5d8cbf96948?_include=Consent:performer", "host": [ "{{api_base_url}}" ], "path": [ "Consent", - "74eed847-ca25-4e76-8cf2-f2c2d7842a7a" + "39df03a2-1b14-4d19-b1dc-d5d8cbf96948" ], "query": [ { - "key": "_unknown", - "value": "true" + "key": "_include", + "value": "Consent:performer" } ] } @@ -7477,157 +7751,171 @@ "response": [] }, { - "name": "Proxy role not found", + "name": "Retrieve mother-child relationship with performer and patient details", "event": [ { "listen": "test", "script": { "exec": [ "const expectedResponseBody = {", - " \"issue\": [", - " {", - " \"code\": \"processing\",", - " \"details\": {", - " \"coding\": [", - " {", - " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", - " \"version\": \"1\",", - " \"code\": \"INVALIDATED_RESOURCE\",", - " \"display\": \"Resource that has been marked as invalid was requested - invalid resources cannot be retrieved\"", - " }", - " ]", + " \"resourceType\": \"Bundle\",", + " \"timestamp\": \"2020-08-26T14:00:00+00:00\",", + " \"total\": 3,", + " \"type\": \"searchset\",", + " \"entry\": [", + " {", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/RelatedPerson/BE974742\",", + " \"resource\": {", + " \"resourceType\": \"RelatedPerson\",", + " \"id\": \"BE974742\",", + " \"identifier\": [", + " {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000019\"", + " },", + " {", + " \"system\": \"https://placeholder.fhir.nhs.uk/Id/local-gp-patient-identifier\",", + " \"value\": \"ABC0000001\"", + " }", + " ],", + " \"patient\": {", + " \"type\": \"Patient\",", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000009\"", + " }", + " },", + " \"relationship\": [", + " {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",", + " \"code\": \"PRN\",", + " \"display\": \"parent\"", + " },", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",", + " \"code\": \"MTH\",", + " \"display\": \"mother\"", + " }", + " ]", + " }", + " ]", + " },", + " \"search\": {", + " \"mode\": \"include\"", + " }", + " },", + " {", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Patient/A3CC67E2\",", + " \"resource\": {", + " \"resourceType\": \"Patient\",", + " \"id\": \"A3CC67E2\",", + " \"identifier\": [", + " {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000009\"", + " },", + " {", + " \"system\": \"https://placeholder.fhir.nhs.uk/Id/local-gp-patient-identifier\",", + " \"value\": \"ABC1234556\"", + " }", + " ],", + " \"name\": [", + " {", + " \"id\": \"123456\",", + " \"use\": \"usual\",", + " \"period\": {", + " \"start\": \"2020-01-01\",", + " \"end\": \"2021-12-31\"", " },", - " \"severity\": \"error\"", - " }", - " ],", - " \"resourceType\": \"OperationOutcome\"", - "}", - "", - "const responseJson = pm.response.json();", - "", - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});", - "", - "pm.test(\"Should have correct response body\", () => {", - " pm.expect(responseJson).to.eql(expectedResponseBody);", - "});" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{api_base_url}}/Consent/a0922245-1072-40c3-8f4e-a7490c10d365", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent", - "a0922245-1072-40c3-8f4e-a7490c10d365" - ] - } - }, - "response": [] - } - ], - "description": "The GET /Consent/{ID} is for retrieving the details of a single proxy relationship, including current status, based on a provided id.\n\nThis folder contains requests covering different scenarios for users with different types of proxy relationship. It also includes error scenarios.\n\nFor more details please see the [OAS page for Validated Relationships Service consent on the NHS England website.](https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service#get-/Consent)" - }, - { - "name": "Create proxy relationship (Consent)", - "item": [ - { - "name": "Parent-child proxy creation", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "const expectedResponseBody = {", - " \"resourceType\": \"OperationOutcome\",", - " \"issue\": [", - " {", - " \"severity\": \"information\",", - " \"code\": \"informational\"", - " }", - " ]", - "}", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Should have correct response body\", () => {", - " var responseJson = pm.response.json();", - " pm.expect(responseJson).to.eql(expectedResponseBody);", - "});", - "", - "pm.test(\"Location header is returned\", () => {", - " pm.response.to.have.header(\"Location\", \"https://sandbox.api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/90b9863e-e33c-4895-a333-fd0ea0e23205\")", - "})" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"resourceType\": \"Consent\",\n \"status\": \"active\",\n \"scope\": {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",\n \"code\": \"patient-privacy\",\n \"display\": \"Privacy Consent\"\n }\n ],\n \"text\": \"Patient Privacy Consent\"\n },\n \"category\": [\n {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",\n \"code\": \"INFA\",\n \"display\": \"Information Access\"\n }\n ],\n \"text\": \"Information Access Consent\"\n }\n ],\n \"patient\": {\n \"type\": \"Patient\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000012\"\n }\n },\n \"dateTime\": \"2025-02-11T14:30:00Z\",\n \"performer\": [\n {\n \"type\": \"RelatedPerson\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000009\"\n }\n }\n ],\n \"provision\": {\n \"period\": {\n \"start\": \"2025-02-11\",\n \"end\": \"2026-02-11\"\n },\n \"actor\": [\n {\n \"role\": {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",\n \"code\": \"PRN\",\n \"display\": \"Parent\"\n }\n ]\n },\n \"reference\": {\n \"type\": \"RelatedPerson\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000009\"\n }\n }\n }\n ]\n },\n \"extension\": [\n {\n \"url\": \"https://fhir.hl7.org.uk/StructureDefinition/Extension-statusReason\",\n \"valueCodeableConcept\": {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consent-reason\",\n \"code\": \"TBC\",\n \"display\": \"TBC\"\n }\n ]\n }\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{api_base_url}}/Consent", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ] - } - }, - "response": [] - }, - { - "name": "Adult-adult proxy creation", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "const expectedResponseBody = {", - " \"resourceType\": \"OperationOutcome\",", - " \"issue\": [", - " {", - " \"severity\": \"information\",", - " \"code\": \"informational\"", - " }", - " ]", + " \"given\": [", + " \"Jane Marie Anne\"", + " ],", + " \"family\": \"Smith\",", + " \"prefix\": [", + " \"Mrs\"", + " ],", + " \"suffix\": [", + " \"MBE\",", + " \"PhD\"", + " ]", + " }", + " ],", + " \"birthDate\": \"2022-10-22\",", + " \"generalPractitioner\": [", + " {", + " \"type\": \"Organization\",", + " \"identifier\": {", + " \"value\": \"ODS12345\",", + " \"system\": \"https://fhir.nhs.uk/Id/ods-organization-code\"", + " }", + " }", + " ]", + " },", + " \"search\": {", + " \"mode\": \"include\"", + " }", + " },", + " {", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/BBCC67E9\",", + " \"resource\": {", + " \"resourceType\": \"Consent\",", + " \"id\": \"BBCC67E9\",", + " \"status\": \"active\",", + " \"scope\": {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",", + " \"code\": \"patient-privacy\",", + " \"display\": \"Privacy Consent\"", + " }", + " ],", + " \"text\": \"Patient Privacy Consent\"", + " },", + " \"category\": [", + " {", + " \"coding\": [", + " {", + " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",", + " \"code\": \"INFA\",", + " \"display\": \"Information Access\"", + " }", + " ],", + " \"text\": \"Information Access Consent\"", + " }", + " ],", + " \"patient\": {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000009\"", + " }", + " },", + " \"dateTime\": \"2024-07-21T17:32:28Z\",", + " \"performer\": [", + " {", + " \"identifier\": {", + " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", + " \"value\": \"9000000019\"", + " }", + " }", + " ]", + " },", + " \"search\": {", + " \"mode\": \"match\"", + " }", + " }", + " ]", "}", "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Should have correct response body\", () => {", - " var responseJson = pm.response.json();", + " const responseJson = pm.response.json();", " pm.expect(responseJson).to.eql(expectedResponseBody);", - "});", - "", - "pm.test(\"Location header is returned\", () => {", - " pm.response.to.have.header(\"Location\", \"https://sandbox.api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/90b9863e-e33c-4895-a333-fd0ea0e23205\")", - "})" + "});" ], "type": "text/javascript", "packages": {} @@ -7635,66 +7923,68 @@ } ], "request": { - "method": "POST", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"resourceType\": \"Consent\",\n \"status\": \"active\",\n \"scope\": {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",\n \"code\": \"patient-privacy\",\n \"display\": \"Privacy Consent\"\n }\n ],\n \"text\": \"Patient Privacy Consent\"\n },\n \"category\": [\n {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",\n \"code\": \"INFA\",\n \"display\": \"Information Access\"\n }\n ],\n \"text\": \"Information Access Consent\"\n }\n ],\n \"patient\": {\n \"type\": \"Patient\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000012\"\n }\n },\n \"dateTime\": \"2025-02-11T14:30:00Z\",\n \"performer\": [\n {\n \"type\": \"RelatedPerson\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000017\"\n }\n }\n ],\n \"provision\": {\n \"period\": {\n \"start\": \"2025-02-11\"\n },\n \"actor\": [\n {\n \"role\": {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",\n \"code\": \"GUARD\",\n \"display\": \"Guardian\"\n }\n ]\n },\n \"reference\": {\n \"type\": \"RelatedPerson\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000017\"\n }\n }\n }\n ]\n },\n \"extension\": [\n {\n \"url\": \"https://fhir.hl7.org.uk/StructureDefinition/Extension-statusReason\",\n \"valueCodeableConcept\": {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consent-reason\",\n \"code\": \"TBC\",\n \"display\": \"TBC\"\n }\n ]\n }\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{api_base_url}}/Consent", + "raw": "{{api_base_url}}/Consent/39df03a2-1b14-4d19-b1dc-d5d8cbf96948?_include=Consent:performer&_include=Consent:patient", "host": [ "{{api_base_url}}" ], "path": [ - "Consent" + "Consent", + "39df03a2-1b14-4d19-b1dc-d5d8cbf96948" + ], + "query": [ + { + "key": "_include", + "value": "Consent:performer" + }, + { + "key": "_include", + "value": "Consent:patient" + } ] } }, "response": [] }, { - "name": "Invalid performer NHS number", + "name": "Invalid consent ID", "event": [ { "listen": "test", "script": { "exec": [ "const expectedResponseBody = {", - " \"issue\": [", - " {", - " \"code\": \"invalid\",", - " \"diagnostics\": \"Not a valid NHS Number provided for the Performer identifier parameter\",", - " \"details\": {", - " \"coding\": [", - " {", - " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", - " \"version\": \"1\",", - " \"code\": \"INVALID_IDENTIFIER\",", - " \"display\": \"Provided value is invalid\"", - " }", - " ]", - " },", - " \"severity\": \"error\"", - " }", - " ],", - " \"resourceType\": \"OperationOutcome\"", + " \"issue\": [", + " {", + " \"code\": \"invalid\",", + " \"diagnostics\": \"Invalid request with error - ID must be a valid UUID.\",", + " \"details\": {", + " \"coding\": [", + " {", + " \"code\": \"INVALID_ID_VALUE\",", + " \"display\": \"Required parameter(s) are invalid.\",", + " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", + " \"version\": \"1\"", + " }", + " ]", + " },", + " \"severity\": \"error\"", + " }", + " ],", + " \"resourceType\": \"OperationOutcome\"", "}", "", - "pm.test(\"Status code is 422\", function () {", - " pm.response.to.have.status(422);", + "const responseJson = pm.response.json();", + "", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", "});", "", "pm.test(\"Should have correct response body\", () => {", - " var responseJson = pm.response.json();", " pm.expect(responseJson).to.eql(expectedResponseBody);", - "});", - "" + "});" ], "type": "text/javascript", "packages": {} @@ -7702,161 +7992,82 @@ } ], "request": { - "method": "POST", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"resourceType\": \"Consent\",\n \"status\": \"active\",\n \"scope\": {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",\n \"code\": \"patient-privacy\",\n \"display\": \"Privacy Consent\"\n }\n ],\n \"text\": \"Patient Privacy Consent\"\n },\n \"category\": [\n {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",\n \"code\": \"INFA\",\n \"display\": \"Information Access\"\n }\n ],\n \"text\": \"Information Access Consent\"\n }\n ],\n \"patient\": {\n \"type\": \"Patient\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000012\"\n }\n },\n \"dateTime\": \"2025-02-11T14:30:00Z\",\n \"performer\": [\n {\n \"type\": \"RelatedPerson\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000000\"\n }\n }\n ],\n \"provision\": {\n \"period\": {\n \"start\": \"2025-02-11\"\n },\n \"actor\": [\n {\n \"role\": {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",\n \"code\": \"GUARD\",\n \"display\": \"Guardian\"\n }\n ]\n },\n \"reference\": {\n \"type\": \"RelatedPerson\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000000\"\n }\n }\n }\n ]\n },\n \"extension\": [\n {\n \"url\": \"https://fhir.hl7.org.uk/StructureDefinition/Extension-statusReason\",\n \"valueCodeableConcept\": {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consent-reason\",\n \"code\": \"TBC\",\n \"display\": \"TBC\"\n }\n ]\n }\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{api_base_url}}/Consent", + "raw": "{{api_base_url}}/Consent/invalid-identifier", "host": [ "{{api_base_url}}" ], "path": [ - "Consent" + "Consent", + "invalid-identifier" ] } }, "response": [] }, { - "name": "Duplicate relationship", + "name": "Missing consent ID", "event": [ { "listen": "test", "script": { "exec": [ "const expectedResponseBody = {", - " \"issue\": [", - " {", - " \"code\": \"invalid\",", - " \"diagnostics\": \"Proxy role already exists.\",", - " \"details\": {", - " \"coding\": [", - " {", - " \"code\": \"DUPLICATE_RELATIONSHIP\",", - " \"display\": \"Request must be for a new proxy role.\",", - " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", - " \"version\": \"1\"", - " }", - " ]", - " },", - " \"severity\": \"error\"", - " }", - " ],", - " \"resourceType\": \"OperationOutcome\"", + " \"issue\": [", + " {", + " \"code\": \"invalid\",", + " \"diagnostics\": \"Invalid request with error - ID must be specified in the request path.\",", + " \"details\": {", + " \"coding\": [", + " {", + " \"code\": \"MISSING_ID_VALUE\",", + " \"display\": \"Required parameter(s) are missing.\",", + " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", + " \"version\": \"1\"", + " }", + " ]", + " },", + " \"severity\": \"error\"", + " }", + " ],", + " \"resourceType\": \"OperationOutcome\"", "}", "", - "pm.test(\"Status code is 409\", function () {", - " pm.response.to.have.status(409);", - "});", - "", - "pm.test(\"Should have correct response body\", () => {", - " var responseJson = pm.response.json();", - " pm.expect(responseJson).to.eql(expectedResponseBody);", - "});", - "" - ], - "type": "text/javascript", - "packages": {} - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"resourceType\": \"Consent\",\n \"status\": \"active\",\n \"scope\": {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",\n \"code\": \"patient-privacy\",\n \"display\": \"Privacy Consent\"\n }\n ],\n \"text\": \"Patient Privacy Consent\"\n },\n \"category\": [\n {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",\n \"code\": \"INFA\",\n \"display\": \"Information Access\"\n }\n ],\n \"text\": \"Information Access Consent\"\n }\n ],\n \"patient\": {\n \"type\": \"Patient\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000000\"\n }\n },\n \"dateTime\": \"2025-02-11T14:30:00Z\",\n \"performer\": [\n {\n \"type\": \"RelatedPerson\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000049\"\n }\n }\n ],\n \"provision\": {\n \"period\": {\n \"start\": \"2025-02-11\"\n },\n \"actor\": [\n {\n \"role\": {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",\n \"code\": \"GUARD\",\n \"display\": \"Guardian\"\n }\n ]\n },\n \"reference\": {\n \"type\": \"RelatedPerson\",\n \"identifier\": {\n \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",\n \"value\": \"9000000049\"\n }\n }\n }\n ]\n },\n \"extension\": [\n {\n \"url\": \"https://fhir.hl7.org.uk/StructureDefinition/Extension-statusReason\",\n \"valueCodeableConcept\": {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/consent-reason\",\n \"code\": \"TBC\",\n \"display\": \"TBC\"\n }\n ]\n }\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{api_base_url}}/Consent", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ] - } - }, - "response": [] - } - ], - "description": "# Create proxy relationships (consent)\n\nThe POST /Consent is for storing confirmed proxy relationships via the Validated Relationships Service.\n\nThis folder contains requests covering different scenarios for users with different types of proxy relationship. Also includes error scenarios.\n\nFor more details please see the [OAS page for Validated Relationships Service consent on the NHS England website.](https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service#get-/Consent)" - }, - { - "name": "Update proxy relationship (Consent)", - "item": [ - { - "name": "Status update", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "const expectedResponseBody = {", - " \"resourceType\": \"OperationOutcome\",", - " \"issue\": [", - " {", - " \"severity\": \"information\",", - " \"code\": \"informational\"", - " }", - " ]", - "}", + "const responseJson = pm.response.json();", "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", "});", "", "pm.test(\"Should have correct response body\", () => {", - " var responseJson = pm.response.json();", " pm.expect(responseJson).to.eql(expectedResponseBody);", "});" ], "type": "text/javascript", "packages": {} } - } - ], - "request": { - "method": "PATCH", - "header": [], - "body": { - "mode": "raw", - "raw": "[\n {\n \"op\": \"replace\",\n \"path\": \"/status\",\n \"value\": \"inactive\"\n }\n]", - "options": { - "raw": { - "language": "json" - } - } - }, + } + ], + "request": { + "method": "GET", + "header": [], "url": { - "raw": "{{api_base_url}}/Consent/c512b0db-6702-43ee-8c21-bbded2552da9", + "raw": "{{api_base_url}}/Consent/ ", "host": [ "{{api_base_url}}" ], "path": [ "Consent", - "c512b0db-6702-43ee-8c21-bbded2552da9" + " " ] - }, - "description": "Valid patch changing status to 'active'" + } }, "response": [] }, { - "name": "Access level update", + "name": "Invalid include parameter", "event": [ { "listen": "test", @@ -7866,18 +8077,30 @@ " \"resourceType\": \"OperationOutcome\",", " \"issue\": [", " {", - " \"severity\": \"information\",", - " \"code\": \"informational\"", + " \"code\": \"invalid\",", + " \"details\": {", + " \"coding\": [", + " {", + " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", + " \"version\": \"1\",", + " \"code\": \"INVALID_VALUE\",", + " \"display\": \"Required parameter(s) are invalid.\"", + " }", + " ]", + " },", + " \"severity\": \"error\"", " }", - " ]", + " ],", + " \"diagnostics\": \"Invalid request with error - _include parameter is invalid.\"", "}", "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(200);", + "const responseJson = pm.response.json();", + "", + "pm.test(\"Status code is 422\", function () {", + " pm.response.to.have.status(422);", "});", "", "pm.test(\"Should have correct response body\", () => {", - " var responseJson = pm.response.json();", " pm.expect(responseJson).to.eql(expectedResponseBody);", "});" ], @@ -7887,33 +8110,29 @@ } ], "request": { - "method": "PATCH", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "[\n {\n \"op\": \"replace\",\n \"path\": \"/provision/period/end\",\n \"value\": \"2026-12-31\"\n }\n]", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{api_base_url}}/Consent/6b71ac92-baa3-4b76-b0f5-a601257e2722", + "raw": "{{api_base_url}}/Consent/39df03a2-1b14-4d19-b1dc-d5d8cbf96948?_include=Consent:invalid", "host": [ "{{api_base_url}}" ], "path": [ "Consent", - "6b71ac92-baa3-4b76-b0f5-a601257e2722" + "39df03a2-1b14-4d19-b1dc-d5d8cbf96948" + ], + "query": [ + { + "key": "_include", + "value": "Consent:invalid" + } ] - }, - "description": "Valid patch modifying the role end date" + } }, "response": [] }, { - "name": "Multiple valid changes", + "name": "Invalid parameters", "event": [ { "listen": "test", @@ -7923,18 +8142,30 @@ " \"resourceType\": \"OperationOutcome\",", " \"issue\": [", " {", - " \"severity\": \"information\",", - " \"code\": \"informational\"", + " \"code\": \"invalid\",", + " \"details\": {", + " \"coding\": [", + " {", + " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", + " \"version\": \"1\",", + " \"code\": \"INVALID_VALUE\",", + " \"display\": \"Required parameter(s) are invalid.\"", + " }", + " ]", + " },", + " \"severity\": \"error\"", " }", - " ]", + " ],", + " \"diagnostics\": \"Invalid request with error - _include parameter is invalid.\"", "}", "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(200);", + "const responseJson = pm.response.json();", + "", + "pm.test(\"Status code is 422\", function () {", + " pm.response.to.have.status(422);", "});", "", "pm.test(\"Should have correct response body\", () => {", - " var responseJson = pm.response.json();", " pm.expect(responseJson).to.eql(expectedResponseBody);", "});" ], @@ -7944,33 +8175,29 @@ } ], "request": { - "method": "PATCH", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "[\n {\n \"op\": \"replace\",\n \"path\": \"/status\",\n \"value\": \"active\"\n },\n {\n \"op\": \"replace\",\n \"path\": \"/provision/period/end\",\n \"value\": \"2026-12-31\"\n }\n]", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{api_base_url}}/Consent/43003db8-ffcd-4bd6-ab2f-b49b9656f9e5", + "raw": "{{api_base_url}}/Consent/74eed847-ca25-4e76-8cf2-f2c2d7842a7a?_unknown=true", "host": [ "{{api_base_url}}" ], "path": [ "Consent", - "43003db8-ffcd-4bd6-ab2f-b49b9656f9e5" + "74eed847-ca25-4e76-8cf2-f2c2d7842a7a" + ], + "query": [ + { + "key": "_unknown", + "value": "true" + } ] - }, - "description": "Valid patch modifying the role end date" + } }, "response": [] }, { - "name": "Invalid status code", + "name": "Proxy role not found", "event": [ { "listen": "test", @@ -7979,15 +8206,14 @@ "const expectedResponseBody = {", " \"issue\": [", " {", - " \"code\": \"invalid\",", - " \"diagnostics\": \"Invalid status code.\",", + " \"code\": \"processing\",", " \"details\": {", " \"coding\": [", " {", - " \"code\": \"INVALID_STATUS_CODE\",", - " \"display\": \"Status code is invalid.\",", " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", - " \"version\": \"1\"", + " \"version\": \"1\",", + " \"code\": \"INVALIDATED_RESOURCE\",", + " \"display\": \"Resource that has been marked as invalid was requested - invalid resources cannot be retrieved\"", " }", " ]", " },", @@ -7997,12 +8223,13 @@ " \"resourceType\": \"OperationOutcome\"", "}", "", - "pm.test(\"Status code is 422\", function () {", - " pm.response.to.have.status(422);", + "const responseJson = pm.response.json();", + "", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", "});", "", "pm.test(\"Should have correct response body\", () => {", - " var responseJson = pm.response.json();", " pm.expect(responseJson).to.eql(expectedResponseBody);", "});" ], @@ -8012,61 +8239,46 @@ } ], "request": { - "method": "PATCH", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "[\n {\n \"op\": \"replace\",\n \"path\": \"/status\",\n \"value\": \"someinvalidcode\"\n }\n]", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{api_base_url}}/Consent/78c35330-fa2f-4934-a5dd-fff847f38de5", + "raw": "{{api_base_url}}/Consent/a0922245-1072-40c3-8f4e-a7490c10d365", "host": [ "{{api_base_url}}" ], "path": [ "Consent", - "78c35330-fa2f-4934-a5dd-fff847f38de5" + "a0922245-1072-40c3-8f4e-a7490c10d365" ] - }, - "description": "Patch with invalid status value" + } }, "response": [] - }, + } + ], + "description": "The GET /Consent/{ID} is for retrieving the details of a single proxy relationship, including current status, based on a provided id.\n\nThis folder contains requests covering different scenarios for users with different types of proxy relationships. It also includes error scenarios.\n\nFor more details, please refer to the [GET Consent by ID OAS page for the Validated Relationship Service on the NHS England website.](https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service#get-/Consent/%7Bid%7D)" + }, + { + "name": "Update a proxy role (Consent)", + "item": [ { - "name": "Invalid path", + "name": "Status update", "event": [ { "listen": "test", "script": { "exec": [ "const expectedResponseBody = {", + " \"resourceType\": \"OperationOutcome\",", " \"issue\": [", " {", - " \"code\": \"invalid\",", - " \"diagnostics\": \"Patch targeting non-existent element.\",", - " \"details\": {", - " \"coding\": [", - " {", - " \"code\": \"INVALID_PATCH_PATH\",", - " \"display\": \"Patch target is invalid.\",", - " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", - " \"version\": \"1\"", - " }", - " ]", - " },", - " \"severity\": \"error\"", + " \"severity\": \"information\",", + " \"code\": \"informational\"", " }", - " ],", - " \"resourceType\": \"OperationOutcome\"", + " ]", "}", "", - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Should have correct response body\", () => {", @@ -8084,7 +8296,7 @@ "header": [], "body": { "mode": "raw", - "raw": "[\n {\n \"op\": \"replace\",\n \"path\": \"/someotherpath\",\n \"value\": \"active\"\n }\n]", + "raw": "[\n {\n \"op\": \"replace\",\n \"path\": \"/status\",\n \"value\": \"inactive\"\n }\n]", "options": { "raw": { "language": "json" @@ -8092,49 +8304,38 @@ } }, "url": { - "raw": "{{api_base_url}}/Consent/01abb0c5-b1ac-499d-9655-9cd0b8d3588f", + "raw": "{{api_base_url}}/Consent/c512b0db-6702-43ee-8c21-bbded2552da9", "host": [ "{{api_base_url}}" ], "path": [ "Consent", - "01abb0c5-b1ac-499d-9655-9cd0b8d3588f" + "c512b0db-6702-43ee-8c21-bbded2552da9" ] }, - "description": "Patch targeting non-existent element" + "description": "Valid patch changing status to 'active'" }, "response": [] }, { - "name": "Resource not found", + "name": "Access level update", "event": [ { "listen": "test", "script": { "exec": [ "const expectedResponseBody = {", + " \"resourceType\": \"OperationOutcome\",", " \"issue\": [", " {", - " \"code\": \"invalid\",", - " \"diagnostics\": \"Proxy role not found.\",", - " \"details\": {", - " \"coding\": [", - " {", - " \"code\": \"RESOURCE_NOT_FOUND\",", - " \"display\": \"Request must be for a existing proxy role.\",", - " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", - " \"version\": \"1\"", - " }", - " ]", - " },", - " \"severity\": \"error\"", + " \"severity\": \"information\",", + " \"code\": \"informational\"", " }", - " ],", - " \"resourceType\": \"OperationOutcome\"", + " ]", "}", "", - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Should have correct response body\", () => {", @@ -8152,7 +8353,7 @@ "header": [], "body": { "mode": "raw", - "raw": "[\n {\n \"op\": \"replace\",\n \"path\": \"/status\",\n \"value\": \"inactive\"\n }\n]", + "raw": "[\n {\n \"op\": \"replace\",\n \"path\": \"/provision/period/end\",\n \"value\": \"2026-12-31\"\n }\n]", "options": { "raw": { "language": "json" @@ -8160,49 +8361,38 @@ } }, "url": { - "raw": "{{api_base_url}}/Consent/0000000", + "raw": "{{api_base_url}}/Consent/6b71ac92-baa3-4b76-b0f5-a601257e2722", "host": [ "{{api_base_url}}" ], "path": [ "Consent", - "0000000" + "6b71ac92-baa3-4b76-b0f5-a601257e2722" ] }, - "description": "Patch for non-existent Consent" + "description": "Valid patch modifying the role end date" }, "response": [] }, { - "name": "Invalid patch format", + "name": "Multiple valid changes", "event": [ { "listen": "test", "script": { "exec": [ "const expectedResponseBody = {", + " \"resourceType\": \"OperationOutcome\",", " \"issue\": [", " {", - " \"code\": \"invalid\",", - " \"diagnostics\": \"Malformed JSON patch document.\",", - " \"details\": {", - " \"coding\": [", - " {", - " \"code\": \"INVALID_PATCH_FORMAT\",", - " \"display\": \"Request format is invalid.\",", - " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", - " \"version\": \"1\"", - " }", - " ]", - " },", - " \"severity\": \"error\"", + " \"severity\": \"information\",", + " \"code\": \"informational\"", " }", - " ],", - " \"resourceType\": \"OperationOutcome\"", + " ]", "}", "", - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(200);", "});", "", "pm.test(\"Should have correct response body\", () => {", @@ -8220,7 +8410,7 @@ "header": [], "body": { "mode": "raw", - "raw": "[\n {\n \"op\": \"replace\",\n \"path\": \"/status\",\n \"value\": \"active\"\n]", + "raw": "[\n {\n \"op\": \"replace\",\n \"path\": \"/status\",\n \"value\": \"active\"\n },\n {\n \"op\": \"replace\",\n \"path\": \"/provision/period/end\",\n \"value\": \"2026-12-31\"\n }\n]", "options": { "raw": { "language": "json" @@ -8228,21 +8418,21 @@ } }, "url": { - "raw": "{{api_base_url}}/Consent/849ea584-2318-471b-a24c-cee1b5ad0137", + "raw": "{{api_base_url}}/Consent/43003db8-ffcd-4bd6-ab2f-b49b9656f9e5", "host": [ "{{api_base_url}}" ], "path": [ "Consent", - "849ea584-2318-471b-a24c-cee1b5ad0137" + "43003db8-ffcd-4bd6-ab2f-b49b9656f9e5" ] }, - "description": "Malformed JSON patch document" + "description": "Valid patch modifying the role end date" }, "response": [] }, { - "name": "Invalid state transition", + "name": "Invalid status code", "event": [ { "listen": "test", @@ -8252,12 +8442,12 @@ " \"issue\": [", " {", " \"code\": \"invalid\",", - " \"diagnostics\": \"Patch attempting invalid status change.\",", + " \"diagnostics\": \"Invalid status code.\",", " \"details\": {", " \"coding\": [", " {", - " \"code\": \"INVALID_STATE_TRANSITION\",", - " \"display\": \"Status change is invalid.\",", + " \"code\": \"INVALID_STATUS_CODE\",", + " \"display\": \"Status code is invalid.\",", " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", " \"version\": \"1\"", " }", @@ -8296,20 +8486,21 @@ } }, "url": { - "raw": "{{api_base_url}}/Consent/7b7f47b8-96e5-43eb-b733-283bf1449f2c", + "raw": "{{api_base_url}}/Consent/78c35330-fa2f-4934-a5dd-fff847f38de5", "host": [ "{{api_base_url}}" ], "path": [ "Consent", - "7b7f47b8-96e5-43eb-b733-283bf1449f2c" + "78c35330-fa2f-4934-a5dd-fff847f38de5" ] - } + }, + "description": "Patch with invalid status value" }, "response": [] }, { - "name": "Invalid Status Reason", + "name": "Invalid path", "event": [ { "listen": "test", @@ -8319,12 +8510,12 @@ " \"issue\": [", " {", " \"code\": \"invalid\",", - " \"diagnostics\": \"Invalid status reason.\",", + " \"diagnostics\": \"Patch targeting non-existent element.\",", " \"details\": {", " \"coding\": [", " {", - " \"code\": \"INVALID_STATUS_REASON\",", - " \"display\": \"Status reason is invalid.\",", + " \"code\": \"INVALID_PATCH_PATH\",", + " \"display\": \"Patch target is invalid.\",", " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", " \"version\": \"1\"", " }", @@ -8336,8 +8527,8 @@ " \"resourceType\": \"OperationOutcome\"", "}", "", - "pm.test(\"Status code is 422\", function () {", - " pm.response.to.have.status(422);", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", "});", "", "pm.test(\"Should have correct response body\", () => {", @@ -8355,7 +8546,7 @@ "header": [], "body": { "mode": "raw", - "raw": "[\n {\n \"op\": \"replace\",\n \"path\": \"/status\",\n \"value\": \"someinvalidcode\"\n }\n]", + "raw": "[\n {\n \"op\": \"replace\",\n \"path\": \"/someotherpath\",\n \"value\": \"active\"\n }\n]", "options": { "raw": { "language": "json" @@ -8363,221 +8554,53 @@ } }, "url": { - "raw": "{{api_base_url}}/Consent/51fb4df5-815a-45cd-8427-04d6558336b7", + "raw": "{{api_base_url}}/Consent/01abb0c5-b1ac-499d-9655-9cd0b8d3588f", "host": [ "{{api_base_url}}" ], "path": [ "Consent", - "51fb4df5-815a-45cd-8427-04d6558336b7" + "01abb0c5-b1ac-499d-9655-9cd0b8d3588f" ] - } + }, + "description": "Patch targeting non-existent element" }, "response": [] - } - ], - "description": "Use this endpoint to update an existing proxy role.\n\nCommon update scenarios include:\n\n- Revocation of the role (status change from \"active\" to \"inactive\")\n \n- Changing the legal basis of the role (TBC)\n \n- Updating the end date for time-bound access" - }, - { - "name": "Get a proxy access request (Questionnaire Response)", - "item": [ + }, { - "name": "Adult to adult with capacity", + "name": "Resource not found", "event": [ { "listen": "test", "script": { "exec": [ "const expectedResponseBody = {", - " \"resourceType\": \"QuestionnaireResponse\",", - " \"status\": \"completed\",", - " \"authored\": \"2024-07-15T09:43:03.280Z\",", - " \"source\": {", - " \"type\": \"RelatedPerson\",", - " \"identifier\": {", - " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000005\"", - " }", - " },", - " \"subject\": {", - " \"type\": \"Patient\",", - " \"identifier\": {", - " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000006\"", - " }", - " },", - " \"questionnaire\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Questionnaire/01dc6813-3421-4d14-948d-a4888241add1\",", - " \"item\": [", - " {", - " \"linkId\": \"relatedPerson\",", - " \"text\": \"Proxy details\",", - " \"item\": [", - " {", - " \"linkId\": \"relatedPerson_identifier\",", - " \"text\": \"NHS number\",", - " \"answer\": [", - " {", - " \"valueString\": \"9000000005\"", - " }", - " ]", - " },", - " {", - " \"linkId\": \"relatedPerson_name\",", - " \"text\": \"Name\",", - " \"item\": [", - " {", - " \"linkId\": \"relatedPerson_name_first\",", - " \"text\": \"First name\",", - " \"answer\": [", - " {", - " \"valueString\": \"Jack\"", - " }", - " ]", - " },", - " {", - " \"linkId\": \"relatedPerson_name_family\",", - " \"text\": \"Last name\",", - " \"answer\": [", - " {", - " \"valueString\": \"Jones\"", - " }", - " ]", - " }", - " ]", - " },", - " {", - " \"linkId\": \"relatedPerson_birthDate\",", - " \"text\": \"Date of birth\",", - " \"answer\": [", - " {", - " \"valueDate\": \"1970-02-15\"", - " }", - " ]", - " },", - " {", - " \"linkId\": \"relatedPerson_basisForAccess\",", - " \"text\": \"Basis for Access\",", - " \"answer\": [", - " {", - " \"valueCoding\": {", - " \"system\": \"https://fhir.hl7.org.uk/CodeSystem/UKCore-AdditionalPersonRelationshipRole\",", - " \"code\": \"PRN\",", - " \"display\": \"Parent\"", - " }", - " }", - " ]", - " },", - " {", - " \"linkId\": \"relatedPerson_relationship\",", - " \"text\": \"Relationship\",", - " \"answer\": [", - " {", - " \"valueCoding\": {", - " \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",", - " \"code\": \"PRN\",", - " \"display\": \"Parent\"", - " }", - " }", - " ]", - " }", - " ]", - " },", - " {", - " \"linkId\": \"patient\",", - " \"text\": \"Patient details\",", - " \"item\": [", - " {", - " \"linkId\": \"patient_identifier\",", - " \"text\": \"NHS number\",", - " \"answer\": [", - " {", - " \"valueString\": \"9000000006\"", - " }", - " ]", - " },", - " {", - " \"linkId\": \"patient_name\",", - " \"text\": \"Name\",", - " \"item\": [", - " {", - " \"linkId\": \"patient_name_first\",", - " \"text\": \"First name\",", - " \"answer\": [", - " {", - " \"valueString\": \"Jill\"", - " }", - " ]", - " },", - " {", - " \"linkId\": \"patient_name_family\",", - " \"text\": \"Last name\",", - " \"answer\": [", - " {", - " \"valueString\": \"Jones\"", - " }", - " ]", - " }", - " ]", - " },", - " {", - " \"linkId\": \"patient_birthDate\",", - " \"text\": \"Date of birth\",", - " \"answer\": [", - " {", - " \"valueDate\": \"1965-01-01\"", - " }", - " ]", - " }", - " ]", - " },", - " {", - " \"linkId\": \"requestedAccess\",", - " \"text\": \"Requested access\",", - " \"item\": [", + " \"issue\": [", " {", - " \"linkId\": \"requestedAccess_accessLevel\",", - " \"text\": \"Requested access level\",", - " \"answer\": [", - " {", - " \"valueCoding\": {", - " \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-RequestedAccess\",", - " \"code\": \"APPT\",", - " \"display\": \"Appointment Booking\"", - " }", + " \"code\": \"invalid\",", + " \"diagnostics\": \"Proxy role not found.\",", + " \"details\": {", + " \"coding\": [", + " {", + " \"code\": \"RESOURCE_NOT_FOUND\",", + " \"display\": \"Request must be for a existing proxy role.\",", + " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", + " \"version\": \"1\"", + " }", + " ]", " },", - " {", - " \"valueCoding\": {", - " \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-RequestedAccess\",", - " \"code\": \"VACC\",", - " \"display\": \"Vaccination Records\"", - " }", - " }", - " ]", - " },", - " {", - " \"linkId\": \"requestedAccess_reasonsForAccess\",", - " \"text\": \"Reason for access\",", - " \"answer\": [", - " {", - " \"valueCoding\": {", - " \"system\": \"https://fhir.nhs.uk/CodeSystem/Proxy-Placeholder-ReasonForAccess\",", - " \"code\": \"PRAC\",", - " \"display\": \"Practical Reasons\"", - " }", - " }", - " ]", + " \"severity\": \"error\"", " }", - " ]", - " }", - " ]", - "};", + " ],", + " \"resourceType\": \"OperationOutcome\"", + "}", "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", "});", "", "pm.test(\"Should have correct response body\", () => {", - " const responseJson = pm.response.json();", + " var responseJson = pm.response.json();", " pm.expect(responseJson).to.eql(expectedResponseBody);", "});" ], @@ -8587,71 +8610,65 @@ } ], "request": { - "method": "GET", - "header": [ - { - "key": "X-Request-ID", - "value": "d967f4c9-8e83-4930-97ab-ae4e122d8ca5", - "type": "text" - }, - { - "key": "X-Correlation-ID", - "value": "8717c840-c222-4f84-a880-45bc129f8382", - "type": "text" + "method": "PATCH", + "header": [], + "body": { + "mode": "raw", + "raw": "[\n {\n \"op\": \"replace\",\n \"path\": \"/status\",\n \"value\": \"inactive\"\n }\n]", + "options": { + "raw": { + "language": "json" + } } - ], + }, "url": { - "raw": "{{api_base_url}}/QuestionnaireResponse?referenceCode=19318ZGLAB", + "raw": "{{api_base_url}}/Consent/0000000", "host": [ "{{api_base_url}}" ], "path": [ - "QuestionnaireResponse" - ], - "query": [ - { - "key": "referenceCode", - "value": "19318ZGLAB" - } + "Consent", + "0000000" ] }, - "description": "Example of Questionnaire Response that will be returned" + "description": "Patch for non-existent Consent" }, "response": [] }, { - "name": "Missing Reference Code", + "name": "Invalid patch format", "event": [ { "listen": "test", "script": { "exec": [ "const expectedResponseBody = {", - " \"resourceType\": \"OperationOutcome\",", - " \"issue\": [", - " {", - " \"severity\": \"error\",", - " \"code\": \"required\",", - " \"details\": {", - " \"coding\": [", - " {", - " \"system\": \"https://fhir.nhs.uk/CodeSystem/Spine-ErrorOrWarningCode\",", - " \"code\": \"MISSING_REFERENCE_CODE\",", - " \"display\": \"Missing reference code\"", - " }", - " ]", - " },", - " \"diagnostics\": \"The reference code parameter is required but was not provided.\"", - " }", - " ]", - "};", + " \"issue\": [", + " {", + " \"code\": \"invalid\",", + " \"diagnostics\": \"Malformed JSON patch document.\",", + " \"details\": {", + " \"coding\": [", + " {", + " \"code\": \"INVALID_PATCH_FORMAT\",", + " \"display\": \"Request format is invalid.\",", + " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", + " \"version\": \"1\"", + " }", + " ]", + " },", + " \"severity\": \"error\"", + " }", + " ],", + " \"resourceType\": \"OperationOutcome\"", + "}", "", "pm.test(\"Status code is 400\", function () {", " pm.response.to.have.status(400);", "});", "", "pm.test(\"Should have correct response body\", () => {", - " const responseJson = pm.response.json();", + " var responseJson = pm.response.json();", " pm.expect(responseJson).to.eql(expectedResponseBody);", "});" ], @@ -8661,65 +8678,65 @@ } ], "request": { - "method": "GET", - "header": [ - { - "key": "X-Request-ID", - "value": "d967f4c9-8e83-4930-97ab-ae4e122d8ca5", - "type": "text" - }, - { - "key": "X-Correlation-ID", - "value": "8717c840-c222-4f84-a880-45bc129f8382", - "type": "text" + "method": "PATCH", + "header": [], + "body": { + "mode": "raw", + "raw": "[\n {\n \"op\": \"replace\",\n \"path\": \"/status\",\n \"value\": \"active\"\n]", + "options": { + "raw": { + "language": "json" + } } - ], + }, "url": { - "raw": "{{api_base_url}}/QuestionnaireResponse", + "raw": "{{api_base_url}}/Consent/849ea584-2318-471b-a24c-cee1b5ad0137", "host": [ "{{api_base_url}}" ], "path": [ - "QuestionnaireResponse" + "Consent", + "849ea584-2318-471b-a24c-cee1b5ad0137" ] }, - "description": "Example of an error response when reference code is missing from request" + "description": "Malformed JSON patch document" }, "response": [] }, { - "name": "Invalid Reference Code", + "name": "Invalid state transition", "event": [ { "listen": "test", "script": { "exec": [ "const expectedResponseBody = {", - " \"resourceType\": \"OperationOutcome\",", - " \"issue\": [", - " {", - " \"severity\": \"error\",", - " \"code\": \"invalid\",", - " \"details\": {", - " \"coding\": [", - " {", - " \"system\": \"https://fhir.nhs.uk/CodeSystem/Spine-ErrorOrWarningCode\",", - " \"code\": \"INVALID_REFERENCE_CODE\",", - " \"display\": \"Invalid reference code\"", - " }", - " ]", - " },", - " \"diagnostics\": \"The specified reference code format is invalid. Reference codes must be alphanumeric.\"", - " }", - " ]", - "};", + " \"issue\": [", + " {", + " \"code\": \"invalid\",", + " \"diagnostics\": \"Patch attempting invalid status change.\",", + " \"details\": {", + " \"coding\": [", + " {", + " \"code\": \"INVALID_STATE_TRANSITION\",", + " \"display\": \"Status change is invalid.\",", + " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", + " \"version\": \"1\"", + " }", + " ]", + " },", + " \"severity\": \"error\"", + " }", + " ],", + " \"resourceType\": \"OperationOutcome\"", + "}", "", - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", + "pm.test(\"Status code is 422\", function () {", + " pm.response.to.have.status(422);", "});", "", "pm.test(\"Should have correct response body\", () => {", - " const responseJson = pm.response.json();", + " var responseJson = pm.response.json();", " pm.expect(responseJson).to.eql(expectedResponseBody);", "});" ], @@ -8729,71 +8746,64 @@ } ], "request": { - "method": "GET", - "header": [ - { - "key": "X-Request-ID", - "value": "d967f4c9-8e83-4930-97ab-ae4e122d8ca5", - "type": "text" - }, - { - "key": "X-Correlation-ID", - "value": "8717c840-c222-4f84-a880-45bc129f8382", - "type": "text" + "method": "PATCH", + "header": [], + "body": { + "mode": "raw", + "raw": "[\n {\n \"op\": \"replace\",\n \"path\": \"/status\",\n \"value\": \"someinvalidcode\"\n }\n]", + "options": { + "raw": { + "language": "json" + } } - ], + }, "url": { - "raw": "{{api_base_url}}/QuestionnaireResponse?referenceCode=INVALID", + "raw": "{{api_base_url}}/Consent/7b7f47b8-96e5-43eb-b733-283bf1449f2c", "host": [ "{{api_base_url}}" ], "path": [ - "QuestionnaireResponse" - ], - "query": [ - { - "key": "referenceCode", - "value": "INVALID" - } + "Consent", + "7b7f47b8-96e5-43eb-b733-283bf1449f2c" ] - }, - "description": "Example of an error response when reference code is invalid" + } }, "response": [] }, { - "name": "Reference Code Not Found", + "name": "Invalid Status Reason", "event": [ { "listen": "test", "script": { "exec": [ "const expectedResponseBody = {", - " \"resourceType\": \"OperationOutcome\",", - " \"issue\": [", - " {", - " \"severity\": \"error\",", - " \"code\": \"not-found\",", - " \"details\": {", - " \"coding\": [", - " {", - " \"system\": \"https://fhir.nhs.uk/CodeSystem/Spine-ErrorOrWarningCode\",", - " \"code\": \"QUESTIONNAIRE_RESPONSE_NOT_FOUND\",", - " \"display\": \"Questionnaire response not found\"", - " }", - " ]", - " },", - " \"diagnostics\": \"The Questionnaire response could not be found using the provided reference code.\"", - " }", - " ]", - "};", + " \"issue\": [", + " {", + " \"code\": \"invalid\",", + " \"diagnostics\": \"Invalid status reason.\",", + " \"details\": {", + " \"coding\": [", + " {", + " \"code\": \"INVALID_STATUS_REASON\",", + " \"display\": \"Status reason is invalid.\",", + " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", + " \"version\": \"1\"", + " }", + " ]", + " },", + " \"severity\": \"error\"", + " }", + " ],", + " \"resourceType\": \"OperationOutcome\"", + "}", "", - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", + "pm.test(\"Status code is 422\", function () {", + " pm.response.to.have.status(422);", "});", "", "pm.test(\"Should have correct response body\", () => {", - " const responseJson = pm.response.json();", + " var responseJson = pm.response.json();", " pm.expect(responseJson).to.eql(expectedResponseBody);", "});" ], @@ -8803,39 +8813,32 @@ } ], "request": { - "method": "GET", - "header": [ - { - "key": "X-Request-ID", - "value": "d967f4c9-8e83-4930-97ab-ae4e122d8ca5", - "type": "text" - }, - { - "key": "X-Correlation-ID", - "value": "8717c840-c222-4f84-a880-45bc129f8382", - "type": "text" + "method": "PATCH", + "header": [], + "body": { + "mode": "raw", + "raw": "[\n {\n \"op\": \"replace\",\n \"path\": \"/status\",\n \"value\": \"someinvalidcode\"\n }\n]", + "options": { + "raw": { + "language": "json" + } } - ], + }, "url": { - "raw": "{{api_base_url}}/QuestionnaireResponse?referenceCode=ABC123XY", + "raw": "{{api_base_url}}/Consent/51fb4df5-815a-45cd-8427-04d6558336b7", "host": [ "{{api_base_url}}" ], "path": [ - "QuestionnaireResponse" - ], - "query": [ - { - "key": "referenceCode", - "value": "ABC123XY" - } + "Consent", + "51fb4df5-815a-45cd-8427-04d6558336b7" ] - }, - "description": "Example of an error response when reference code is not found in database" + } }, "response": [] } - ] + ], + "description": "Use this endpoint to update an existing proxy role.\n\nCommon update scenarios include:\n\n- Revocation of the role (status change from \"active\" to \"inactive\")\n- Changing the legal basis of the role (TBC)\n- Updating the end date for time-bound access\n \n\nThis folder contains requests covering different scenarios for various valid and invalid update requests.\n\nFor more details, please refer to the [PATCH Consent OAS page for the Validated Relationship Service on the NHS England website.](https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service#patch-/Consent/-id-)" } ], "event": [ diff --git a/specification/examples/responses/GET_Consent/single-consenting-adult-relationship-include-patient.yaml b/specification/examples/responses/GET_Consent/single-consenting-adult-relationship-include-patient.yaml index 051408a7..a200a15d 100644 --- a/specification/examples/responses/GET_Consent/single-consenting-adult-relationship-include-patient.yaml +++ b/specification/examples/responses/GET_Consent/single-consenting-adult-relationship-include-patient.yaml @@ -5,7 +5,7 @@ ConsentSingleConsentingAdultRelationshipIncludePatientBundle: value: resourceType: Bundle timestamp: '2020-08-26T14:00:00+00:00' - total: 3 + total: 2 type: searchset entry: - fullUrl: https://api.service.nhs.uk/validated-relationships/FHIR/R4/Patient/DFCC67F5 diff --git a/specification/examples/responses/GET_Consent/single-consenting-adult-relationship-include-performer.yaml b/specification/examples/responses/GET_Consent/single-consenting-adult-relationship-include-performer.yaml index 55283215..22f43dc5 100644 --- a/specification/examples/responses/GET_Consent/single-consenting-adult-relationship-include-performer.yaml +++ b/specification/examples/responses/GET_Consent/single-consenting-adult-relationship-include-performer.yaml @@ -5,7 +5,7 @@ ConsentSingleConsentingAdultRelationshipIncludePerformerBundle: value: resourceType: Bundle timestamp: '2020-08-26T14:00:00+00:00' - total: 3 + total: 2 type: searchset entry: - fullUrl: https://api.service.nhs.uk/validated-relationships/FHIR/R4/RelatedPerson/RP974720 diff --git a/specification/examples/responses/GET_Consent/single-mother-child-relationship-include-patient.yaml b/specification/examples/responses/GET_Consent/single-mother-child-relationship-include-patient.yaml index f671ccb4..a34e27bf 100644 --- a/specification/examples/responses/GET_Consent/single-mother-child-relationship-include-patient.yaml +++ b/specification/examples/responses/GET_Consent/single-mother-child-relationship-include-patient.yaml @@ -5,7 +5,7 @@ ConsentSingleAdultChildRelationshipIncludePatientBundle: value: resourceType: Bundle timestamp: '2020-08-26T14:00:00+00:00' - total: 3 + total: 2 type: searchset entry: - fullUrl: https://api.service.nhs.uk/validated-relationships/FHIR/R4/Patient/A3CC67E2 diff --git a/specification/examples/responses/GET_Consent/single-mother-child-relationship-include-performer.yaml b/specification/examples/responses/GET_Consent/single-mother-child-relationship-include-performer.yaml index 5ad13fe6..cd7dc457 100644 --- a/specification/examples/responses/GET_Consent/single-mother-child-relationship-include-performer.yaml +++ b/specification/examples/responses/GET_Consent/single-mother-child-relationship-include-performer.yaml @@ -5,7 +5,7 @@ ConsentSingleAdultChildRelationshipIncludePerformerBundle: value: resourceType: Bundle timestamp: '2020-08-26T14:00:00+00:00' - total: 3 + total: 2 type: searchset entry: - fullUrl: https://api.service.nhs.uk/validated-relationships/FHIR/R4/RelatedPerson/BE974742 diff --git a/specification/validated-relationships-service-api.yaml b/specification/validated-relationships-service-api.yaml index 9c584d8e..01c48093 100644 --- a/specification/validated-relationships-service-api.yaml +++ b/specification/validated-relationships-service-api.yaml @@ -126,7 +126,7 @@ info: * only covers a limited set of scenarios * is open access, so does not allow you to test authorisation - [Run In Postman](https://god.gw.postman.com/run-collection/44536620-de538326-5564-4efd-9ed2-d1c64142fcfe?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D44536620-de538326-5564-4efd-9ed2-d1c64142fcfe%26entityType%3Dcollection%26workspaceId%3Dd553b6fe-6915-4ada-a926-d96af988d3cc) + [Run In Postman](https://app.getpostman.com/run-collection/18067099-110252c4-5fa1-46ca-a08d-b5ce96e28fde?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D18067099-110252c4-5fa1-46ca-a08d-b5ce96e28fde%26entityType%3Dcollection%26workspaceId%3D8870ed4a-d599-42a7-ab17-cee80095ffab) ### Integration testing @@ -777,10 +777,18 @@ paths: examples: ConsentSingleConsentingAdultRelationshipBundle: $ref: "./examples/responses/GET_Consent/single-consenting-adult-relationship.yaml#/ConsentSingleConsentingAdultRelationshipBundle" + ConsentSingleConsentingAdultRelationshipIncludePatientBundle: + $ref: "./examples/responses/GET_Consent/single-consenting-adult-relationship-include-patient.yaml#/ConsentSingleConsentingAdultRelationshipIncludePatientBundle" + ConsentSingleConsentingAdultRelationshipIncludePerformerBundle: + $ref: "./examples/responses/GET_Consent/single-consenting-adult-relationship-include-performer.yaml#/ConsentSingleConsentingAdultRelationshipIncludePerformerBundle" ConsentSingleConsentingAdultRelationshipIncludePerformerPatientBundle: $ref: "./examples/responses/GET_Consent/single-consenting-adult-relationship-include-performer-patient.yaml#/ConsentSingleConsentingAdultRelationshipIncludePerformerPatientBundle" ConsentSingleAdultChildRelationshipBundle: $ref: "./examples/responses/GET_Consent/single-mother-child-relationship.yaml#/ConsentSingleAdultChildRelationshipBundle" + ConsentSingleAdultChildRelationshipIncludePatientBundle: + $ref: "./examples/responses/GET_Consent/single-mother-child-relationship-include-patient.yaml#/ConsentSingleAdultChildRelationshipIncludePatientBundle" + ConsentSingleAdultChildRelationshipIncludePerformerBundle: + $ref: "./examples/responses/GET_Consent/single-mother-child-relationship-include-performer.yaml#/ConsentSingleAdultChildRelationshipIncludePerformerBundle" ConsentSingleAdultChildRelationshipIncludePerformerPatientBundle: $ref: "./examples/responses/GET_Consent/single-mother-child-relationship-include-performer-patient.yaml#/ConsentSingleAdultChildRelationshipIncludePerformerPatientBundle" @@ -799,7 +807,7 @@ paths: | 404 | `INVALIDATED_RESOURCE` | Resource that has been marked as invalid was requested - invalid resources cannot be retrieved | | 405 | `METHOD_NOT_ALLOWED` | The method is not allowed. | | 408 | `TIMEOUT` | Request timed out. | - | 422 | `INVALID_ID_SYSTEM` | Invalid id. | + | 422 | `INVALID_ID_VALUE` | Invalid id. | | 429 | `THROTTLED` | You have exceeded your application's [rate limit](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#rate-limits). | content: @@ -815,6 +823,8 @@ paths: $ref: "./examples/responses/GET_Consent/ID/errors/missing-id.yaml#/ConsentMissingIDError" InvalidIdError: $ref: "./examples/responses/GET_Consent/ID/errors/invalid-id.yaml#/ConsentInvalidIDError" + InvalidIncludeParameterError: + $ref: "./examples/responses/errors/invalid-include-parameter.yaml#/InvalidIncludeParameterError" "5XX": description: | Errors will be returned for the first error encountered in the request. An error occurred as follows: From d8b7829dea6ace2f2ea73a6d2bdc82d224641540 Mon Sep 17 00:00:00 2001 From: adamclarkson Date: Fri, 6 Jun 2025 15:38:19 +0100 Subject: [PATCH 7/9] npa-5087 - formatting updates --- sandbox/api/constants.py | 8 ++++++-- sandbox/api/get_consent_by_id.py | 11 ++++------- sandbox/api/tests/test_get_consent_by_id.py | 4 ++-- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/sandbox/api/constants.py b/sandbox/api/constants.py index aaeaf192..24e94c1a 100644 --- a/sandbox/api/constants.py +++ b/sandbox/api/constants.py @@ -41,7 +41,9 @@ GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_BOTH = ( f"{GET_CONSENT__DIRECTORY}single-consenting-adult-relationship-include-performer-patient.yaml" ) -GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_PATIENT = f"{GET_CONSENT__DIRECTORY}single-consenting-adult-relationship-include-patient.yaml" +GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_PATIENT = ( + f"{GET_CONSENT__DIRECTORY}single-consenting-adult-relationship-include-patient.yaml" +) GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_PERFORMER = ( f"{GET_CONSENT__DIRECTORY}single-consenting-adult-relationship-include-performer.yaml" ) @@ -49,7 +51,9 @@ GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_BOTH = ( f"{GET_CONSENT__DIRECTORY}single-mother-child-relationship-include-performer-patient.yaml" ) -GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PATIENT = f"{GET_CONSENT__DIRECTORY}single-mother-child-relationship-include-patient.yaml" +GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PATIENT = ( + f"{GET_CONSENT__DIRECTORY}single-mother-child-relationship-include-patient.yaml" +) GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PERFORMER = ( f"{GET_CONSENT__DIRECTORY}single-mother-child-relationship-include-performer.yaml" ) diff --git a/sandbox/api/get_consent_by_id.py b/sandbox/api/get_consent_by_id.py index 3802b1f5..644ff719 100644 --- a/sandbox/api/get_consent_by_id.py +++ b/sandbox/api/get_consent_by_id.py @@ -18,12 +18,9 @@ GET_CONSENT_BY_ID__INVALID_ID_ERROR, GET_CONSENT_BY_ID__MISSING_ID_ERROR, BAD_REQUEST_INCLUDE_PARAM_INVALID, - INVALIDATED_RESOURCE -) -from .utils import ( - generate_response_from_example, - check_for_consent_include_params + INVALIDATED_RESOURCE, ) +from .utils import generate_response_from_example, check_for_consent_include_params def get_consent_by_id_response(identifier: str) -> Union[dict, tuple]: @@ -45,7 +42,7 @@ def get_consent_by_id_response(identifier: str) -> Union[dict, tuple]: GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP, GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_BOTH, GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_PATIENT, - GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_PERFORMER + GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP_INCLUDE_PERFORMER, ) elif identifier == "39df03a2-1b14-4d19-b1dc-d5d8cbf96948": return check_for_consent_include_params( @@ -53,7 +50,7 @@ def get_consent_by_id_response(identifier: str) -> Union[dict, tuple]: GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP, GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_BOTH, GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PATIENT, - GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PERFORMER + GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PERFORMER, ) elif identifier == "a0922245-1072-40c3-8f4e-a7490c10d365": return generate_response_from_example(INVALIDATED_RESOURCE, 404) diff --git a/sandbox/api/tests/test_get_consent_by_id.py b/sandbox/api/tests/test_get_consent_by_id.py index 395e3d56..231f2de5 100644 --- a/sandbox/api/tests/test_get_consent_by_id.py +++ b/sandbox/api/tests/test_get_consent_by_id.py @@ -18,13 +18,13 @@ 422, ), ( - "a0922245-1072-40c3-8f4e-a7490c10d365", # No proxy-role record found error + "a0922245-1072-40c3-8f4e-a7490c10d365", # No proxy-role record found error "", "./api/examples/errors/invalidated-resource.yaml", 404, ), ( - " ", # Missing consent ID + " ", # Missing consent ID "", "./api/examples/GET_Consent/ID/errors/missing-id.yaml", 400, From 74ef567f174ea07c5e0df3dd95db19d707c9893a Mon Sep 17 00:00:00 2001 From: adamclarkson Date: Fri, 6 Jun 2025 15:55:11 +0100 Subject: [PATCH 8/9] npa-5087 - further formatting updates --- sandbox/api/tests/test_get_consent_by_id.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sandbox/api/tests/test_get_consent_by_id.py b/sandbox/api/tests/test_get_consent_by_id.py index 231f2de5..5031f608 100644 --- a/sandbox/api/tests/test_get_consent_by_id.py +++ b/sandbox/api/tests/test_get_consent_by_id.py @@ -83,7 +83,7 @@ def test_get_consent_by_id_returns_expected_responses__mocked_get_consent_by_id( 200, ), ( - "74eed847-ca25-4e76-8cf2-f2c2d7842a7a", # Single consenting adult relationship with include performer and patient + "74eed847-ca25-4e76-8cf2-f2c2d7842a7a", # Single consenting adult relationship with include both "_include=Consent:performer&_include=Consent:patient", "./api/examples/GET_Consent/single-consenting-adult-relationship-include-performer-patient.yaml", 200, @@ -107,7 +107,7 @@ def test_get_consent_by_id_returns_expected_responses__mocked_get_consent_by_id( 200, ), ( - "39df03a2-1b14-4d19-b1dc-d5d8cbf96948", # Single adult-child relationship with include performer and patient + "39df03a2-1b14-4d19-b1dc-d5d8cbf96948", # Single adult-child relationship with include both "_include=Consent:performer&_include=Consent:patient", "./api/examples/GET_Consent/single-mother-child-relationship-include-performer-patient.yaml", 200, From af8d85de8e3bea9200a8991bf52959ba8ff9952e Mon Sep 17 00:00:00 2001 From: adamclarkson Date: Fri, 6 Jun 2025 16:11:34 +0100 Subject: [PATCH 9/9] npa-5087 - Updated import positioning --- sandbox/api/get_consent_by_id.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sandbox/api/get_consent_by_id.py b/sandbox/api/get_consent_by_id.py index 644ff719..893cc179 100644 --- a/sandbox/api/get_consent_by_id.py +++ b/sandbox/api/get_consent_by_id.py @@ -3,8 +3,6 @@ from flask import request -logger = getLogger(__name__) - from .constants import ( INTERNAL_SERVER_ERROR_EXAMPLE, GET_CONSENT__SINGLE_CONSENTING_ADULT_RELATIONSHIP, @@ -22,6 +20,8 @@ ) from .utils import generate_response_from_example, check_for_consent_include_params +logger = getLogger(__name__) + def get_consent_by_id_response(identifier: str) -> Union[dict, tuple]: """Sandbox API for GET /Consent/{id} @@ -31,7 +31,7 @@ def get_consent_by_id_response(identifier: str) -> Union[dict, tuple]: """ try: params = request.args.to_dict() - if not "_include" in params and len(params) > 0: + if "_include" not in params and len(params) > 0: return generate_response_from_example(BAD_REQUEST_INCLUDE_PARAM_INVALID, 422) else: _include = request.args.getlist("_include")