DSTU2

This page is part of the FHIR Specification (v1.0.2: DSTU 2). The current version which supercedes this version is 5.0.0. For a full list of available versions, see the Directory of published versions . Page versions: R5 R4B R4 R3 R2

1.23.0 Element Definition

FHIR Infrastructure Work GroupMaturity Level: N/ABallot Status: DSTU 2

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

  • Name, Cardinality, and data type
  • Definitions, usage notes, requirements
  • Default or fixed values
  • Constraints, Length limits, and other usage rules
  • Terminology Binding
  • Mappings to other specifications
  • Structural Usage Information such as Slicing

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

1.23.0.1 Content

Structure

NameFlagsCard.TypeDescription & Constraintsdoco
.. ElementDefinition Σ IElementDefinition of an element in a resource or extension
Types must be unique by the combination of code and profile
Constraints must be unique by key
Binding can only be present for coded elements, string, and uri
Pattern and value are mutually exclusive
default value and meaningWhenMissing are mutually exclusive
Min <= Max
Pattern may only be specified if there is one type
Fixed value may only be specified if there is one type
Either a namereference or a fixed value (but not both) is permitted
... path Σ1..1stringThe path of the element (see the Detailed Descriptions)
... representation Σ0..*codeHow this element is represented in instances
PropertyRepresentation (Required)
... name Σ0..1stringName for this particular element definition (reference target)
... label Σ0..1stringName for element to display with or prompt for element
... code Σ0..*CodingDefining code
LOINC Codes (Example)
... slicing Σ I0..1ElementThis element is sliced - slices follow
If there are no discriminators, there must be a definition
.... discriminator Σ0..*stringElement values that used to distinguish the slices
.... description Σ I0..1stringText description of how slicing works (or not)
.... ordered Σ0..1booleanIf elements must be in same order as slices
.... rules Σ1..1codeclosed | open | openAtEnd
SlicingRules (Required)
... short Σ0..1stringConcise definition for xml presentation
... definition Σ0..1markdownFull formal definition as narrative text
... comments Σ0..1markdownComments about the use of this element
... requirements Σ0..1markdownWhy is this needed?
... alias Σ0..*stringOther names
... min Σ I0..1integerMinimum Cardinality
... max Σ I0..1stringMaximum Cardinality (a number or *)
Max SHALL be a number or "*"
... base Σ0..1ElementBase definition information for tools
.... path Σ1..1stringPath that identifies the base element
.... min Σ1..1integerMin cardinality of the base element
.... max Σ1..1stringMax cardinality of the base element
... type Σ I0..*ElementData type and Profile for this element
Aggregation may only be specified if one of the allowed types for the element is a resource
.... code Σ1..1codeName of Data type or Resource
FHIRDefinedType (Required)
.... profile Σ0..*uriProfile (StructureDefinition) to apply (or IG)
.... aggregation Σ I0..*codecontained | referenced | bundled - how aggregated
AggregationMode (Required)
... nameReference Σ I0..1stringTo another element constraint (by element.name)
... defaultValue[x] Σ I0..1*Specified value it missing from instance
... meaningWhenMissing Σ I0..1markdownImplicit meaning when this element is missing
... fixed[x] Σ I0..1*Value must be exactly this
... pattern[x] Σ I0..1*Value must have at least these property values
... example[x] Σ0..1*Example value: [as defined for type]
... minValue[x] Σ0..1*Minimum Allowed Value (for some types)
... maxValue[x] Σ0..1*Maximum Allowed Value (for some types)
... maxLength Σ0..1integerMax length for strings
... condition Σ0..*idReference to invariant about presence
... constraint Σ0..*ElementCondition that must evaluate to true
.... key Σ I1..1idTarget of 'condition' reference above
.... requirements Σ0..1stringWhy this constraint necessary or appropriate
.... severity Σ1..1codeerror | warning
ConstraintSeverity (Required)
.... human Σ1..1stringHuman description of constraint
.... xpath Σ1..1stringXPath expression of constraint
... mustSupport Σ0..1booleanIf the element must supported
... isModifier Σ0..1booleanIf this modifies the meaning of other elements
... isSummary Σ0..1booleanInclude when _summary = true?
... binding Σ I0..1ElementValueSet details if this is coded
provide either a reference or a description (or both)
.... strength Σ1..1coderequired | extensible | preferred | example
BindingStrength (Required)
.... description Σ I0..1stringHuman explanation of the value set
.... valueSet[x] Σ I0..1Source of value set
URI SHALL start with http:// or https://
..... valueSetUriuri
..... valueSetReferenceReference(ValueSet)
... mapping Σ0..*ElementMap element to another set of definitions
.... identity Σ1..1idReference to mapping declaration
.... language Σ0..1codeComputable language of mapping
MimeType (Required)
.... map Σ1..1stringDetails of the mapping

doco Documentation for this format

UML Diagram

Element⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025extension : Extension 0..*ElementDefinition⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025path : string [1..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025representation : code [0..*] « ⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025PropertyRepresentation! »⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025name : string [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025label : string [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025code : Coding [0..*] « ⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025LOINC ?? »⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025short : string [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025definition : markdown [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025comments : markdown [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025requirements : markdown [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025alias : string [0..*]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025min : integer [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025max : string [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025nameReference : string [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025defaultValue[x] : * [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025meaningWhenMissing : markdown [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025fixed[x] : * [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025pattern[x] : * [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025example[x] : * [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025minValue[x] : * [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025maxValue[x] : * [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025maxLength : integer [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025condition : id [0..*]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025mustSupport : boolean [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025isModifier : boolean [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025isSummary : boolean [0..1]Slicing⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025discriminator : string [0..*]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025description : string [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025ordered : boolean [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025rules : code [1..1] « ⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025SlicingRules! »Base⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025path : string [1..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025min : integer [1..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025max : string [1..1]TypeRef⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025code : code [1..1] « ⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025FHIRDefinedType! »⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025profile : uri [0..*]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025aggregation : code [0..*] « ⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025AggregationMode! »Constraint⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025key : id [1..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025requirements : string [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025severity : code [1..1] « ⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025ConstraintSeverity! »⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025human : string [1..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025xpath : string [1..1]Binding⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025strength : code [1..1] « ⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025BindingStrength! »⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025description : string [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025valueSet[x] : Type [0..1] « uri|Reference(ValueSet) »Mapping⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025identity : id [1..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025language : code [0..1] « ⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025MimeType! »⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025map : string [1..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025slicing[0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025base[0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025type[0..*]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025constraint[0..*]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025binding[0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025mapping[0..*]

XML Template

<[name] xmlns="http://hl7.org/fhir"> doco
 <!-- from Element: extension -->
 <path value="[string]"/><!-- 1..1 The path of the element (see the Detailed Descriptions) -->
 <representation value="[code]"/><!-- 0..* How this element is represented in instances -->
 <name value="[string]"/><!-- 0..1 Name for this particular element definition (reference target) -->
 <label value="[string]"/><!-- 0..1 Name for element to display with or prompt for element -->
 <code><!-- 0..* Coding Defining code --></code>
 <slicing>  <!-- 0..1 This element is sliced - slices follow -->
  <discriminator value="[string]"/><!-- 0..* Element values that used to distinguish the slices -->
  <description value="[string]"/><!-- ?? 0..1 Text description of how slicing works (or not) -->
  <ordered value="[boolean]"/><!-- 0..1 If elements must be in same order as slices -->
  <rules value="[code]"/><!-- 1..1 closed | open | openAtEnd -->
 </slicing>
 <short value="[string]"/><!-- 0..1 Concise definition for xml presentation -->
 <definition value="[markdown]"/><!-- 0..1 Full formal definition as narrative text -->
 <comments value="[markdown]"/><!-- 0..1 Comments about the use of this element -->
 <requirements value="[markdown]"/><!-- 0..1 Why is this needed? -->
 <alias value="[string]"/><!-- 0..* Other names -->
 <min value="[integer]"/><!-- ?? 0..1 Minimum Cardinality -->
 <max value="[string]"/><!-- ?? 0..1 Maximum Cardinality (a number or *) -->
 <base>  <!-- 0..1 Base definition information for tools -->
  <path value="[string]"/><!-- 1..1 Path that identifies the base element -->
  <min value="[integer]"/><!-- 1..1 Min cardinality of the base element -->
  <max value="[string]"/><!-- 1..1 Max cardinality of the base element -->
 </base>
 <type>  <!-- ?? 0..* Data type and Profile for this element -->
  <code value="[code]"/><!-- 1..1 Name of Data type or Resource -->
  <profile value="[uri]"/><!-- 0..* Profile (StructureDefinition) to apply (or IG) -->
  <aggregation value="[code]"/><!-- ?? 0..* contained | referenced | bundled - how aggregated -->
 </type>
 <nameReference value="[string]"/><!-- ?? 0..1 To another element constraint (by element.name) -->
 <defaultValue[x]><!-- ?? 0..1 * Specified value it missing from instance --></defaultValue[x]>
 <meaningWhenMissing value="[markdown]"/><!-- ?? 0..1 Implicit meaning when this element is missing -->
 <fixed[x]><!-- ?? 0..1 * Value must be exactly this --></fixed[x]>
 <pattern[x]><!-- ?? 0..1 * Value must have at least these property values --></pattern[x]>
 <example[x]><!-- 0..1 * Example value: [as defined for type] --></example[x]>
 <minValue[x]><!-- 0..1 * Minimum Allowed Value (for some types) --></minValue[x]>
 <maxValue[x]><!-- 0..1 * Maximum Allowed Value (for some types) --></maxValue[x]>
 <maxLength value="[integer]"/><!-- 0..1 Max length for strings -->
 <condition value="[id]"/><!-- 0..* Reference to invariant about presence -->
 <constraint>  <!-- 0..* Condition that must evaluate to true -->
  <key value="[id]"/><!-- ?? 1..1 Target of 'condition' reference above -->
  <requirements value="[string]"/><!-- 0..1 Why this constraint necessary or appropriate -->
  <severity value="[code]"/><!-- 1..1 error | warning -->
  <human value="[string]"/><!-- 1..1 Human description of constraint -->
  <xpath value="[string]"/><!-- 1..1 XPath expression of constraint -->
 </constraint>
 <mustSupport value="[boolean]"/><!-- 0..1 If the element must supported -->
 <isModifier value="[boolean]"/><!-- 0..1 If this modifies the meaning of other elements -->
 <isSummary value="[boolean]"/><!-- 0..1 Include when _summary = true? -->
 <binding>  <!-- ?? 0..1 ValueSet details if this is coded -->
  <strength value="[code]"/><!-- 1..1 required | extensible | preferred | example -->
  <description value="[string]"/><!-- ?? 0..1 Human explanation of the value set -->
  <valueSet[x]><!-- ?? 0..1 uri|Reference(ValueSet) Source of value set --></valueSet[x]>
 </binding>
 <mapping>  <!-- 0..* Map element to another set of definitions -->
  <identity value="[id]"/><!-- 1..1 Reference to mapping declaration -->
  <language value="[code]"/><!-- 0..1 Computable language of mapping  -->
  <map value="[string]"/><!-- 1..1 Details of the mapping -->
 </mapping>
</[name]>

JSON Template


{doco
  // from Element: extension
  "path" : "<string>", // R!  The path of the element (see the Detailed Descriptions)
  "representation" : ["<code>"], // How this element is represented in instances
  "name" : "<string>", // Name for this particular element definition (reference target)
  "label" : "<string>", // Name for element to display with or prompt for element
  "code" : [{ Coding }], // Defining code
  "slicing" : { // This element is sliced - slices follow
    "discriminator" : ["<string>"], // Element values that used to distinguish the slices
    "description" : "<string>", // C? Text description of how slicing works (or not)
    "ordered" : <boolean>, // If elements must be in same order as slices
    "rules" : "<code>" // R!  closed | open | openAtEnd
  },
  "short" : "<string>", // Concise definition for xml presentation
  "definition" : "<markdown>", // Full formal definition as narrative text
  "comments" : "<markdown>", // Comments about the use of this element
  "requirements" : "<markdown>", // Why is this needed?
  "alias" : ["<string>"], // Other names
  "min" : <integer>, // C? Minimum Cardinality
  "max" : "<string>", // C? Maximum Cardinality (a number or *)
  "base" : { // Base definition information for tools
    "path" : "<string>", // R!  Path that identifies the base element
    "min" : <integer>, // R!  Min cardinality of the base element
    "max" : "<string>" // R!  Max cardinality of the base element
  },
  "type" : [{ // C? Data type and Profile for this element
    "code" : "<code>", // R!  Name of Data type or Resource
    "profile" : ["<uri>"], // Profile (StructureDefinition) to apply (or IG)
    "aggregation" : ["<code>"] // C? contained | referenced | bundled - how aggregated
  }],
  "nameReference" : "<string>", // C? To another element constraint (by element.name)
  // defaultValue[x]: Specified value it missing from instance. One of these 23:
  "defaultValueInteger" : <integer>,
  "defaultValueDecimal" : <decimal>,
  "defaultValueDateTime" : "<dateTime>",
  "defaultValueDate" : "<date>",
  "defaultValueInstant" : "<instant>",
  "defaultValueString" : "<string>",
  "defaultValueUri" : "<uri>",
  "defaultValueBoolean" : <boolean>,
  "defaultValueCode" : "<code>",
  "defaultValueBase64Binary" : "<base64Binary>",
  "defaultValueCoding" : { Coding },
  "defaultValueCodeableConcept" : { CodeableConcept },
  "defaultValueAttachment" : { Attachment },
  "defaultValueIdentifier" : { Identifier },
  "defaultValueQuantity" : { Quantity },
  "defaultValueRange" : { Range },
  "defaultValuePeriod" : { Period },
  "defaultValueRatio" : { Ratio },
  "defaultValueHumanName" : { HumanName },
  "defaultValueAddress" : { Address },
  "defaultValueContactPoint" : { ContactPoint },
  "defaultValueSchedule" : { Schedule },
  "defaultValueReference" : { Reference },
  "meaningWhenMissing" : "<markdown>", // C? Implicit meaning when this element is missing
  // fixed[x]: Value must be exactly this. One of these 23:
  "fixedInteger" : <integer>,
  "fixedDecimal" : <decimal>,
  "fixedDateTime" : "<dateTime>",
  "fixedDate" : "<date>",
  "fixedInstant" : "<instant>",
  "fixedString" : "<string>",
  "fixedUri" : "<uri>",
  "fixedBoolean" : <boolean>,
  "fixedCode" : "<code>",
  "fixedBase64Binary" : "<base64Binary>",
  "fixedCoding" : { Coding },
  "fixedCodeableConcept" : { CodeableConcept },
  "fixedAttachment" : { Attachment },
  "fixedIdentifier" : { Identifier },
  "fixedQuantity" : { Quantity },
  "fixedRange" : { Range },
  "fixedPeriod" : { Period },
  "fixedRatio" : { Ratio },
  "fixedHumanName" : { HumanName },
  "fixedAddress" : { Address },
  "fixedContactPoint" : { ContactPoint },
  "fixedSchedule" : { Schedule },
  "fixedReference" : { Reference },
  // pattern[x]: Value must have at least these property values. One of these 23:
  "patternInteger" : <integer>,
  "patternDecimal" : <decimal>,
  "patternDateTime" : "<dateTime>",
  "patternDate" : "<date>",
  "patternInstant" : "<instant>",
  "patternString" : "<string>",
  "patternUri" : "<uri>",
  "patternBoolean" : <boolean>,
  "patternCode" : "<code>",
  "patternBase64Binary" : "<base64Binary>",
  "patternCoding" : { Coding },
  "patternCodeableConcept" : { CodeableConcept },
  "patternAttachment" : { Attachment },
  "patternIdentifier" : { Identifier },
  "patternQuantity" : { Quantity },
  "patternRange" : { Range },
  "patternPeriod" : { Period },
  "patternRatio" : { Ratio },
  "patternHumanName" : { HumanName },
  "patternAddress" : { Address },
  "patternContactPoint" : { ContactPoint },
  "patternSchedule" : { Schedule },
  "patternReference" : { Reference },
  // example[x]: Example value: [as defined for type]. One of these 23:
  "exampleInteger" : <integer>,
  "exampleDecimal" : <decimal>,
  "exampleDateTime" : "<dateTime>",
  "exampleDate" : "<date>",
  "exampleInstant" : "<instant>",
  "exampleString" : "<string>",
  "exampleUri" : "<uri>",
  "exampleBoolean" : <boolean>,
  "exampleCode" : "<code>",
  "exampleBase64Binary" : "<base64Binary>",
  "exampleCoding" : { Coding },
  "exampleCodeableConcept" : { CodeableConcept },
  "exampleAttachment" : { Attachment },
  "exampleIdentifier" : { Identifier },
  "exampleQuantity" : { Quantity },
  "exampleRange" : { Range },
  "examplePeriod" : { Period },
  "exampleRatio" : { Ratio },
  "exampleHumanName" : { HumanName },
  "exampleAddress" : { Address },
  "exampleContactPoint" : { ContactPoint },
  "exampleSchedule" : { Schedule },
  "exampleReference" : { Reference },
  // minValue[x]: Minimum Allowed Value (for some types). One of these 23:
  "minValueInteger" : <integer>,
  "minValueDecimal" : <decimal>,
  "minValueDateTime" : "<dateTime>",
  "minValueDate" : "<date>",
  "minValueInstant" : "<instant>",
  "minValueString" : "<string>",
  "minValueUri" : "<uri>",
  "minValueBoolean" : <boolean>,
  "minValueCode" : "<code>",
  "minValueBase64Binary" : "<base64Binary>",
  "minValueCoding" : { Coding },
  "minValueCodeableConcept" : { CodeableConcept },
  "minValueAttachment" : { Attachment },
  "minValueIdentifier" : { Identifier },
  "minValueQuantity" : { Quantity },
  "minValueRange" : { Range },
  "minValuePeriod" : { Period },
  "minValueRatio" : { Ratio },
  "minValueHumanName" : { HumanName },
  "minValueAddress" : { Address },
  "minValueContactPoint" : { ContactPoint },
  "minValueSchedule" : { Schedule },
  "minValueReference" : { Reference },
  // maxValue[x]: Maximum Allowed Value (for some types). One of these 23:
  "maxValueInteger" : <integer>,
  "maxValueDecimal" : <decimal>,
  "maxValueDateTime" : "<dateTime>",
  "maxValueDate" : "<date>",
  "maxValueInstant" : "<instant>",
  "maxValueString" : "<string>",
  "maxValueUri" : "<uri>",
  "maxValueBoolean" : <boolean>,
  "maxValueCode" : "<code>",
  "maxValueBase64Binary" : "<base64Binary>",
  "maxValueCoding" : { Coding },
  "maxValueCodeableConcept" : { CodeableConcept },
  "maxValueAttachment" : { Attachment },
  "maxValueIdentifier" : { Identifier },
  "maxValueQuantity" : { Quantity },
  "maxValueRange" : { Range },
  "maxValuePeriod" : { Period },
  "maxValueRatio" : { Ratio },
  "maxValueHumanName" : { HumanName },
  "maxValueAddress" : { Address },
  "maxValueContactPoint" : { ContactPoint },
  "maxValueSchedule" : { Schedule },
  "maxValueReference" : { Reference },
  "maxLength" : <integer>, // Max length for strings
  "condition" : ["<id>"], // Reference to invariant about presence
  "constraint" : [{ // Condition that must evaluate to true
    "key" : "<id>", // C? R!  Target of 'condition' reference above
    "requirements" : "<string>", // Why this constraint necessary or appropriate
    "severity" : "<code>", // R!  error | warning
    "human" : "<string>", // R!  Human description of constraint
    "xpath" : "<string>" // R!  XPath expression of constraint
  }],
  "mustSupport" : <boolean>, // If the element must supported
  "isModifier" : <boolean>, // If this modifies the meaning of other elements
  "isSummary" : <boolean>, // Include when _summary = true?
  "binding" : { // C? ValueSet details if this is coded
    "strength" : "<code>", // R!  required | extensible | preferred | example
    "description" : "<string>", // C? Human explanation of the value set
    // valueSet[x]: Source of value set. One of these 2:
    "valueSetUri" : "<uri>"
    "valueSetReference" : { Reference(ValueSet) }
  },
  "mapping" : [{ // Map element to another set of definitions
    "identity" : "<id>", // R!  Reference to mapping declaration
    "language" : "<code>", // Computable language of mapping 
    "map" : "<string>" // R!  Details of the mapping
  }]
}

Structure

NameFlagsCard.TypeDescription & Constraintsdoco
.. ElementDefinition Σ IElementDefinition of an element in a resource or extension
Types must be unique by the combination of code and profile
Constraints must be unique by key
Binding can only be present for coded elements, string, and uri
Pattern and value are mutually exclusive
default value and meaningWhenMissing are mutually exclusive
Min <= Max
Pattern may only be specified if there is one type
Fixed value may only be specified if there is one type
Either a namereference or a fixed value (but not both) is permitted
... path Σ1..1stringThe path of the element (see the Detailed Descriptions)
... representation Σ0..*codeHow this element is represented in instances
PropertyRepresentation (Required)
... name Σ0..1stringName for this particular element definition (reference target)
... label Σ0..1stringName for element to display with or prompt for element
... code Σ0..*CodingDefining code
LOINC Codes (Example)
... slicing Σ I0..1ElementThis element is sliced - slices follow
If there are no discriminators, there must be a definition
.... discriminator Σ0..*stringElement values that used to distinguish the slices
.... description Σ I0..1stringText description of how slicing works (or not)
.... ordered Σ0..1booleanIf elements must be in same order as slices
.... rules Σ1..1codeclosed | open | openAtEnd
SlicingRules (Required)
... short Σ0..1stringConcise definition for xml presentation
... definition Σ0..1markdownFull formal definition as narrative text
... comments Σ0..1markdownComments about the use of this element
... requirements Σ0..1markdownWhy is this needed?
... alias Σ0..*stringOther names
... min Σ I0..1integerMinimum Cardinality
... max Σ I0..1stringMaximum Cardinality (a number or *)
Max SHALL be a number or "*"
... base Σ0..1ElementBase definition information for tools
.... path Σ1..1stringPath that identifies the base element
.... min Σ1..1integerMin cardinality of the base element
.... max Σ1..1stringMax cardinality of the base element
... type Σ I0..*ElementData type and Profile for this element
Aggregation may only be specified if one of the allowed types for the element is a resource
.... code Σ1..1codeName of Data type or Resource
FHIRDefinedType (Required)
.... profile Σ0..*uriProfile (StructureDefinition) to apply (or IG)
.... aggregation Σ I0..*codecontained | referenced | bundled - how aggregated
AggregationMode (Required)
... nameReference Σ I0..1stringTo another element constraint (by element.name)
... defaultValue[x] Σ I0..1*Specified value it missing from instance
... meaningWhenMissing Σ I0..1markdownImplicit meaning when this element is missing
... fixed[x] Σ I0..1*Value must be exactly this
... pattern[x] Σ I0..1*Value must have at least these property values
... example[x] Σ0..1*Example value: [as defined for type]
... minValue[x] Σ0..1*Minimum Allowed Value (for some types)
... maxValue[x] Σ0..1*Maximum Allowed Value (for some types)
... maxLength Σ0..1integerMax length for strings
... condition Σ0..*idReference to invariant about presence
... constraint Σ0..*ElementCondition that must evaluate to true
.... key Σ I1..1idTarget of 'condition' reference above
.... requirements Σ0..1stringWhy this constraint necessary or appropriate
.... severity Σ1..1codeerror | warning
ConstraintSeverity (Required)
.... human Σ1..1stringHuman description of constraint
.... xpath Σ1..1stringXPath expression of constraint
... mustSupport Σ0..1booleanIf the element must supported
... isModifier Σ0..1booleanIf this modifies the meaning of other elements
... isSummary Σ0..1booleanInclude when _summary = true?
... binding Σ I0..1ElementValueSet details if this is coded
provide either a reference or a description (or both)
.... strength Σ1..1coderequired | extensible | preferred | example
BindingStrength (Required)
.... description Σ I0..1stringHuman explanation of the value set
.... valueSet[x] Σ I0..1Source of value set
URI SHALL start with http:// or https://
..... valueSetUriuri
..... valueSetReferenceReference(ValueSet)
... mapping Σ0..*ElementMap element to another set of definitions
.... identity Σ1..1idReference to mapping declaration
.... language Σ0..1codeComputable language of mapping
MimeType (Required)
.... map Σ1..1stringDetails of the mapping

doco Documentation for this format

UML Diagram

Element⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025extension : Extension 0..*ElementDefinition⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025path : string [1..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025representation : code [0..*] « ⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025PropertyRepresentation! »⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025name : string [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025label : string [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025code : Coding [0..*] « ⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025LOINC ?? »⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025short : string [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025definition : markdown [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025comments : markdown [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025requirements : markdown [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025alias : string [0..*]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025min : integer [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025max : string [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025nameReference : string [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025defaultValue[x] : * [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025meaningWhenMissing : markdown [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025fixed[x] : * [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025pattern[x] : * [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025example[x] : * [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025minValue[x] : * [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025maxValue[x] : * [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025maxLength : integer [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025condition : id [0..*]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025mustSupport : boolean [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025isModifier : boolean [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025isSummary : boolean [0..1]Slicing⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025discriminator : string [0..*]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025description : string [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025ordered : boolean [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025rules : code [1..1] « ⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025SlicingRules! »Base⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025path : string [1..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025min : integer [1..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025max : string [1..1]TypeRef⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025code : code [1..1] « ⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025FHIRDefinedType! »⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025profile : uri [0..*]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025aggregation : code [0..*] « ⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025AggregationMode! »Constraint⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025key : id [1..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025requirements : string [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025severity : code [1..1] « ⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025ConstraintSeverity! »⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025human : string [1..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025xpath : string [1..1]Binding⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025strength : code [1..1] « ⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025BindingStrength! »⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025description : string [0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025valueSet[x] : Type [0..1] « uri|Reference(ValueSet) »Mapping⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025identity : id [1..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025language : code [0..1] « ⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025MimeType! »⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025map : string [1..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025slicing[0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025base[0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025type[0..*]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025constraint[0..*]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025binding[0..1]⭐ Must Read: fhir/DSTU/elementdefinition.html - Kapook Update 2025mapping[0..*]

XML Template

<[name] xmlns="http://hl7.org/fhir"> doco
 <!-- from Element: extension -->
 <path value="[string]"/><!-- 1..1 The path of the element (see the Detailed Descriptions) -->
 <representation value="[code]"/><!-- 0..* How this element is represented in instances -->
 <name value="[string]"/><!-- 0..1 Name for this particular element definition (reference target) -->
 <label value="[string]"/><!-- 0..1 Name for element to display with or prompt for element -->
 <code><!-- 0..* Coding Defining code --></code>
 <slicing>  <!-- 0..1 This element is sliced - slices follow -->
  <discriminator value="[string]"/><!-- 0..* Element values that used to distinguish the slices -->
  <description value="[string]"/><!-- ?? 0..1 Text description of how slicing works (or not) -->
  <ordered value="[boolean]"/><!-- 0..1 If elements must be in same order as slices -->
  <rules value="[code]"/><!-- 1..1 closed | open | openAtEnd -->
 </slicing>
 <short value="[string]"/><!-- 0..1 Concise definition for xml presentation -->
 <definition value="[markdown]"/><!-- 0..1 Full formal definition as narrative text -->
 <comments value="[markdown]"/><!-- 0..1 Comments about the use of this element -->
 <requirements value="[markdown]"/><!-- 0..1 Why is this needed? -->
 <alias value="[string]"/><!-- 0..* Other names -->
 <min value="[integer]"/><!-- ?? 0..1 Minimum Cardinality -->
 <max value="[string]"/><!-- ?? 0..1 Maximum Cardinality (a number or *) -->
 <base>  <!-- 0..1 Base definition information for tools -->
  <path value="[string]"/><!-- 1..1 Path that identifies the base element -->
  <min value="[integer]"/><!-- 1..1 Min cardinality of the base element -->
  <max value="[string]"/><!-- 1..1 Max cardinality of the base element -->
 </base>
 <type>  <!-- ?? 0..* Data type and Profile for this element -->
  <code value="[code]"/><!-- 1..1 Name of Data type or Resource -->
  <profile value="[uri]"/><!-- 0..* Profile (StructureDefinition) to apply (or IG) -->
  <aggregation value="[code]"/><!-- ?? 0..* contained | referenced | bundled - how aggregated -->
 </type>
 <nameReference value="[string]"/><!-- ?? 0..1 To another element constraint (by element.name) -->
 <defaultValue[x]><!-- ?? 0..1 * Specified value it missing from instance --></defaultValue[x]>
 <meaningWhenMissing value="[markdown]"/><!-- ?? 0..1 Implicit meaning when this element is missing -->
 <fixed[x]><!-- ?? 0..1 * Value must be exactly this --></fixed[x]>
 <pattern[x]><!-- ?? 0..1 * Value must have at least these property values --></pattern[x]>
 <example[x]><!-- 0..1 * Example value: [as defined for type] --></example[x]>
 <minValue[x]><!-- 0..1 * Minimum Allowed Value (for some types) --></minValue[x]>
 <maxValue[x]><!-- 0..1 * Maximum Allowed Value (for some types) --></maxValue[x]>
 <maxLength value="[integer]"/><!-- 0..1 Max length for strings -->
 <condition value="[id]"/><!-- 0..* Reference to invariant about presence -->
 <constraint>  <!-- 0..* Condition that must evaluate to true -->
  <key value="[id]"/><!-- ?? 1..1 Target of 'condition' reference above -->
  <requirements value="[string]"/><!-- 0..1 Why this constraint necessary or appropriate -->
  <severity value="[code]"/><!-- 1..1 error | warning -->
  <human value="[string]"/><!-- 1..1 Human description of constraint -->
  <xpath value="[string]"/><!-- 1..1 XPath expression of constraint -->
 </constraint>
 <mustSupport value="[boolean]"/><!-- 0..1 If the element must supported -->
 <isModifier value="[boolean]"/><!-- 0..1 If this modifies the meaning of other elements -->
 <isSummary value="[boolean]"/><!-- 0..1 Include when _summary = true? -->
 <binding>  <!-- ?? 0..1 ValueSet details if this is coded -->
  <strength value="[code]"/><!-- 1..1 required | extensible | preferred | example -->
  <description value="[string]"/><!-- ?? 0..1 Human explanation of the value set -->
  <valueSet[x]><!-- ?? 0..1 uri|Reference(ValueSet) Source of value set --></valueSet[x]>
 </binding>
 <mapping>  <!-- 0..* Map element to another set of definitions -->
  <identity value="[id]"/><!-- 1..1 Reference to mapping declaration -->
  <language value="[code]"/><!-- 0..1 Computable language of mapping  -->
  <map value="[string]"/><!-- 1..1 Details of the mapping -->
 </mapping>
</[name]>

JSON Template

{doco
  // from Element: extension
  "path" : "<string>", // R!  The path of the element (see the Detailed Descriptions)
  "representation" : ["<code>"], // How this element is represented in instances
  "name" : "<string>", // Name for this particular element definition (reference target)
  "label" : "<string>", // Name for element to display with or prompt for element
  "code" : [{ Coding }], // Defining code
  "slicing" : { // This element is sliced - slices follow
    "discriminator" : ["<string>"], // Element values that used to distinguish the slices
    "description" : "<string>", // C? Text description of how slicing works (or not)
    "ordered" : <boolean>, // If elements must be in same order as slices
    "rules" : "<code>" // R!  closed | open | openAtEnd
  },
  "short" : "<string>", // Concise definition for xml presentation
  "definition" : "<markdown>", // Full formal definition as narrative text
  "comments" : "<markdown>", // Comments about the use of this element
  "requirements" : "<markdown>", // Why is this needed?
  "alias" : ["<string>"], // Other names
  "min" : <integer>, // C? Minimum Cardinality
  "max" : "<string>", // C? Maximum Cardinality (a number or *)
  "base" : { // Base definition information for tools
    "path" : "<string>", // R!  Path that identifies the base element
    "min" : <integer>, // R!  Min cardinality of the base element
    "max" : "<string>" // R!  Max cardinality of the base element
  },
  "type" : [{ // C? Data type and Profile for this element
    "code" : "<code>", // R!  Name of Data type or Resource
    "profile" : ["<uri>"], // Profile (StructureDefinition) to apply (or IG)
    "aggregation" : ["<code>"] // C? contained | referenced | bundled - how aggregated
  }],
  "nameReference" : "<string>", // C? To another element constraint (by element.name)
  // defaultValue[x]: Specified value it missing from instance. One of these 23:
  "defaultValueInteger" : <integer>,
  "defaultValueDecimal" : <decimal>,
  "defaultValueDateTime" : "<dateTime>",
  "defaultValueDate" : "<date>",
  "defaultValueInstant" : "<instant>",
  "defaultValueString" : "<string>",
  "defaultValueUri" : "<uri>",
  "defaultValueBoolean" : <boolean>,
  "defaultValueCode" : "<code>",
  "defaultValueBase64Binary" : "<base64Binary>",
  "defaultValueCoding" : { Coding },
  "defaultValueCodeableConcept" : { CodeableConcept },
  "defaultValueAttachment" : { Attachment },
  "defaultValueIdentifier" : { Identifier },
  "defaultValueQuantity" : { Quantity },
  "defaultValueRange" : { Range },
  "defaultValuePeriod" : { Period },
  "defaultValueRatio" : { Ratio },
  "defaultValueHumanName" : { HumanName },
  "defaultValueAddress" : { Address },
  "defaultValueContactPoint" : { ContactPoint },
  "defaultValueSchedule" : { Schedule },
  "defaultValueReference" : { Reference },
  "meaningWhenMissing" : "<markdown>", // C? Implicit meaning when this element is missing
  // fixed[x]: Value must be exactly this. One of these 23:
  "fixedInteger" : <integer>,
  "fixedDecimal" : <decimal>,
  "fixedDateTime" : "<dateTime>",
  "fixedDate" : "<date>",
  "fixedInstant" : "<instant>",
  "fixedString" : "<string>",
  "fixedUri" : "<uri>",
  "fixedBoolean" : <boolean>,
  "fixedCode" : "<code>",
  "fixedBase64Binary" : "<base64Binary>",
  "fixedCoding" : { Coding },
  "fixedCodeableConcept" : { CodeableConcept },
  "fixedAttachment" : { Attachment },
  "fixedIdentifier" : { Identifier },
  "fixedQuantity" : { Quantity },
  "fixedRange" : { Range },
  "fixedPeriod" : { Period },
  "fixedRatio" : { Ratio },
  "fixedHumanName" : { HumanName },
  "fixedAddress" : { Address },
  "fixedContactPoint" : { ContactPoint },
  "fixedSchedule" : { Schedule },
  "fixedReference" : { Reference },
  // pattern[x]: Value must have at least these property values. One of these 23:
  "patternInteger" : <integer>,
  "patternDecimal" : <decimal>,
  "patternDateTime" : "<dateTime>",
  "patternDate" : "<date>",
  "patternInstant" : "<instant>",
  "patternString" : "<string>",
  "patternUri" : "<uri>",
  "patternBoolean" : <boolean>,
  "patternCode" : "<code>",
  "patternBase64Binary" : "<base64Binary>",
  "patternCoding" : { Coding },
  "patternCodeableConcept" : { CodeableConcept },
  "patternAttachment" : { Attachment },
  "patternIdentifier" : { Identifier },
  "patternQuantity" : { Quantity },
  "patternRange" : { Range },
  "patternPeriod" : { Period },
  "patternRatio" : { Ratio },
  "patternHumanName" : { HumanName },
  "patternAddress" : { Address },
  "patternContactPoint" : { ContactPoint },
  "patternSchedule" : { Schedule },
  "patternReference" : { Reference },
  // example[x]: Example value: [as defined for type]. One of these 23:
  "exampleInteger" : <integer>,
  "exampleDecimal" : <decimal>,
  "exampleDateTime" : "<dateTime>",
  "exampleDate" : "<date>",
  "exampleInstant" : "<instant>",
  "exampleString" : "<string>",
  "exampleUri" : "<uri>",
  "exampleBoolean" : <boolean>,
  "exampleCode" : "<code>",
  "exampleBase64Binary" : "<base64Binary>",
  "exampleCoding" : { Coding },
  "exampleCodeableConcept" : { CodeableConcept },
  "exampleAttachment" : { Attachment },
  "exampleIdentifier" : { Identifier },
  "exampleQuantity" : { Quantity },
  "exampleRange" : { Range },
  "examplePeriod" : { Period },
  "exampleRatio" : { Ratio },
  "exampleHumanName" : { HumanName },
  "exampleAddress" : { Address },
  "exampleContactPoint" : { ContactPoint },
  "exampleSchedule" : { Schedule },
  "exampleReference" : { Reference },
  // minValue[x]: Minimum Allowed Value (for some types). One of these 23:
  "minValueInteger" : <integer>,
  "minValueDecimal" : <decimal>,
  "minValueDateTime" : "<dateTime>",
  "minValueDate" : "<date>",
  "minValueInstant" : "<instant>",
  "minValueString" : "<string>",
  "minValueUri" : "<uri>",
  "minValueBoolean" : <boolean>,
  "minValueCode" : "<code>",
  "minValueBase64Binary" : "<base64Binary>",
  "minValueCoding" : { Coding },
  "minValueCodeableConcept" : { CodeableConcept },
  "minValueAttachment" : { Attachment },
  "minValueIdentifier" : { Identifier },
  "minValueQuantity" : { Quantity },
  "minValueRange" : { Range },
  "minValuePeriod" : { Period },
  "minValueRatio" : { Ratio },
  "minValueHumanName" : { HumanName },
  "minValueAddress" : { Address },
  "minValueContactPoint" : { ContactPoint },
  "minValueSchedule" : { Schedule },
  "minValueReference" : { Reference },
  // maxValue[x]: Maximum Allowed Value (for some types). One of these 23:
  "maxValueInteger" : <integer>,
  "maxValueDecimal" : <decimal>,
  "maxValueDateTime" : "<dateTime>",
  "maxValueDate" : "<date>",
  "maxValueInstant" : "<instant>",
  "maxValueString" : "<string>",
  "maxValueUri" : "<uri>",
  "maxValueBoolean" : <boolean>,
  "maxValueCode" : "<code>",
  "maxValueBase64Binary" : "<base64Binary>",
  "maxValueCoding" : { Coding },
  "maxValueCodeableConcept" : { CodeableConcept },
  "maxValueAttachment" : { Attachment },
  "maxValueIdentifier" : { Identifier },
  "maxValueQuantity" : { Quantity },
  "maxValueRange" : { Range },
  "maxValuePeriod" : { Period },
  "maxValueRatio" : { Ratio },
  "maxValueHumanName" : { HumanName },
  "maxValueAddress" : { Address },
  "maxValueContactPoint" : { ContactPoint },
  "maxValueSchedule" : { Schedule },
  "maxValueReference" : { Reference },
  "maxLength" : <integer>, // Max length for strings
  "condition" : ["<id>"], // Reference to invariant about presence
  "constraint" : [{ // Condition that must evaluate to true
    "key" : "<id>", // C? R!  Target of 'condition' reference above
    "requirements" : "<string>", // Why this constraint necessary or appropriate
    "severity" : "<code>", // R!  error | warning
    "human" : "<string>", // R!  Human description of constraint
    "xpath" : "<string>" // R!  XPath expression of constraint
  }],
  "mustSupport" : <boolean>, // If the element must supported
  "isModifier" : <boolean>, // If this modifies the meaning of other elements
  "isSummary" : <boolean>, // Include when _summary = true?
  "binding" : { // C? ValueSet details if this is coded
    "strength" : "<code>", // R!  required | extensible | preferred | example
    "description" : "<string>", // C? Human explanation of the value set
    // valueSet[x]: Source of value set. One of these 2:
    "valueSetUri" : "<uri>"
    "valueSetReference" : { Reference(ValueSet) }
  },
  "mapping" : [{ // Map element to another set of definitions
    "identity" : "<id>", // R!  Reference to mapping declaration
    "language" : "<code>", // Computable language of mapping 
    "map" : "<string>" // R!  Details of the mapping
  }]
}

Constraints

  • eld-1: On ElementDefinition.slicing: If there are no discriminators, there must be a definition (xpath on f:ElementDefinition/f:slicing: (f:discriminator) or (f:description))
  • eld-10: On ElementDefinition.binding: provide either a reference or a description (or both) (xpath on f:ElementDefinition/f:binding: (exists(f:valueSetUri) or exists(f:valueSetReference)) or exists(f:description))
  • eld-11: Binding can only be present for coded elements, string, and uri (xpath: not(exists(f:binding)) or (count(f:type/f:code) = 0) or f:type/f:code/@value=('code','Coding','CodeableConcept','Quantity','Extension', 'string', 'uri'))
  • eld-12: On ElementDefinition.binding.valueSet[x]: URI SHALL start with http:// or https:// (xpath on f:ElementDefinition/f:binding/f:valueSet[x]: starts-with(string(@value), 'http:') or starts-with(string(@value), 'https:'))
  • eld-13: Types must be unique by the combination of code and profile (xpath: not(exists(for $type in f:type return $type/preceding-sibling::f:type[f:code/@value=$type/f:code/@value and f:profile/@value = $type/f:profile/@value])))
  • eld-14: Constraints must be unique by key (xpath: count(f:constraint) = count(distinct-values(f:constraint/f:key/@value)))
  • eld-15: default value and meaningWhenMissing are mutually exclusive (xpath: not(exists(f:*[starts-with(local-name(.), 'fixed')])) or not(exists(f:meaningWhenMissing)))
  • eld-2: Min <= Max (xpath: not(exists(f:min)) or not(exists(f:max)) or (not(f:max/@value) and not(f:min/@value)) or (f:max/@value = '*') or (number(f:max/@value) >= f:min/@value))
  • eld-3: On ElementDefinition.max: Max SHALL be a number or "*" (xpath on f:ElementDefinition/f:max: @value='*' or (normalize-space(@value)!='' and normalize-space(translate(@value, '0123456789',''))=''))
  • eld-4: On ElementDefinition.type: Aggregation may only be specified if one of the allowed types for the element is a resource (xpath on f:ElementDefinition/f:type: not(exists(f:aggregation)) or exists(f:code[@value = 'Reference']))
  • eld-5: Either a namereference or a fixed value (but not both) is permitted (xpath: not(exists(f:nameReference) and exists(f:*[starts-with(local-name(.), 'value')])))
  • eld-6: Fixed value may only be specified if there is one type (xpath: not(exists(f:*[starts-with(local-name(.), 'fixed')])) or (count(f:type)=1))
  • eld-7: Pattern may only be specified if there is one type (xpath: not(exists(f:*[starts-with(local-name(.), 'pattern')])) or (count(f:type)=1))
  • eld-8: Pattern and value are mutually exclusive (xpath: not(exists(f:*[starts-with(local-name(.), 'pattern')])) or not(exists(f:*[starts-with(local-name(.), 'value')])))

1.23.0.2 Interpretation of ElementDefinition in different contexts

The data type ElementDefinition is used both in StructureDefinition and DataElement, and within those resources, the way its elements are to be used and interpreted depend on the context where ElementDefinition used:

ElementDefinition field DataElement Base definition, first element Base definition, following elements Constraint Definition, first element Constraint Definition, following elements
name prohibited prohibited prohibited prohibited optional, for profile re-use
slicing prohibited prohibited prohibited prohibited optional
short/definition optional required required required‡ required‡
requirements/
comments/alias
optional prohibited optional prohibited‡ optional‡
base prohibited prohibited prohibited required required
nameReference prohibited prohibited optional prohibited optional
defaultValue[x] optional prohibited optional prohibited optional†
meaningWhenMissing optional prohibited optional prohibited optional†
fixed[x] prohibited prohibited prohibited prohibited optional
pattern[x] optional prohibited prohibited prohibited optional
example[x] optional prohibited optional prohibited optional
minValue[x] optional prohibited prohibited prohibited optional
maxValue[x] optional prohibited prohibited prohibited optional
maxLength optional prohibited prohibited prohibited optional
mustSupport optional prohibited prohibited optional optional
isModifier prohibited prohibited optional prohibited optional†
isSummary prohibited prohibited optional prohibited optional†
binding optional prohibited optional prohibited optional
constraint/mapping optional prohibited optional optional∆ optional∆

Notes:

  • Base definition: A StructureDefinition without a base element - e.g. a definition of a structure that doesn't constrain another structure
  • Constraint definition: A StructureDefinition with a base element - e.g. a definition of a structure that constrains another base structure
  • †: The element's presence, and value, must match the definition in the base structure
  • ‡: The element content must be consistent with that matching element in the base structure
  • ∆: Additional constraints and mappings can be defined, but they do not replace the ones in the base structure

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

Context path (1st element) path (following elements) type (1st element)
Data Element Any token Any token (distinct in the DataElement) Any type
Base definition of a data type
(example: Quantity - XML, JSON)
Name of the type Path inside the datatype Element
A constrained data type
(example: Money - XML, JSON)
Name of the base type Path inside the datatype Name of the base type
Base definition of a resource
(example: Patient - XML, JSON)
The name of the resource Path inside the resource DomainResource or sometimes Resource
Constraint on a resource
(example: DAF Patient - XML, JSON)
The name of the resource Path inside the resource
(including into the data types)
The name of the resource
Base Extension (a standard data type)
(example: Extension - XML, JSON)
Extension Extension.value[x] or Extension.extension Extension
A defined Extension
(example: Extension - XML, JSON)
Extension Extension.value[x] or Extension.extension (for complex extensions) Extension

1.23.0.2.1 Rules about Slicing

  • Slicing is only allowed when constraining an existing structure
  • slicing can only be used on the first repeat of an element, this element is considered the slicing entry
  • The first entry (the one having the slicing information) 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:
    • slicing must be present
    • min and max govern the number of total occurrences of the sliced element including the number of occurrences in the open portion of the slice.
  • An element with a cardinality of 0..1 and a choice of multiple types can be sliced by type. This is in order to specify different constraints for different types. In this case, the discriminator SHALL be "@type"

1.23.0.2.2 Rules about min and max

In a DataElement, min and max are always required.

In a StructureDefinition:

  • If there is no StructureDefinition.base: min and max are always required
  • Else, in StructureDefinition.differential: min and max are always optional; if they are not present, they default to the base min and max
  • and in StructureDefinition.snapshot: min and max are always required

1.23.0.2.3 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 may not have a value at all. All the application can say is that the value is unknown.

However, for some elements, this specification makes specific rules about what it means if the element is missing. For some elements, this takes the form of a default value, a value that should be assumed if on element is present. For example, here are some default values:

ElementDefault Value
ElementDefinition.mustSupportfalse
SampledData.factor1
ValueSet.codeSystem.concept.abstractfalse
List.entry.deletedfalse

Most default values are mathematical / numerical non-operations e.g. false, 0 for addition or 1 for multiplication. Default values are rarely used because:

  • The value must be known by all implementations
  • When an element has a default value, it can never be unknown - e.g. it is implicitly mandatory
  • The default value can never be changed.

For other elements, the resource explicitly documents what the meaning of a missing element is, and the meaning is not represented by a default value. Some examples:

ElementMeaning when missing
Period.endIf the end of the period is missing, it means that the period is ongoing
Quantity.comparatorIf there is no comparator, then there is no modification of the value
MedicationAdministration.wasNotGivenIf this is missing, then the medication was administered
Substance.instanceIf this element is not present, then the substance resource describes a kind of substance

Like default values, and for the same reasons, assigning a meaning when an element is missing is something that is not done very often. Note that Profiles cannot change the default value or missing meaning of an element, since it can't be done in the base specification either.