Skip to content

Commit 62e08d6

Browse files
committed
NRL-1051 have response message in outcome field for each entry
1 parent 8c627ee commit 62e08d6

File tree

7 files changed

+127
-9
lines changed

7 files changed

+127
-9
lines changed

api/consumer/swagger.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ components:
948948
pattern: ([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))
949949
description: The date/time that the resource was modified on the server.
950950
outcome:
951-
$ref: "#/components/schemas/DocumentReference"
951+
$ref: "#/components/schemas/OperationOutcome"
952952
description: An OperationOutcome containing hints and warnings produced as part of processing this entry in a batch or transaction.
953953
required:
954954
- status

api/producer/processTransaction/process_transaction_bundle.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
DocumentReferenceRelatesTo,
2424
ExpressionItem,
2525
Meta,
26+
OperationOutcome,
2627
OperationOutcomeIssue,
2728
)
2829

@@ -410,7 +411,9 @@ def handler(
410411
response_entries = [
411412
BundleEntry(
412413
response=BundleEntryResponse(
413-
status=response.statusCode, location=response.headers.get("Location")
414+
status=response.statusCode,
415+
location=response.headers.get("Location"),
416+
outcome=OperationOutcome.model_validate_json(response.body),
414417
)
415418
)
416419
for response in responses

api/producer/processTransaction/tests/test_process_transaction_bundle.py

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,25 @@ def test_create_single_nrl_document_reference_with_transaction_happy_path(
7272
"response": {
7373
"status": "201",
7474
"location": "/producer/FHIR/R4/DocumentReference/Y05868-00000000-0000-0000-0000-000000000001",
75+
"outcome": {
76+
"resourceType": "OperationOutcome",
77+
"issue": [
78+
{
79+
"severity": "information",
80+
"code": "informational",
81+
"details": {
82+
"coding": [
83+
{
84+
"system": "https://fhir.nhs.uk/ValueSet/NRL-ResponseCode",
85+
"code": "RESOURCE_CREATED",
86+
"display": "Resource created",
87+
}
88+
]
89+
},
90+
"diagnostics": "The document has been created",
91+
}
92+
],
93+
},
7594
},
7695
},
7796
],
@@ -150,6 +169,25 @@ def test_create_single_mhds_document_reference_with_transaction_happy_path(
150169
"response": {
151170
"status": "201",
152171
"location": "/producer/FHIR/R4/DocumentReference/Y05868-00000000-0000-0000-0000-000000000001",
172+
"outcome": {
173+
"resourceType": "OperationOutcome",
174+
"issue": [
175+
{
176+
"severity": "information",
177+
"code": "informational",
178+
"details": {
179+
"coding": [
180+
{
181+
"system": "https://fhir.nhs.uk/ValueSet/NRL-ResponseCode",
182+
"code": "RESOURCE_CREATED",
183+
"display": "Resource created",
184+
}
185+
]
186+
},
187+
"diagnostics": "The document has been created",
188+
}
189+
],
190+
},
153191
},
154192
},
155193
],
@@ -241,12 +279,50 @@ def test_create_multiple_mhds_document_reference_with_transaction_happy_path(
241279
"response": {
242280
"status": "201",
243281
"location": "/producer/FHIR/R4/DocumentReference/Y05868-00000000-0000-0000-0000-000000000001",
282+
"outcome": {
283+
"resourceType": "OperationOutcome",
284+
"issue": [
285+
{
286+
"severity": "information",
287+
"code": "informational",
288+
"details": {
289+
"coding": [
290+
{
291+
"system": "https://fhir.nhs.uk/ValueSet/NRL-ResponseCode",
292+
"code": "RESOURCE_CREATED",
293+
"display": "Resource created",
294+
}
295+
]
296+
},
297+
"diagnostics": "The document has been created",
298+
}
299+
],
300+
},
244301
},
245302
},
246303
{
247304
"response": {
248305
"status": "201",
249306
"location": "/producer/FHIR/R4/DocumentReference/Y05868-00000000-0000-0000-0000-000000000002",
307+
"outcome": {
308+
"resourceType": "OperationOutcome",
309+
"issue": [
310+
{
311+
"severity": "information",
312+
"code": "informational",
313+
"details": {
314+
"coding": [
315+
{
316+
"system": "https://fhir.nhs.uk/ValueSet/NRL-ResponseCode",
317+
"code": "RESOURCE_CREATED",
318+
"display": "Resource created",
319+
}
320+
]
321+
},
322+
"diagnostics": "The document has been created",
323+
}
324+
],
325+
},
250326
},
251327
},
252328
],
@@ -354,12 +430,51 @@ def test_create_multiple_mhds_document_reference_with_transaction_wrong_ods_retu
354430
{
355431
"response": {
356432
"status": "400",
433+
"outcome": {
434+
"resourceType": "OperationOutcome",
435+
"issue": [
436+
{
437+
"severity": "error",
438+
"code": "invalid",
439+
"details": {
440+
"coding": [
441+
{
442+
"system": "https://fhir.nhs.uk/ValueSet/Spine-ErrorOrWarningCode-1",
443+
"code": "BAD_REQUEST",
444+
"display": "Bad request",
445+
}
446+
]
447+
},
448+
"diagnostics": "The custodian of the provided DocumentReference does not match the expected ODS code for this organisation",
449+
"expression": ["custodian.identifier.value"],
450+
}
451+
],
452+
},
357453
},
358454
},
359455
{
360456
"response": {
361457
"status": "201",
362458
"location": "/producer/FHIR/R4/DocumentReference/Y05868-00000000-0000-0000-0000-000000000002",
459+
"outcome": {
460+
"resourceType": "OperationOutcome",
461+
"issue": [
462+
{
463+
"severity": "information",
464+
"code": "informational",
465+
"details": {
466+
"coding": [
467+
{
468+
"system": "https://fhir.nhs.uk/ValueSet/NRL-ResponseCode",
469+
"code": "RESOURCE_CREATED",
470+
"display": "Resource created",
471+
}
472+
]
473+
},
474+
"diagnostics": "The document has been created",
475+
}
476+
],
477+
},
363478
},
364479
},
365480
],

api/producer/swagger.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1540,7 +1540,7 @@ components:
15401540
pattern: ([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))
15411541
description: The date/time that the resource was modified on the server.
15421542
outcome:
1543-
$ref: "#/components/schemas/DocumentReference"
1543+
$ref: "#/components/schemas/OperationOutcome"
15441544
description: An OperationOutcome containing hints and warnings produced as part of processing this entry in a batch or transaction.
15451545
required:
15461546
- status

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

Lines changed: 2 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-11-20T09:43:58+00:00
3+
# timestamp: 2024-12-12T12:52:13+00:00
44

55
from __future__ import annotations
66

@@ -776,7 +776,7 @@ class BundleEntryResponse(BaseModel):
776776
),
777777
] = None
778778
outcome: Annotated[
779-
Optional[DocumentReference],
779+
Optional[OperationOutcome],
780780
Field(
781781
description="An OperationOutcome containing hints and warnings produced as part of processing this entry in a batch or transaction."
782782
),

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

Lines changed: 2 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-02T21:57:21+00:00
3+
# timestamp: 2024-12-12T12:52:09+00:00
44

55
from __future__ import annotations
66

@@ -760,7 +760,7 @@ class BundleEntryResponse(BaseModel):
760760
),
761761
] = None
762762
outcome: Annotated[
763-
Optional[DocumentReference],
763+
Optional[OperationOutcome],
764764
Field(
765765
description="An OperationOutcome containing hints and warnings produced as part of processing this entry in a batch or transaction."
766766
),

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

Lines changed: 2 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-02T21:57:22+00:00
3+
# timestamp: 2024-12-12T12:52:11+00:00
44

55
from __future__ import annotations
66

@@ -666,7 +666,7 @@ class BundleEntryResponse(BaseModel):
666666
),
667667
] = None
668668
outcome: Annotated[
669-
Optional[DocumentReference],
669+
Optional[OperationOutcome],
670670
Field(
671671
description="An OperationOutcome containing hints and warnings produced as part of processing this entry in a batch or transaction."
672672
),

0 commit comments

Comments
 (0)