Skip to content

Commit f8bbe3b

Browse files
committed
NPA-5537: Add new legal basis specs
1 parent 8a90c8a commit f8bbe3b

8 files changed

+394
-51
lines changed

postman/Validated Relationship Service Sandbox.postman_collection.json

Lines changed: 11 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -8772,11 +8772,6 @@
87728772
" \"display\": \"Parent\",",
87738773
" \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\"",
87748774
" }",
8775-
" {",
8776-
" \"code\": \"unknown\",",
8777-
" \"display\": \"Unknown\",",
8778-
" \"system\": \"https://fhir.nhs.uk/CodeSystem/proxy-legal-basis\"",
8779-
" }",
87808775
" ]",
87818776
" }",
87828777
" }",
@@ -8875,10 +8870,17 @@
88758870
" \"start\": \"2020-01-01\",",
88768871
" \"end\": \"2021-12-31\"",
88778872
" },",
8878-
" \"given\": [\"Jane Marie Anne\"],",
8873+
" \"given\": [",
8874+
" \"Jane Marie Anne\"",
8875+
" ],",
88798876
" \"family\": \"Smith\",",
8880-
" \"prefix\": [\"Mrs\"],",
8881-
" \"suffix\": [\"MBE\",\"PhD\"]",
8877+
" \"prefix\": [",
8878+
" \"Mrs\"",
8879+
" ],",
8880+
" \"suffix\": [",
8881+
" \"MBE\",",
8882+
" \"PhD\"",
8883+
" ]",
88828884
" }",
88838885
" ],",
88848886
" \"birthDate\": \"2022-10-22\",",
@@ -8944,38 +8946,7 @@
89448946
" \"authority\": \"https://www.england.nhs.uk\",",
89458947
" \"uri\": \"REPLACE_WITH_LINK_TO_PUBLISHED_NATIONAL_PROXY_STANDARD\"",
89468948
" }",
8947-
" ],",
8948-
" \"provision\": {",
8949-
" \"actor\": [",
8950-
" {",
8951-
" \"reference\": {",
8952-
" \"identifier\": {",
8953-
" \"system\": \"https://fhir.nhs.uk/Id/nhs-number\",",
8954-
" \"value\": \"9000000019\"",
8955-
" },",
8956-
" \"type\": \"RelatedPerson\"",
8957-
" },",
8958-
" \"role\": {",
8959-
" \"coding\": [",
8960-
" {",
8961-
" \"code\": \"PRN\",",
8962-
" \"display\": \"Parent\",",
8963-
" \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\"",
8964-
" },",
8965-
" {",
8966-
" \"code\": \"unknown\",",
8967-
" \"display\": \"Unknown\",",
8968-
" \"system\": \"https://fhir.nhs.uk/CodeSystem/proxy-legal-basis\"",
8969-
" }",
8970-
" ]",
8971-
" }",
8972-
" }",
8973-
" ],",
8974-
" \"period\": {",
8975-
" \"start\": \"2025-02-11\",",
8976-
" \"end\": \"2026-02-11\"",
8977-
" }",
8978-
" }",
8949+
" ]",
89798950
" },",
89808951
" \"search\": {",
89818952
" \"mode\": \"match\"",
@@ -9073,11 +9044,6 @@
90739044
" \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",",
90749045
" \"code\": \"MTH\",",
90759046
" \"display\": \"mother\"",
9076-
" },",
9077-
" {",
9078-
" \"system\": \"https://fhir.nhs.uk/CodeSystem/proxy-legal-basis\",",
9079-
" \"code\": \"unknown\",",
9080-
" \"display\": \"Unknown\"",
90819047
" }",
90829048
" ]",
90839049
" }",
@@ -9362,11 +9328,6 @@
93629328
" \"display\": \"Parent\",",
93639329
" \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\"",
93649330
" }",
9365-
" {",
9366-
" \"code\": \"unknown\",",
9367-
" \"display\": \"Unknown\",",
9368-
" \"system\": \"https://fhir.nhs.uk/CodeSystem/proxy-legal-basis\"",
9369-
" }",
93709331
" ]",
93719332
" }",
93729333
" }",

sandbox/api/constants.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,18 @@
7171
GET_CONSENT__MULTIPLE_RELATIONSHIPS_SINGLE_PATIENT_INCLUDE_BOTH = (
7272
f"{GET_CONSENT__DIRECTORY}multiple-relationships-single-patient-include-performer-patient.yaml"
7373
)
74+
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_UNKNOWN_LEGAL_BASIS = (
75+
f"{GET_CONSENT__DIRECTORY}single-mother-child-relationship-unknown-legal-basis.yaml"
76+
)
77+
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_UNKNOWN_LEGAL_BASIS_INCLUDE_BOTH = (
78+
f"{GET_CONSENT__DIRECTORY}single-mother-child-relationship-unknown-legal-basis-include-performer-patient.yaml"
79+
)
80+
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_UNKNOWN_LEGAL_BASIS_INCLUDE_PATIENT = (
81+
f"{GET_CONSENT__DIRECTORY}single-mother-child-relationship-unknown-legal-basis-include-patient.yaml"
82+
)
83+
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_UNKNOWN_LEGAL_BASIS_INCLUDE_PERFORMER = (
84+
f"{GET_CONSENT__DIRECTORY}single-mother-child-relationship-unknown-legal-basis-include-performer.yaml"
85+
)
7486

7587
# GET Consent by ID
7688
GET_CONSENT_BY_ID__INVALID_ID_ERROR = f"{GET_CONSENT__DIRECTORY}ID/errors/invalid-id.yaml"

