Skip to content

Commit 3e9e5c1

Browse files
NRL-1050 Add imaging type/category validation
1 parent aa1c4be commit 3e9e5c1

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

layer/nrlf/core/constants.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@ def coding_value(self):
150150
PointerTypes.PERSONALISED_CARE_AND_SUPPORT_PLAN.value: {
151151
"display": "Personalised Care and Support Plan",
152152
},
153+
PointerTypes.MRA_UPPER_LIMB_ARTERY.value: {
154+
"display": "MRA Upper Limb Artery",
155+
},
156+
PointerTypes.MRI_AXILLA_BOTH.value: {
157+
"display": "MRI Axilla Both",
158+
},
153159
}
154160

155161
TYPE_CATEGORIES = {

layer/nrlf/core/validators.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -374,11 +374,11 @@ def _validate_type(self, model: DocumentReference):
374374
return
375375

376376
coding = model.type.coding[0]
377-
if coding.system != "http://snomed.info/sct":
377+
if coding.system not in ["http://snomed.info/sct", "https://nicip.nhs.uk"]:
378378
self.result.add_error(
379379
issue_code="value",
380380
error_code="INVALID_RESOURCE",
381-
diagnostics=f"Invalid type system: {coding.system} Type system must be 'http://snomed.info/sct'",
381+
diagnostics=f"Invalid type system: {coding.system} Type system must be either 'http://snomed.info/sct' or 'https://nicip.nhs.uk'",
382382
field="type.coding[0].system",
383383
)
384384
return
@@ -429,11 +429,11 @@ def _validate_category(self, model: DocumentReference):
429429
return
430430

431431
coding = model.category[0].coding[0]
432-
if coding.system != "http://snomed.info/sct":
432+
if coding.system not in ["http://snomed.info/sct", "https://nicip.nhs.uk"]:
433433
self.result.add_error(
434434
issue_code="value",
435435
error_code="INVALID_RESOURCE",
436-
diagnostics=f"Invalid category system: {coding.system} Category system must be 'http://snomed.info/sct'",
436+
diagnostics=f"Invalid category system: {coding.system} Category system must be either 'http://snomed.info/sct' or 'https://nicip.nhs.uk'",
437437
field="category[0].coding[0].system",
438438
)
439439
return

0 commit comments

Comments
 (0)