2nd DSTU Draft For Comment

This page is part of the FHIR Specification (v0.4.0: DSTU 2 Draft). 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.14.0 Element Definition

Introduction

1.14.0.1 Content

Structure

NameFlagsCard.TypeDescription & Constraintsdoco
.. ElementDefinition I0..*ElementDefinition of an elements 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
Pattern and value are mutually exclusive
Constraint names must be unique.
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)
... 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..1stringFull formal definition in human language
... comments 0..1stringComments about the use of this element
... requirements 0..1stringWhy is this needed?
... synonym 0..*stringOther names
... min I0..1integerMinimum Cardinality
... max I0..1stringMaximum Cardinality (a number or *)
Max SHALL be a number or "*"
... 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
DataType (Required)
.... profile 0..1uriProfile.structure to apply
.... 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..1stringImplicit 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]
... 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
.... name I0..1stringShort human label
.... 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
Example value sets are always extensible
provide either a reference or a description (or both)
.... name 1..1stringDescriptive Name
.... isExtensible I1..1booleanCan additional codes be used?
.... conformance I0..1coderequired | preferred | example
BindingConformance (Required)
.... description I0..1stringHuman explanation of the value set
.... reference[x] ISource of value set
uri SHALL start with http:// or https://
..... referenceUri0..1uri
..... referenceReference0..1ValueSet
... mapping 0..*ElementMap element to another set of definitions
.... identity 1..1idReference to mapping declaration
.... map 1..1stringDetails of the mapping

UML Diagram

to do

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) -->
 <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="[string]"/><!-- 0..1 Full formal definition in human language -->
 <comments value="[string]"/><!-- 0..1 Comments about the use of this element -->
 <requirements value="[string]"/><!-- 0..1 Why is this needed? -->
 <synonym value="[string]"/><!-- 0..* Other names -->
 <min value="[integer]"/><!-- ?? 0..1 Minimum Cardinality -->
 <max value="[string]"/><!-- ?? 0..1 Maximum Cardinality (a number or *) -->
 <type>  <!-- ?? 0..* Data type and Profile for this element -->
  <code value="[code]"/><!-- 1..1 Name of Data type or Resource -->
  <profile value="[uri]"/><!-- 0..1 Profile.structure to apply -->
  <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="[string]"/><!-- ?? 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]>
 <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 -->
  <name value="[string]"/><!-- ?? 0..1 Short human label -->
  <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 -->
  <name value="[string]"/><!-- 1..1 Descriptive Name -->
  <isExtensible value="[boolean]"/><!-- ?? 1..1 Can additional codes be used? -->
  <conformance value="[code]"/><!-- ?? 0..1 required | preferred | example -->
  <description value="[string]"/><!-- ?? 0..1 Human explanation of the value set -->
  <reference[x]><!-- ?? 0..1 uri|Reference(ValueSet) Source of value set --></reference[x]>
 </binding>
 <mapping>  <!-- 0..* Map element to another set of definitions -->
  <identity value="[id]"/><!-- 1..1 Reference to mapping declaration -->
  <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)
  "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" : "<string>", // Full formal definition in human language
  "comments" : "<string>", // Comments about the use of this element
  "requirements" : "<string>", // Why is this needed?
  "synonym" : ["<string>"], // Other names
  "min" : <integer>, // C? Minimum Cardinality
  "max" : "<string>", // C? Maximum Cardinality (a number or *)
  "type" : [{ // C? Data type and Profile for this element
    "code" : "<code>", // R! Name of Data type or Resource
    "profile" : "<uri>", // Profile.structure to apply
    "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 },
  "defaultValueContact" : { Contact },
  "defaultValueSchedule" : { Schedule },
  "defaultValueReference" : { Reference },
  "meaningWhenMissing" : "<string>", // 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 },
  "fixedContact" : { Contact },
  "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 },
  "patternContact" : { Contact },
  "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 },
  "exampleContact" : { Contact },
  "exampleSchedule" : { Schedule },
  "exampleReference" : { 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
    "name" : "<string>", // C? Short human label
    "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
    "name" : "<string>", // R! Descriptive Name
    "isExtensible" : <boolean>, // C? R! Can additional codes be used?
    "conformance" : "<code>", // C? required | preferred | example
    "description" : "<string>", // C? Human explanation of the value set
    // reference[x]: Source of value set. One of these 2:
    "referenceUri" : "<uri>"
    "referenceReference" : { Reference(ValueSet) }
  },
  "mapping" : [{ // Map element to another set of definitions
    "identity" : "<id>", // R! Reference to mapping declaration
    "map" : "<string>" // R! Details of the mapping
  }]
}

Structure

NameFlagsCard.TypeDescription & Constraintsdoco
.. ElementDefinition I0..*ElementDefinition of an elements 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
Pattern and value are mutually exclusive
Constraint names must be unique.
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)
... 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..1stringFull formal definition in human language
... comments 0..1stringComments about the use of this element
... requirements 0..1stringWhy is this needed?
... synonym 0..*stringOther names
... min I0..1integerMinimum Cardinality
... max I0..1stringMaximum Cardinality (a number or *)
Max SHALL be a number or "*"
... 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
DataType (Required)
.... profile 0..1uriProfile.structure to apply
.... 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..1stringImplicit 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]
... 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
.... name I0..1stringShort human label
.... 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
Example value sets are always extensible
provide either a reference or a description (or both)
.... name 1..1stringDescriptive Name
.... isExtensible I1..1booleanCan additional codes be used?
.... conformance I0..1coderequired | preferred | example
BindingConformance (Required)
.... description I0..1stringHuman explanation of the value set
.... reference[x] ISource of value set
uri SHALL start with http:// or https://
..... referenceUri0..1uri
..... referenceReference0..1ValueSet
... mapping 0..*ElementMap element to another set of definitions
.... identity 1..1idReference to mapping declaration
.... map 1..1stringDetails of the mapping

