Skip to content

Key openEHR datatypes

The openEHR Reference model defines a relatively small set of information model constructs which openEHR back-ends must support. This includes a number of generic classes and datatypes.

The Reference model contains virtually no clinical content e.g concepts for Medication, or Diagnosis. These are defined and managed separately as archetypes.

openEHR has a very rich set of allowable datatypes. A full definition is beyond the scope of this document but developers new to this field may find the following notes helpful. You can refer to the openEHR Specification and UML for full details.

The formal Class names for all datatypes in openEHR start with DV_

Datatype: text (DV_TEXT)

Allows the recording of simple, unformatted text. Newlines and carriage returns are allowed. openEHR does not normally constrain the length of string.

The example shows how a multiple occurrence Element is handled.

The rm.data_types.text package contains classes for representing all textual values in the health record, including plain text, coded terms, and narrative text. UML - openEHR RM-datatypes.text package

   {
    {
                        "items": [
                            {
                                "_type": "ELEMENT",
                                "name": {
                                    "_type": "DV_TEXT",
                                    "value": "What matters to me"
                                },
                                "archetype_node_id": "at0004",
                                "value": {
                                    "_type": "DV_TEXT",
                                    "value": "Parents"
                                }
                            },
                            {
                                "_type": "ELEMENT",
                                "name": {
                                    "_type": "DV_TEXT",
                                    "value": "What matters to me #2"
                                },
                                "archetype_node_id": "at0004",
                                "value": {
                                    "_type": "DV_TEXT",
                                    "value": "Mood"
                                }
                            },
                            {
                                "_type": "ELEMENT",
                                "name": {
                                    "_type": "DV_TEXT",
                                    "value": "What matters to me #3"
                                },
                                "archetype_node_id": "at0004",
                                "value": {
                                    "_type": "DV_TEXT",
                                    "value": "Isolation"
                                }
                            }
                        ]
                    }
     "what_matters_to_me": [
          "Parents",
          "Mood",
          "Isolation"
         ]
        }
    ```json
      {
       "what_matters_to_me:0": "Parents",
       "what_matters_to_me:1": "Mood",
       "what_matters_to_me:2": "Isolation"
      }

Hint

DV_TEXT can always be sub-classed to DV_CODED_TEXT, so when you see a text constraint in an archetype , this can normally always be converted to a codedText in a template or at run-time. As an example, the primary element in the Adverse reaction risk archetype is a DV_TEXT but in most circumstances a DV_CODED_TEXT will actually be used.

Datatype: codedText (DV_CODED_TEXT)

Is a commonly used datatype in openEHR systems and is a sub-class of text. i.e wherever text is specified codedText can be used instead.

Codes may be 'external' e.g. SNOMED CT, LOINC, ICD-10 or 'local', where they are defined within archetypes, have the form atxxxxx and are commonly referred to as 'atCodes'.

A codedText element always includes the terminologyID, the code itself and the text of the coded concept (Rubric). In the patient data this is a carried in the defining_code attribute of the datatype.

The rm.data_types.text package contains classes for representing all textual values in the health record, including plain text, coded terms, and narrative text. UML - openEHR RM-datatypes.text package

   {
        "_type": "ELEMENT",
        "name": {
            "_type": "DV_TEXT",
            "value": "Status"
        },
        "archetype_node_id": "at0004",
        "value": {
            "_type": "DV_CODED_TEXT",
            "value": "Unknown",
            "defining_code": {
                "_type": "CODE_PHRASE",
                "terminology_id": {
                    "_type": "TERMINOLOGY_ID",
                    "value": "local"
                },
                "code_string": "at0007"
            }
        }
    }
    "legal_welfare_proxy_in_place": [
                                    {
                                        "status": [
                                            {
                                                "|code": "at0007",
                                                "|value": "Unknown",
                                                "|terminology": "local"
                                            }
                                        ],
                                    }
    ]
  "legal_welfare_proxy_in_place/status|value": "Unknown",
  "legal_welfare_proxy_in_place/status|code": "at0007",
  "legal_welfare_proxy_in_place/status|terminology": "local"

Using local 'atCodes'

e.g local::at0007| normal|

When a codedText item is added to a FLAT or STRUCTURED JSON format document, you must give the code, value and terminology, unless this is a local 'atCode', in which case only the code needs to be provided, as the terminologyId and text value will be supplied as defaults, based on the known values in the template.

Only the code needs to be specified - the value and terminology are not required since they are pre-defined in the openEHR template..

asthma_diary_entry/examination_findings:0/pulmonary_function_testing:0/result_details/pulmonary_flow_rate_result/test_result_name|code': 'at0071'

Using external terminology

e.g. SNOMED-CT::23924001| chest tightness |

If an external terminology is used, the code, terminology and value must be specified

json 'asthma_diary_entry/history:0/story_history/symptom:0/symptom_name|code': '23924001', 'asthma_diary_entry/history:0/story_history/symptom:0/symptom_name|value': 'chest tightness', 'asthma_diary_entry/history:0/story_history/symptom:0/symptom_name|terminology': 'SNOMED-CT',

Handling multiple codes - Mappings

Both DV_TEXT and DV_CODED_TEXT allow for other codes to be recorded in the patient record alongside the text value or defining code. THis is done via the mappings attribute in the DV_TEXT/DV_CODED_TEXT datatype.




Datatype: ordinal DV_ORDINALand scale DV_SCALE

Combines codedText with a score, expressed as an integer (DV_ORDINAL) or a real number (DV_SCALE).

DV_SCALE is just being introduced in the latest version of the Reference Model to support the small number of scales and scores that need real numbers. We expect DV_SCALE to be used in preference to DV_ORDINAL for new archetypes as it can also handle integers.

DV_ORDINAL: A data type that represents integral score values, e.g. pain, Apgar values, etc, where there is: a) implied ordering, b) no implication that the distance between each value is constant, and c) the total number of values is finite; d) integer values only.

DV_SCALE: A data type that represents scale values, where there is: a) implied ordering, b) no implication that the distance between each value is constant, and c) the total number of values is finite; d) non-integer values are allowed.



'community_dental_final_assessment_letter/assessment_scales/dental_rag_score:0/caries_tooth_decay/caries_risk|code': 'at0024',
'community_dental_final_assessment_letter/assessment_scales/dental_rag_score:0/caries_tooth_decay/caries_risk|ordinal': 2,
'community_dental_final_assessment_letter/assessment_scales/dental_rag_score:0/caries_tooth_decay/caries_risk|value': 'Red',

Datatype: count DV_COUNT

Countable quantities. Used for countable types such as pregnancies and steps (taken by a physiotherapy patient), number of cigarettes smoked in a day.

'community_dental_final_assessment_letter/investigations_and_results:0/imaging_examination_result:0/result_group/decayed_teeth/decayed_teeth': 4,

Datatype: datetime

Records a date or date and time using the ISO8061 format.

'ctx/time': '2014-09-23T00:11:02.518+02:00'

Datatype: quantity

Records a physical quantity along with the appropriate SI units, which should normally be compliant with UCUM.

"asthma_diary_entry/examination_findings:0/pulmonary_function_testing:0/result_details/pulmonary_flow_rate_result/actual_result|magnitude": 550,
"asthma_diary_entry/examination_findings:0/pulmonary_function_testing:0/result_details/pulmonary_flow_rate_result/actual_result|unit": "l/min",