Skip to content

National Data Opt-Out FHIR Mapping

Overview

The National Data Opt-out Programme (NDOP) allows patients to choose if they wish to only allow their personally identifiable data used for their care and treatment, or if they wish to allow their data to be shared with other healthcare organisations for planning and research purposes.

The NDOP FHIR API can be used to retrieve the Consent preferences of a patient by querying their NHS Number.

Mapping

The Consent template contains the Liquid template for converting an NDOP MESH Consent resource into UK Core Consent.

The FHIR-Converter provides a template for converting from Stu3 to R4. Those can be found in the FHIR-Converter repository and includes:

  • Consent.liquid
  • Consent/_Base.liquid
  • Consent/_Provision.liquid
  • DataType/CodingToCodeableConcept.liquid
  • Resource.liquid

These templates have been modified to include any requirements for UK Core Consent which extends R4.

In summary, the main modifications are:

  • mergeDiff: The original template uses a custom mergeDiff tag which allows the author to specify any mappings, whilst also merging any other fields which are unchanged. As we do not use mergeDiff in this repository, the merge is done manually, by including all the fields explicitly.
  • Resource: The original template references a Resource template which itself references dozens of other templates. To avoid including many unused files, the Resource file has been edited to include only the parts relating to Consent.
  • UK Core requirements: There are some required fields in UK Core which are not in NDOP Mesh. These have been added, but temporarily filled with placeholder values.
  • References: The NDOP Mesh input includes literal references - these are translated to logical references so that these values can be later updated once the new literal references are known.
Source Destination Comment
resourceType resourceType No change from FHIR-Converter template
id id No change from FHIR-Converter template
status status No change from FHIR-Converter template
scope Added - required in UK Core Consent but not MESH
category Added - required in UK Core Consent but not MESH
patient patient No change from FHIR-Converter template
dateTime dateTime No change from FHIR-Converter template
contained contained No change from FHIR-Converter template
identifier identifier No change from FHIR-Converter template
organization organization Modified literal reference to logical reference using new Consent/_Organization.liquid
policy policy No change from FHIR-Converter template
policyRule policyRule No change from FHIR-Converter template
sourceIdentifier sourceIdentifier No change from FHIR-Converter template
except provision.except No change from FHIR-Converter template
data provision.data No change from FHIR-Converter template
dataPeriod provision.dataPeriod No change from FHIR-Converter template
purpose provision.purpose No change from FHIR-Converter template
securityLabel provision.securityLabel No change from FHIR-Converter template
action provision.action No change from FHIR-Converter template
actor provision.actor No change from FHIR-Converter template
consentingParty performer FHIR-Converter template renamed this to performer. Additionally, modified literal reference to logical reference using new Consent/_ConsentingParty.liquid
period provision.period No change from FHIR-Converter template

Test Cases

The Consent liquid template has two associated test input files. These are:

  • SampleConsent_Consent.json: This is based on this example https://developer.nhs.uk/apis/optout/Examples/NDOP-Bundle-Searchset-Example-2.json. It is used to show converting a Consent resource generated by NDOP MESH into a UK Core Consent resource.
  • SampleMultiple_Consent.json: This is a modification of the example above. It adds multiple references to the organization array and the consentingParty array. This is to test the conversion of multiple literal references into multiple logical references, rather than just a single one.