sandbox/api/get_consent.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP,
2222
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_BOTH,
2323
INTERNAL_SERVER_ERROR_EXAMPLE,
24-
INVALIDATED_RESOURCE,
24+
INVALIDATED_RESOURCE, GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_UNKNOWN_LEGAL_BASIS,
25+
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_UNKNOWN_LEGAL_BASIS_INCLUDE_BOTH,
26+
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_UNKNOWN_LEGAL_BASIS_INCLUDE_PATIENT,
27+
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_UNKNOWN_LEGAL_BASIS_INCLUDE_PERFORMER,
2528
)
2629
from .utils import (
2730
check_for_consent_filtering,
@@ -65,6 +68,16 @@ def get_consent_response() -> Union[dict, tuple]:
6568
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP,
6669
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_BOTH,
6770
)
71+
# Single mother-child relationship with unknown legal basis
72+
elif performer_identifier == "9000000999" or patient_identifier == "9000000998":
73+
return check_for_consent_include_params(
74+
_include,
75+
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_UNKNOWN_LEGAL_BASIS,
76+
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_UNKNOWN_LEGAL_BASIS_INCLUDE_BOTH,
77+
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_UNKNOWN_LEGAL_BASIS_INCLUDE_PATIENT,
78+
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_UNKNOWN_LEGAL_BASIS_INCLUDE_PERFORMER,
79+
)
80+
6881
elif patient_identifier == "9000000100":
6982
return check_for_consent_include_params(
7083
_include,

sandbox/api/tests/test_get_consent.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,36 @@ def test_get_consent_returns_expected_responses__mocked_get_consent(
168168
"./api/examples/GET_Consent/multiple-relationships-single-patient-include-performer-patient.yaml",
169169
200,
170170
),
171+
(
172+
"performer:identifier=9000000999",
173+
"./api/examples/GET_Consent/single-mother-child-relationship-unknown-legal-basis.yaml",
174+
200,
175+
),
176+
(
177+
"patient:identifier=9000000998",
178+
"./api/examples/GET_Consent/single-mother-child-relationship-unknown-legal-basis.yaml",
179+
200,
180+
),
181+
(
182+
"performer:identifier=9000000999&patient:identifier=9000000998",
183+
"./api/examples/GET_Consent/single-mother-child-relationship-unknown-legal-basis.yaml",
184+
200,
185+
),
186+
(
187+
"performer:identifier=9000000999&_include=Consent:patient",
188+
"./api/examples/GET_Consent/single-mother-child-relationship-unknown-legal-basis-include-patient.yaml",
189+
200,
190+
),
191+
(
192+
"performer:identifier=9000000999&_include=Consent:performer",
193+
"./api/examples/GET_Consent/single-mother-child-relationship-unknown-legal-basis-include-performer.yaml",
194+
200,
195+
),
196+
(
197+
"performer:identifier=9000000999&_include=Consent:performer&_include=Consent:patient",
198+
"./api/examples/GET_Consent/single-mother-child-relationship-unknown-legal-basis-include-performer-patient.yaml",
199+
200,
200+
),
171201
(
172202
"performer:identifier=9000000017&status=test", # Invalid status parameter error
173203
"./api/examples/GET_Consent/errors/invalid-status-parameter.yaml",
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
ConsentSingleAdultChildRelationshipUnknownLegalBasisIncludePatientBundle:
2+
summary: Single adult-child proxy relationship with patient details and unknown legal basis
3+
description: A Bundle containing a single proxy relationship between an adult and child including the patient details where the legal basis is unknown.
4+
value:
5+
resourceType: Bundle
6+
timestamp: "2020-08-26T14:00:00+00:00"
7+
total: 1
8+
type: searchset
9+
link:
10+
- relation: self
11+
url: https://sandbox.api.service.nhs.uk/validated-relationships/FHIR/R4/Consent?performer:identifier=9000000999&_include=Consent:patient
12+
entry:
13+
- fullUrl: https://api.service.nhs.uk/validated-relationships/FHIR/R4/Patient/A3CC6799
14+
resource:
15+
resourceType: Patient
16+
id: A3CC6799
17+
meta:
18+
security:
19+
- system: "https://fhir.nhs.uk/England/CodeSystem/England-NHSIdentityProofingLevel"
20+
code: "P9"
21+
display: "High level verification (P9)"
22+
identifier:
23+
- system: "https://fhir.nhs.uk/Id/nhs-number"
24+
value: "9000000998"
25+
- system: "https://placeholder.fhir.nhs.uk/Id/local-gp-patient-identifier"
26+
value: ABC9999999
27+
name:
28+
- id: "123457"
29+
use: usual
30+
period:
31+
start: "2020-01-01"
32+
end: "2021-12-31"
33+
given:
34+
- Jane Marie Anne
35+
family: Smith
36+
prefix:
37+
- Mrs
38+
suffix:
39+
- MBE
40+
- PhD
41+
birthDate: "2022-10-22"
42+
generalPractitioner:
43+
- type: Organization
44+
identifier:
45+
value: ODS99999
46+
system: "https://fhir.nhs.uk/Id/ods-organization-code"
47+
search:
48+
mode: include
49+
- fullUrl: https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/UNKNOWN_LB_BBCC6799
50+
resource:
51+
resourceType: Consent
52+
id: UNKNOWN_LB_BBCC6799
53+
status: active
54+
scope:
55+
coding:
56+
- system: "http://terminology.hl7.org/CodeSystem/consentscope"
57+
code: patient-privacy
58+
display: Privacy Consent
59+
text: Patient Privacy Consent
60+
category:
61+
- coding:
62+
- system: "http://terminology.hl7.org/CodeSystem/v3-ActCode"
63+
code: INFA
64+
display: Information Access
65+
text: Information Access Consent
66+
patient:
67+
identifier:
68+
system: "https://fhir.nhs.uk/Id/nhs-number"
69+
value: "9000000998"
70+
dateTime: "2024-07-21T17:32:28Z"
71+
performer:
72+
- identifier:
73+
system: "https://fhir.nhs.uk/Id/nhs-number"
74+
value: "9000000999"
75+
policy:
76+
- authority: https://www.england.nhs.uk
77+
uri: REPLACE_WITH_LINK_TO_PUBLISHED_NATIONAL_PROXY_STANDARD
78+
code: unknown
79+
display: Unknown legal basis
80+
search:
81+
mode: match
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
ConsentSingleAdultChildRelationshipUnknownLegalBasisIncludePerformerPatientBundle:
2+
summary: Single adult-child proxy relationship with performer and patient details and unknown legal basis
3+
description: A Bundle containing a single proxy relationship between an adult and child including both the performer and patient details where the legal basis is unknown.
4+
value:
5+
resourceType: Bundle
6+
timestamp: "2020-08-26T14:00:00+00:00"
7+
total: 1
8+
type: searchset
9+
link:
10+
- relation: self
11+
url: https://sandbox.api.service.nhs.uk/validated-relationships/FHIR/R4/Consent?performer:identifier=9000000999&_include=Consent:performer&_include=Consent:patient
12+
entry:
13+
- fullUrl: https://api.service.nhs.uk/validated-relationships/FHIR/R4/RelatedPerson/BE974799
14+
resource:
15+
resourceType: RelatedPerson
16+
id: BE974799
17+
identifier:
18+
- system: "https://fhir.nhs.uk/Id/nhs-number"
19+
value: "9000000999"
20+
- system: "https://placeholder.fhir.nhs.uk/Id/local-gp-patient-identifier"
21+
value: ABC9999998
22+
patient:
23+
type: Patient
24+
identifier:
25+
system: "https://fhir.nhs.uk/Id/nhs-number"
26+
value: "9000000998"
27+
relationship:
28+
- coding:
29+
- system: "http://terminology.hl7.org/CodeSystem/v3-RoleCode"
30+
code: PRN
31+
display: parent
32+
search:
33+
mode: include
34+
- fullUrl: https://api.service.nhs.uk/validated-relationships/FHIR/R4/Patient/A3CC6799
35+
resource:
36+
resourceType: Patient
37+
id: A3CC6799
38+
meta:
39+
security:
40+
- system: "https://fhir.nhs.uk/England/CodeSystem/England-NHSIdentityProofingLevel"
41+
code: "P9"
42+
display: "High level verification (P9)"
43+
identifier:
44+
- system: "https://fhir.nhs.uk/Id/nhs-number"
45+
value: "9000000998"
46+
- system: "https://placeholder.fhir.nhs.uk/Id/local-gp-patient-identifier"
47+
value: ABC9999999
48+
name:
49+
- id: "123457"
50+
use: usual
51+
period:
52+
start: "2020-01-01"
53+
end: "2021-12-31"
54+
given:
55+
- Jane Marie Anne
56+
family: Smith
57+
prefix:
58+
- Mrs
59+
suffix:
60+
- MBE
61+
- PhD
62+
birthDate: "2022-10-22"
63+
generalPractitioner:
64+
- type: Organization
65+
identifier:
66+
value: ODS99999
67+
system: "https://fhir.nhs.uk/Id/ods-organization-code"
68+
search:
69+
mode: include
70+
- fullUrl: https://api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/UNKNOWN_LB_BBCC6799
71+
resource:
72+
resourceType: Consent
73+
id: UNKNOWN_LB_BBCC6799
74+
status: active
75+
scope:
76+
coding:
77+
- system: "http://terminology.hl7.org/CodeSystem/consentscope"
78+
code: patient-privacy
79+
display: Privacy Consent
80+
text: Patient Privacy Consent
81+
category:
82+
- coding:
83+
- system: "http://terminology.hl7.org/CodeSystem/v3-ActCode"
84+
code: INFA
85+
display: Information Access
86+
text: Information Access Consent
87+
patient:
88+
identifier:
89+
system: "https://fhir.nhs.uk/Id/nhs-number"
90+
value: "9000000998"
91+
dateTime: "2024-07-21T17:32:28Z"
92+
performer:
93+
- identifier:
94+
system: "https://fhir.nhs.uk/Id/nhs-number"
95+
value: "9000000999"
96+
policy:
97+
- authority: https://www.england.nhs.uk
98+
uri: REPLACE_WITH_LINK_TO_PUBLISHED_NATIONAL_PROXY_STANDARD
99+
code: unknown
100+
display: Unknown legal basis
101+
provision:
102+
actor:
103+
- reference:
104+
identifier:
105+
system: https://fhir.nhs.uk/Id/nhs-number"
106+
value: "9000000999"
107+
type: RelatedPerson
108+
role:
109+
coding:
110+
- code: PRN
111+
display: Parent
112+
system: http://terminology.hl7.org/CodeSystem/v3-RoleCode
113+
period:
114+
end: "2026-02-11"
115+
start: "2025-02-11"
116+
search:
117+
mode: match

0 commit comments

Comments
 (0)