Skip to content

Instantly share code, notes, and snippets.

@ewoutkramer
Last active August 29, 2015 14:08
Show Gist options
  • Save ewoutkramer/f1ec43e184c4ac7ab5d7 to your computer and use it in GitHub Desktop.
Save ewoutkramer/f1ec43e184c4ac7ab5d7 to your computer and use it in GitHub Desktop.

Interpretation of ElementDefinition in different contexts

The pseudo-datatype ElementDefinition is used both in StructureDefinition and ExtensionDefinition, and even within those resources, the way its elements are to be used and interpreted depend on the context where ElementDefinition used.

Common properties

  • short, formal, comments, requirements, synonym can be used in any context to convey a change to the interpretation of the constrained element as compared to the base definition.
  • condition and constraint may be used in all contexts
  • mapping may be used in all contexts

First (root) element in a structure

  • path is equal to the name of the type indicated in Structure.type
  • representation may not be used
  • name associates a name
  • slicing may not be used
  • min and max may not be used
  • type is set to "Resource" for constraints on Resources, "Element" for constraints on data types
  • nameReference may not be used
  • fixed, pattern indicate a value that an instance of a while complex type constrained by this structure must match. May be used instead of applying constraints to the nested elements of the datatype.
  • example example value for a complex type in an instance that complies to the structure
  • maxLength may not be used
  • mustSupport may not be used
  • isModifier may not be used
  • isSummary may not be used
  • binding may not be used

Nested element in a structure

  • representation may only be used on elements of a primitive type (and currently only on the "value" element of FHIR primitive types and "url" element of Extension)
  • slicing can only be used on the first repeat of an element, this element is considered the slicing entry
  • mustSupport may be used, but if it is not present it defaults to "false"
  • isModifier must be the same as the base definition for the datatype or Resource
  • isSummary must be the same as the base definition for the datatype or Resource

Element in a structure acting as the slicing entry

The ElementDefinition is understood to be the set of constraints to be used for the "open" slice, i.e. when the slice is open, this definition is used as a constraint on elements in the instance that are not part of a slice and belong to the open portion of the slice. Its use follows the "normal case", except:

  • representation may not be used
  • name may not be used?
  • slicing must be present
  • min and max are considered to govern the number of total occurrences of the sliced element including the number of occurrences in the open portion of the slice.
  • isModifier must be the same as the base definition for the datatype or Resource
  • isSummary must be the same as the base definition for the datatype or Resource

Only element in a simple extension

  • path is equal to ExtensionDefinition.name
  • representation may not be used
  • name may not be used
  • slicing may be used to express constraints on the use of specific types when the element allows a choice of type (name ends in [x])
  • min, max defines the allowed number of occurrences of this extension in an instance. Actual use in the target context of an extension may governed by slicing the (modifier)extension element of the target and must be compatible with this number. Note that having a min > 0 can only be guaranteed where such slicing rules are in place in the target.
  • type indicates the (choice of) types of the extension's value
  • nameReference may not be used
  • mustSupport may be used, but if it is not present it defaults to "false"
  • isModifier indicates whether the extension appears in the of element in the instance. If it is not present it defaults to "false"
  • isSummary indicates whether the extension will appear in a summary

First (root) element in a complex extension

  • path is equal to ExtensionDefinition.name
  • representation may not be used
  • name may not be used
  • slicing may not be used
  • min, max defines the allowed number of occurrences of this extension in an instance. Actual use in the target context of an extension may governed by slicing the (modifier)extension element of the target and must be compatible with this number. Note that having a min > 0 can only be guaranteed where such slicing rules are in place in the target.
  • type is set to Extension
  • nameReference may not be used
  • fixed, pattern may not be used. (Lloyd may describe a usecase)
  • example example value for the complex extension in an instance
  • maxLength may not be used
  • mustSupport may not be used
  • isModifier indicates whether the extension appears in the of element in the instance. If it is not present it defaults to "false"
  • isSummary indicates whether the extension will appear in a summary (depends on modifierExtension?)
  • binding may not be used

Nested element in a complex extension

  • representation may not be used
  • slicing may be used to express constraints on the use of specific types when the element allows a choice of type (name ends in [x])
  • mustSupport may be used, but if it is not present it defaults to "false"
  • isModifier may be used, but if it is not present it defaults to "false"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment