Skip to content

Commit 31501c8

Browse files
committed
Merge branch 'develop' of github.com:NHSDigital/NRLF into feature/eema1-NRL-1075-multiCategorySearch
2 parents 29e4dae + b77abb9 commit 31501c8

File tree

14 files changed

+389
-204
lines changed

14 files changed

+389
-204
lines changed

api/consumer/swagger.yaml

Lines changed: 54 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -333,34 +333,28 @@ paths:
333333
code: urn:ihe:pcc:handp:2008
334334
display: History and Physical Specification
335335
context:
336-
encounter:
337-
- identifier:
338-
value: Encounter/4409815415
339336
event:
340337
- coding:
341338
- system: http://snomed.info/sct
342-
code: "305625009"
343-
display: Seen by mental health counselor
339+
code: "445627002"
340+
display: Assessment using adult early warning scoring system
344341
period:
345342
start: "2022-12-20T09:00:41+11:00"
346343
end: "2022-12-20T09:45:41+11:00"
347344
facilityType:
348345
coding:
349346
- system: http://snomed.info/sct
350-
code: "390826005"
351-
display: Mental health caregiver support
347+
code: "82242000"
348+
display: Children's hospital
352349
practiceSetting:
353350
coding:
354351
- system: http://snomed.info/sct
355-
code: "390826005"
356-
display: Mental health caregiver support
357-
sourcePatientInfo:
358-
identifier:
359-
value: Patient/4409815415
352+
code: "788002001"
353+
display: Adult mental health service
360354
related:
361355
- identifier:
362-
system: https://fhir.nhs.uk/Id/ods-organization-code
363-
value: MENTAL HEALTH OUTREACH
356+
system: https://fhir.nhs.uk/Id/nhsSpineASID
357+
value: "200000000610"
364358
headers:
365359
X-Correlation-Id:
366360
$ref: "#/components/headers/CorrelationId"
@@ -466,29 +460,28 @@ paths:
466460
code: urn:ihe:pcc:cm:2008
467461
display: Care Management
468462
context:
469-
encounter:
470-
- identifier:
471-
value: Encounter/4409815415
472-
event:
473-
- coding:
474-
- system: http://snomed.info/sct
475-
code: "861421000000109"
476-
display: End of life care coordination summary
477-
period:
478-
start: "2022-12-21T09:00:41+11:00"
479-
end: "2022-12-21T10:45:41+11:00"
480-
facilityType:
481-
coding:
482-
- system: http://snomed.info/sct
483-
code: "14866005"
484-
display: Hospital outpatient mental health center
485-
sourcePatientInfo:
486-
identifier:
487-
value: Patient/4409815415
488-
related:
489-
- identifier:
490-
system: https://fhir.nhs.uk/Id/ods-organization-code
491-
value: TRAFFORD GENERAL HOSPITAL
463+
- event:
464+
- coding:
465+
system: http://snomed.info/sct
466+
code: "445627002"
467+
display: Assessment using adult early warning scoring system
468+
- period:
469+
start: "2022-12-20T09:00:41+11:00"
470+
end: "2022-12-20T09:45:41+11:00"
471+
- facilityType:
472+
- coding:
473+
system: http://snomed.info/sct
474+
code: "82242000"
475+
display: Children's hospital
476+
- practiceSetting:
477+
- coding:
478+
system: http://snomed.info/sct
479+
code: "788002001"
480+
display: Adult mental health service
481+
- related:
482+
- identifier:
483+
system: https://fhir.nhs.uk/Id/nhsSpineASID
484+
value: "200000000610"
492485
headers:
493486
X-Correlation-Id:
494487
$ref: "#/components/headers/CorrelationId"
@@ -579,26 +572,28 @@ paths:
579572
code: urn:ihe:pcc:handp:2008
580573
display: History and Physical Specification
581574
context:
582-
encounter:
583-
- identifier:
584-
value: Encounter/4409815415
585-
event:
586-
- coding:
587-
- system: http://snomed.info/sct
588-
code: "702779007"
589-
display: Emergency health care plan agreed
590-
period:
591-
start: "2022-12-20T09:00:41+11:00"
592-
end: "2022-12-20T09:45:41+11:00"
593-
facilityType:
594-
coding:
595-
- system: http://snomed.info/sct
596-
code: "453121000124107"
597-
display: Emergency department healthcare professional
598-
related:
599-
- identifier:
600-
system: https://fhir.nhs.uk/Id/ods-organization-code
601-
value: EMERGENCY DEPT PRIMARY CARE STREAMING
575+
- event:
576+
- coding:
577+
system: http://snomed.info/sct
578+
code: "445627002"
579+
display: Assessment using adult early warning scoring system
580+
- period:
581+
start: "2022-12-20T09:00:41+11:00"
582+
end: "2022-12-20T09:45:41+11:00"
583+
- facilityType:
584+
- coding:
585+
system: http://snomed.info/sct
586+
code: "82242000"
587+
display: Children's hospital
588+
- practiceSetting:
589+
- coding:
590+
system: http://snomed.info/sct
591+
code: "788002001"
592+
display: Adult mental health service
593+
- related:
594+
- identifier:
595+
system: https://fhir.nhs.uk/Id/nhsSpineASID
596+
value: "200000000610"
602597
headers:
603598
X-Correlation-Id:
604599
$ref: "#/components/headers/CorrelationId"
@@ -1057,6 +1052,8 @@ components:
10571052
items:
10581053
$ref: "#/components/schemas/Reference"
10591054
description: Related identifiers or resources associated with the DocumentReference.
1055+
required:
1056+
- practiceSetting
10601057
DocumentReferenceContent:
10611058
type: object
10621059
properties:

api/producer/createDocumentReference/tests/test_create_document_reference.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,21 @@ def test_create_document_reference_invalid_body():
269269
"diagnostics": "Request body could not be parsed (content: Field required)",
270270
"expression": ["content"],
271271
},
272+
{
273+
"severity": "error",
274+
"code": "invalid",
275+
"details": {
276+
"coding": [
277+
{
278+
"system": "https://fhir.nhs.uk/ValueSet/Spine-ErrorOrWarningCode-1",
279+
"code": "MESSAGE_NOT_WELL_FORMED",
280+
"display": "Message not well formed",
281+
}
282+
]
283+
},
284+
"diagnostics": "Request body could not be parsed (context: Field required)",
285+
"expression": ["context"],
286+
},
272287
],
273288
}
274289

@@ -355,6 +370,47 @@ def test_create_document_reference_with_no_custodian():
355370
}
356371

357372

373+
def test_create_document_reference_with_no_practiceSetting():
374+
doc_ref = load_document_reference("Y05868-736253002-Valid")
375+
doc_ref.context.practiceSetting = None
376+
377+
event = create_test_api_gateway_event(
378+
headers=create_headers(),
379+
body=doc_ref.model_dump_json(exclude_none=True),
380+
)
381+
382+
result = handler(event, create_mock_context())
383+
body = result.pop("body")
384+
385+
assert result == {
386+
"statusCode": "400",
387+
"headers": default_response_headers(),
388+
"isBase64Encoded": False,
389+
}
390+
391+
parsed_body = json.loads(body)
392+
assert parsed_body == {
393+
"resourceType": "OperationOutcome",
394+
"issue": [
395+
{
396+
"severity": "error",
397+
"code": "invalid",
398+
"details": {
399+
"coding": [
400+
{
401+
"code": "MESSAGE_NOT_WELL_FORMED",
402+
"display": "Message not well formed",
403+
"system": "https://fhir.nhs.uk/ValueSet/Spine-ErrorOrWarningCode-1",
404+
}
405+
],
406+
},
407+
"diagnostics": "Request body could not be parsed (context.practiceSetting: Field required)",
408+
"expression": ["context.practiceSetting"],
409+
},
410+
],
411+
}
412+
413+
358414
def test_create_document_reference_invalid_custodian_id():
359415
doc_ref = load_document_reference("Y05868-736253002-Valid")
360416

0 commit comments

Comments
 (0)