NHSE Design and Development Approach

This guidance is under active development by NHS Digital and content may be added or updated on a regular basis.

Instance Example Design

Examples help clarify the complexities of FHIR for the reader. For this reason, UKCore SHALL have at least one example for every Resource and Extension. Snippets of code may also be needed to convey certain information on specific elements which may be general to may Resources, or creating a full Resource would complicate the example. This section details how examples are constructed, named and referenced in the UK Core.



Constraints and Configuration

Instance examples in Simplifier need to be correctly named and constructed to avoid duplicates being generated or other conflicts occurring. This guidance overrides the default Simplifier behaviour and has been developed following consultation with the Simplifier development team.

When creating examples the filename SHALL adhere to the following convention:

  • ResourceExampleName - UKCore-[ResourceName]-[FurtherDescription]-Example
  • ExtensionExampleName - UKCore-[ResourceName]-Extension-[ExtensionName]-Example
  • SnippetExampleName - UKCore-[ResourceName]-Sn-[FurtherDescription]-Example

Where the [FurtherDescription] is enough information for a reader to to able to understand what the example is representing. This description SHALL also be sufficient to make the example unique in the UK Core.


Construction of Examples

Each example SHOULD have the minimum amount of information necessary to convey the intended message whilst ensuring it is still a valid resource or extension. If there any agreed Clinical scenario(s), then these SHALL be represented examples.

Resource Example

Each Resource example SHALL include the following, along with any mandatory elements and any elements listed with the Profiles Minimum Viable Content (MVC) within the Implementation Guide:

<[Resource] xmlns="http://hl7.org/fhir">
    <id value="[ResourceExampleName]" />
    [Elements to convey resource example & any other elements to create a valid example]
</[Resource]> 

Extension Example

Each Extension Example SHALL have the following, along with any mandatory elements:

<[Resource] xmlns="http://hl7.org/fhir">
    <id value="[ResourceExampleName]" />
     <extension url="[ExtensionUrl]">
    [Elements to convey Extension example & any other elements to create a valid example]
</[Resource]> 

Snippet Example

Each Snippet example SHALL have the following, along with any mandatory elements and comments describing the information:

<[Resource] xmlns="http://hl7.org/fhir">
    <id value="[ResourceExampleName]" />
    <!-- **************Snippet start************** -->
    [Elements to convey the snippet information]
    <!-- **************Snippet end************** -->
    [Necessary elements to create a valid snippet example]
</[Resource]> 

Meta Element

The Resource.meta element SHALL NOT be used for Examples.


Resource Example Illustration

An example of a Resource Example

Table View

Command 'table' could not render: File not found for 'subject=UKCore-Patient-RichardSmith-Example'

XML View

Command 'xml' could not render: File not found for 'subject=UKCore-Patient-RichardSmith-Example'

JSON View

Command 'json' could not render: File not found for 'subject=UKCore-Patient-RichardSmith-Example'

An example of an Extension Example

Table View

Command 'table' could not render: File not found for 'subject=UKCore-Patient-Extension-AddressKey-Example'

XML View

Command 'xml' could not render: File not found for 'subject=UKCore-Patient-Extension-AddressKey-Example'

JSON View

Command 'json' could not render: File not found for 'subject=UKCore-Patient-Extension-AddressKey-Example'

An example of an Snippet Example

Table View

Command 'table' could not render: File not found for 'subject=UKCore-Condition-Sn-Extension-CodingSCT-MoleOfSkin-Example'

XML View

Command 'xml' could not render: File not found for 'subject=UKCore-Condition-Sn-Extension-CodingSCT-MoleOfSkin-Example'

JSON View

Command 'json' could not render: File not found for 'subject=UKCore-Condition-Sn-Extension-CodingSCT-MoleOfSkin-Example'

Configuration of Simplifier

Simplifier creates metadata around an instance when imported from GitHub. This metadata needs a custom configuration to allow the examples to be correctly imported. The url for updating the metadata expressions is accessible via:

https://simplifier.net/ukcore/$editmetadataexpressions
which requires Admin access to update or configure.

For each Profile the metadata expression SHALL follow the following convention:

[FHIRAssetName].Title: ('[FHIRAssetName] example: ' + id)
[FHIRAssetName].Description: ('[FHIRAssetName] example: ' + id)
[FHIRAssetName].UrlKey: id

Important Note: the following properties of examples are automatically generated by Simplifier and SHALL NOT be manually changed or updated

  • Title
  • Description
  • Url Key
  • Filename

back to top