Extension Design

It is common for specific implementations to have valid requirements that are not part of the agreed common requirements modelled in the FHIR standard. Incorporating all specific use cases would make the standard too cumbersome. Therefore, additional valid requirements can be implemented as extensions to the agreed common resources. Further information about extensibility is available.

There are two basic types of extensions used by UK Core:

  • Simple extensions: A simple extension has a single Extension.urlelement and a single Extension.value[x] element, which may have many datatypes associated with it. See Extension Element for more details.
  • Complex extensions: A complex extension has a single Extension.urlelement and a single Extension.extension element. The latter contains a nested structure and are used for one of two reason:
    • The extension has complex content, which is presented as a nested tree of values and defined locally within the extension.
    • The extension is extended with an additional extension defined seperately.

Currently the UK Core does not use modifierExtensions, so no guidance is given here on this type. More information on modifierExtensions is available in the FHIR specification.

Metadata usage

The list below contains the element differences between the UKcore and HL7.

Element name Base Cardinality UK Core Cardinality Type Definition, Constraints and Notes
id 0..1 1..1 id Logical id of this artifact.

In the UK Core the format is the following, with the Extension name in PascalCase:

UKCore-[Extension name].
url 0..1 1..1 uri Canonical identifier for this Extension, represented as a URI (globally unique).

In the UK Core the format is the follwoing, with the Extension name in PascalCase:

https://fhir.hl7.org.uk/StructureDefinition/UKCore-[Extension name](in PascalCase).
identifier 0..* 0..* Identifier Additional identifier for the Extension, for example an OID.

If this is an OID, this should be in the following format:

    <identifier>
        <system value="urn:ietf:rfc:3986"/>
        <value value="urn:oid:2.16.840.1.113883.2.1.3.2.4.16.21"/>
    </identifier>


Further guidance may be needed in due course.
Would we ever use this?
version 0..1 1..1 string Business version of the Extension.

This will follow the Semantic Versioning standard [major.minor.patch].
Further details about internal versioning for UK Core assets are available.
name 0..1 1..1 string Computer readable name, this should reflect the name in the url element.

In the UK Core the format is PascalCase:

UKCore[Extension name] .
title 0..1 1..1 string Human readable name, this should reflect the name in the url element.

In the UK Core the format in Proper Case:

UK Core [Extension name] .
status 1..1 1..1 code The publication status as defined in value set publication-status.

For the UKCore these are defined as:
  • draft - Extensions in development
  • active - Extensions that have been approved via Clinical and Technical Assurance
  • retired - Extensions that are no longer required
date 0..1 1..1 dateTime The date (and optionally time) when the Extension was published or last changed. The date must change when the business version or status changes.

Only the date, without time, is populated in the UK Core.
publisher 0..1 1..1 string Name of the publisher (organization or individual).

For all UK Core Extensions, where the base URL is https://fhir.hl7.org.uk, this will be HL7 UK.
contact 0..* 1..* ContactDetail Contact details for the publisher.

See the Metadata Design for details of how this SHALL be populated for all UK Core Extensions, where the base URL is https://fhir.hl7.org.uk/.
description 0..1 1..1 markdown A free text natural language description of the of the Extension from a consumer's perspective.
purpose 0..1 1..1 markdown This provides traceability of ''why'' the resource is either needed or ''why'' it is defined as it is.
copyright 0..1 1..1 markdown A copyright statement relating to the Extension and/or its contents.

All UK Core Extensions SHALL contain the the copright as listed in Metadata Design
fhirVersion 0..1 0..1 code The version of the FHIR specification on which this StructureDefinition is based - this is the formal version of the specification, without the revision number, e.g. [publication].[major].[minor]

The UKCore uses Simplifer Forge which mandates the use of this element.
Added - Is the mandatory correct?



The Extension Root Element

Extensions are optional within the UK Core (minimum cardinality of 0), but certain use cases may mandate their use. Currently, all UK Core extensions are modelled as being optional at the extension root element. Where the use case requires an extension to be mandated, the Implementation Guide for that use case will specify the requirements.

Extension Bindings When the Value is a Coded type

If any of the extension.value elements is constrained to a coded type e.g. one of Code, Coding, or CodeableConcept, the extension.value SHALL be bound to a ValueSet.

Further information about FHIR datatypes is available.

Cardinality of an extension.value element

On a simple extension the extension.value SHALL be mandated, so SHALL have a cardinality of 1..1.

Extension-UKCore-ActualProblem.value is 0..1

On a complex extension all the Extension.extension.value elements SHALL be mandated. The Extension.extension:[extension].valuex[x] SHALL be mandated.

Is this correct as Extension.extension:legalStatusContext.value is 0..1

Extension Examples

Simple Extension Illustration

Snapshot View

Command 'tree' could not render: File was not found for 'https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-EthnicCategory'

Differential View

Command 'tree' could not render: File was not found for 'https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-EthnicCategory'

Hybrid View

Command 'tree' could not render: File was not found for 'https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-EthnicCategory'

Table View

Command 'table' could not render: File was not found for 'https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-EthnicCategory'

XML View

Command 'xml' could not render: File was not found for 'https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-EthnicCategory'

JSON View

Command 'json' could not render: File was not found for 'https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-EthnicCategory'

Complex Extension Illustration

Snapshot View

Command 'tree' could not render: File was not found for 'https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-AddressKey'

Differential View

Command 'tree' could not render: File was not found for 'https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-AddressKey'

Hybrid View

Command 'tree' could not render: File was not found for 'https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-AddressKey'

Table View

Command 'table' could not render: File was not found for 'https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-AddressKey'

XML View

Command 'xml' could not render: File was not found for 'https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-AddressKey'

JSON View

Command 'json' could not render: File was not found for 'https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-AddressKey'