R4 Ballot #1 (Mixed Normative/Trial use) FHIR Home Getting Started Documentation Resources Profiles Extensions Operations Terminologies Foundation Element This page is part of the FHIR Specification (v3.3.0: R4 Ballot 2). The current version which supercedes this version is 4.0.1 . For a full list of available versions, see the Directory of published versions Element Detailed Descriptions 2.27.0 Element FHIR Infrastructure Work Group Maturity Level : 5 Ballot Status : Normative Normative Candidate Note: This page is candidate normative content for R4 in the Infrastructure Package . Once normative, it will lose it's Maturity Level, and breaking changes will no longer be made. 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 Element : Primitive data types , that add a primitive value property of the specified type Complex data types , that add their own children (all of which are also elements) BackboneElement , A specialization that adds modifierExtension, which is the super-type of all the element types defined in resource definitions (e.g. Patient.contact ) Note that resources themselves all specialize the base type Resource . 2.27.0.1 Content Structure UML XML JSON All Structure Name Flags Card. Type Description & Constraints Element I n/a Base for all elements All FHIR elements must have a @value or children id 0..1 string xml:id (or equivalent in JSON) extension 0..* Extension Additional Content defined by implementations Documentation for this format UML Diagram ( Legend ) Element Internal ID id : string 0..1 Extensions - as described for all elements: additional information that is not part of the basic definition of the resource / type extension : Extension 0..* XML Template <</extension> </[name]> JSON Template // complex types: { " " // from Element: (recursive) " " }] } // primitive types: { "{name}" : "value", "{name}_" : { " " // from Element: (recursive) " " }] } } Structure Name Flags Card. Type Description & Constraints Element I Element Base for all elements All FHIR elements must have a @value or children id 0..1 string xml:id (or equivalent in JSON) extension 0..* Extension Additional Content defined by implementations Documentation for this format UML Diagram ( Legend ) Element Internal ID id : string 0..1 Extensions - as described for all elements: additional information that is not part of the basic definition of the resource / type extension : Extension 0..* XML Template <</extension> </[name]> JSON Template // complex types: { " " // from Element: (recursive) " " }] } // primitive types: { "{name}" : "value", "{name}_" : { " " // from Element: (recursive) " " }] } }   Constraints ele-1 : All FHIR elements must have a @value or children ( expression : hasValue() | (children().count() > id.count()) )

This constraint exists to reduce syntactical variation in resource contents. If an element content has no children, then it is always omitted from the resource, as opposed to optionally present without any content. 2.27.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 Element type. 2.27.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 id is represented as an attribute (similar moved 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 are any extensions <extension> .. elements of Coding type... </code> Primitive types have the same representation; the actual primitive value appears as an XML attribute named value 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 are any extensions <extension> </code> 2.27.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 id is represented as a JSON string property named "_id". Extensions are represented in a JSON array of objects 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 "_" prepended. 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 .

2.27.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 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 Mixed Nomative/Trial Use Ballot (v3.3.0-13671) generated on Tue, Apr 3, 2018 12:18+1000. QA Page Links: Search | Version History | Table of Contents | Credits | Compare to DSTU3 | | Propose a change try { var currentTabIndex = sessionStorage.getItem('fhir-resource-tab-index'); } catch(exception){ } if (!currentTabIndex) currentTabIndex = '0'; $( '#tabs-Element' ).tabs({ active: currentTabIndex, activate: function( event, ui ) { store(ui.newTab.index()); } }); function store(currentTab) { document.activeElement.blur(); try { sessionStorage.setItem('fhir-resource-tab-index', currentTab); } catch(exception){ } $( '#tabs-Element' ).tabs('option', 'active', currentTab); }