--- type: "doc" title: "Resource Definitions" source: "source/formats.html" --- \[%settitle Resource Definitions%\] \[%file newheader%\] \[%file newnavbar%\] <%fmtheader base%> # Resource Definitions | Responsible Owner: [\[%wgt fhir%\]]([%wg fhir%]) Work Group | [Standards Status](versions#std-process):[Normative](versions#std-process) | | --- | --- | This page documents how the content of the resources defined by the FHIR specification are described. In actual exchange, resources can be represented in the following formats: [XML](xml), [JSON](json) and [RDF (Turtle)](rdf). A [UML Based Object-Oriented Definition](uml) is also provided. This specification defines <%res-type-count%> resources as part of this specification. Additional resources may be defined in other specifications - see the discussion on [Resource](resource#additional). ## Resource Definition The resources are described in several different ways: - a hierarchical table that presents a logical view of the content - a UML diagram that summarizes the content graphically - a pseudo-XML syntax that provides a visual sense of what the end resource instances will look like in XML - a pseudo-JSON syntax that provides a visual sense of what the end resource instances will look like in JSON - a pseudo-Turtle syntax that provides a visual sense of what the end resource instances will look like in Turtle In addition to this descriptive syntax, other definitional forms are available, including W3C schema, Schematron, JSON Schema, and the [StructureDefinition](structuredefinition) syntax defined internally. ### Logical table The Logical View shows the resources as a tree structure with the following columns: | **Column** | **Content** | | --- | --- | | Name | The name of the element in the resource (manifests as XML element name or JSON or RDF property name). Some names finish with `[x]` - the meaning of this is discussed below. In addition, this column contains an icon that denotes the underlying type of the content. The icons are described below | | Flags | A set of information about the element that impacts how implementers handle them. The flags are described below | | Card. | Cardinality: the lower and upper bounds on how many times this element is allowed to appear in the resource | | Type | The type of the element (hyperlinked to the definition of the type). Note that the type of the element has one of two meanings, depending on whether the element has defined children. If the element has children, then the element has an anonymous type that specializes the given type. If the element has no children, then the element has properties and children as specified by the nominated type | | Description & Constraints | A description of the element, and details about constraints that are applied to it. Particularly, for coded elements, information about which codes can be used. The description comes from [ElementDefinition.short](elementdefinition-definitions#ElementDefinition.short) | Here's an example: | Name | Flags | Card. | Type | Description & Constraints | | --- | --- | --- | --- | --- | | ![.](tbl_spacer.png)![.](icon_resource.png "Resource") [Resource Name](# "Definition") | | | [Base Type](resource) | Definition | | ![.](tbl_spacer.png)![.](tbl_vjoin.png)![.](icon_datatype.gif "Datatype") [nameA](# "Definition") | Σ | 1..1 | [TypeA](#) | description of content | | ![.](tbl_spacer.png)![.](tbl_vjoin.png)![.](icon_choice.gif "Choice of Types") [nameB\[x\]](# "Description") | ?! Σ | 0..1 | | description SHALL at least have a value | | ![.](tbl_spacer.png)![.](tbl_vline.png)![.](tbl_vjoin.png)![.](icon_primitive.png "Primitive Datatype") nameBType1 | | 0..1 | [typeB](#) | | | ![.](tbl_spacer.png)![.](tbl_vline.png)![.](tbl_vjoin_end.png)![.](icon_primitive.png "Primitive Datatype") nameBType2 | I | 0..1 | [typeC](#) | | | ![.](tbl_spacer.png)![.](tbl_vjoin_end.png)![.](icon_element.gif "Element") [nameC](# "Definition") | | 1..\* | BackboneElement | Definition | | ![.](tbl_spacer.png)![.](tbl_blank.png)![.](tbl_vjoin_end.png)![.](icon_datatype.gif "Datatype") [nameD](# "Definition") | | 1..1 | [TypeD](#) | Relevant Records | Key to Type Icons - ![.](icon_resource.png "Resource"): The base element for a resource (see [Resources](resource)) - ![.](icon_element.gif "Element"): An element that is part of the resource and has elements within it defined in the same resource or profile - ![.](icon_choice.gif "Choice of Types"): An element which can have one of several different types (see below) - ![.](icon_primitive.png "Primitive Datatype"): An element of a datatype which describes an element that has a `value` attribute/property. These are also known as primitive types. All primitive type names start with a lower case letter - ![.](icon_datatype.gif "Datatype"): An element of a datatype which describes an element that has other elements. These are known as complex types. All complex type names defined in this specification start with an uppwer case letter - ![.](icon_reference.png "Reference to another Resource"): An element that contains a reference to another resource (see [references](references)) - ![.](icon_reuse.png "Reference to another Element"): This element has the same content as another element defined within this resource or profile - ![.](icon_slice.png "Slice Definition"): Introduction of a set of slices (see [Slicing](profiling#slicing)) - ![.](icon_extension_complex.png "Complex Extension"): A complex extension - one with nested extensions (see [Extensibility](extensibility#complex)) - ![.](icon_extension_simple.png "Simple Extension"): An extension that has a value and no nested extensions (see [Extensibility](extensibility)) - ![.](icon_modifier_extension_complex.png "Complex Modifier Extension"): A complex modifier extension - one with nested extensions (see [Extensibility](extensibility#complex)) - ![.](icon_modifier_extension_simple.png "Simple Modifier Extension"): A modifier extension that has a value and no nested extensions (see [Extensibility](extensibility)) - ![.](icon_profile.png "Profile"): The root of a logical profile Key to Flags - `?!`: This element is a modifying element - see [Modifier Elements](conformance-rules#isModifier) - `S`: This element is an element that has implementation obligations - see [Implementation Obligations](obligations) - `Σ`: This element is an element that is part of the summary set - see [Summary Searches](search#summary) - `I`: This element defines or is affected by constraints - see [Constraints](conformance-rules#constraints) - `T`: This element is a candidate for carrying translations - see [Multi-language support](languages#translatable) - `«A»`: This Type is an [Abstract Type](uml#abstract) - `«I»`: This Resource is an [Interface Definition](uml#interface) - [TU](versions#std-process): This element has a [standards status of Trial Use](versions#std-process) (for discussion about mixing standards status in a resource, see [Mixed Normative content](versions#std-process)) - [N](versions#std-process): This element has a [standards status of Normative](versions#std-process) - [D](versions#std-process): This element has a [standards status of Draft](versions#std-process) Notes: - Resource and Element names are case-sensitive (though duplicates that differ only in case are never defined) - Any elements that have a [primitive type](datatypes#primitive) will have a `value` attribute/property to contain the actual value of the element - This `value` attribute/property can never be empty. Either it is absent, or it is present with at least one character of non-whitespace content - Elements are assigned a cardinality that specifies how many times the element may or must appear. - Unless elements have children defined directly (as nameC does above) they are assigned one or more types (see [the datatypes](datatypes)). All the type names are hyperlinked to the source definition - Element reuse: Some datatypes that have children have the same set of children as some other element defined in the resource. In that case, the type of that element has a "see \[name\]" where \[name\] is the name of the element that has the defined children - Each element name is also a hyperlink to the formal definition of the element in the data dictionary that underlies the exchange formats. - Any of the elements may have an `id` attribute to serve as [the target of an internal reference](references#id). The `id` attribute is not shown in this format. Extensions are not always shown, but may appear except where the flag `NE` appears - FHIR elements can never be empty. If an element is present in the resource, it SHALL have either a value, child elements as defined for its type, or 1 or more [extensions](extensibility) - Infrastructural elements that are common to all resources are not shown in the logical representation. These are described in the common base classes [Resource](resource), and [DomainResource](domainresource) The datatype for a particular element is typically expressed as the name of the specified type with a hyperlink to its definition. However, there are two exceptions: - If the element supports multiple types (name ends with \[x\]), then the type will be a list of datatype options, each separated by "|" - If one of the types is [Reference](references) or [canonical](datatypes#canonical), the datatype might be followed by a list of allowed targets the reference is allowed to be. These might be resource names, datatype names, or profile URLs, depending on the context. As well, the following symbols may appear that represent expectations of where the referenced resource is located: - `b`: Resource must appear within the same [Bundle](bundle); - `c`: Resource must be sent as a [contained](references) resource; - `r`: Resource is a non-contained reference - i.e., to a resource within the same Bundle or to an external resource In profiles, references to types may be profiled - i.e., Instances of the element must comply with a specified profile or one of a list of profiles. The canonical URLs of any applicable profiles are listed inside {}. Where an element can have a choice of datatypes, or is a [Reference](references) these are represented by showing the common type (`Reference` or `Type`), and then showing the applicable datatype names or resource types in a stereotype, separated by the `|` character. ### Choice of Datatypes A few elements have a choice of more than one datatype for their content. All such elements have a name that takes the form `nnn[x]`. The "nnn" part of the name is constant, and the "\[x\]" is replaced with the title-cased name of the type that is actually used. The table view shows each of these names explicitly. Elements that have a choice of datatype cannot repeat - they must have a maximum cardinality of 1. When constructing an instance of an element with a choice of types, the authoring system must create a single element with a datatype chosen from among the list of permitted datatypes. Note: In object-oriented implementations, this is naturally represented as a polymorphic property (see [Object Representation of FHIR](uml)). However this is not necessary and the correct implementation varies according to the particular features of the language. In XML schema, these become an xs:choice of element. To help with code generation, [a list of choice elements](choice-elements.json) is published. \[%file newfooter%\]