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 hte example. This section details how examples are constructed, named and referenced in the UK Core.


Simplifier 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 Simplifer behaviour and has been developed following consultation with the Simplifier development team.


Naming of Examples

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.

Resource Example

Each Resource example SHALL have the following, along with any mandatory elements and any elements lited with the Profiles Minimum Viable Content (MVC) within the Implimentation 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.


Examples

An example of a Resource Example

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'

An example of an Extension Example

Snapshot View

Command 'tree' could not render: File was not found for UKCore-Patient-Extension-AddressKey-Example

Differential View

Command 'tree' could not render: File was not found for UKCore-Patient-Extension-AddressKey-Example

Hybrid View

Command 'tree' could not render: File was not found for UKCore-Patient-Extension-AddressKey-Example

Table View

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

XML View

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

JSON View

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

An example of an Snippet Example

Snapshot View

Command 'tree' could not render: File was not found for UKCore-Condition-Sn-Extension-CodingSCT-MoleOfSkin-Example

Differential View

Command 'tree' could not render: File was not found for UKCore-Condition-Sn-Extension-CodingSCT-MoleOfSkin-Example

Hybrid View

Command 'tree' could not render: File was not found for UKCore-Condition-Sn-Extension-CodingSCT-MoleOfSkin-Example

Table View

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

XML View

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

JSON View

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

Configuration of Simplifier

Simplifer 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.

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

  • Title
  • Description
  • Url Key
  • Filename

An illustration of the properties of an example is shown below for information.

Could not find subject. File was not found for Properties.png