UML Diagram

todo

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) -->
 <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="[string]"/><!-- 0..1 Full formal definition in human language -->
 <comments value="[string]"/><!-- 0..1 Comments about the use of this element -->
 <requirements value="[string]"/><!-- 0..1 Why is this needed? -->
 <synonym value="[string]"/><!-- 0..* Other names -->
 <min value="[integer]"/><!-- ?? 0..1 Minimum Cardinality -->
 <max value="[string]"/><!-- ?? 0..1 Maximum Cardinality (a number or *) -->
 <type>  <!-- ?? 0..* Data type and Profile for this element -->
  <code value="[code]"/><!-- 1..1 Name of Data type or Resource -->
  <profile value="[uri]"/><!-- 0..1 Profile.structure to apply -->
  <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="[string]"/><!-- ?? 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]>
 <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 -->
  <name value="[string]"/><!-- ?? 0..1 Short human label -->
  <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 -->
  <name value="[string]"/><!-- 1..1 Descriptive Name -->
  <isExtensible value="[boolean]"/><!-- ?? 1..1 Can additional codes be used? -->
  <conformance value="[code]"/><!-- ?? 0..1 required | preferred | example -->
  <description value="[string]"/><!-- ?? 0..1 Human explanation of the value set -->
  <reference[x]><!-- ?? 0..1 uri|Reference(ValueSet) Source of value set --></reference[x]>
 </binding>
 <mapping>  <!-- 0..* Map element to another set of definitions -->
  <identity value="[id]"/><!-- 1..1 Reference to mapping declaration -->
  <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)
  "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" : "<string>", // Full formal definition in human language
  "comments" : "<string>", // Comments about the use of this element
  "requirements" : "<string>", // Why is this needed?
  "synonym" : ["<string>"], // Other names
  "min" : <integer>, // C? Minimum Cardinality
  "max" : "<string>", // C? Maximum Cardinality (a number or *)
  "type" : [{ // C? Data type and Profile for this element
    "code" : "<code>", // R! Name of Data type or Resource
    "profile" : "<uri>", // Profile.structure to apply
    "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 },
  "defaultValueContact" : { Contact },
  "defaultValueSchedule" : { Schedule },
  "defaultValueReference" : { Reference },
  "meaningWhenMissing" : "<string>", // 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 },
  "fixedContact" : { Contact },
  "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 },
  "patternContact" : { Contact },
  "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 },
  "exampleContact" : { Contact },
  "exampleSchedule" : { Schedule },
  "exampleReference" : { 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
    "name" : "<string>", // C? Short human label
    "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
    "name" : "<string>", // R! Descriptive Name
    "isExtensible" : <boolean>, // C? R! Can additional codes be used?
    "conformance" : "<code>", // C? required | preferred | example
    "description" : "<string>", // C? Human explanation of the value set
    // reference[x]: Source of value set. One of these 2:
    "referenceUri" : "<uri>"
    "referenceReference" : { Reference(ValueSet) }
  },
  "mapping" : [{ // Map element to another set of definitions
    "identity" : "<id>", // R! Reference to mapping declaration
    "map" : "<string>" // R! Details of the mapping
  }]
}

Commentary

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:definition))
  • eld-10: On ElementDefinition.binding: provide either a reference or a description (or both) (xpath on f:ElementDefinition/f:binding: (exists(f:referenceUri) or exists(f:referenceReference)) or exists(f:description))
  • eld-11: Binding can only be present for coded elements (xpath: not(exists(f:binding)) or (count(f:type/f:code) = 0) or f:type/f:code/@value=('code','Coding','CodeableConcept','Quantity','Extension', 'string'))
  • eld-12: On ElementDefinition.binding.reference[x]: uri SHALL start with http:// or https:// (xpath on f:ElementDefinition/f:binding/f:reference[x]: starts-with(@value, 'http:') or starts-with(@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: Constraint names must be unique. (xpath: count(f:constraint[f:name]) = count(distinct-values(f:constraint/f:name/@value)))
  • eld-16: 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: (f:max/@value = '*') or (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')])))
  • eld-9: On ElementDefinition.binding: Example value sets are always extensible (xpath on f:ElementDefinition/f:binding: not(f:conformance/@value='example' and f:isExtensible/@value='false'))

Further Commentary

1.14.0.2 Interpretation of ElementDefinition in different contexts

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

1.14.0.2.1 First (root) element in a Structure

  • Must be a "complex" element (see below)
  • path is equal to the name of the type indicated in Structure.type
  • name associates a name
  • Prohibited: slicing, nameReference, fixed, mustSupport, isSummary
  • type is set to "DomainResource" or (rarely) "Resource" for constraints on Resources, "Element" for constraints on data types
  • pattern indicates 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 data type.
  • example example value for a complex type in an instance that complies to the structure
  • min and max are prohibited unless defining an extension, in which case they set outer bounds on how the element can appear when referenced in a profile
  • isModifier is prohibited when defining resources or data types. When defining extensions, this indicates whether the extension is a modifier extension
  • isSummary is prohibited when defining resources or data types. When defining extensions, this indicates whether the extension is a modifier extension

1.14.0.2.2 Nested element in a structure

(i.e. not root)
  • slicing can only be used on the first repeat of an element, this element is considered the slicing entry

1.14.0.2.3 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:

  • 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.

1.14.0.2.4 Resource and Extension definitions

  • Prohibited: name
  • slicing is only supported when slicing based on type (to assert different rules/guidance for resources with multiple types, e.g. "code|integer" or "Reference(Foo|Bar)"

1.14.0.2.5 Only element in a simple extension

  • path is equal to Extension
  • mustSupport may be used, but if it is not present it defaults to "false"

1.14.0.2.6 First (root) element in a complex extension

  • path is equal to Extension
  • type is set to Extension

1.14.0.2.7 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"

1.14.0.2.8 Complex elements (elements with upper-case data type)

  • representation is prohibited
  • maxLength may not be used

1.14.0.2.9 Additional constraints

  • binding may only be used on elements which allow a type of code, Coding or CodeableConcept (this includes *)

1.14.0.2.10 Constraint rules

  • short, formal, comments, requirements, synonym, mapping can be replaced with content that provides more contextual guidance. However, the new text must still be aligned with the base element. I.e. An instance that is created based on the definition, usage notes, etc. of the profiled element must still also be valid against the definition, usage notes, etc. of the base element.
  • Supplementary information may be appended to comments, requirements and synonym
  • Additional condition, constraint and mapping elements may be added
  • Mapping elements can be removed if they do not apply within the new context
  • isModifier and isSummary must be the same as the base definition for the data type or Resource

ElementDefinition is used in the following places: Profile, ExtensionDefinition and StructureDefinition