Skip to content

Commit f8663e7

Browse files
NRL-518 Pydantic format validation, fix casing format display
1 parent 52f1d24 commit f8663e7

21 files changed

+121
-28
lines changed

api/consumer/swagger.yaml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,7 @@ components:
10651065
$ref: "#/components/schemas/Attachment"
10661066
description: The document or URL of the document along with critical metadata to prove content has integrity.
10671067
format:
1068-
$ref: "#/components/schemas/Coding"
1068+
$ref: "#/components/schemas/NRLFormatCode"
10691069
description: An identifier of the document encoding, structure, and template that the document conforms to beyond the base format indicated in the mimeType.
10701070
extension:
10711071
type: array
@@ -1230,6 +1230,30 @@ components:
12301230
required:
12311231
- url
12321232
- valueCodeableConcept
1233+
NRLFormatCode:
1234+
type: object
1235+
properties:
1236+
system:
1237+
type: string
1238+
enum:
1239+
- "https://fhir.nhs.uk/England/CodeSystem/England-NRLFormatCode"
1240+
description: The system URL for the NRLF Format Code.
1241+
code:
1242+
type: string
1243+
enum:
1244+
- "urn:nhs-ic:record-contact"
1245+
- "urn:nhs-ic:unstructured"
1246+
description: The code representing the format of the document.
1247+
display:
1248+
type: string
1249+
enum:
1250+
- "Contact details (HTTP Unsecured)"
1251+
- "Unstructured Document"
1252+
description: The display text for the code.
1253+
required:
1254+
- system
1255+
- code
1256+
- display
12331257
Identifier:
12341258
type: object
12351259
properties:

api/producer/swagger.yaml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ paths:
334334
{
335335
"system": "https://fhir.nhs.uk/England/CodeSystem/England-NRLFormatCode",
336336
"code": "urn:nhs-ic:unstructured"
337-
"display": "Unstructured document"
337+
"display": "Unstructured Document"
338338
}
339339
]
340340
```
@@ -1215,7 +1215,7 @@ components:
12151215
format:
12161216
system: https://fhir.nhs.uk/England/CodeSystem/England-NRLFormatCode
12171217
code: "urn:nhs-ic:unstructured"
1218-
display: Unstructured document
1218+
display: Unstructured Document
12191219
context:
12201220
event:
12211221
- coding:
@@ -1630,7 +1630,7 @@ components:
16301630
$ref: "#/components/schemas/Attachment"
16311631
description: The document or URL of the document along with critical metadata to prove content has integrity.
16321632
format:
1633-
$ref: "#/components/schemas/Coding"
1633+
$ref: "#/components/schemas/NRLFormatCode"
16341634
description: An identifier of the document encoding, structure, and template that the document conforms to beyond the base format indicated in the mimeType.
16351635
extension:
16361636
type: array
@@ -1796,6 +1796,30 @@ components:
17961796
required:
17971797
- url
17981798
- valueCodeableConcept
1799+
NRLFormatCode:
1800+
type: object
1801+
properties:
1802+
system:
1803+
type: string
1804+
enum:
1805+
- "https://fhir.nhs.uk/England/CodeSystem/England-NRLFormatCode"
1806+
description: The system URL for the NRLF Format Code.
1807+
code:
1808+
type: string
1809+
enum:
1810+
- "urn:nhs-ic:record-contact"
1811+
- "urn:nhs-ic:unstructured"
1812+
description: The code representing the format of the document.
1813+
display:
1814+
type: string
1815+
enum:
1816+
- "Contact details (HTTP Unsecured)"
1817+
- "Unstructured Document"
1818+
description: The display text for the code.
1819+
required:
1820+
- system
1821+
- code
1822+
- display
17991823
Identifier:
18001824
type: object
18011825
properties:

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

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
22
# filename: swagger.yaml
3-
# timestamp: 2024-12-06T02:57:59+00:00
3+
# timestamp: 2024-12-06T04:10:37+00:00
44

55
from __future__ import annotations
66

@@ -249,6 +249,21 @@ class ContentStabilityExtension(BaseModel):
249249
valueCodeableConcept: ValueCodeableConcept
250250

251251

252+
class NRLFormatCode(BaseModel):
253+
system: Annotated[
254+
Literal["https://fhir.nhs.uk/England/CodeSystem/England-NRLFormatCode"],
255+
Field(description="The system URL for the NRLF Format Code."),
256+
]
257+
code: Annotated[
258+
Literal["urn:nhs-ic:record-contact", "urn:nhs-ic:unstructured"],
259+
Field(description="The code representing the format of the document."),
260+
]
261+
display: Annotated[
262+
Literal["Contact details (HTTP Unsecured)", "Unstructured Document"],
263+
Field(description="The display text for the code."),
264+
]
265+
266+
252267
class Period(BaseModel):
253268
id: Annotated[
254269
Optional[str],
@@ -461,7 +476,7 @@ class DocumentReferenceContent(BaseModel):
461476
),
462477
]
463478
format: Annotated[
464-
Coding,
479+
NRLFormatCode,
465480
Field(
466481
description="An identifier of the document encoding, structure, and template that the document conforms to beyond the base format indicated in the mimeType."
467482
),

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

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
22
# filename: swagger.yaml
3-
# timestamp: 2024-12-06T02:57:56+00:00
3+
# timestamp: 2024-12-06T04:10:35+00:00
44

55
from __future__ import annotations
66

@@ -249,6 +249,21 @@ class ContentStabilityExtension(BaseModel):
249249
valueCodeableConcept: ValueCodeableConcept
250250

251251

252+
class NRLFormatCode(BaseModel):
253+
system: Annotated[
254+
Literal["https://fhir.nhs.uk/England/CodeSystem/England-NRLFormatCode"],
255+
Field(description="The system URL for the NRLF Format Code."),
256+
]
257+
code: Annotated[
258+
Literal["urn:nhs-ic:record-contact", "urn:nhs-ic:unstructured"],
259+
Field(description="The code representing the format of the document."),
260+
]
261+
display: Annotated[
262+
Literal["Contact details (HTTP Unsecured)", "Unstructured Document"],
263+
Field(description="The display text for the code."),
264+
]
265+
266+
252267
class Period(BaseModel):
253268
id: Annotated[
254269
Optional[str],
@@ -451,7 +466,7 @@ class DocumentReferenceContent(BaseModel):
451466
),
452467
]
453468
format: Annotated[
454-
Coding,
469+
NRLFormatCode,
455470
Field(
456471
description="An identifier of the document encoding, structure, and template that the document conforms to beyond the base format indicated in the mimeType."
457472
),

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

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
22
# filename: swagger.yaml
3-
# timestamp: 2024-12-06T02:57:58+00:00
3+
# timestamp: 2024-12-06T04:10:36+00:00
44

55
from __future__ import annotations
66

@@ -226,6 +226,21 @@ class ContentStabilityExtension(BaseModel):
226226
valueCodeableConcept: ValueCodeableConcept
227227

228228

229+
class NRLFormatCode(BaseModel):
230+
system: Annotated[
231+
Literal["https://fhir.nhs.uk/England/CodeSystem/England-NRLFormatCode"],
232+
Field(description="The system URL for the NRLF Format Code."),
233+
]
234+
code: Annotated[
235+
Literal["urn:nhs-ic:record-contact", "urn:nhs-ic:unstructured"],
236+
Field(description="The code representing the format of the document."),
237+
]
238+
display: Annotated[
239+
Literal["Contact details (HTTP Unsecured)", "Unstructured Document"],
240+
Field(description="The display text for the code."),
241+
]
242+
243+
229244
class Period(BaseModel):
230245
id: Annotated[
231246
Optional[StrictStr],
@@ -398,7 +413,7 @@ class DocumentReferenceContent(BaseModel):
398413
),
399414
]
400415
format: Annotated[
401-
Coding,
416+
NRLFormatCode,
402417
Field(
403418
description="An identifier of the document encoding, structure, and template that the document conforms to beyond the base format indicated in the mimeType."
404419
),

swagger/producer-static/components.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ components:
122122
format:
123123
system: https://fhir.nhs.uk/England/CodeSystem/England-NRLFormatCode
124124
code: "urn:nhs-ic:unstructured"
125-
display: Unstructured document
125+
display: Unstructured Document
126126
context:
127127
practiceSetting:
128128
coding:

swagger/producer-static/narrative.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ paths:
287287
{
288288
"system": "https://fhir.nhs.uk/England/CodeSystem/England-NRLFormatCode",
289289
"code": "urn:nhs-ic:unstructured"
290-
"display": "Unstructured document"
290+
"display": "Unstructured Document"
291291
}
292292
]
293293
```

tests/data/DocumentReference/RQI-736253002-Valid.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"format": {
7070
"system": "https://fhir.nhs.uk/England/CodeSystem/England-NRLFormatCode",
7171
"code": "urn:nhs-ic:unstructured",
72-
"display": "Unstructured document"
72+
"display": "Unstructured Document"
7373
},
7474
"extension": [
7575
{

tests/data/DocumentReference/Y05868-736253002-Valid-with-date-and-meta-lastupdated.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"format": {
7474
"system": "https://fhir.nhs.uk/England/CodeSystem/England-NRLFormatCode",
7575
"code": "urn:nhs-ic:unstructured",
76-
"display": "Unstructured document"
76+
"display": "Unstructured Document"
7777
},
7878
"extension": [
7979
{

tests/data/DocumentReference/Y05868-736253002-Valid-with-date.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"format": {
7171
"system": "https://fhir.nhs.uk/England/CodeSystem/England-NRLFormatCode",
7272
"code": "urn:nhs-ic:unstructured",
73-
"display": "Unstructured document"
73+
"display": "Unstructured Document"
7474
},
7575
"extension": [
7676
{

0 commit comments

Comments
 (0)