diff --git a/postman/Validate Relationship Service Sandbox.postman_collection.json b/postman/Validate Relationship Service Sandbox.postman_collection.json index 1ee64f1f..3b60744f 100644 --- a/postman/Validate Relationship Service Sandbox.postman_collection.json +++ b/postman/Validate Relationship Service Sandbox.postman_collection.json @@ -1,36 +1,224 @@ { "info": { - "_postman_id": "de538326-5564-4efd-9ed2-d1c64142fcfe", - "name": "Validate Relationship Service Sandbox 04/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)", + "_postman_id": "110252c4-5fa1-46ca-a08d-b5ce96e28fde", + "name": "Validate Relationship Service Sandbox 06/06/25", + "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": "44536620" + "_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", @@ -4849,14 +5311,1212 @@ " ]", "}", "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", + "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?patient:identifier=9000000100&_include=Consent:patient", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], + "query": [ + { + "key": "patient:identifier", + "value": "9000000100" + }, + { + "key": "_include", + "value": "Consent:patient" + } + ] + } + }, + "response": [] + }, + { + "name": "No relationships", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const expectedResponseBody = {", + " \"resourceType\": \"Bundle\",", + " \"timestamp\": \"2020-08-26T14:00:00+00:00\",", + " \"total\": 0,", + " \"type\": \"searchset\",", + " \"entry\": []", + "}", + "", + "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" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{api_base_url}}/Consent?performer:identifier=9000000025", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], + "query": [ + { + "key": "performer:identifier", + "value": "9000000025" + } + ] + } + }, + "response": [] + }, + { + "name": "Single consenting adult proxy 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" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{api_base_url}}/Consent?performer:identifier=9000000010", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], + "query": [ + { + "key": "performer:identifier", + "value": "9000000010" + } + ] + } + }, + "response": [] + }, + { + "name": "Single consenting adult proxy relationship include performer and patient", + "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" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{api_base_url}}/Consent?performer:identifier=9000000010&_include=Consent:performer&_include=Consent:patient", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], + "query": [ + { + "key": "performer:identifier", + "value": "9000000010" + }, + { + "key": "_include", + "value": "Consent:performer" + }, + { + "key": "_include", + "value": "Consent:patient" + } + ] + } + }, + "response": [] + }, + { + "name": "Single 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" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{api_base_url}}/Consent?performer:identifier=9000000019", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], + "query": [ + { + "key": "performer:identifier", + "value": "9000000019" + } + ] + } + }, + "response": [] + }, + { + "name": "Single mother-child relationship include performer and patient", + "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?performer:identifier=9000000019&_include=Consent:performer&_include=Consent:patient", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], + "query": [ + { + "key": "performer:identifier", + "value": "9000000019" + }, + { + "key": "_include", + "value": "Consent:performer" + }, + { + "key": "_include", + "value": "Consent:patient" + } + ] + } + }, + "response": [] + }, + { + "name": "Invalid status parameter", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const expectedResponseBody = {", + " \"resourceType\": \"OperationOutcome\",", + " \"issue\": [", + " {", + " \"severity\": \"error\",", + " \"code\": \"invalid\",", + " \"diagnostics\": \"Invalid request with error - status parameter is invalid.\",", + " \"details\": {", + " \"coding\": [", + " {", + " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", + " \"version\": \"1\",", + " \"code\": \"INVALID_PARAMETER\",", + " \"display\": \"Required parameter(s) are 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?performer:identifier=9000000017&status=test", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], + "query": [ + { + "key": "performer:identifier", + "value": "9000000017" + }, + { + "key": "status", + "value": "test" + } + ] + } + }, + "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 error response\", () => {", + " pm.expect(responseJson.issue[0].details.coding[0].code).to.eql(\"INVALID_VALUE\");", + "});", + "", + "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?performer:identifier=9000000019&_include=test", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], + "query": [ + { + "key": "performer:identifier", + "value": "9000000019" + }, + { + "key": "_include", + "value": "test" + } + ] + } + }, + "response": [] + }, + { + "name": "No performer record found", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const expectedResponseBody = {", + " \"resourceType\": \"OperationOutcome\",", + " \"issue\": [", + " {", + " \"severity\": \"error\",", + " \"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\"", + " }", + " ]", + " }", + " }", + " ]", + "}", + "", + "const responseJson = pm.response.json();", + "", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});", + "", + "pm.test(\"Should have correct error response\", () => {", + " pm.expect(responseJson.issue[0].details.coding[0].code).to.eql(\"INVALIDATED_RESOURCE\");", + "});", + "", + "pm.test(\"Should have correct response body\", () => {", + " pm.expect(responseJson).to.eql(expectedResponseBody);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{api_base_url}}/Consent?performer:identifier=9000000999", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], + "query": [ + { + "key": "performer:identifier", + "value": "9000000999" + } + ] + } + }, + "response": [] + }, + { + "name": "Invalid performer identifier", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const expectedResponseBody = {", + " \"issue\": [", + " {", + " \"code\": \"invalid\",", + " \"diagnostics\": \"Invalid request with error - performer:identifier or patient:identifier parameter is invalid.\",", + " \"details\": {", + " \"coding\": [", + " {", + " \"code\": \"INVALID_IDENTIFIER_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 422\", function () {", + " pm.response.to.have.status(422);", + "});", + "", + "pm.test(\"Should have correct error response\", () => {", + " pm.expect(responseJson.issue[0].details.coding[0].code).to.eql(\"INVALID_IDENTIFIER_VALUE\");", + "});", + "", + "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?performer:identifier=90000009990", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], + "query": [ + { + "key": "performer:identifier", + "value": "90000009990" + } + ] + } + }, + "response": [] + }, + { + "name": "Invalid performer identifier system", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const expectedResponseBody = {", + " \"issue\": [", + " {", + " \"code\": \"invalid\",", + " \"diagnostics\": \"Invalid request with error - performer:identifier or patient:identifier system parameter is invalid.\",", + " \"details\": {", + " \"coding\": [", + " {", + " \"code\": \"INVALID_IDENTIFIER_SYSTEM\",", + " \"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 422\", function () {", + " pm.response.to.have.status(422);", + "});", + "", + "pm.test(\"Should have correct error response\", () => {", + " pm.expect(responseJson.issue[0].details.coding[0].code).to.eql(\"INVALID_IDENTIFIER_SYSTEM\");", + "});", + "", + "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?performer:identifier=https://fhir.nhs.uk/Id/nhs-number|1234567890", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], + "query": [ + { + "key": "performer:identifier", + "value": "https://fhir.nhs.uk/Id/nhs-number|1234567890" + } + ] + } + }, + "response": [] + }, + { + "name": "Missing performer identifier value", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const expectedResponseBody = {", + " \"issue\": [", + " {", + " \"code\": \"invalid\",", + " \"diagnostics\": \"Invalid request with error - performer:identifier or patient:identifier parameter not found.\",", + " \"details\": {", + " \"coding\": [", + " {", + " \"code\": \"MISSING_IDENTIFIER_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 error response\", () => {", + " pm.expect(responseJson.issue[0].details.coding[0].code).to.eql(\"MISSING_IDENTIFIER_VALUE\");", + "});", + "", + "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": "GP Practice 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\": \"GP_PRACTICE_NOT_FOUND\",", + " \"display\": \"GP Practice could not be found - 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 error response\", () => {", + " pm.expect(responseJson.issue[0].details.coding[0].code).to.eql(\"GP_PRACTICE_NOT_FOUND\");", + "});", + "", + "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?performer:identifier=9000000012", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], + "query": [ + { + "key": "performer:identifier", + "value": "9000000012" + } + ] + } + }, + "response": [] + } + ], + "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": "Create a proxy role (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\", () => {", - " 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": {} @@ -4864,153 +6524,302 @@ } ], "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?patient:identifier=9000000100&_include=Consent:patient", + "raw": "{{api_base_url}}/Consent", "host": [ "{{api_base_url}}" ], "path": [ "Consent" - ], - "query": [ - { - "key": "patient:identifier", - "value": "9000000100" - }, - { - "key": "_include", - "value": "Consent:patient" - } ] } }, "response": [] }, { - "name": "No relationships", + "name": "Adult-adult proxy creation", "event": [ { "listen": "test", "script": { "exec": [ "const expectedResponseBody = {", - " \"resourceType\": \"Bundle\",", - " \"timestamp\": \"2020-08-26T14:00:00+00:00\",", - " \"total\": 0,", - " \"type\": \"searchset\",", - " \"entry\": []", + " \"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);", - "});" + "});", + "", + "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" + "type": "text/javascript", + "packages": {} } } ], "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?performer:identifier=9000000025", + "raw": "{{api_base_url}}/Consent", "host": [ "{{api_base_url}}" ], "path": [ "Consent" - ], - "query": [ - { - "key": "performer:identifier", - "value": "9000000025" + ] + } + }, + "response": [] + }, + { + "name": "Invalid performer NHS number", + "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\"", + "}", + "", + "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);", + "});", + "" + ], + "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\": \"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", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" ] } }, "response": [] }, { - "name": "Single consenting adult proxy 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/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\": \"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\"", + " }", + " ]", " },", - " \"verificationDate\": \"2024-07-21T17:32:28Z\"", - " }", - " ]", - " },", - " \"search\": {", - " \"mode\": \"match\"", - " }", - " }", - " ]", + " \"search\": {", + " \"mode\": \"match\"", + " }", + " }", + " ]", "}", "", "pm.test(\"Status code is 200\", function () {", @@ -5022,7 +6831,8 @@ " pm.expect(responseJson).to.eql(expectedResponseBody);", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -5030,25 +6840,20 @@ "method": "GET", "header": [], "url": { - "raw": "{{api_base_url}}/Consent?performer:identifier=9000000010", + "raw": "{{api_base_url}}/Consent/74eed847-ca25-4e76-8cf2-f2c2d7842a7a", "host": [ "{{api_base_url}}" ], "path": [ - "Consent" - ], - "query": [ - { - "key": "performer:identifier", - "value": "9000000010" - } + "Consent", + "74eed847-ca25-4e76-8cf2-f2c2d7842a7a" ] } }, "response": [] }, { - "name": "Single consenting adult proxy relationship include performer and patient", + "name": "Retrieve consenting adult relationship with patient details", "event": [ { "listen": "test", @@ -5057,48 +6862,10 @@ "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/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\",", @@ -5217,7 +6984,8 @@ " pm.expect(responseJson).to.eql(expectedResponseBody);", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -5225,22 +6993,15 @@ "method": "GET", "header": [], "url": { - "raw": "{{api_base_url}}/Consent?performer:identifier=9000000010&_include=Consent:performer&_include=Consent:patient", + "raw": "{{api_base_url}}/Consent/74eed847-ca25-4e76-8cf2-f2c2d7842a7a?_include=Consent:patient", "host": [ "{{api_base_url}}" ], "path": [ - "Consent" + "Consent", + "74eed847-ca25-4e76-8cf2-f2c2d7842a7a" ], "query": [ - { - "key": "performer:identifier", - "value": "9000000010" - }, - { - "key": "_include", - "value": "Consent:performer" - }, { "key": "_include", "value": "Consent:patient" @@ -5251,7 +7012,7 @@ "response": [] }, { - "name": "Single mother-child relationship", + "name": "Retrieve consenting adult relationship with performer details", "event": [ { "listen": "test", @@ -5260,14 +7021,52 @@ "const expectedResponseBody = {", " \"resourceType\": \"Bundle\",", " \"timestamp\": \"2020-08-26T14:00:00+00:00\",", - " \"total\": 1,", + " \"total\": 2,", " \"type\": \"searchset\",", " \"entry\": [", " {", - " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/BBCC67E9\",", + " \"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\": \"BBCC67E9\",", + " \"id\": \"WWCC67T1\",", " \"status\": \"active\",", " \"scope\": {", " \"coding\": [", @@ -5294,7 +7093,7 @@ " \"patient\": {", " \"identifier\": {", " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000009\"", + " \"value\": \"9000000005\"", " }", " },", " \"dateTime\": \"2024-07-21T17:32:28Z\",", @@ -5302,10 +7101,22 @@ " {", " \"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\": {", " \"mode\": \"match\"", @@ -5323,7 +7134,8 @@ " pm.expect(responseJson).to.eql(expectedResponseBody);", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -5331,17 +7143,18 @@ "method": "GET", "header": [], "url": { - "raw": "{{api_base_url}}/Consent?performer:identifier=9000000019", + "raw": "{{api_base_url}}/Consent/74eed847-ca25-4e76-8cf2-f2c2d7842a7a?_include=Consent:performer", "host": [ "{{api_base_url}}" ], "path": [ - "Consent" + "Consent", + "74eed847-ca25-4e76-8cf2-f2c2d7842a7a" ], "query": [ { - "key": "performer:identifier", - "value": "9000000019" + "key": "_include", + "value": "Consent:performer" } ] } @@ -5349,7 +7162,7 @@ "response": [] }, { - "name": "Single mother-child relationship include performer and patient", + "name": "Retrieve consenting adult relationship with performer and patient details", "event": [ { "listen": "test", @@ -5362,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\"", " }", " ]", " }", @@ -5405,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\": [", @@ -5428,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\",", @@ -5456,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\": [", @@ -5486,7 +7290,7 @@ " \"patient\": {", " \"identifier\": {", " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",", - " \"value\": \"9000000009\"", + " \"value\": \"9000000005\"", " }", " },", " \"dateTime\": \"2024-07-21T17:32:28Z\",", @@ -5494,10 +7298,22 @@ " {", " \"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\": {", " \"mode\": \"match\"", @@ -5524,18 +7340,15 @@ "method": "GET", "header": [], "url": { - "raw": "{{api_base_url}}/Consent?performer:identifier=9000000019&_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" + "Consent", + "74eed847-ca25-4e76-8cf2-f2c2d7842a7a" ], "query": [ - { - "key": "performer:identifier", - "value": "9000000019" - }, { "key": "_include", "value": "Consent:performer" @@ -5550,250 +7363,75 @@ "response": [] }, { - "name": "Invalid status parameter", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "const expectedResponseBody = {", - " \"resourceType\": \"OperationOutcome\",", - " \"issue\": [", - " {", - " \"severity\": \"error\",", - " \"code\": \"invalid\",", - " \"diagnostics\": \"Invalid request with error - status parameter is invalid.\",", - " \"details\": {", - " \"coding\": [", - " {", - " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", - " \"version\": \"1\",", - " \"code\": \"INVALID_PARAMETER\",", - " \"display\": \"Required parameter(s) are 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?performer:identifier=9000000017&status=test", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ], - "query": [ - { - "key": "performer:identifier", - "value": "9000000017" - }, - { - "key": "status", - "value": "test" - } - ] - } - }, - "response": [] - }, - { - "name": "Invalid include parameter", + "name": "Retrieve mother-child relationship", "event": [ { "listen": "test", "script": { "exec": [ "const expectedResponseBody = {", - " \"resourceType\": \"OperationOutcome\",", - " \"issue\": [", + " \"resourceType\": \"Bundle\",", + " \"timestamp\": \"2020-08-26T14:00:00+00:00\",", + " \"total\": 1,", + " \"type\": \"searchset\",", + " \"entry\": [", " {", - " \"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 error response\", () => {", - " pm.expect(responseJson.issue[0].details.coding[0].code).to.eql(\"INVALID_VALUE\");", - "});", - "", - "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?performer:identifier=9000000019&_include=test", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ], - "query": [ - { - "key": "performer:identifier", - "value": "9000000019" - }, - { - "key": "_include", - "value": "test" - } - ] - } - }, - "response": [] - }, - { - "name": "No performer record found", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "const expectedResponseBody = {", - " \"resourceType\": \"OperationOutcome\",", - " \"issue\": [", - " {", - " \"severity\": \"error\",", - " \"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\"", - " }", - " ]", + " \"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\"", " }", - " }", - " ]", - "}", - "", - "const responseJson = pm.response.json();", - "", - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});", - "", - "pm.test(\"Should have correct error response\", () => {", - " pm.expect(responseJson.issue[0].details.coding[0].code).to.eql(\"INVALIDATED_RESOURCE\");", - "});", - "", - "pm.test(\"Should have correct response body\", () => {", - " pm.expect(responseJson).to.eql(expectedResponseBody);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{api_base_url}}/Consent?performer:identifier=9000000999", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ], - "query": [ - { - "key": "performer:identifier", - "value": "9000000999" - } - ] - } - }, - "response": [] - }, - { - "name": "Invalid performer identifier", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "const expectedResponseBody = {", - " \"issue\": [", - " {", - " \"code\": \"invalid\",", - " \"diagnostics\": \"Invalid request with error - performer:identifier or patient:identifier parameter is invalid.\",", - " \"details\": {", - " \"coding\": [", + " ],", + " \"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\": [", " {", - " \"code\": \"INVALID_IDENTIFIER_VALUE\",", - " \"display\": \"Required parameter(s) are invalid.\",", - " \"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 422\", function () {", - " pm.response.to.have.status(422);", - "});", - "", - "pm.test(\"Should have correct error response\", () => {", - " pm.expect(responseJson.issue[0].details.coding[0].code).to.eql(\"INVALID_IDENTIFIER_VALUE\");", + "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);", "});" ], @@ -5806,62 +7444,139 @@ "method": "GET", "header": [], "url": { - "raw": "{{api_base_url}}/Consent?performer:identifier=90000009990", + "raw": "{{api_base_url}}/Consent/39df03a2-1b14-4d19-b1dc-d5d8cbf96948", "host": [ "{{api_base_url}}" ], "path": [ - "Consent" - ], - "query": [ - { - "key": "performer:identifier", - "value": "90000009990" - } + "Consent", + "39df03a2-1b14-4d19-b1dc-d5d8cbf96948" ] } }, "response": [] }, { - "name": "Invalid performer identifier system", + "name": "Retrieve mother-child relationship with patient details", "event": [ { "listen": "test", "script": { "exec": [ "const expectedResponseBody = {", - " \"issue\": [", + " \"resourceType\": \"Bundle\",", + " \"timestamp\": \"2020-08-26T14:00:00+00:00\",", + " \"total\": 2,", + " \"type\": \"searchset\",", + " \"entry\": [", " {", - " \"code\": \"invalid\",", - " \"diagnostics\": \"Invalid request with error - performer:identifier or patient:identifier system parameter is invalid.\",", - " \"details\": {", - " \"coding\": [", + " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Patient/A3CC67E2\",", + " \"resource\": {", + " \"resourceType\": \"Patient\",", + " \"id\": \"A3CC67E2\",", + " \"identifier\": [", " {", - " \"code\": \"INVALID_IDENTIFIER_SYSTEM\",", - " \"display\": \"Required parameter(s) are invalid.\",", - " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", - " \"version\": \"1\"", + " \"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\"", + " }", " }", " ]", " },", - " \"severity\": \"error\"", + " \"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\"", + " }", " }", - " ],", - " \"resourceType\": \"OperationOutcome\"", + " ]", "}", "", - "const responseJson = pm.response.json();", - "", - "pm.test(\"Status code is 422\", function () {", - " pm.response.to.have.status(422);", - "});", - "", - "pm.test(\"Should have correct error response\", () => {", - " pm.expect(responseJson.issue[0].details.coding[0].code).to.eql(\"INVALID_IDENTIFIER_SYSTEM\");", + "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);", "});" ], @@ -5874,17 +7589,18 @@ "method": "GET", "header": [], "url": { - "raw": "{{api_base_url}}/Consent?performer:identifier=https://fhir.nhs.uk/Id/nhs-number|1234567890", + "raw": "{{api_base_url}}/Consent/39df03a2-1b14-4d19-b1dc-d5d8cbf96948?_include=Consent:patient", "host": [ "{{api_base_url}}" ], "path": [ - "Consent" + "Consent", + "39df03a2-1b14-4d19-b1dc-d5d8cbf96948" ], "query": [ { - "key": "performer:identifier", - "value": "https://fhir.nhs.uk/Id/nhs-number|1234567890" + "key": "_include", + "value": "Consent:patient" } ] } @@ -5892,105 +7608,118 @@ "response": [] }, { - "name": "Missing performer identifier value", + "name": "Retrieve mother-child relationship with performer details", "event": [ { "listen": "test", "script": { "exec": [ "const expectedResponseBody = {", - " \"issue\": [", + " \"resourceType\": \"Bundle\",", + " \"timestamp\": \"2020-08-26T14:00:00+00:00\",", + " \"total\": 2,", + " \"type\": \"searchset\",", + " \"entry\": [", " {", - " \"code\": \"invalid\",", - " \"diagnostics\": \"Invalid request with error - performer:identifier or patient:identifier parameter not found.\",", - " \"details\": {", - " \"coding\": [", + " \"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\": [", " {", - " \"code\": \"MISSING_IDENTIFIER_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(\"Should have correct error response\", () => {", - " pm.expect(responseJson.issue[0].details.coding[0].code).to.eql(\"MISSING_IDENTIFIER_VALUE\");", - "});", - "", - "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": "GP Practice 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\": \"GP_PRACTICE_NOT_FOUND\",", - " \"display\": \"GP Practice could not be found - 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 error response\", () => {", - " pm.expect(responseJson.issue[0].details.coding[0].code).to.eql(\"GP_PRACTICE_NOT_FOUND\");", + "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);", "});" ], @@ -6003,58 +7732,190 @@ "method": "GET", "header": [], "url": { - "raw": "{{api_base_url}}/Consent?performer:identifier=9000000012", + "raw": "{{api_base_url}}/Consent/39df03a2-1b14-4d19-b1dc-d5d8cbf96948?_include=Consent:performer", "host": [ "{{api_base_url}}" ], "path": [ - "Consent" + "Consent", + "39df03a2-1b14-4d19-b1dc-d5d8cbf96948" ], "query": [ { - "key": "performer:identifier", - "value": "9000000012" + "key": "_include", + "value": "Consent:performer" } ] } }, "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)" - }, - { - "name": "Create proxy relationship (Consent)", - "item": [ + }, { - "name": "Parent-child proxy creation", + "name": "Retrieve mother-child relationship with performer and patient details", "event": [ { "listen": "test", "script": { "exec": [ "const expectedResponseBody = {", - " \"resourceType\": \"OperationOutcome\",", - " \"issue\": [", - " {", - " \"severity\": \"information\",", - " \"code\": \"informational\"", - " }", - " ]", + " \"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 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": {} @@ -6062,192 +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\": \"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", + "raw": "{{api_base_url}}/Consent/39df03a2-1b14-4d19-b1dc-d5d8cbf96948?_include=Consent:performer&_include=Consent:patient", "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\"", - " }", - " ]", - "}", - "", - "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\": \"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", - "host": [ - "{{api_base_url}}" + "Consent", + "39df03a2-1b14-4d19-b1dc-d5d8cbf96948" ], - "path": [ - "Consent" - ] - } - }, - "response": [] - }, - { - "name": "Invalid performer NHS number", - "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\"", - "}", - "", - "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);", - "});", - "" - ], - "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\": \"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" + "query": [ + { + "key": "_include", + "value": "Consent:performer" + }, + { + "key": "_include", + "value": "Consent:patient" } - } - }, - "url": { - "raw": "{{api_base_url}}/Consent", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" ] } }, "response": [] }, { - "name": "Duplicate relationship", + "name": "Invalid 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 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 409\", function () {", - " pm.response.to.have.status(409);", + "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": {} @@ -6255,58 +7992,56 @@ } ], "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\": \"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", + "raw": "{{api_base_url}}/Consent/invalid-identifier", "host": [ "{{api_base_url}}" ], "path": [ - "Consent" + "Consent", + "invalid-identifier" ] } }, "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", + "name": "Missing consent ID", "event": [ { "listen": "test", "script": { "exec": [ "const expectedResponseBody = {", - " \"resourceType\": \"OperationOutcome\",", - " \"issue\": [", - " {", - " \"severity\": \"information\",", - " \"code\": \"informational\"", - " }", - " ]", + " \"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 201\", function () {", - " pm.response.to.have.status(200);", + "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);", "});" ], @@ -6316,33 +8051,23 @@ } ], "request": { - "method": "PATCH", + "method": "GET", "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}}/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", @@ -6352,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);", "});" ], @@ -6373,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", @@ -6409,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);", "});" ], @@ -6430,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", @@ -6465,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\"", " }", " ]", " },", @@ -6483,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);", "});" ], @@ -6498,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\", () => {", @@ -6570,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" @@ -6578,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\", () => {", @@ -6638,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" @@ -6646,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\", () => {", @@ -6706,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" @@ -6714,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", @@ -6738,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\"", " }", @@ -6782,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", @@ -6805,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\"", " }", @@ -6822,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\", () => {", @@ -6841,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" @@ -6849,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);", "});" ], @@ -7073,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);", "});" ], @@ -7147,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);", "});" ], @@ -7215,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);", "});" ], @@ -7289,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": [ @@ -7355,4 +8872,4 @@ "type": "string" } ] -} +} \ No newline at end of file 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..24e94c1a 100644 --- a/sandbox/api/constants.py +++ b/sandbox/api/constants.py @@ -41,10 +41,22 @@ 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 +70,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..893cc179 --- /dev/null +++ b/sandbox/api/get_consent_by_id.py @@ -0,0 +1,64 @@ +from logging import getLogger +from typing import Union + +from flask import request + +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, + BAD_REQUEST_INCLUDE_PARAM_INVALID, + INVALIDATED_RESOURCE, +) +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} + + Returns: + Union[dict, tuple]: Response for GET /Consent/{id} + """ + try: + params = request.args.to_dict() + 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") + + 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 == "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: + return generate_response_from_example(GET_CONSENT_BY_ID__INVALID_ID_ERROR, 400) + + except Exception: + logger.exception("An error occurred while processing the request") + return generate_response_from_example(INTERNAL_SERVER_ERROR_EXAMPLE, 500) 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..5031f608 --- /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(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, + 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 both + "_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 both + "_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) 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..a200a15d --- /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: 2 + 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..22f43dc5 --- /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: 2 + 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..a34e27bf --- /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: 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' + 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..cd7dc457 --- /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: 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 diff --git a/specification/validated-relationships-service-api.yaml b/specification/validated-relationships-service-api.yaml index 18ed08fb..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 @@ -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" @@ -761,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" @@ -783,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: @@ -799,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: