This tutorial describes how to create and use an extension in FHIR.

  1. Create a new template/profile for the extension
    1. Select the “Extension” for the “Applies To” field
    2. Create a constraint for the “@url” attribute with a single-value binding of the same URL as the template/profile’s “Long ID” (ex: “http://hl7.org/fhir/us/ccda/StructureDefinition/CCDA-on-FHIR-Authorization”)
    3. Create a constraint for the “value[x]” choice. On this constraint, I suggest selecting “SHALL” and “1..1” for the conformance and cardinality, because an optional value[x] would not provide much value in an extension, and may not even be valid according to FHIR
    4. Create a constraint for *one* of the “value[x]” choice options (ex: “valueString”)
  2. In the template/profile where you want to use the extension:
    1. Create a constraint for the “extension” element
    2. Select the extension template/profile created in step 1 (above) as a contained template
    3. Select that the “extension” constraint is a branch/slice “root” if this template/profile might have multiple extensions. Otherwise, this will be the only extension that can be used in the template/profile.