FHIR Chat · Processing FHIR Message Bundles · implementers

Stream: implementers

Topic: Processing FHIR Message Bundles


view this post on Zulip Dave Barnet (Dec 21 2018 at 10:20):

I have created a specification for messaging child health data around our healthcare system. The specification tells an implementer how to format a message bundle, and how to send it to a recipient. I think I'm OK explaining how to format the message bundle (creating the resources and reference links etc.). What I'm less sure about is explaining how a recipient might process the message bundle - given that the references will point in directions in accordance to the FHIR spec (an Encounter can reference (point to) a HealthcareService, but Observations, Procedures etc. all point back to the Encounter. Does anyone have some clear literature on how a novice to FHIR might go about writing code to process a FHIR message bundle?Processing FHIR Message Bundle

view this post on Zulip John Moehrke (Dec 21 2018 at 13:46):

http://build.fhir.org/documentation.html

view this post on Zulip Craig McClendon (Dec 21 2018 at 16:43):

The Bundle resource definition page is the place to start. There is a section there on resolving references in a Bundle, which is a key part of processing them. http://build.fhir.org/bundle.html#references - It can be tricky depending on what you are doing. If the processing system is assigning it's own resource IDs you have to work out the dependency order in the bundle so you persist the resources in the correct order so you can update the references properly.

view this post on Zulip Rishi Tarar (Jan 16 2019 at 20:19):

I have been trying to process a MessageBundle by reading it after it has been posted on a HAPI server.

But the reference resolution is not happning for "Practitioner/598af951-66e4-4910-a964-7e41533b183c" in the Bundle.

Below is the paste link to the bundle.

https://pastebin.com/xrAZJCMV

I have tried validating it against the validate operation on HAPI Server 3.5.0

Also I have the fhir validator jar results below.

rguments: ./instances/Referral-A.xml -version 3.0
  .. connect to tx server @ http://tx.fhir.org
  .. definitions from hl7.fhir.core#3.0.1
    (v3.0.1-null)
  .. validate [./instances/Referral-A.xml]
Terminology server: Check for supported code systems for https://www.hl7.org/fhir/valueset-message-events.html
Exception in thread "main" java.lang.Error: Not done yet - resolve Practitioner/598af951-66e4-4910-a964-7e41533b183c locally
    at org.hl7.fhir.r4.validation.InstanceValidator$ValidatorHostServices.resolveReference(InstanceValidator.java:198)
    at org.hl7.fhir.r4.utils.FHIRPathEngine.funcResolve(FHIRPathEngine.java:3058)
    at org.hl7.fhir.r4.utils.FHIRPathEngine.evaluateFunction(FHIRPathEngine.java:2520)

Any ideas ? @Simone Heckmann

view this post on Zulip Simone Heckmann (Jan 16 2019 at 22:41):

I think your syntax needs to be
<reference value="urn:uuid:ffa2bf53-ee09-43a1-b11a-73ed0f1cd73b"/>
instead of
<reference value="PractitionerRole/ffa2bf53-ee09-43a1-b11a-73ed0f1cd73b"/>

view this post on Zulip Lloyd McKenzie (Jan 16 2019 at 22:42):

Both syntaxes should work. In looking at the instance, everything seems like it should work. Double-check that you're using the most recent validator from http://build.fhir.org. If you are, then please submit a change request and attach your instance and point to this zulip thread.

view this post on Zulip Rick Geimer (Jan 16 2019 at 22:46):

I think Simone is correct. The reference is Practitioner/598af951-66e4-4910-a964-7e41533b183c

But the entry has this:

<fullUrl value="urn:uuid:598af951-66e4-4910-a964-7e41533b183c"/>

view this post on Zulip Simone Heckmann (Jan 16 2019 at 22:46):

it should look like this:
pasted image

view this post on Zulip Rick Geimer (Jan 16 2019 at 22:47):

Reference needs to become urn:uuid:598af951-66e4-4910-a964-7e41533b183c, or the fullUrl needs to become "http://SOME-FHIR-ENDPOINT/Practitioner/598af951-66e4-4910-a964-7e41533b183c

view this post on Zulip Lloyd McKenzie (Jan 16 2019 at 22:50):

If the format is Practitoner/x, that means you're doing a local reference - which means you take the base URL of the referencing resource and use it as the base for the referenced URL. The base of the referencing resource is urn:uuid:, so the two expressions should be equivalent. If changing the reference style works, that's fine, but it's still a bug if the validator doesn't support both. I'm pretty sure it used to...

view this post on Zulip Simone Heckmann (Jan 16 2019 at 22:52):

Quote from http://hl7.org/implement/standards/fhir/bundle.html#reference

How to resolve a reference in a Bundle:

If the reference is not an absolute reference, convert it to an absolute URL:
if the reference has the format [type]/[id], and
if the fullUrl for the bundle entry containing the resource is a RESTful one (see the RESTful URL regex)
extract the [root] from the fullUrl, and append the reference (type/id) to it
then try to resolve within the bundle as for a RESTful URL reference.
If no resolution is possible, then the reference has no defined meaning within this specification
else no resolution is possible and the reference has no defined meaning within this specification
else
Look for an entry with a fullUrl that matches the URI in the reference
if no match is found, and the URI is a URL that can be resolved (e.g. if an http: URL), try accessing it directly)

