View raw Markdown
type: docsource: source/elementdefinition.html

[%settitle Element Definition%] [%file newheader%] [%file newnavbar%] <%dtxheader base ElementDefinition%>

Element Definition

Responsible Owner: [[%wgt fhir%]]([%wg fhir%]) Work GroupStandards Status: Normative

Types Framework Cross Reference: Base Types | Datatypes | Resources | Patterns

The definition of an element in a resource or an extension. The definition includes:

The ElementDefinition type is the core of the FHIR metadata layer, and is closely (conceptually) aligned to ISO 11179. All the data elements defined in this specification are published as a collection of data elements (XML or JSON).

ElementDefinition is used in [%dtusage ElementDefinition%]

Content

[%dt ElementDefinition 1%]

Constraints

[%dt.constraints ElementDefinition%]

Use of ElementDefinition.path

The path element is the most important property of the element definition. It both names the element, and locates the element within a hierarchy defined within a particular context. Within the FHIR specification, there is only one original definition for each path. This is the master definition to which all the other definitions with the same path must conform.

All elements defined within the FHIR specification itself are defined within a StructureDefinition that defines a resource, or a datatype. This defines the identity of the element and provides the context in which the meaning of the element is understood. When Elements are defined, the following rules apply:

If the element is polymorphic (has more than one datatype), then the end of the path for the element SHALL be "[x]" to designate that the name of the element may vary when serialized. The "[x]" is not considered to be part of the official element name, though it may frequently appear in documentation that way.

Elements may be defined in:

StructureDefinitions with derivation = constraint (i.e., Resource and Datatype profiles) are not allowed to define or include ElementDefinitions with a path not defined within the base type definition from which they derive (e.g., in the FHIR specification).

ElementDefinition.id

In addition to the path, every ElementDefinition SHALL have a populated id, and the id SHALL have a unique value populated by following this algorithm:

Note that in a profile with no slices, this id will match the path exactly and entirely. id values constructed in this fashion are unique, and persistent, and may be used as the target of external references into the definition, where necessary.

Interpretation of ElementDefinition in different contexts

The datatype ElementDefinition is used in StructureDefinition. The way its elements are to be used and interpreted depends on the context:

ElementDefinition fieldType definition, root elementType definition, following elementsConstraint Definition, root elementConstraint Definition, following elements
sliceNameprohibitedprohibitedprohibitedrequired for slices, else prohibited
labeloptionaloptionalrecommendedrecommended
codeoptionaloptionaloptionaloptional
slicingprohibitedoptionalprohibitedoptional
short/definitionrequiredrequiredrequired‡required‡
requirementsprohibitedoptionalprohibited‡optional‡
commentoptionaloptionaloptionaloptional
aliasoptionaloptionaloptionaloptional
basesnapshot: expected <br/> differential: optionalsnapshot: expected <br/> differential: optionalexpectedexpected
typeNot expectedrequiredoptionaloptional
nameReferenceprohibitedoptionalprohibitedoptional
min/maxoptional§requiredoptionaloptional†
defaultValue[x]prohibitedoptionalprohibitedoptional†
meaningWhenMissingprohibitedoptionalprohibitedoptional†
fixed[x]prohibitedprohibitedprohibitedoptional
pattern[x]prohibitedprohibitedprohibitedoptional
example[x]prohibitedoptionalprohibitedoptional
minValue[x]prohibitedprohibitedprohibitedoptional
maxValue[x]prohibitedprohibitedprohibitedoptional
maxLengthprohibitedprohibitedprohibitedoptional
mustSupportoptional♉︎optional♉︎optionaloptional
isModifieroptionaloptionaloptionaloptional†
isSummaryNot expectedoptionalNot expectedoptional†
bindingprohibitedoptionaloptionaloptional
constraintoptionaloptionaloptional∆optional∆
conditionNot expectedoptionalNot expectedoptional∆
mappingoptionaloptionaloptional∆optional∆

Notes:♉

The use of Path and type depends more deeply on the context where the ElementDefinition is used:

