NHS Digital FHIR Implementation Guide (Retired - 2.1.50)

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

Testing and FHIR Validation

FHIR Validation SHOULD be used with this implementation guide.

This IG and FHIR Validation currently tests the following:

Aspect Verified Description Notes
Structure Check that all the content in the resource is described by the specification, and nothing extra is present XML, JSON and RDF
Cardinality Check that the cardinality of all properties is correct (min & max)
Value Domains Check that the values of all properties conform to the rules for the specified types (including checking that enumerated codes are valid)
Coding/CodeableConcept bindings Limited Check that codes/displays provided in the Coding/CodeableConcept types are valid This requires a UK Terminology Server and currently it is not possible to use this directly with FHIR Validation tools.
Invariants Check that the invariants (co-occurrence rules, etc.) have been followed correctly
Profiles Check that any rules in profiles have been followed (including those listed in the Resource.meta.profile, or in CapabilityStatement, or in an ImplementationGuide, or otherwise required by context)
Questionnaires Check that a QuestionnaireResponse is valid against its matching Questionnaire
Message Definitions Check that a Bundle (type=message) is valid against its matching MessageDefinition Not supported in HL7 Validation tools but is supported in NHS Digital validators (Solutions Assurance and EPS)
Document Definitions Check that a Bundle (type=document) is valid against its matching Composition Not supported in HL7 Validation tools but is supported in NHS Digital validators (Solutions Assurance)
Business Rules Business rules are made outside the specification, such as checking for duplicates, checking that references resolve, checking that a user is authorized to do what they want to do, etc. Business rules are beyond the scope of the FHIR Implementation Guide.

HL7 FHIR Validator

When using the FHIR Validator, the general format will be:

java -jar org.hl7.fhir.validator.jar [filename] -version 4.0.1 -ig [nhs-digial-ig-package] -profile [profile]

Where

  • filename is the file name of the resource being validatatd.
  • nhs-digital-ig-package is the url of the NHS Digital IG Package which can be found in the Downloads section
  • profile the url of the profile to validate against.

e.g.

java -jar org.hl7.fhir.validator.jar patient-ex.xml -version 4.0.1 -ig https://packages.simplifier.net/uk.nhsdigital.r4/-/uk.nhsdigital.r4-2.1.25-discovery.tgz -profile https://fhir.nhs.uk/StructureDefinition/NHSDigital-Patient

Asking a FHIR Server

The Electronic Prescription Service has implemented this operation and is available GitHub validation-service-fhir-r4

back to top