view this post on Zulip Simone Heckmann (Jan 16 2019 at 22:54):

Since the condition "if the reference has the format [type]/[id] and if the fullUrl for the bundle entry containing the resource is a RESTful one" is a "no" because "urn:uuid" doesn't match the RESTFul pattern, we're in the "else" branch:
"Look for an entry with a fullUrl that matches the URI in the reference"

view this post on Zulip Simone Heckmann (Jan 16 2019 at 22:54):

I read that as "matches exactly"...

view this post on Zulip Simone Heckmann (Jan 16 2019 at 22:57):

Though the spec could be a bit more verbose about this :)

view this post on Zulip Rick Geimer (Jan 16 2019 at 22:59):

Think of the reverse. Let say I have this reference:
<reference value="urn:uuid:598af951-66e4-4910-a964-7e41533b183c"/>

And two fullUrls with the following:

<fullUrl value="http://SOME-FHIR-ENDPOINT/Practitioner/598af951-66e4-4910-a964-7e41533b183c"/>
<fullUrl value="http://SOME-FHIR-ENDPOINT/Encounter/598af951-66e4-4910-a964-7e41533b183c"/>

These are both valid, but which does the reference resolve too? You can't mix the urn format with the RESTful

view this post on Zulip Simone Heckmann (Jan 16 2019 at 23:01):

I think this is not the point of uuids :D

view this post on Zulip Rishi Tarar (Jan 17 2019 at 15:06):

I am going to give what @Simone Heckmann suggested and will report back.
@ArunSrinivasan @AbdulMalik Shakir @John Loonsk @Marcelo caldas

view this post on Zulip Rishi Tarar (Jan 17 2019 at 15:45):

Following are my observations.
1. The urn:uuid in references passes $validate operation on the Bundle on HAPI 3.5.0 Server (SUCCESS)
2. It passes the HAPI Client 3.6.0 to parse and resolve references for processing (SUCCESS)
3. It fails the Hl7 Validation jar validation from the latest build on build.fhir.org (see results below) (ERROR)

Here is the latest paste with urn:uuid in references.
https://pastebin.com/JH2QEs6z

Arguments: ./instances/Referral-A.xml -version 3.0
  .. connect to tx server @ http://tx.fhir.org
  .. definitions from hl7.fhir.core#3.0.1
    (v3.0.1-null)
  .. validate [./instances/Referral-A.xml]
Terminology server: Check for supported code systems for https://www.hl7.org/fhir/valueset-message-events.html
Exception in thread "main" java.lang.Error: Not done yet - resolve urn:uuid:598af951-66e4-4910-a964-7e41533b183c locally
    at org.hl7.fhir.r4.validation.InstanceValidator$ValidatorHostServices.resolveReference(InstanceValidator.java:198)

1 and 2 above are what I need right now to do what I am doing for HIMSS Interp Showcase. But I will post my notes with this sample as @Lloyd McKenzie suggested .

view this post on Zulip Lloyd McKenzie (Jan 17 2019 at 16:18):

Are you using the current validator from build.fhir.org?

view this post on Zulip Rishi Tarar (Jan 17 2019 at 18:34):

I am using the one from here http://build.fhir.org/validator.zip

view this post on Zulip Lloyd McKenzie (Jan 17 2019 at 18:56):

Please submit a tracker item


Last updated: Apr 12 2022 at 19:14 UTC