Uploaded image for project: 'FHIR Specification Feedback'
  1. FHIR Specification Feedback
  2. FHIR-31732

Referencing a container from a contained resource using '#' is illegal according to ref-1

    XMLWordPrintableJSON

Details

    • Icon: Technical Correction Technical Correction
    • Resolution: Persuasive
    • Icon: Medium Medium
    • FHIR Core (FHIR)
    • R4
    • FHIR Infrastructure
    • References
    • 2.3.0.8
    • Hide

      Will change invariant to:

      reference.startsWith('#').not() or (reference.substring(1).trace('url') in %rootResource.contained.id.trace('ids')) or (reference='#' and %rootResource!=%resource)

      Show
      Will change invariant to: reference.startsWith('#').not() or (reference.substring(1).trace('url') in %rootResource.contained.id.trace('ids')) or (reference='#' and %rootResource!=%resource)
    • Correction
    • R5

    Description

      In the section "Contained Resources" on the page for the Reference datatype, we see that contained resources can reference their containers using the special "#" syntax:

      (begin quote)
      For a resource that references the container, the reference is "#", like this:

      <Patient xmlns="http://hl7.org/fhir">
        <id value="something"/>
        <contained>
          <Provenance>
            <!-- no id necessary (though still allowed) -->
            <target>
              <reference value="#"/>
            </target>
          </Provenance>
        </contained>
        <!-- other attributes -->
      </Patient>
      

      (end quote)

      However, the invariant ref-1 states:

      reference.startsWith('#').not() or (reference.substring(1).trace('url') in %rootResource.contained.id.trace('ids'))`
      

      The part reference.substring(1) will in this case result in the empty string, which will not be found in the %rootResource.contained.id collection.

      So, I think the business rule will trigger for this kind of reference, and we should adapt ref-1 to make this possible.

      Attachments

        Activity

          People

            jmandel Josh Mandel
            ewout Ewout Kramer
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: