LinuxForHealth / FHIR

The LinuxForHealth FHIR® Server and related projects
https://linuxforhealth.github.io/FHIR
Apache License 2.0
326 stars 157 forks source link

$submit-data operation fails #3064

Closed kmbarton423 closed 2 years ago

kmbarton423 commented 2 years ago

Running IBM FHIR Server 4.10.0 with CPG and CQF operations. Executed $submit-data operation for an existing MeasureReport:
POST {{local1}}{{context1}}/Measure/$submit-data
(see attached requestBody.txt)

Status 200 received yet operation fails:

  "resourceType": "OperationOutcome",
  "id": "ac-11-0-3-cde64786-f73c-408f-a87b-3b1a174101be",
  "issue": [
    {
      "severity": "fatal",
      "code": "exception",
      "details": {
        "text": "FHIROperationException: Operation failed"
      }
    }
  ]
}

Logs indicate "PSQLException: ERROR: Concurrent update - mismatch of version in JSON" (see attached out.log)

The core issue is related to MeasureSubmitDataOperation.java on line 80. The switch between PUT/POST depends on a VERSION. On the second submission of the same data element, the version is passed into the persistence layer, and the persistence layer sees a violation of the stored version (v1) violates the incoming version (v1).

Options, remove the version in that code, or use ifNoneMatch and handle the response.

Additional context

kmbarton423 commented 2 years ago

Receive the following after the fix:

Status 409 Conflict

{ "resourceType": "OperationOutcome", "id": "ac-11-0-3-e8b4cd0e-8ba2-494c-af1d-b34a53d711c0", "issue": [ { "severity": "fatal", "code": "conflict", "details": { "text": "Encountered version id mismatch while inserting Resource" }, "expression": [ "<empty>", "Bundle.entry[1]" ] } ] }