Skip to content

Commit a3c9760

Browse files
NRL-1491 Add InContext retrieval mechanism and allow text/html with structured format
1 parent fd335ba commit a3c9760

File tree

10 files changed

+62
-29
lines changed

10 files changed

+62
-29
lines changed

api/consumer/swagger.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,10 +1015,16 @@ components:
10151015
- "https://fhir.nhs.uk/England/CodeSystem/England-RetrievalMechanism"
10161016
code:
10171017
type: string
1018-
enum: ["SSP", "Direct", "LDR"]
1018+
enum: ["SSP", "Direct", "LDR", "InContext"]
10191019
display:
10201020
type: string
1021-
enum: ["Spine Secure Proxy", "Direct", "Large Document Retrieval"]
1021+
enum:
1022+
[
1023+
"Spine Secure Proxy",
1024+
"Direct",
1025+
"Large Document Retrieval",
1026+
"Direct using In-Context",
1027+
]
10221028
required:
10231029
- system
10241030
- code

api/producer/swagger.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,10 +1671,16 @@ components:
16711671
- "https://fhir.nhs.uk/England/CodeSystem/England-RetrievalMechanism"
16721672
code:
16731673
type: string
1674-
enum: ["SSP", "Direct", "LDR"]
1674+
enum: ["SSP", "Direct", "LDR", "InContext"]
16751675
display:
16761676
type: string
1677-
enum: ["Spine Secure Proxy", "Direct", "Large Document Retrieval"]
1677+
enum:
1678+
[
1679+
"Spine Secure Proxy",
1680+
"Direct",
1681+
"Large Document Retrieval",
1682+
"Direct using In-Context",
1683+
]
16781684
required:
16791685
- system
16801686
- code

layer/nrlf/consumer/fhir/r4/model.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,13 @@ class ContentStabilityExtensionCoding(Coding):
242242

243243
class RetrievalMechanismExtensionCoding(Coding):
244244
system: Literal["https://fhir.nhs.uk/England/CodeSystem/England-RetrievalMechanism"]
245-
code: Literal["SSP", "Direct", "LDR"]
246-
display: Literal["Spine Secure Proxy", "Direct", "Large Document Retrieval"]
245+
code: Literal["SSP", "Direct", "LDR", "InContext"]
246+
display: Literal[
247+
"Spine Secure Proxy",
248+
"Direct",
249+
"Large Document Retrieval",
250+
"Direct using In-Context",
251+
]
247252

248253

249254
class NRLFormatCode(Coding):

