Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 146 additions & 6 deletions postman/Validated Relationship Service Sandbox.postman_collection.json
Original file line number Diff line number Diff line change
@@ -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": [
{
Expand Down Expand Up @@ -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",
Comment thread
LeoKHoward marked this conversation as resolved.
"event": [
Expand Down Expand Up @@ -10166,7 +10303,6 @@
"listen": "prerequest",
"script": {
"type": "text/javascript",
"packages": {},
"exec": [
""
]
Expand All @@ -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');",
Expand All @@ -10189,6 +10324,11 @@
{
"key": "api_base_url",
"value": "https://sandbox.api.service.nhs.uk/validated-relationships/FHIR/R4"
},
{
"value": "",
"type": "string",
"disabled": true
}
]
}
3 changes: 3 additions & 0 deletions sandbox/api/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 8 additions & 0 deletions sandbox/api/get_consent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions sandbox/api/tests/test_get_consent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 3 additions & 2 deletions sandbox/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Comment thread
LeoKHoward marked this conversation as resolved.
Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions specification/validated-relationships-service-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ info:
* only covers a limited set of scenarios
* is open access, so does not allow you to test authorisation

[<img src="https://run.pstmn.io/button.svg" alt="Run In Postman" style="width: 128px; height: 32px;">](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)

[<img src="https://run.pstmn.io/button.svg" alt="Run In Postman" style="width: 128px; height: 32px;">](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)
Expand Down Expand Up @@ -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 |
Expand Down