DSTU2 STU 3 Candidate
This page is part of the FHIR Specification (v1.0.2: DSTU 2). The current version which supercedes this version is

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

1.21.0 1.20.0 Element Element

The base definition for all elements contained inside a resource. All elements, whether defined as a Data Type (including primitives) or as part of a resource structure, have this base content:
FHIR Infrastructure FHIR Infrastructure Work Group Work Group Maturity Level : N/A Maturity Level : N/A Ballot Status : DSTU 2 Ballot Status : DSTU 2

The base definition for all elements contained inside a resource. All elements, whether defined as a Data Type (including primitives) or as part of a resource structure, have this base content:

  • Extensions An internal id There are 3 kinds of descendent types that specialize
  • An internal id

There are 3 kinds of descendent types that specialize Element : :

Note that resources themselves all specialise the base type Resource . .

1.21.0.1 Content 1.20.0.1 Content

Structure

Name Flags Card. Type Description & Constraints Description & Constraints doco
. . Element I Element Base for all elements Base for all elements
All FHIR elements must have a @value or children All FHIR elements must have a @value or children
. . . id 0..1 id xml:id (or equivalent in JSON) xml:id (or equivalent in JSON)
. . . extension 0..* Extension Additional Content defined by implementations Additional Content defined by implementations

Documentation for this format doco Documentation for this format

XML Template XML Template

<[name] xmlns="http://hl7.org/fhir" id="Internal id (e.g. like xml:id) (id)"> doco
 <extension><!-- 0..* Extension Additional Content defined by implementations --></extension>
</[name]>

JSON Template JSON Template

// complex types:
    
{doco
  "id" : "<id>", // Internal Id
  "extension" : [{//  Additional Content defined by implementations
    // from Element: extension (recursive)
    "url" : "<uri>", // R!  identifies the meaning of the extension
    "value[x]" : <*> // identifies the meaning of the extension
  }]  
}
// primitive types:
    
{doco
  "{name}" : "value",  // The primitive value
  "{name}_" : { // Special syntax for the id and extensions
    "id" : "<id>", // Internal Id
    "extension" : [{//  Additional Content defined by implementations
      // from Element: extension (recursive)
      "url" : "<uri>", // R!  identifies the meaning of the extension
      "value[x]" : <*> // identifies the meaning of the extension
    }]  
  }
}

Structure

Name Flags Card. Type Description & Constraints Description & Constraints doco
. . Element I Element Base for all elements Base for all elements
All FHIR elements must have a @value or children All FHIR elements must have a @value or children
. . . id 0..1 id xml:id (or equivalent in JSON) xml:id (or equivalent in JSON)
. . . extension 0..* Extension Additional Content defined by implementations Additional Content defined by implementations

Documentation for this format doco Documentation for this format

XML Template XML Template

<[name] xmlns="http://hl7.org/fhir" id="Internal id (e.g. like xml:id) (id)"> doco
 <extension><!-- 0..* Extension Additional Content defined by implementations --></extension>
</[name]>

JSON Template JSON Template

// complex types:
    
{doco
  "id" : "<id>", // Internal Id
  "extension" : [{//  Additional Content defined by implementations
    // from Element: extension (recursive)
    "url" : "<uri>", // R!  identifies the meaning of the extension
    "value[x]" : <*> // identifies the meaning of the extension
  }]  
}
// primitive types:
    
{doco
  "{name}" : "value",  // The primitive value
  "{name}_" : { // Special syntax for the id and extensions
    "id" : "<id>", // Internal Id
    "extension" : [{//  Additional Content defined by implementations
      // from Element: extension (recursive)
      "url" : "<uri>", // R!  identifies the meaning of the extension
      "value[x]" : <*> // identifies the meaning of the extension
    }]  
  }
}

 

