fhirbase / fhirbase-plv8

[DEPRECATED] Fhirbase 2.0 is an FHIR relational storage
https://health-samurai.io/fhirbase
Other
105 stars 39 forks source link

Failed transaction response doesn't conform Bundle specification #124

Open draakhan opened 8 years ago

draakhan commented 8 years ago

Hi!

Issue connected with #119, but my case is related to errors during transaction:

Trying to create resource of non-existing type:

fhirbase=# SELECT fhir_transaction('{"resourceType":"Bundle","type":"transaction","entry":[{"resource":{"resourceType":"UnknownResource","active":true,"name":[{"use":"official","family":["Snow"],"given":["John"]}],"gender":"male","birthDate":"2001-01-01"},"request":{"method":"POST","url":"UnknownResource"}}]}');

a response

fhir_transaction | {"resourceType":"Bundle","type":"transaction-response","entry":[{"resourceType":"OperationOutcome","text":{"div":"<div>Storage for UnknownResource not exists</div>"},"issue":[{"severity":"error","code":"not-supported"}]}]}

The response doesn't conform specification at: https://www.hl7.org/fhir/bundle-response.json.html

Tested on v.1.3.0.15

danil commented 8 years ago

@draakhan according to FHIR documentation: "For a failed transaction, the server returns a single OperationOutcome instead of a Bundle" http://hl7-fhir.github.io/http.html#transaction-response appropriate test here https://github.com/fhirbase/fhirbase-plv8/blob/0eef311f107ca8f32061e5df40ff5538b6716cad/test/integration/issues/124_spec.coffee#L8 if not, feel free to reopen

draakhan commented 8 years ago

@danil It looks that single OperationOutcome is contrary to: http://hl7-fhir.github.io/bundle.html#transaction-response

Here is my next example for transaction with more than one operation:

fhirbase=# select fhir_transaction('{
fhirbase'#   "resourceType": "Bundle",
fhirbase'#   "type": "transaction",
fhirbase'#   "entry": [
fhirbase'#     {
fhirbase'#       "resource": {
fhirbase'#         "resourceType": "UnknownResource",
fhirbase'#         "active": true,
fhirbase'#         "name": [
fhirbase'#           {
fhirbase'#             "use": "official",
fhirbase'#             "family": [
fhirbase'#               "Snow"
fhirbase'#             ],
fhirbase'#             "given": [
fhirbase'#               "John"
fhirbase'#             ]
fhirbase'#           }
fhirbase'#         ],
fhirbase'#         "gender": "male",
fhirbase'#         "birthDate": "2001-01-01"
fhirbase'#       },
fhirbase'#       "request": {
fhirbase'#         "method": "POST",
fhirbase'#         "url": "UnknownResource"
fhirbase'#       }
fhirbase'#     },
fhirbase'#     {
fhirbase'#       "resource": {
fhirbase'#         "resourceType": "Patient",
fhirbase'#         "active": true,
fhirbase'#         "name": [
fhirbase'#           {
fhirbase'#             "use": "official",
fhirbase'#             "family": [
fhirbase'#               "Snow"
fhirbase'#             ],
fhirbase'#             "given": [
fhirbase'#               "John"
fhirbase'#             ]
fhirbase'#           }
fhirbase'#         ],
fhirbase'#         "gender": "male",
fhirbase'#         "birthDate": "2001-01-01"
fhirbase'#       },
fhirbase'#       "request": {
fhirbase'#         "method": "POST",
fhirbase'#         "url": "Patient"
fhirbase'#       }
fhirbase'#     }
fhirbase'#   ]
fhirbase'# }');
-[ RECORD 1 ]----+-------------------------------------------------------------------------------------------------------------------------------------------------
fhir_transaction | {"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"not-supported","diagnostics":"Storage for UnknownResource not exists"}]}

It could be more useful for developing and supporting transaction when in case of error we'll have response for every operation in transaction.

danil commented 8 years ago

@draakhan do you suggest to ignore http://hl7-fhir.github.io/http.html#transaction-response ?

draakhan commented 8 years ago

Yes, I think about ignoring it and conforming only to http://hl7-fhir.github.io/bundle.html#transaction-response . On the other hand, a diagnostic message from OperationOutcome, if it is added to Bundle.entry.response for failed operations, it will be useful too.

danil commented 8 years ago

@draakhan

Yes, I think about ignoring it and conforming only to http://hl7-fhir.github.io/bundle.html#transaction-response .

i should first consult with team about this