openEHR and FHIR UKCore

It does appear that openEHR Templates (and Archetypes) and FHIR Questionnaires are very much related.

Is some minor differences mostly around coding and Template context (openEHR examples I’ve found go for XDS document metadata and FHIR examples tends to follow HL7 v2 ADT Encounters … this may be lack of understanding of openEHR and it is all fine).

Example conversion to FHIR Questionnaire from Template: Vital signs [openEHR Clinical Knowledge Manager]

{
  "resourceType": "Questionnaire",
  "id": "a24b52ef-deb2-45e7-ac64-1346bbd64843",
  "meta": {
    "versionId": "3",
    "lastUpdated": "2023-09-09T07:55:30.633Z"
  },
  "url": "https://example.fhir.openehr.org/Questionnaire/Vitalsigns",
  "identifier": [
    {
      "value": "74b50979-ab22-4351-bfdc-cc5191ea0ac5"
    }
  ],
  "title": "Vital signs",
  "status": "draft",
  "contact": [
    {
      "name": "2021-03-07"
    }
  ],
  "purpose": "A simple template containing only the most commonly used main data elements of Body temperature, Blood pressure, Body mass index, Height/Length, Body weight, Pulse/Heart beat, Respiration, and Pulse oximetry. Non-metric unit alternatives have been constrained out.",
  "item": [
    {
      "extension": [
        {
          "url": "http://openehr.org/Datatype",
          "valueString": "CARCHETYPEROOT"
        },
        {
          "url": "http://openehr.org/Archetype",
          "valueString": "openEHR-EHR-OBSERVATION.body_temperature.v2"
        }
      ],
      "linkId": "at0000-3930",
      "text": "Body temperature",
      "type": "group",
      "item": [
        {
          "extension": [
            {
              "url": "http://openehr.org/Datatype",
              "valueString": "CCOMPLEXOBJECT/ELEMENT"
            },
            {
              "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod",
              "valueDuration": {
                "value": 2,
                "unit": "weeks",
                "system": "http://unitsofmeasure.org",
                "code": "wk"
              }
            },
            {
              "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationExtract",
              "valueBoolean": true
            },
            {
              "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unitOption",
              "valueCoding": {
                "system": "http://unitsofmeasure.org",
                "code": "Cel"
              }
            }
          ],
          "linkId": "at0000-3930/at0004-4161",
          "code": [
            {
              "system": "http://snomed.info/sct",
              "code": "386725007"
            }
          ],
          "text": "Temperature",
          "type": "quantity"
        }
      ]
    },
    {
      "extension": [
        {
          "url": "http://openehr.org/Datatype",
          "valueString": "CARCHETYPEROOT"
        },
        {
          "url": "http://openehr.org/Archetype",
          "valueString": "openEHR-EHR-OBSERVATION.blood_pressure.v2"
        }
      ],
      "linkId": "at0000-171",
      "code": [
        {
          "system": "http://snomed.info/sct",
          "code": "364090009"
        }
      ],
      "text": "Blood pressure",
      "type": "group",
      "item": [
        {
          "extension": [
            {
              "url": "http://openehr.org/Datatype",
              "valueString": "CCOMPLEXOBJECT/ELEMENT"
            },
            {
              "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod",
              "valueDuration": {
                "value": 2,
                "unit": "weeks",
                "system": "http://unitsofmeasure.org",
                "code": "wk"
              }
            },
            {
              "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationExtract",
              "valueBoolean": true
            },
            {
              "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unitOption",
              "valueCoding": {
                "system": "http://unitsofmeasure.org",
                "code": "mm[Hg]"
              }
            }
          ],
          "linkId": "at0000-171/at0004-6886",
          "code": [
            {
              "system": "http://snomed.info/sct",
              "code": "271649006"
            },
            {
              "system": "http://openehr.org/CodeSystem",
              "code": "125"
            }
          ],
          "text": "Systolic",
          "type": "quantity"
        },
        {
          "extension": [
            {
              "url": "http://openehr.org/Datatype",
              "valueString": "CCOMPLEXOBJECT/ELEMENT"
            },
            {
              "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod",
              "valueDuration": {
                "value": 2,
                "unit": "weeks",
                "system": "http://unitsofmeasure.org",
                "code": "wk"
              }
            },
            {
              "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationExtract",
              "valueBoolean": true
            },
            {
              "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unitOption",
              "valueCoding": {
                "system": "http://unitsofmeasure.org",
                "code": "mm[Hg]"
              }
            }
          ],
          "linkId": "at0000-171/at0005-1110",
          "code": [
            {
              "system": "http://snomed.info/sct",
              "code": "271650006"
            },
            {
              "system": "http://openehr.org/CodeSystem",
              "code": "125"
            }
          ],
          "text": "Diastolic",
          "type": "quantity"
        }
      ]
    },
    {
      "extension": [
        {
          "url": "http://openehr.org/Datatype",
          "valueString": "CARCHETYPEROOT"
        },
        {
          "url": "http://openehr.org/Archetype",
          "valueString": "openEHR-EHR-OBSERVATION.body_mass_index.v2"
        }
      ],
      "linkId": "at0000-2329",
      "text": "Body mass index",
      "type": "group",
      "item": [
        {
          "extension": [
            {
              "url": "http://openehr.org/Datatype",
              "valueString": "CCOMPLEXOBJECT/ELEMENT"
            },
            {
              "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod",
              "valueDuration": {
                "value": 2,
                "unit": "weeks",
                "system": "http://unitsofmeasure.org",
                "code": "wk"
              }
            },
            {
              "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationExtract",
              "valueBoolean": true
            },
            {
              "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unitOption",
              "valueCoding": {
                "system": "http://unitsofmeasure.org",
                "code": "kg/m2"
              }
            }
          ],
          "linkId": "at0000-2329/at0004-7991",
          "code": [
            {
              "system": "http://snomed.info/sct",
              "code": "60621009"
            },
            {
              "system": "http://loinc.org",
              "code": "39156-5"
            },
            {
              "system": "http://openehr.org/CodeSystem",
              "code": "349"
            }
          ],
          "text": "Body mass index",
          "type": "quantity"
        }
      ]
    },
    {
      "extension": [
        {
          "url": "http://openehr.org/Datatype",
          "valueString": "CARCHETYPEROOT"
        },
        {
          "url": "http://openehr.org/Archetype",
          "valueString": "openEHR-EHR-OBSERVATION.height.v2"
        }
      ],
      "linkId": "at0000-9736",
      "text": "Height/Length",
      "type": "group",
      "item": [
        {
          "extension": [
            {
              "url": "http://openehr.org/Datatype",
              "valueString": "CCOMPLEXOBJECT/ELEMENT"
            },
            {
              "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod",
              "valueDuration": {
                "value": 2,
                "unit": "weeks",
                "system": "http://unitsofmeasure.org",
                "code": "wk"
              }
            },
            {
              "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationExtract",
              "valueBoolean": true
            },
            {
              "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unitOption",
              "valueCoding": {
                "system": "http://unitsofmeasure.org",
                "code": "cm"
              }
            }
          ],
          "linkId": "at0000-9736/at0004-5081",
          "code": [
            {
              "system": "http://loinc.org",
              "code": "8302-2"
            },
            {
              "system": "http://openehr.org/CodeSystem",
              "code": "122"
            }
          ],
          "text": "Height/Length",
          "type": "quantity"
        }
      ]
    },
    {
      "extension": [
        {
          "url": "http://openehr.org/Datatype",
          "valueString": "CARCHETYPEROOT"
        },
        {
          "url": "http://openehr.org/Archetype",
          "valueString": "openEHR-EHR-OBSERVATION.body_weight.v2"
        }
      ],
      "linkId": "at0000-2405",
      "text": "Body weight",
      "type": "group",
      "item": [
        {
          "extension": [
            {
              "url": "http://openehr.org/Datatype",
              "valueString": "CCOMPLEXOBJECT/ELEMENT"
            },
            {
              "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod",
              "valueDuration": {
                "value": 2,
                "unit": "weeks",
                "system": "http://unitsofmeasure.org",
                "code": "wk"
              }
            },
            {
              "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationExtract",
              "valueBoolean": true
            },
            {
              "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unitOption",
              "valueCoding": {
                "system": "http://unitsofmeasure.org",
                "code": "kg"
              }
            },
            {
              "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unitOption",
              "valueCoding": {
                "system": "http://unitsofmeasure.org",
                "code": "g"
              }
            }
          ],
          "linkId": "at0000-2405/at0004-4936",
          "code": [
            {
              "system": "http://loinc.org",
              "code": "29463-7"
            },
            {
              "system": "http://openehr.org/CodeSystem",
              "code": "124"
            }
          ],
          "text": "Weight",
          "type": "quantity"
        }
      ]
    },
    {
      "extension": [
        {
          "url": "http://openehr.org/Datatype",
          "valueString": "CARCHETYPEROOT"
        },
        {
          "url": "http://openehr.org/Archetype",
          "valueString": "openEHR-EHR-OBSERVATION.pulse.v2"
        }
      ],
      "linkId": "at0000-6911",
      "text": "Pulse/Heart beat",
      "type": "group",
      "item": [
        {
          "extension": [
            {
              "url": "http://openehr.org/Datatype",
              "valueString": "CCOMPLEXOBJECT/ELEMENT"
            },
            {
              "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unitOption",
              "valueCoding": {
                "system": "http://unitsofmeasure.org",
                "code": "/min"
              }
            }
          ],
          "linkId": "at0000-6911/at0004-3770",
          "code": [
            {
              "system": "http://openehr.org/CodeSystem",
              "code": "382"
            }
          ],
          "text": "Rate",
          "type": "quantity"
        }
      ]
    },
    {
      "extension": [
        {
          "url": "http://openehr.org/Datatype",
          "valueString": "CARCHETYPEROOT"
        },
        {
          "url": "http://openehr.org/Archetype",
          "valueString": "openEHR-EHR-OBSERVATION.respiration.v2"
        }
      ],
      "linkId": "at0000-3263",
      "text": "Respiration",
      "type": "group",
      "item": [
        {
          "extension": [
            {
              "url": "http://openehr.org/Datatype",
              "valueString": "CCOMPLEXOBJECT/ELEMENT"
            },
            {
              "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod",
              "valueDuration": {
                "value": 2,
                "unit": "weeks",
                "system": "http://unitsofmeasure.org",
                "code": "wk"
              }
            },
            {
              "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationExtract",
              "valueBoolean": true
            },
            {
              "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unitOption",
              "valueCoding": {
                "system": "http://unitsofmeasure.org",
                "code": "/min"
              }
            }
          ],
          "linkId": "at0000-3263/at0004-8183",
          "code": [
            {
              "system": "http://snomed.info/sct",
              "code": "271625008"
            },
            {
              "system": "http://openehr.org/CodeSystem",
              "code": "382"
            }
          ],
          "text": "Rate",
          "type": "quantity"
        }
      ]
    },
    {
      "extension": [
        {
          "url": "http://openehr.org/Datatype",
          "valueString": "CARCHETYPEROOT"
        },
        {
          "url": "http://openehr.org/Archetype",
          "valueString": "openEHR-EHR-OBSERVATION.pulse_oximetry.v1"
        }
      ],
      "linkId": "at0000-4333",
      "text": "Pulse oximetry",
      "type": "group",
      "item": [
        {
          "extension": [
            {
              "url": "http://openehr.org/Datatype",
              "valueString": "CCOMPLEXOBJECT/ELEMENT"
            },
            {
              "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod",
              "valueDuration": {
                "value": 2,
                "unit": "weeks",
                "system": "http://unitsofmeasure.org",
                "code": "wk"
              }
            },
            {
              "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationExtract",
              "valueBoolean": true
            }
          ],
          "linkId": "at0000-4333/at0006-221",
          "code": [
            {
              "system": "http://snomed.info/sct",
              "code": "431314004"
            },
            {
              "system": "http://loinc.org",
              "code": "59408-5"
            }
          ],
          "text": "SpO₂",
          "type": "integer"
        }
      ]
    }
  ]
}

I have a basic bit of conversion code in this git repo GitHub - NHSDigital/IOPS-FHIR-openEHR. Its spring boot based / java based (like FHR Bridge). It has two end points:

POST {{baseUrl}}/Questionnaire/$convertTemplate
POST {{baseUrl}}/Questionnaire/$convertArchetype

baseUrl on local machines would be http://localhost:9006/openFHIR/R4