layer/nrlf/core/constants.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,8 @@ def coding_value(self):
687687
CONTENT_RETRIEVAL_CODE_MAP = {
688688
"Direct": "Direct",
689689
"SSP": "Spine Secure Proxy",
690-
"LDR": "Large Document Retrieval",
690+
"NDR": "Large Document Retrieval",
691+
"InContext": "Direct using In-Context",
691692
}
692693
CONTENT_FORMAT_CODE_URL = "https://fhir.nhs.uk/England/CodeSystem/England-NRLFormatCode"
693694
CONTENT_FORMAT_CODE_MAP = {

layer/nrlf/core/validators.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,8 @@ def _validate_content_format(self, model: DocumentReference):
472472
for i, content in enumerate(model.content):
473473
if (
474474
content.attachment.contentType == "text/html"
475-
and content.format.code != "urn:nhs-ic:record-contact"
475+
and content.format.code
476+
not in ["urn:nhs-ic:record-contact", "urn:nhs-ic:structured"]
476477
):
477478
self.result.add_error(
478479
issue_code="business-rule",

layer/nrlf/producer/fhir/r4/model.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,13 @@ class ContentStabilityExtensionCoding(Coding):
286286

287287
class RetrievalMechanismExtensionCoding(Coding):
288288
system: Literal["https://fhir.nhs.uk/England/CodeSystem/England-RetrievalMechanism"]
289-
code: Literal["SSP", "Direct", "LDR"]
290-
display: Literal["Spine Secure Proxy", "Direct", "Large Document Retrieval"]
289+
code: Literal["SSP", "Direct", "LDR", "InContext"]
290+
display: Literal[
291+
"Spine Secure Proxy",
292+
"Direct",
293+
"Large Document Retrieval",
294+
"Direct using In-Context",
295+
]
291296

292297

293298
class NRLFormatCode(Coding):

layer/nrlf/producer/fhir/r4/strict_model.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,13 @@ class ContentStabilityExtensionCoding(Coding):
257257

258258
class RetrievalMechanismExtensionCoding(Coding):
259259
system: Literal["https://fhir.nhs.uk/England/CodeSystem/England-RetrievalMechanism"]
260-
code: Literal["SSP", "Direct", "LDR"]
261-
display: Literal["Spine Secure Proxy", "Direct", "Large Document Retrieval"]
260+
code: Literal["SSP", "Direct", "LDR", "InContext"]
261+
display: Literal[
262+
"Spine Secure Proxy",
263+
"Direct",
264+
"Large Document Retrieval",
265+
"Direct using In-Context",
266+
]
262267

263268

264269
class NRLFormatCode(Coding):

resources/fhir/NRLF-Retrieval-CodeSystem.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"resourceType": "CodeSystem",
33
"id": "England-RetrievalMechanismNRL",
44
"url": "https://fhir.nhs.uk/England/CodeSystem/England-RetrievalMechanismNRL",
5-
"version": "1.0.1",
5+
"version": "1.1.0",
66
"name": "EnglandRetrievalMechanismNRL",
77
"title": "England Retrieval MechanismNRL",
88
"status": "draft",
@@ -40,7 +40,14 @@
4040
{
4141
"code": "Direct",
4242
"display": "Direct",
43-
"definition": "This document can be directly retrieved via HTTP(s) at its public URL."
43+
"definition": "This document can be directly retrieved via HTTP(s) at its public URL.",
44+
"concept": [
45+
{
46+
"code": "InContext",
47+
"display": "Direct using In-Context",
48+
"definition": "This document can be retrieved in-context via the In-Context launch mechanism."
49+
}
50+
]
4451
},
4552
{
4653
"code": "Proxy",
@@ -58,11 +65,6 @@
5865
"definition": "This document can be retrieved via the Large Document Retrieval proxy service."
5966
}
6067
]
61-
},
62-
{
63-
"code": "Direct_InContext",
64-
"display": "Direct using In-Context",
65-
"definition": "This document can be retrieved in-context via the In-Context launch mechanism."
6668
}
6769
]
6870
}

resources/fhir/NRLF-RetrievalMechanism-ValueSet.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"resourceType": "ValueSet",
33
"id": "England-RetrievalMechanism",
44
"url": "https://fhir.nhs.uk/England/ValueSet/England-RetrievalMechanism",
5-
"version": "1.0.1",
5+
"version": "1.1.0",
66
"name": "EnglandRetrievalMechanism",
77
"status": "draft",
88
"date": "2025-02-28",
@@ -35,7 +35,7 @@
3535
"display": "Large Document Retrieval"
3636
},
3737
{
38-
"code": "Direct_InContext",
38+
"code": "InContext",
3939
"display": "Direct using In-Context"
4040
}
4141
]

tests/data/samples/INCTX_IN_CONTEXT_LAUNCH_EXAMPLE.json renamed to tests/data/samples/SYNTHETIC_IN_CONTEXT_LAUNCH_EXAMPLE.json

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,16 @@
7676
"url": "https://fhir.nhs.uk/England/StructureDefinition/Extension-England-ContentStability"
7777
},
7878
{
79-
"url": "https://fhir.nhs.uk/England/StructureDefinition/Extension-England-RetrievalMechanism",
80-
"valueCodeableConcept": [
81-
{
82-
"system": "https://fhir.nhs.uk/England/CodeSystem/England-RetrievalMechanism",
83-
"code": "Direct_InContext",
84-
"display": "Direct using In-Context"
85-
}
86-
]
79+
"valueCodeableConcept": {
80+
"coding": [
81+
{
82+
"system": "https://fhir.nhs.uk/England/CodeSystem/England-RetrievalMechanism",
83+
"code": "InContext",
84+
"display": "Direct using In-Context"
85+
}
86+
]
87+
},
88+
"url": "https://fhir.nhs.uk/England/StructureDefinition/Extension-England-RetrievalMechanism"
8789
}
8890
]
8991
}

0 commit comments

Comments
 (0)