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
Differential View
Hybrid View
Table View
XML View
JSON View
An example of an Extension Example
Snapshot View
Differential View
Hybrid View
Table View
XML View
JSON View
An example of an Snippet Example
Snapshot View
Differential View
Hybrid View
Table View
XML View
JSON View
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.