Different Ways of Modeling Extensions

Modeling extensions in SAP Health Data Services for FHIR can be categorized by structure (simple or complex), definition scope (inline or external), and context of use (resource, data type, or element level).

You can model extensions in SAP Health Data Services for FHIR in the following ways.

Classification Based on Structure

  • Simple Extensions: These extensions have a single value and do not contain any nested elements. You use them to add additional information to a resource without changing its core structure.

  • Complex Extensions (Nested): These extensions contain multiple elements and can have nested structures. You use them to represent more complex data that simple extensions cannot capture.

Classification Based on Definition Scope

  • Inline Extensions: These extensions are defined within the same StructureDefinition (local definition) when custom elements are only relevant to that profile.

  • External Extensions: An external extension refers to an extension definition that is hosted separately and referenced by a URL. The resource only contains the URL of the extension definition. This allows you to reuse the same extension across multiple profiles and resources.

Classification Based on Context of Use

  • Resource Extensions: These extensions are added to a specific resource type, such as Patient or Observation. You use them to add information that is relevant to that resource.

  • Data Type Extensions: These extensions are added to a specific data type, such as HumanName or Address. You use them to add information that is relevant to that data type.

  • Element Extensions: These extensions are added to a specific element within a resource or data type. You use them to add information that is relevant to that element.

    The elements can be of the following types:

    • Primitive Element Extensions: These extensions are added to primitive elements, such as string or boolean. You use them to add information that is relevant to that primitive element.

    • Complex Element Extensions: These extensions are added to complex elements, such as BackboneElement or DomainResource. You use them to add information that is relevant to that complex element.

Examples

Primitive Data Type Extension

  • Resource Type Level Extension

    Extensions are defined over the resource type:
  • Data Type Level Extension

    Extensions are defined inside the data type:

Complex Data Type Extension

The extensions can have cardinalities like 0..1 and 0..* (zero to many).

  • Resource Type Level Extension

    Extensions are defined over the resource type:
  • Data Type Level Extension

    Extensions are defined inside the data type: