Skip to content

Commit 1bc0721

Browse files
NPA-4707: Examples for usage of patient relations
1 parent d20ae97 commit 1bc0721

File tree

7 files changed

+120
-1
lines changed

7 files changed

+120
-1
lines changed

sandbox/api/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@
9595
RELATED__EMPTY_RESPONSE = f"{RELATED_DIRECTORY}empty_response.yaml"
9696
RELATED__LIST_RELATIONSHIP = f"{RELATED_DIRECTORY}list_relationship_9000000017.yaml"
9797
RELATED__LIST_RELATIONSHIP_WITH_INCLUDE = f"{RELATED_DIRECTORY}list_relationship_9000000017_include.yaml"
98+
RELATED__LIST_CHILD_RELATIONSHIP = f"{RELATED_DIRECTORY}list_relationship_9000000042.yaml"
99+
RELATED__LIST_CHILD_RELATIONSHIP_WITH_INCLUDE = f"{RELATED_DIRECTORY}list_relationship_9000000042_include.yaml"
98100
RELATED__VERIFY_RELATIONSHIP_09 = f"{RELATED_DIRECTORY}verify_relationship_9000000009.yaml"
99101
RELATED__VERIFY_RELATIONSHIP_09_WITH_INCLUDE = f"{RELATED_DIRECTORY}verify_relationship_9000000009_include.yaml"
100102
RELATED__VERIFY_RELATIONSHIP_25 = f"{RELATED_DIRECTORY}verify_relationship_9000000025.yaml"

sandbox/api/get_related_person.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,15 @@ def get_related_person_response() -> Union[dict, tuple]:
7373
):
7474
return one_seven
7575

76+
if four_two := check_for_list(
77+
"9000000042",
78+
patient_identifier,
79+
include,
80+
RELATED__LIST_RELATIONSHIP,
81+
RELATED__LIST_RELATIONSHIP_WITH_INCLUDE,
82+
):
83+
return four_two
84+
7685
raise ValueError("Invalid request")
7786

7887
except Exception:

sandbox/api/tests/test_get_related_person.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@
2525
"./api/examples/GET_RelatedPerson/list_relationship_9000000017_include.yaml",
2626
200,
2727
),
28+
(
29+
"patient:identifier=9000000042",
30+
"./api/examples/GET_RelatedPerson/list_relationship_9000000042.yaml",
31+
200,
32+
),
33+
(
34+
"patient:identifier=9000000042&_include=RelatedPerson:patient",
35+
"./api/examples/GET_RelatedPerson/list_relationship_9000000042_include.yaml",
36+
200,
37+
),
2838
(
2939
"identifier=9000000017&_include=any",
3040
"./api/examples/GET_RelatedPerson/list_relationship_9000000017.yaml",

specification/examples/responses/GET_RelatedPerson/list_relationship_9000000017_include.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ListRelationship9000000017Include:
2-
summary: List relationship response for 9000000017
2+
summary: List relationship response for 9000000017 with include
33
description: |
44
Example response containing the details of a list of matched candidate proxy relationship between a birth mother and her children.
55
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
ListRelationship9000000042:
2+
summary: List relationship response for 9000000042
3+
description: |
4+
Example response containing the details of a list of matched candidate proxy relationship between a child and their birth mother.
5+
6+
The FHIR Bundle contains a `RelatedPerson` resource for each of the relationships verified against authoritative sources.
7+
8+
value:
9+
entry:
10+
- fullUrl: https://sandbox.api.service.nhs.uk/validated-relationships/FHIR/R4/RelatedPerson/BE974742
11+
resource:
12+
id: BE974742
13+
identifier:
14+
- system: https://fhir.nhs.uk/Id/nhs-number
15+
value: '9000000042'
16+
patient:
17+
identifier:
18+
system: https://fhir.nhs.uk/Id/nhs-number
19+
value: '9000000009'
20+
type: Patient
21+
relationship:
22+
- coding:
23+
- code: CHILD
24+
display: child
25+
system: http://terminology.hl7.org/CodeSystem/v3-RoleCode
26+
resourceType: RelatedPerson
27+
search:
28+
mode: match
29+
link:
30+
- relation: self
31+
url: https://sandbox.api.service.nhs.uk/validated-relationships/FHIR/R4/RelatedPerson?patient:identifier=9000000042
32+
resourceType: Bundle
33+
timestamp: '2024-01-01T00:00:00+00:00'
34+
total: 1
35+
type: searchset
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
ListRelationship9000000042Include:
2+
summary: List relationship response for 9000000042 with include
3+
description: |
4+
Example response containing the details of a list of matched candidate proxy relationship between a child and their birth mother.
5+
6+
The FHIR Bundle contains a `RelatedPerson` resource for each of the relationships verified against authoritative sources.
7+
8+
`Patient` resources are included in the bundle when the `_include=RelatedPerson:patient` query parameter is specified.
9+
10+
value:
11+
entry:
12+
- fullUrl: https://sandbox.api.service.nhs.uk/validated-relationships/FHIR/R4/RelatedPerson/BE974742
13+
resource:
14+
id: BE974742
15+
identifier:
16+
- system: https://fhir.nhs.uk/Id/nhs-number
17+
value: '9000000042'
18+
patient:
19+
identifier:
20+
system: https://fhir.nhs.uk/Id/nhs-number
21+
value: '9000000009'
22+
type: Patient
23+
relationship:
24+
- coding:
25+
- code: CHILD
26+
display: child
27+
system: http://terminology.hl7.org/CodeSystem/v3-RoleCode
28+
resourceType: RelatedPerson
29+
search:
30+
mode: match
31+
- fullUrl: https://sandbox.api.service.nhs.uk/validated-relationships/FHIR/R4/Patient/9000000009
32+
resource:
33+
birthDate: '2017-09-23'
34+
id: '9000000009'
35+
identifier:
36+
- system: https://fhir.nhs.uk/Id/nhs-number
37+
value: '9000000009'
38+
name:
39+
- family: MOGAJI
40+
given:
41+
- GADIL
42+
id: BLnbA
43+
period:
44+
start: '2021-07-08'
45+
prefix:
46+
- MR
47+
use: usual
48+
resourceType: Patient
49+
search:
50+
mode: include
51+
link:
52+
- relation: self
53+
url: https://sandbox.api.service.nhs.uk/validated-relationships/FHIR/R4/RelatedPerson?patient:identifier=9000000042
54+
resourceType: Bundle
55+
timestamp: '2024-01-01T00:00:00+00:00'
56+
total: 2
57+
type: searchset

specification/validated-relationships-service-api.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,8 @@ paths:
359359
| --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------- |
360360
| List Relationship | `identifier`=`9000000017` | HTTP Status 200 List of relationships for the proxy |
361361
| List Relationship and include patient's details | `identifier`=`9000000017` and `_include`=`RelatedPerson:patient` | HTTP Status 200 List of relationships for the proxy and includes patient data |
362+
| List Patient Relationship | `identifier`=`9000000042` | HTTP Status 200 List of relationships for the patient |
363+
| List Patient Relationship and include patient's details | `identifier`=`9000000042` and `_include`=`RelatedPerson:patient` | HTTP Status 200 List of relationships for the patient and includes proxy data |
362364
| List Relationship and no relationships returned | `identifier`=`9000000033` | HTTP Status 200 Empty bundle |
363365
| Verify Relationship between proxy and patient | `identifier`=`9000000017` and `patient:identifier`=`9000000009` | HTTP Status 200 Verified relationship between patient and proxy |
364366
| Verify Relationship between proxy and patient and include patient's details | `identifier`=`9000000017` and `patient:identifier`=`9000000009` and `_include`=`RelatedPerson:patient` | HTTP Status 200 Verified relationship between patient and proxy and includes patient's details |
@@ -395,6 +397,10 @@ paths:
395397
$ref: "./examples/responses/GET_RelatedPerson/list_relationship_9000000017.yaml#/ListRelationship9000000017"
396398
listRelationshipIncludePatient:
397399
$ref: "./examples/responses/GET_RelatedPerson/list_relationship_9000000017_include.yaml#/ListRelationship9000000017Include"
400+
listChildRelationship:
401+
$ref: "./examples/responses/GET_RelatedPerson/list_relationship_9000000042.yaml#/ListRelationship9000000042"
402+
listChildRelationshipIncludePatient:
403+
$ref: "./examples/responses/GET_RelatedPerson/list_relationship_9000000042_include.yaml#/ListRelationship9000000042Include"
398404
verifyRelationshipExample1:
399405
$ref: "./examples/responses/GET_RelatedPerson/verify_relationship_9000000009.yaml#/VerifyRelationship9000000009"
400406
verifyRelationshipExample1Include:

0 commit comments

Comments
 (0)