Release 4B Ballot #1
FHIR Infrastructure Work GroupMaturity Level: NormativeStandards Status: Normative
This page has been approved as part of an ANSI standard. See the Infrastructure Package for further details.

The UML diagrams represent the Resource and Type defined in this specification in UML.

Each type is represented as a class with a name and an ancestor class (except for Element and Resource, which have no ancestor). In addition, types may be marked as abstract, aor assigned stereotypes that describe how they used.

Classes also have a zero or more attributes defined, where each attribute has the following properties:

  • name: the name of the attribute
  • type: the type of the attribute - either another type defined in the speification, or (for primitive types) a type from XML Schema
  • [cardinality]: [min..max] control over the attribute cardinality. Attributes with Max cardinality >1 (usually *) are ordered, though the meaning of the order might not be known or defined
  • « stereotypes »: these provide additional detail about the element - see below

In addition, classes have zero or more associations, which are always aggregations, and have the following properties:

  • name: the name of the association (which is the name of the element that represents it in XML/JSON)
  • [cardinality]: [min..max] control over the association cardinality. Associations with Max cardinality >1 (usually *) are ordered, though the meaning of the order might not be known or defined
NameA Documentationelement : [type] [0..*] DocumentationnameB : CodeableConcept [0..1] « Value Set Description (Strength=Preferred)Value Set Name? » NameC Documentationvalue[x] : Type [0..1] « Type1|Type2|Type3 » Docuementationreference : Reference [0..1] « Resource1|Resource2 » DocumentationnameC [0..1]

The elements and the data types are hyperlinks to the formal definitions of the parts.

Note that the order of elements in XML (the only serialization where order is required to be correct) cannot be inferred from the UML diagram - the attributes will be in the order presented, but the order in which the associations are serialized, which are interspersed with the attributes, cannotbe determined. Also, it cannot be determined whether a UML property becomes an element or an attribute in the XML representation.

This specification uses a number of stereotypes to further define the types and resources. The following stereotypes are used on classes.

Some of the abstract types are labeled with the stereotype «Interface». This indicates that in addition to being abstract, the definitions associated with the class have no implementation. As such:

  • There is no implementation of the interface described by the definition
  • Any classes the implement the interface redeclare any attributes and associations that are on the interface, and gives them an order
  • Such re-declarations will be consistent with the interface but may be a subset of the value domain e.g. the cardinality of an attribute may be 0..* on the interface, and 0..1 on a particular resource
  • In addition, the resource might not implement the attribute at all - this is equivalent to constraining the attribute to a cardinality of 0..0 - not used with this resource
  • Since the interface supports both read and write, the interface is described using attributes not operations
  • The interface resources also define search parameters, invariants and other information about the resources that are all inherited by the resources the implement these interfaces

Notes for implementers:

  • The interfaces are declared as part of a single hierarchy. This specification itself does not define any multiple inheritance
  • Some reference implementations may wish to represent the interfaces as classes internally - the best way to handle this depends on language features

Some of types are labeled with the stereotype «Pattern». This indicates that in addition to being abstract, and an interface, classes that follow the interface do so loosely. As such:

  • There is no direct implementation of the interfaces
  • The relationship between the attributes and associations may be indirect - e.g. attributes may be renamed, restructured, or have different value domains
  • Such patterns are there primarily to provide document general design intentions, which are subject to ongoing harmonization with observed real world requirements
  • The relationship between the patterns and the resources that follow them is found in the mappings for the resources

Notes for implementers:

  • It is possible to implement these interfaces, but in general implementers should expect to write code manually to implement the mappings, and have arrangements for dealing with differences such as adding 'canDoX' to the interface

There are three stereotypes for attributes, both of which constrain the value domain of the assigned data type. These three stereotypes can be differentiated by examining the contents of the stereotype.

Note that where these stereotypes are allowed, they are usually present and populated.

If the data type assigned to an attribute is abstract, then a stereotype may be provided that indicates which concrete sub-types are allowed to be used for this particular element. If this stereotype is provided, only the specified types are allowed. Note: as such, this is equivalent to an OCL constraint on the attribute.

The format of this stereotype is a list of types defined within this specification (concrete specializations of Type) separated by the | character.

If the data type assigned to an attribute is a reference to another resource (one of Reference, canonical or CodeableReference), then a stereotype may be provided that indicates which kinds of resources the references are allowed to refer to. If this stereotype is provided, only the specified resources are allowed to be referenced. Note: as such, this is conceptually equivalent to an OCL constraint on the attribute, but the rules can only be evaluated by fetching the target of the reference from the specified URL and examining it's content.

The format of this stereotype is a list of resource types defined within this specification (concrete specializations of Resource) separated by the | character.

If the data type associated with the attribute is one of the data types that can be bound to a value set, then a stereotype may be provided that restricts the codes that may be present in the attribute. If this stereotype is provided, the rules as defined by the binding must be followed. Note: there is no OCL equivalent for this stereotype.

This stereotype has two parts: the value set name (which is a link to the value set), and a symbol that denotes the strength of the binding: