-
Couldn't load subscription status.
- Fork 166
Description
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
POST
{
"type": "batch",
"entry": [
{
"fullUrl": "urn:uuid:54312ae1-757f-40dc-89b5-0d536bba8855",
"resource": {
"meta": {
"tag": [
{
"system": "http://projectcrucible.org",
"code": "testdata"
}
]
},
"identifier": [
{
"use": "official",
"system": "http://projectcrucible.org",
"value": "1606669429"
}
],
"name": [
{
"use": "official",
"text": "Batch Crucible",
"family": "Crucible",
"given": [
"Batch"
]
}
],
"resourceType": "Patient"
},
"request": {
"method": "POST",
"url": "Patient"
}
},
{
"fullUrl": "urn:uuid:8f22bab3-5dec-4d66-b0cd-e53c05ecc2e4",
"resource": {
"meta": {
"tag": [
{
"system": "http://projectcrucible.org",
"code": "testdata"
}
]
},
"status": "final",
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "8302-2"
}
]
},
"subject": {
"reference": "urn:uuid:54312ae1-757f-40dc-89b5-0d536bba8855"
},
"valueQuantity": {
"value": 900,
"unit": "cm",
"system": "http://unitsofmeasure.org"
},
"resourceType": "Observation"
},
"request": {
"method": "POST",
"url": "Observation"
}
}
],
"resourceType": "Bundle"
}
Result:
{
"resourceType":"Bundle",
"type":"transaction-response",
"entry":[
{
"fullUrl":"http://localhost:5000/fhir/Patient/1108/_history/1",
"resource":{
"resourceType":"Patient",
"id":"1108",
"meta":{
"versionId":"1",
"lastUpdated":"2020-11-29T20:03:49.3667599+03:00",
"tag":[
{
"system":"http://projectcrucible.org",
"code":"testdata"
}
]
},
"identifier":[
{
"use":"official",
"system":"http://projectcrucible.org",
"value":"1606669429"
}
],
"name":[
{
"use":"official",
"text":"Batch Crucible",
"family":"Crucible",
"given":[
"Batch"
]
}
]
},
"response":{
"status":"201 Created",
"location":"http://localhost:5000/fhir/Patient/1108/_history/1",
"etag":"W/\"1\"",
"lastModified":"2020-11-29T20:03:49.3667599+03:00"
}
},
{
"fullUrl":"http://localhost:5000/fhir/Observation/88/_history/1",
"resource":{
"resourceType":"Observation",
"id":"88",
"meta":{
"versionId":"1",
"lastUpdated":"2020-11-29T20:03:49.3667851+03:00",
"tag":[
{
"system":"http://projectcrucible.org",
"code":"testdata"
}
]
},
"status":"final",
"code":{
"coding":[
{
"system":"http://loinc.org",
"code":"8302-2"
}
]
},
"subject":{
"reference":"Patient/1108"
},
"valueQuantity":{
"value":900.0,
"unit":"cm",
"system":"http://unitsofmeasure.org"
}
},
"response":{
"status":"201 Created",
"location":"http://localhost:5000/fhir/Observation/88/_history/1",
"etag":"W/\"1\"",
"lastModified":"2020-11-29T20:03:49.3667851+03:00"
}
}
]
}
Expected behavior
According to http://hl7.org/fhir/STU3/http.html#2.21.0.17.1
For a batch, there SHALL be no interdependencies between the different entries in the Bundle that cause change on the server. The success or failure of one change SHOULD not alter the success or failure or resulting content of another change. Servers SHOULD validate that this is the case. Note that it is considered that servers execute the batch in the same order as that specified below for transactions, though the order of execution should not matter given the previous rule.
So server should return 4XX response for the second entry (Observation). Like, 400 (bad request) with the explanation of the failure, instead of 201 (Created).
Failed tests
TransactionAndBatchTest (XFER10)