Stream: implementers
Topic: Bundle Transaction with externally referenced Resources
Joel Francis (Apr 12 2018 at 23:23):
Hi,
I am looking for clarification on how to send an externally existing resources in a bundle.
I am sending a Bundle [type=”transaction”] and I want to POST a ServiceRequestand Patient resource existing on my Server at http://sendingsystem/fhir/ServiceRequest/123 and http://sendingsystem/fhir/Patient/12345 to http://receivingSystem/fhir/Bundle
And have the ServiceRequest and Patient saved at the respective /ServiceRequest and /Patient end points. The way I would structure the Bundle keeping in mind https://www.hl7.org/fhir/bundle.html#references is as follows:
I have used the fullUrl element as the base and then provided the respective ids for each and the transaction related operation with be a POST to the appropriate end points.
Is this approach valid and the norm?
Thanks,
Joel
Transaction_External_Ref.png
Lloyd McKenzie (Apr 13 2018 at 00:52):
Your fullUrls need to include the identifiers
Joel Francis (Apr 13 2018 at 13:41):
Your fullUrls need to include the identifiers
Thanks @Lloyd McKenzie
Morten Ernebjerg (Apr 20 2018 at 13:58):
I have a similar usecase, but it is still not quite clear how to set fullUrl in my case: I want to have a client system use batch bundles to POST new Observations that do not (yet) exists as FHIR resources anywhere. These resources contain references to patients that already exist on the receiving server, and the client knows the corresponding logical IDs (so that it can put the correct relative URLs - Patient/123 etc. - into the resources being POSTed). The receiving server assigns logical IDs to created identities itself and will ignore any IDs the client sends along.
In that case, it is not clear to me how the client can give a fullUrl since the resource does have an identity yet. Indeed, if I leave out fullUrl altogether (as generally allowed for POSTs in bundles), POSTing the bundle on the base URL works fine on a test server (http://fhirtest.uhn.ca/baseDstu3). However the resource validator JAR gives a validation error for the corresponding bundle resource: "Relative Reference appears inside Bundle whose entry is missing a fullUrl". If I add a UUID as the fullUrl, the validator gives a warning: "URN reference is not locally contained within the bundle Patient/abc123".
So is the best/correct option in that case to put in a generated UUID as the fullUrl or to leave it out altogether - or maybe some third option?
Łukasz Dywicki (Apr 20 2018 at 15:23):
So is the best/correct option in that case to put in a generated UUID as the fullUrl or to leave it out altogether - or maybe some third option?
I had same case a while ago and somehow I managed to get #hapi accepting URLs of non existent resources (it was failing at random factor). Temporary identifier you talk about is way to go. Under the hood, regardless of how you specify reference, it is resolved to Patient/<resource-id>
and UUID is gone once transaction is commited.
Grahame Grieve (Apr 20 2018 at 21:14):
uuid: is expected in this case
Morten Ernebjerg (Apr 23 2018 at 06:52):
@Łukasz Dywicki @Grahame Grieve Thanks!
Last updated: Apr 12 2022 at 19:14 UTC