Constraints

  • ele-1 : All FHIR elements must have a @value or children (xpath: @value|f:*|h:div : All FHIR elements must have a @value or children ( expression : * )
  • This constraint exists to reduce syntactical variation in resource contents. If an element has no children, then it is always omitted from the resource, as opposed to optionally present without any content.

This constraint exists to reduce syntactical variation in resource contents. If an element has no children, then it is always omitted from the resource, as opposed to optionally present without any content.

1.21.0.2 Representation of Element 1.20.0.2 Representation of Element As the base type for all elements included in a resource, Element is an important structural element of FHIR. Even the primitive types inherit the base features and representation rules that apply to the

As the base type for all elements included in a resource, Element type. is an important structural element of FHIR. Even the primitive types inherit the base features and representation rules that apply to the Element type.

1.21.0.3 XML Representation 1.20.0.3 XML Representation Elements are represented by an XML element. The name of the element comes from the context in which it is used, not from the type. The internal

Elements are represented by an XML element. The name of the element comes from the context in which it is used, not from the type. The internal id is represented as an attribute (similar to xml:id, but see below about scope). Extensions are represented as XML elements. Here is the representation for an element 'code' of type is represented as an attribute (similar to xml:id, but see below about scope). Extensions are represented as XML elements. Here is the representation for an element 'code' of type Coding : :

  <code id="[internal id]">
    <extension url="..."/>
      ... if there is any extensions
    <extension>
    .. elements of Coding type...
  </code>
Primitive
types
have
the
same
representation;
the
actual
primitive
value
appears
as
an
XML
attributed
named

Primitive types have the same representation; the actual primitive value appears as an XML attributed named value on the XML element. For example, a string property named "name" will be represented like this: on the XML element. For example, a string property named "name" will be represented like this:

  <code id="[internal id] value="[value of string]"">
    <extension url="..."/>
      ... if there is any extensions
    <extension>
  </code>

1.21.0.4 JSON Representation 1.20.0.4 JSON Representation Elements (except for primitive types, see below) are represented by a json object property. The name of the property comes from the context in which it is used, not from the type. The internal

Elements (except for primitive types, see below) are represented by a json object property. The name of the property comes from the context in which it is used, not from the type. The internal id is represented as a JSON string property named "_id". Extensions are represented in a JSON array of object named "extension". Here is the representation for a property 'code' of type is represented as a JSON string property named "_id". Extensions are represented in a JSON array of object named "extension". Here is the representation for a property 'code' of type Coding : :

  {
    "code" : {
      "_id" : "[internal id]",
      "extension" : [
        ..extensions, if present...
      ],  
      .. properties of Coding type...
    }
  }
Primitive
types
are
represented
differently;
the
actual
primitive
value
appears
as
a
JSON
string
or
number
property.
If
an
internal
id
or
extensions
are
present,
they
appear
in
a
json
object
with
the
name
of
the
primitive
value
property
with
"_"
appended.
For
example,
a
string
property
named
"name"
will
be
represented
like
this:


Primitive types are represented differently; the actual primitive value appears as a JSON string or number property. If an internal id or extensions are present, they appear in a json object with the name of the primitive value property with "_" appended. For example, a string property named "name" will be represented like this:

  {
    "name" : "[value of string]",
    "name_" : {
      "_id" : "[internal id]",
      "extension" : [
        ..extensions, if present...
      ]
    }
  }
The
exact
use
of
this
pattern
is
described
here
.

The exact use of this pattern is described here .

1.21.0.5 Internal Id Scope 1.20.0.5 Internal Id Scope The id property of the element is defined to allow implementers to build implementation functionality that makes use of internal references inside the resource. This specification does not use the internal id on the element in any way. The internal id is unique within the scope of the resource that contains it. Specifically, this means: The id SHALL be unique within a given resource the uniqueness boundary extends into contained resources. i.e. a contained resource cannot have the same

The id as any element in the resource that contains it or any other contained resource The uniqueness boundary is broken at Bundle.entry.resource and Parameters.parameter.resource, since these are elements that aggregate different resources These rules ensure that there is no need to change internal identifiers while exchanging resources. © HL7.org 2011+. FHIR DSTU2 (v1.0.2-7202) generated on Sat, Oct 24, 2015 07:44+1100. Links: Search property of the element is defined to allow implementers to build implementation functionality that makes use of internal references inside the resource. This specification does not use the internal id on the element in any way.

The internal id is unique within the scope of the resource that contains it. Specifically, this means:

  • The id SHALL be unique within a given resource
  • the uniqueness boundary extends into contained resources. i.e. a contained resource cannot have the same id as any element in the resource that contains it or any other contained resource
  • The uniqueness boundary is broken at Bundle.entry.resource and Parameters.parameter.resource, since these are elements that aggregate different resources

These rules ensure that there is no need to change internal identifiers while exchanging resources.