Contextpath (1st element)path (following elements)type (1st element)
Base definition of a datatype <br/> (example: Quantity - XML, JSON)Name of the typePath inside the datatypeElement
A constrained datatype <br/> (example: Money - XML, JSON)Name of the base typePath inside the datatypeName of the base type
Base definition of a resource <br/> (example: Patient - XML, JSON)The name of the resourcePath inside the resourceDomainResource or sometimes Resource
Constraint on a resource <br/> (example: DAF Patient - XML, JSON)The name of the resourcePath inside the resource <br/> (including into the datatypes)The name of the resource
Base Extension (which is a standard datatype) <br/> (example: Extension - XML, JSON)ExtensionExtension.value[x] or Extension.extensionExtension
A defined Extension <br/> (example: Extension - XML, JSON)ExtensionExtension.value[x] or Extension.extension (for complex extensions)Extension

There are additional notes about the use of ElementDefinition when defining Extensions on the Defining Extensions page.

Rules about Slicing

For a description of slicing, see Slicing

Constraining elements with a choice of Type

Elements that allow a choice of multiple types can be constrained. In principle, there are two different types of constraints to apply:

When constraining elements with multiple types, the following rules apply:

Rules about min and max

Primitive Values

All primitive data types have a value and also extensions. Even if the element is present, the value might not be present; instead, an extension may be present the either provides information about why the value is not present, or provides an expression that might be used to generate a value in a particular context. Some common extensions that might appear in place of a primitive value:

In many cases, profiles want to make a primitive element required (min = 1), and also want to say that when a primitive element is present, the value must be present, since the value is what is processed by applications. The flag mustHaveValue can be set to true to indicate that the primitive data type must have value if present (so it has impact whatever the value of min). Note that this flag is a short cut, equivalent to the profile walking into the primitive data type and setting min = 1 for the value. The short cut is preferable because it's simpler and more concise for implementers.

Alternatively, profiles may wish to allow the primitive value to be replaced by some extensions but not others. In this case, the profiles can list the allowable extensions using the valueAlternatives element, which contains a list of the extensions that can appear if the primitive value is not present. Note that this list is a short cut for actually profiling the extensions on the primitive data type and making a co-occurence constraint, but has no effect when the value is present.

For further discussion regarding populating primitive values, see Exchanging Data using FHIR.

Rules about Aggregation

Missing Elements

Most elements have a minimum cardinality of 0, which means that they may be missing from a resource when it is exchanged between systems. Generally, when an element is missing, all that an application processing the resource can say about the element is that the value is unknown - it may have a correct value, but it has not been provided for security or workflow reasons. On the other hand, it might not have a value at all. All the application can say is that the value is unknown.

This also applies when the element is present, but has no value or child elements, and only has extensions instead.

However, for some elements, this specification makes specific rules about what it means if the element is missing. Constraints on other structures cannot change the missing meaning of an element. Here is a list of all elements with a default value or a missing meaning:

<%missing-element-list%>

This specification does not define any default values for resources or datatypes because:

Note that default values can be defined in Logical Models.

Bindings / Additional Bindings

For further information about bindings, see Terminology bindings.

Must-support

The primary focus of the FHIR specification is on correct application behavior around what is exchanged and how: valid APIs and resource instances. However many FHIR implementation guides are interested in specifying additional obligations about how the applications involved handle the data that is being exchanged.

Element Definitions use the property mustSupport to indicate that there are rules that apply to how the data is handled. In addition, the <%extension http://hl7.org/fhir/StructureDefinition/obligation%> extension can be used to make more detailed statements about application behavior. See Implementation Obligations for the proper use of these features.

[%file newfooter%] try { var currentTabIndex = sessionStorage.getItem('fhir-resource-tab-index'); } catch (exception) {} if (!currentTabIndex) currentTabIndex = '0'; $('#tabs-ElementDefinition').tabs({ active: currentTabIndex, activate: function(event, ui) { store(ui.newTab.index()); } }); function store(currentTab) { document.activeElement.blur(); try { sessionStorage.setItem('fhir-resource-tab-index', currentTab); } catch (exception) {} $('#tabs-ElementDefinition').tabs('option', 'active', currentTab); }