Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch processing - interdependencies between entries #306

Open
andy-a-o opened this issue Nov 29, 2020 · 0 comments
Open

Batch processing - interdependencies between entries #306

andy-a-o opened this issue Nov 29, 2020 · 0 comments
Labels

Comments

@andy-a-o
Copy link
Contributor

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants