Question
· Feb 28, 2023

FHIR Transaction Bundles: how to properly form urn patient id?

Hi folks!

Researching FHIR bundle transactions.

The idea is that you can post a bundle to a FHIR server with a set of resources. And you can send it as a transaction, so only all the resources will be published or neither.

E.g. I send a bundle of two resources: patient and its observation.

The observation resource should reference an existing patient. But it probably doesn't exist yet on the server and goes within the same bundle. 

For this purpose there is a way to have a temporary id in the bundle, to let resources reference ids.

Here is the bundle I use:

 
Spoiler

I create a temporary id for Patient resource as "fullUrl": "urn:uuid:patient", parameter.

urn-uuid is the form of setting temporary id within the FHIR bunde.

I send this POST request to IRIS FHIR server and get the following error:

{
    "resourceType": "OperationOutcome",
    "issue": [
        {
            "severity": "error",
            "code": "invalid",
            "diagnostics": "<HSFHIRErr>MalformedRelativeReference",
            "details": {
                "text": "The reference value 'urn:uuid:patient' in property (subject) of Type 'Observation' is malformed"
            },
            "expression": [
                "Observation.subject"
            ]
        }
    ]

}

It works with HAPI FHIR though. I'm following this video.

What do I do wrong? How to properly setup the internal id with InterSystems FHIR server?

Product version: IRIS 2022.3
Discussion (6)2
Log in or sign up to continue

First question is not clear on why this is happening - it seems that the response is sending this error message as it is treating the value of fullUrl as being a relative reference, when clearly it is not.

In regards to setting the internal id of a resource in InterSystems FHIR Server, passing a valid UUID string after "urn:uuid" and having it properly referenced in the bundle will make the FHIR Server assign an id value to it - the value is an incremental number that the server assigns on creation of the resource.

Another method that gives you more control on the FHIR id being created would be to override the method HS.FHIR.DTL.Util.API.Transform.SDA3ToFHIR:GetId() to assign resources in the bundle an id.

Good question. GUIDs do create the resource, and our FHIR Server seems to have implemented it that way. 

However some research around the FHIR specification (http://hl7.org/fhir/http.html#trules) seems to suggest that the fullUrl is to be ignored when processing a POST for a transaction bundle, since the server will generate an id for the resource anyway.