Skip to content

Commit d70e45b

Browse files
committed
NRL-1049 update allowed categories and types and create test to show it can search by new NICIP type
1 parent 6d56aeb commit d70e45b

File tree

3 files changed

+64
-2
lines changed

3 files changed

+64
-2
lines changed

api/consumer/searchDocumentReference/tests/test_search_document_reference_consumer.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,53 @@ def test_search_document_reference_happy_path_with_type(
135135
}
136136

137137

138+
@mock_aws
139+
@mock_repository
140+
def test_search_document_reference_happy_path_with_nicip_type(
141+
repository: DocumentPointerRepository,
142+
):
143+
doc_ref = load_document_reference("Y05868-736253002-Valid")
144+
doc_ref.type.coding[0].code = "MAULR"
145+
doc_ref.type.coding[0].system = "https://nicip.nhs.uk"
146+
doc_ref.type.coding[0].display = "MRA Upper Limb Rt"
147+
doc_ref.category[0].coding[0].code = "721981007"
148+
doc_ref.category[0].coding[0].display = "Diagnostic Studies Report"
149+
doc_pointer = DocumentPointer.from_document_reference(doc_ref)
150+
151+
repository.create(doc_pointer)
152+
153+
event = create_test_api_gateway_event(
154+
headers=create_headers(),
155+
query_string_parameters={
156+
"subject:identifier": "https://fhir.nhs.uk/Id/nhs-number|6700028191",
157+
"type": "https://nicip.nhs.uk|MAULR",
158+
},
159+
)
160+
161+
result = handler(event, create_mock_context())
162+
body = result.pop("body")
163+
164+
assert result == {
165+
"statusCode": "200",
166+
"headers": default_response_headers(),
167+
"isBase64Encoded": False,
168+
}
169+
170+
parsed_body = json.loads(body)
171+
assert parsed_body == {
172+
"resourceType": "Bundle",
173+
"type": "searchset",
174+
"link": [
175+
{
176+
"relation": "self",
177+
"url": "https://pytest.api.service.nhs.uk/record-locator/consumer/FHIR/R4/DocumentReference?subject:identifier=https://fhir.nhs.uk/Id/nhs-number|6700028191&type=https://nicip.nhs.uk|MAULR",
178+
}
179+
],
180+
"total": 1,
181+
"entry": [{"resource": doc_ref.dict(exclude_none=True)}],
182+
}
183+
184+
138185
@mock_aws
139186
@mock_repository
140187
def test_search_document_reference_no_results(repository: DocumentPointerRepository):

layer/nrlf/core/constants.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ class PointerTypes(Enum):
5555
TREATMENT_ESCALATION_PLAN = "http://snomed.info/sct|735324008"
5656
SUMMARY_RECORD = "http://snomed.info/sct|824321000000109"
5757
PERSONALISED_CARE_AND_SUPPORT_PLAN = "http://snomed.info/sct|2181441000000107"
58+
MRA_UPPER_LIMB_ARTERY = "https://nicip.nhs.uk|MAULR"
59+
MRI_AXILLA_BOTH = "https://nicip.nhs.uk|MAXIB"
5860

5961
@staticmethod
6062
def list():
@@ -71,6 +73,8 @@ class Categories(Enum):
7173
CARE_PLAN = "http://snomed.info/sct|734163000"
7274
OBSERVATIONS = "http://snomed.info/sct|1102421000000108"
7375
CLINICAL_NOTE = "http://snomed.info/sct|823651000000106"
76+
DIAGNOSTIC_STUDIES_REPORT = "http://snomed.info/sct|721981007"
77+
DIAGNOSTIC_PROCEDURE = "http://snomed.info/sct|103693007"
7478

7579
@staticmethod
7680
def list():
@@ -93,6 +97,12 @@ def coding_value(self):
9397
Categories.CLINICAL_NOTE.value: {
9498
"display": "Clinical note",
9599
},
100+
Categories.DIAGNOSTIC_STUDIES_REPORT.value: {
101+
"display": "Diagnostic Studies Report",
102+
},
103+
Categories.DIAGNOSTIC_PROCEDURE.value: {
104+
"display": "Diagnostic Procedure",
105+
},
96106
}
97107

98108
TYPE_CATEGORIES = {
@@ -114,7 +124,11 @@ def coding_value(self):
114124
#
115125
# Clinical notes
116126
PointerTypes.SUMMARY_RECORD.value: Categories.CLINICAL_NOTE.value,
127+
#
128+
# Imaging
129+
PointerTypes.MRA_UPPER_LIMB_ARTERY.value: Categories.DIAGNOSTIC_STUDIES_REPORT.value,
130+
PointerTypes.MRI_AXILLA_BOTH.value: Categories.DIAGNOSTIC_PROCEDURE.value,
117131
}
118132

119133

120-
SYSTEM_SHORT_IDS = {"http://snomed.info/sct": "SCT"}
134+
SYSTEM_SHORT_IDS = {"http://snomed.info/sct": "SCT", "https://nicip.nhs.uk": "NICIP"}

layer/test_permissions/Y05868-TestApp-12345678/Y05868.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"http://snomed.info/sct|736253001",
33
"http://snomed.info/sct|736253002",
44
"http://snomed.info/sct|1363501000000100",
5-
"http://snomed.info/sct|861421000000109"
5+
"http://snomed.info/sct|861421000000109",
6+
"https://nicip.nhs.uk|MAULR"
67
]

0 commit comments

Comments
 (0)