Chris Grenz
Chris Grenz

Reputation: 161

FHIR: Nested extensions

What is the correct representation of a multi-level FHIR extension?

<extension url="http://example.com/DataElement/researchAuth">
   <extension url="http://example.com/DataElement/researchAuth.type">
      <valueCode value="local" />
   </extension>
   <extension url="http://example.com/DataElement/researchAuth.flag>
      <valueBoolean value="true" />
   </extension>
</extension>

-- OR --

<extension url="http://example.com/DataElement/researchAuth">
   <extension url="http://example.com/DataElement/researchAuth#type">
      <valueCode value="local" />
   </extension>
   <extension url="http://example.com/DataElement/researchAuth#flag>
      <valueBoolean value="true" />
   </extension>
</extension>

In the StructureDefinition, should the URL for the sub-extensions be fully qualified (url: "http://example.com/DataElement/researchAuth#type") or just the name ("type") as here: http://hl7-fhir.github.io/extension-goal-relationship.html

Finally, is there an standard linkage between StructureDefinition.name and the sub-extension URL? I.e. the part after the # (type in http://example.com/DataElement/researchAuth#type) should match the name in the structure defition of the extension:

<StructureDefinition>
   ...
      <element>
         <path value="Extension" />
         <name value="researchAuth" />
      </element>
      <element>
         <path value="Extension.extension" />
         <name value="researchAuth.type" />
      </element>
    ...
</StructureDefinition>

Otherwise, how does one determine what the post # element is??

James's example adds to my confusion: http://jamesagnew.github.io/hapi-fhir/doc_extensions.html

In the sub-extensions section, the "parent" is "http://example.com#parent" and the children are "http://example.com#ChildOne" and "http://example.com#ChildTwo" respectively.

I would expect only "http://example.com" for the parent extension (no # as it's the base extension defined at the URL). OR http://example.com#parent.ChildOne for the sub-extensions.

Upvotes: 1

Views: 1056

Answers (1)

Lloyd McKenzie
Lloyd McKenzie

Reputation: 6793

In DSTU 1, it would be the first approach. In DSTU 2, it would be this:

<extension url="http://example.com/DataElement/researchAuth">
   <extension url="type">
      <valueCode value="local" />
   </extension>
   <extension url="flag>
      <valueBoolean value="true" />
   </extension>
</extension>

That only holds for children of complex extensions. If you want to include an extension defined elsewhere inside another extension, you need to use the full URL.

Upvotes: 1

Related Questions