Skip to content
Advertisement

fhir.executeBundle replacing resource id…How to prevent this?

I am using this Java code to upload a resource to a FHIRstore. The resource is as follows

{
  "resourceType": "Bundle",
  "id": "bundle-transaction",
  "meta": {
    "lastUpdated": "2018-03-11T11:22:16Z"
  },
  "type": "transaction",
  "entry": [
    {
      "resource": {
        "resourceType": "Patient", "id" : 123456,
        "name": [
          {
            "family": "Smith",
            "given": [
              "Darcy"
            ]
          }
        ],
        "gender": "female",
        "address": [
          {
            "line": [
              "123 Main St."
            ],
            "city": "Anycity",
            "state": "CA",
            "postalCode": "12345"
          }
        ]
      },
      "request": {
        "method": "POST",
    "url": "Patient"
      }
    }
  ]
}

But the id i am using(123456) is getting replaced by a hexadecimal number.

This does not happen while using fhirstores.import method Is there any way to stop executeBundle method from replacing my id…as i want to use custom id in my resource?

Any help would be appreciated. Thank you

Advertisement

Answer

When you’re performing a transaction, the effect is going to be the same as if you were POSTing the resources individually. On a POST, the server determines the resource id. On a regular POST, the id is just ignored or raises an error. Within a transaction, the id is used to manage resolution of references across the transaction, but the server still chooses what the id will be of the persisted resources (and updates all references accordingly). If you want to control the resource id values within a transaction, use PUT rather than POST. (Note that not all servers will allow an ‘upsert’ – i.e. a PUT that performs a create at a specific resource location.) For details, see http://hl7.org/fhir/http.html#upsert.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement