Skip to content

Commit b7e53c9

Browse files
Merge pull request #1007 from NHSDigital/feature/axkr1-NRL-1491-incontext-example-rebased
NRL-1491 Add in context retrieval mechanism example
2 parents 9ab93ae + 4fad9db commit b7e53c9

File tree

13 files changed

+283
-16
lines changed

13 files changed

+283
-16
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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,7 @@ def coding_value(self):
688688
"Direct": "Direct",
689689
"SSP": "Spine Secure Proxy",
690690
"LDR": "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/tests/test_validators.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1884,6 +1884,7 @@ def test_validate_content_stability_extension_display_mismatch(code, display):
18841884
("SSP", "Spine Secure Proxy"),
18851885
("Direct", "Direct"),
18861886
("LDR", "Large Document Retrieval"),
1887+
("InContext", "Direct using In-Context"),
18871888
],
18881889
)
18891890
def test_validate_retrieval_mechanism_extension_valid(code, display):
@@ -1911,3 +1912,45 @@ def test_validate_retrieval_mechanism_extension_display_mismatch(code, display):
19111912
in issue.diagnostics
19121913
for issue in validator.result.issues
19131914
)
1915+
1916+
1917+
def test_validate_structured_format_with_text_html_for_incontext_launch():
1918+
validator = DocumentReferenceValidator()
1919+
document_ref_data = load_document_reference_json("Y05868-736253002-Valid")
1920+
1921+
# Set up for direct in-context launch
1922+
document_ref_data["content"][0]["attachment"]["contentType"] = "text/html"
1923+
document_ref_data["content"][0]["format"] = {
1924+
"system": "https://fhir.nhs.uk/England/CodeSystem/England-NRLFormatCode",
1925+
"code": "urn:nhs-ic:structured",
1926+
"display": "Structured Document",
1927+
}
1928+
document_ref_data["content"][0]["extension"] = [
1929+
{
1930+
"url": "https://fhir.nhs.uk/England/StructureDefinition/Extension-England-RetrievalMechanism",
1931+
"valueCodeableConcept": {
1932+
"coding": [
1933+
{
1934+
"system": "https://fhir.nhs.uk/England/CodeSystem/England-RetrievalMechanism",
1935+
"code": "InContext",
1936+
"display": "Direct using In-Context",
1937+
}
1938+
]
1939+
},
1940+
},
1941+
{
1942+
"url": "https://fhir.nhs.uk/England/StructureDefinition/Extension-England-ContentStability",
1943+
"valueCodeableConcept": {
1944+
"coding": [
1945+
{
1946+
"system": "https://fhir.nhs.uk/England/CodeSystem/England-NRLContentStability",
1947+
"code": "dynamic",
1948+
"display": "Dynamic",
1949+
}
1950+
]
1951+
},
1952+
},
1953+
]
1954+
1955+
result = validator.validate(document_ref_data)
1956+
assert result.is_valid is True

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 & 2 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",

resources/fhir/NRLF-RetrievalMechanism-ValueSet.json

Lines changed: 5 additions & 1 deletion
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",
@@ -33,6 +33,10 @@
3333
{
3434
"code": "LDR",
3535
"display": "Large Document Retrieval"
36+
},
37+
{
38+
"code": "InContext",
39+
"display": "Direct using In-Context"
3640
}
3741
]
3842
}

0 commit comments

Comments
 (0)