diff --git a/postman/Validated Relationship Service Sandbox.postman_collection.json b/postman/Validated Relationship Service Sandbox.postman_collection.json
index 299b58ff..55e673a0 100644
--- a/postman/Validated Relationship Service Sandbox.postman_collection.json
+++ b/postman/Validated Relationship Service Sandbox.postman_collection.json
@@ -1,11 +1,10 @@
{
"info": {
- "_postman_id": "e45a02c2-af60-4d4c-b790-c6708ae0f214",
- "name": "Validated Relationship Service Sandbox 03/11/25",
+ "_postman_id": "4fd91043-1337-4f8b-92c9-96c597b343c8",
+ "name": "Validated Relationship Service Sandbox 04/11/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",
- "_collection_link": "https://l44444-2379.postman.co/workspace/aac72fed-09cc-4a02-a0b4-9429fb546dba/collection/44536620-e45a02c2-af60-4d4c-b790-c6708ae0f214?action=share&source=collection_link&creator=44536620"
+ "_exporter_id": "26376766"
},
"item": [
{
@@ -7351,6 +7350,144 @@
},
"response": []
},
+ {
+ "name": "Single mother-child relationship unknown legal basis",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "const expectedResponseBody = {",
+ " \"resourceType\": \"Bundle\",",
+ " \"timestamp\": \"2020-08-26T14:00:00+00:00\",",
+ " \"total\": 1,",
+ " \"type\": \"searchset\",",
+ " \"link\": [",
+ " {",
+ " \"relation\": \"self\",",
+ " \"url\": \"https://sandbox.api.service.nhs.uk/validated-relationships/FHIR/R4/Consent?performer:identifier=9000000111\"",
+ " }",
+ " ],",
+ " \"entry\": [",
+ " {",
+ " \"fullUrl\": \"https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/AF974742\",",
+ " \"resource\": {",
+ " \"resourceType\": \"Consent\",",
+ " \"id\": \"AF974742\",",
+ " \"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\": \"9000000119\"",
+ " }",
+ " },",
+ " \"dateTime\": \"2024-07-21T17:32:28Z\",",
+ " \"performer\": [",
+ " {",
+ " \"identifier\": {",
+ " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",",
+ " \"value\": \"9000000111\"",
+ " }",
+ " }",
+ " ],",
+ " \"policy\": [",
+ " {",
+ " \"authority\": \"https://www.england.nhs.uk\",",
+ " \"uri\": \"REPLACE_WITH_LINK_TO_PUBLISHED_NATIONAL_PROXY_STANDARD\",",
+ " \"code\": \"unknown\",",
+ " \"display\": \"Unknown legal basis\"",
+ " }",
+ " ],",
+ " \"provision\": {",
+ " \"actor\": [",
+ " {",
+ " \"reference\": {",
+ " \"identifier\": {",
+ " \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",",
+ " \"value\": \"9000000111\"",
+ " },",
+ " \"type\": \"RelatedPerson\"",
+ " },",
+ " \"role\": {",
+ " \"coding\": [",
+ " {",
+ " \"code\": \"unknown\",",
+ " \"display\": \"Unknown\",",
+ " \"system\": \"https://fhir.nhs.uk/CodeSystem/proxy-legal-basis\"",
+ " }",
+ " ]",
+ " }",
+ " }",
+ " ],",
+ " \"period\": {",
+ " \"start\": \"2025-02-11\",",
+ " \"end\": \"2026-02-11\"",
+ " }",
+ " }",
+ " },",
+ " \"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=9000000111",
+ "host": [
+ "{{api_base_url}}"
+ ],
+ "path": [
+ "Consent"
+ ],
+ "query": [
+ {
+ "key": "performer:identifier",
+ "value": "9000000111"
+ }
+ ]
+ }
+ },
+ "response": []
+ },
{
"name": "No performer record found",
"event": [
@@ -10166,7 +10303,6 @@
"listen": "prerequest",
"script": {
"type": "text/javascript",
- "packages": {},
"exec": [
""
]
@@ -10176,7 +10312,6 @@
"listen": "test",
"script": {
"type": "text/javascript",
- "packages": {},
"exec": [
"pm.test(\"Response has FHIR content type\", () => {",
" pm.expect(pm.response.headers.get('Content-Type')).to.include('application/fhir+json');",
@@ -10189,6 +10324,11 @@
{
"key": "api_base_url",
"value": "https://sandbox.api.service.nhs.uk/validated-relationships/FHIR/R4"
+ },
+ {
+ "value": "",
+ "type": "string",
+ "disabled": true
}
]
}
\ No newline at end of file
diff --git a/sandbox/api/constants.py b/sandbox/api/constants.py
index 5d044316..9c700c07 100644
--- a/sandbox/api/constants.py
+++ b/sandbox/api/constants.py
@@ -71,6 +71,9 @@
GET_CONSENT__MULTIPLE_RELATIONSHIPS_SINGLE_PATIENT_INCLUDE_BOTH = (
f"{GET_CONSENT__DIRECTORY}multiple-relationships-single-patient-include-performer-patient.yaml"
)
+GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_UNKNOWN_LEGAL_BASIS = (
+ f"{GET_CONSENT__DIRECTORY}single-mother-child-relationship-unknown-legal-basis.yaml"
+)
# GET Consent by ID
GET_CONSENT_BY_ID__INVALID_ID_ERROR = f"{GET_CONSENT__DIRECTORY}ID/errors/invalid-id.yaml"
diff --git a/sandbox/api/get_consent.py b/sandbox/api/get_consent.py
index df34839d..68cee8de 100644
--- a/sandbox/api/get_consent.py
+++ b/sandbox/api/get_consent.py
@@ -22,6 +22,7 @@
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_BOTH,
INTERNAL_SERVER_ERROR_EXAMPLE,
INVALIDATED_RESOURCE,
+ GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_UNKNOWN_LEGAL_BASIS,
)
from .utils import (
check_for_consent_filtering,
@@ -65,6 +66,13 @@ def get_consent_response() -> Union[dict, tuple]:
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP,
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_BOTH,
)
+ # Single mother-child relationship with unknown legal basis
+ elif performer_identifier == "9000000111" or patient_identifier == "9000000119":
+ return check_for_consent_include_params(
+ _include,
+ GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_UNKNOWN_LEGAL_BASIS,
+ )
+
elif patient_identifier == "9000000100":
return check_for_consent_include_params(
_include,
diff --git a/sandbox/api/tests/test_get_consent.py b/sandbox/api/tests/test_get_consent.py
index c027b4d9..17a1b2e3 100644
--- a/sandbox/api/tests/test_get_consent.py
+++ b/sandbox/api/tests/test_get_consent.py
@@ -168,6 +168,11 @@ def test_get_consent_returns_expected_responses__mocked_get_consent(
"./api/examples/GET_Consent/multiple-relationships-single-patient-include-performer-patient.yaml",
200,
),
+ (
+ "performer:identifier=9000000111&patient:identifier=9000000119",
+ "./api/examples/GET_Consent/single-mother-child-relationship-unknown-legal-basis.yaml",
+ 200,
+ ),
(
"performer:identifier=9000000017&status=test", # Invalid status parameter error
"./api/examples/GET_Consent/errors/invalid-status-parameter.yaml",
diff --git a/sandbox/api/utils.py b/sandbox/api/utils.py
index 563f5a9f..d5c5b6eb 100644
--- a/sandbox/api/utils.py
+++ b/sandbox/api/utils.py
@@ -229,7 +229,7 @@ def generate_response_from_example(example_path: str, status_code: int, headers:
def check_for_consent_include_params(
_include: List[str],
include_none_response_yaml: str,
- include_both_response_yaml: str,
+ include_both_response_yaml: str = None,
include_patient_response_yaml: str = None,
include_performer_response_yaml: str = None,
) -> Response:
@@ -238,7 +238,8 @@ def check_for_consent_include_params(
Args:
_include (List[str]): The include parameters supplied to the request
include_none_response_yaml (str): Bundle to return when include params are empty
- include_both_response_yaml (str): Bundle to return when include param is Consent:performer,Consent:patient
+ include_both_response_yaml (str): (optional) Bundle to return when include param
+ is Consent:performer,Consent:patient
include_patient_response_yaml (str): (optional) Bundle to return when include param is Consent:patient
include_performer_response_yaml (str): (optional) Bundle to return when include param is Consent:performer
diff --git a/specification/examples/responses/GET_Consent/single-mother-child-relationship-unknown-legal-basis.yaml b/specification/examples/responses/GET_Consent/single-mother-child-relationship-unknown-legal-basis.yaml
new file mode 100644
index 00000000..94afa36a
--- /dev/null
+++ b/specification/examples/responses/GET_Consent/single-mother-child-relationship-unknown-legal-basis.yaml
@@ -0,0 +1,60 @@
+ConsentSingleAdultChildRelationshipUnknownLegalBasisBundle:
+ summary: Single adult-child proxy relationship with unknown legal basis
+ description: A Bundle containing a single proxy relationship between an adult and child where the legal basis is unknown
+ value:
+ resourceType: Bundle
+ timestamp: '2020-08-26T14:00:00+00:00'
+ total: 1
+ type: searchset
+ link:
+ - relation: self
+ url: https://sandbox.api.service.nhs.uk/validated-relationships/FHIR/R4/Consent?performer:identifier=9000000111
+ entry:
+ - fullUrl: https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/AF974742
+ resource:
+ resourceType: Consent
+ id: AF974742
+ 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: '9000000119'
+ dateTime: '2024-07-21T17:32:28Z'
+ performer:
+ - identifier:
+ system: 'https://fhir.nhs.uk/Id/nhs-number'
+ value: '9000000111'
+ policy:
+ - authority: https://www.england.nhs.uk
+ uri: REPLACE_WITH_LINK_TO_PUBLISHED_NATIONAL_PROXY_STANDARD
+ code: unknown
+ display: Unknown legal basis
+ provision:
+ actor:
+ - reference:
+ identifier:
+ system: https://fhir.nhs.uk/Id/nhs-number
+ value: '9000000111'
+ type: RelatedPerson
+ role:
+ coding:
+ - code: unknown
+ display: Unknown
+ system: https://fhir.nhs.uk/CodeSystem/proxy-legal-basis
+ period:
+ start: '2025-02-11'
+ end: '2026-02-11'
+ search:
+ mode: match
diff --git a/specification/validated-relationships-service-api.yaml b/specification/validated-relationships-service-api.yaml
index e145263d..83dcd84f 100644
--- a/specification/validated-relationships-service-api.yaml
+++ b/specification/validated-relationships-service-api.yaml
@@ -141,8 +141,7 @@ info:
* only covers a limited set of scenarios
* is open access, so does not allow you to test authorisation
- [
](https://app.getpostman.com/run-collection/44536620-e45a02c2-af60-4d4c-b790-c6708ae0f214?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D44536620-e45a02c2-af60-4d4c-b790-c6708ae0f214%26entityType%3Dcollection%26workspaceId%3D65d46c77-2ee2-4fb0-92de-2ec03857a9e6)
-
+ [
](https://app.getpostman.com/run-collection/26376766-4fd91043-1337-4f8b-92c9-96c597b343c8?action=collection%2Ffork&collection-url=entityId%3D26376766-4fd91043-1337-4f8b-92c9-96c597b343c8%26entityType%3Dcollection%26workspaceId%3D8fc7bffa-055c-43e2-b94b-da0fdce3aa4b)
### Integration testing
Our [integration test environment](https://digital.nhs.uk/developer/guides-and-documentation/testing#integration-testing)
@@ -563,6 +562,7 @@ paths:
| A single proxy relationship between consenting adults including details | `performer:identifier=9000000010` and/or `patient:identifier=9000000005&_include=Consent:patient&_include=Consent:proxy` | HTTP Status 200 Bundle containing a single proxy relationship including performer and patient details |
| A single proxy relationship between a mother and child | `performer:identifier=9000000019` and/or `patient:identifier=9000000009` | HTTP Status 200 Bundle containing a single proxy relationship |
| A single proxy relationship between a mother and child including details | `performer:identifier=9000000019` and/or `patient:identifier=9000000009&_include=Consent:patient&_include=Consent:proxy` | HTTP Status 200 Bundle containing a single proxy relationship including performer and patient details |
+ | A single proxy relationship between a mother and child with legal basis unknown | `performer:identifier=9000000111` and/or `patient:identifier=9000000119` | HTTP Status 200 Bundle containing a single proxy relationship with legal basis unknown |
| Invalid status parameter | `performer:identifier=9000000019` and/or `patient:identifier=9000000009&status=test` | HTTP Status 422 and INVALID_PARAMETER error response |
| Invalid include parameter | `performer:identifier=9000000019` and/or `patient:identifier=9000000009&_include=test` | HTTP Status 422 and INVALID_PARAMETER error response |
| Missing identifier | `patient:identifier=9000000009` | HTTP Status 400 and MISSING_IDENTIFIER_VALUE error response |