Search code examples
hl7-fhir

Bundle-internal reference: relative URL "[type]/[id]" when resource has fullUrl "urn:uuid:[id]", not "http://blah/blih/[type]/[id]"


I am having trouble with a reference/URL constellation that I found in the first example of project eRezeptAbgabedaten @ simplifier.net.

The referenced internal resource has a fullUrl of type uuid (urn:uuid:11ba8a7b-79f6-4b7a-8a29-0524c9e0ba41) but it is referenced elsewhere in the bundle via the relative URL Organization/11ba8a7b-79f6-4b7a-8a29-0524c9e0ba41. The entry containing the reference also has a fullUrl of type uuid.

<Bundle xmlns="http://hl7.org/fhir">
  ...
  <entry>
    <fullUrl value="urn:uuid:ac1e9724-f5ee-448b-a594-74259fd8a926" />
    <resource>
      <Composition>
        ...
        <author>
          <reference value="Organization/11ba8a7b-79f6-4b7a-8a29-0524c9e0ba41" />
        </author>
        ...
     </Composition>
  </entry>
  <entry>
    <fullUrl value="urn:uuid:11ba8a7b-79f6-4b7a-8a29-0524c9e0ba41" />
    <resource>
      <Organization>
        <id value="11ba8a7b-79f6-4b7a-8a29-0524c9e0ba41" />
        ...
      </Organization>
    </resource>
  </entry>
</Bundle>

In the documentation I cannot find any rule resembling 'for a relative URL like [type]/[id], look for an entry of type [type] with id [id] in the bundle before any other resolution attempts' (or, conversely, 'build a table of pseudo URLs [type]/[id] for all entries in the bundle and try to match relative URLs against this table before looking elsewhere').

In particular, the instructions for 2.36.4.1 Resolving references in Bundles seem to leave little room for such an interpretation:

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)

Note, in addition, that a reference may be by identifier, and if it is, and there is no URL, it may be resolved by scanning the ids in the bundle.

Does anyone know where the rule for 'synthesising' the [type]/[id] pseudo URLs for lookups in bundles can be found?


Solution

  • The rules were somewhat ambiguous in the past about whether 'relative' references were allowed when the full URL was a UUID. Thus there were some systems that did support that. We're clarifying in R5 that this is NOT allowed (and refactoring the resolution rules to be more clear).

    In short - you may find this in R4 or earlier (though it's not preferred/encouraged), but it won't be allowed in R5 and on.