UK FHIR Developer - Implementation Guide and Testing (FHIR Validation)

I did a presentation this week at HL7 UK on developing with FHIR in the UK.
As a developer I face a number of problems working with FHIR and the biggest one for me, is being able to test what I’ve done is correct. FHIR has a number of tools to support this but they are not simple to use in the UK.

Online FHIR Validation

I’ve blogged about one solution before Validating FHIR (Care Connect) This described how to use the FHIR Validator app within the Care Connect Reference Implementation. I’ve worked with Aire Logic to produce a new version which uses:

  • NHS Digital Ontology Server to validate all coding including UK SNOMED.
  • Uses FHIR 3.0.2
  • Includes a FHIR Bundle viewer

Command Line - Official HL7 FHIR Validation Tool

A solution is to use the official HL7 Validation Tool, details can be found here on how to use the tool: Using the FHIR Validator. This requires an ImplementationGuide which we don’t have in the UK.

UK Implementation Guide (example)

This is not an official guide and the Profiles it contains are also not official (see next section for reasons)

To work around this I’ve created a UK Base ImplementationGuide which can currently be found here: UK Base Implementation Guide

I’ve concentrated on making it work from a technical perspective. However it does work for validating/testing resources against UK profiles. So to validate a Patient resource in a patient.xml file you can use the following command (with the HL7 FHIR Validator)

java -jar org.hl7.fhir.validator.jar c:\temp\patient.xml -version 3.0 -ig

Errors in Profiles

As mentioned above, the Profiles are not official and contain numerous corrections to support validation. The changes include:

  • Removal of snapshots from the profile
  • Correction of typos
  • Removal of some ValueSets (mostly in Patient, the core spec and UK said the same thing)

Terminology Support

The official validator should also work with the NHS Digital Ontology Server The FHIR server for this is

In theory we can validate UK FHIR resources using both the IG and the Onto Server by using this command (At the time of writing this doesn’t work correctly):

java -jar org.hl7.fhir.validator.jar c:\temp\patient.xml -version 3.0 -ig -tx

Open Source

All of the code above is open source and the repositories can be found on GitHub:

Other Conformance Resources

This is more experimental at present but profiles are not enough for FHIR Implementation. IG is shown above but others such as:

  • GraphDefinition - rules and display of models
  • Questionnaire - rules on FHIR QuestionnaireResponse
  • ObservationDefinition - units and codes for common observations.

A demonstration of these is here:
For GraphDefinition I’ve created a number of examples in particular for GP Connect Structured Response. Others includes Transfer of Care FHIR Documents and Digital Child Health Birth Details - FHIR Messaging

The use of GraphDefinition, as I see it, is to explain what is in a FHIR Bundle and how the Bundle is constructed - this is not covered in FHIR profiles. A nice side effect is the GraphDefinition can be use to create a diagram.

This is again open source GitHub - project-wildfyre/conformance: Exploring FHIR Conformance resources

1 Like

Note the above post has been edited as the IG has moved to HL7 UK github

and moved again. Shouldn’t move again…