ADL - Archetype Definition Language
Introduction
This section describes whole ADL artefacts. The relationship of the cADL-encoded definition section and the ODIN-encoded terminology section is discussed in detail.
Some syntax valdity rules are defined, but validity in general is defined by the rules stated in the AOM specification, which can be checked by a compiler as soon as an AOM structure is parsed from an ADL document (or other serialsiation format).
The general structure of ADL artefacts is as follows (the full definitions are shown in [Syntax Specification] below):
adl_artefact: artefact_type meta_data?
ARCHETYPE_HRID
('specialize'
ARCHETYPE_REF)?
'language'
odin_text
'description'
odin_text
'definition'
c_complex_object
('rules'
el_text)?
('rm_overlay'
odin_text)?
'terminology'
odin_text
('annotations'
odin_text)?
;
artefact_type: 'archetype' | 'template' | 'template_overlay' | 'operational_template' ;
meta_data: '(' meta_data_item (';' meta_data_item )* ')' ;
The syntax for meta_data_item, ARCHETYPE_HRID and ARCHETYPE_REF can be found below in [_base_patterns].
The 'archetype' artefact type can have any or all of the above sections. The other artefact types are more specific in their form.
An ADL source template has the following structure.
adl_template: 'template' meta_data?
ARCHETYPE_HRID
'specialize'
ARCHETYPE_REF
'language'
odin_text
'description'
odin_text
'definition'
c_complex_object
('rules'
el_text)?
('rm_overlay'
odin_text)?
'terminology'
odin_text
('annotations'
odin_text)?
;
An ADL template overlay has the structure shown below.
adl_template_overlay: 'template_overlay'
ARCHETYPE_HRID
'specialize'
ARCHETYPE_REF
'definition'
c_complex_object
('rules'
el_text)?
('rm_overlay'
odin_text)?
'terminology'
odin_text
;
The structure of an operational template is as follows.
adl_operational_template: 'operational_template' meta_data?
ARCHETYPE_HRID
'language'
odin_text
'description'
odin_text
'definition'
c_complex_object
('rules'
el_text)?
('rm_overlay'
odin_text)?
'terminology'
odin_text
('annotations'
odin_text)?
'component_terminologies'
odin_text
;
File-naming Convention
Up until ADL 1.4, archetypes were expressed in 'flat' form ADL and were saved in files with the extension .adl. These are now treated as legacy flat format files. Beginning with ADL 2, the source file format of an archetype is the 'differential' form, with the extension .adls. The flat format generated by tools now has the extension .adlf.
Artefact Content
For specialised archetypes, differential form follows the object-oriented convention and only includes overridden or new elements but not unchanged inherited elements. Inherited elements are determined by compiling and 'flattening' a differential archetype with respect to the parent archetypes in its inheritance lineage .
For top-level archetypes the full structure is included in the differential file, but internal references, where they exist, are expanded out in the flat form.
Basics
Keywords
ADL has a small number of keywords which are reserved for use in archetype declarations, as follows:
-
archetype,template,template_overlay,operational_template, -
specialise/specialize, -
language, -
description,definition,rules,terminology -
annotations
All of these words can safely appear as identifiers in the definition and terminology sections.
Deprecated keywords include:
-
invariant— replaced byrules -
ontology— replaced byterminology -
concept— obsolete
Artefact declaration
The first word in a source ADL archetype declares the artefact type, and is one of the following keywords:
-
archetype: signifies an archetype; -
template: signifies a template; -
template_overlay: signifies an overlay component of a template.
The flattened form of any of the above types starts with the keyword 'flat' followed by the artefact type.
A fourth artefact type is also possible.
-
operational_archetype: signifies an operational archetype, generated by flattening a template.
Node Identifier Codes
In the definition section of an ADL archetype, a specific set of codes is used as node identifiers. Identifier codes always appear in brackets ([] ), and begin with the 'id' prefix. Specialisations of locally coded concepts have the same root, followed by 'dot' extensions, e.g. [id10.2] . From a terminology point of view, these codes have no implied semantics - the 'dot' structuring is used as an optimisation on node identification.
Deprecated: In ADL 1.4 at-codes were used as node identifiers. These are converted to id-codes by ADL 1.4 to ADL 2 converters.
Local Term Codes
In the definition section of an ADL archetype, a second set of codes is used for terms denoting constraints on coded items. Term codes are either local to the archetype, or from an external lexicon. This means that the archetype description is the same in all languages, and is available in any language that the codes have been translated to. All term codes are shown in brackets ([]) and are prefixed with "at", e.g. at10 . Codes of any length are acceptable in ADL archetypes. Specialisations of locally coded concepts have the same root, followed by 'dot' extensions, e.g. at10.2 . From a terminology point of view, these codes have no implied semantics - the 'dot' structuring is used as an optimisation on node identification.
Local Value Set Codes
A third kind of local code is used to stand for value set constraints on coded text items in the body of the archetype. Because they are language- and/or terminology-sensitive, they are defined in the terminology section, and referenced by codes prefixed by "ac", e.g. [ac9].
Deprecated: In ADL 1.4 and transitional forms of ADL 1.5/2, 0-padded 'at' and 'ac' codes were used within top-level archetypes. In ADL 2, all such codes are reformatted to remove the 0-padding.
Archetype Identification Section
This section introduces the archetype with the keyword archetype, template, template_overlay or operational_archetype, followed by a number of items of meta-data in parentheses, and on the next line, a human-readable archetype identifier. The following shows an identification section with all possible meta-data items.
archetype (adl_version=2.0.5; rm_release=1.0.3; provenance_id=15E82D77-7DB7-4F70-8D8E-EED6FF241B2D; build_uid=E163E472-3E90-409C-9803-0668A7DA48CE; generated; controlled)
openEHR-EHR-OBSERVATION.haematology_result.v0.1.9
ADL Version Indicator
An ADL version identifier is mandatory in all archetypes, and is expressed as a string of the form adl_version=N.M , or N.M.P, where N.M[.P] is the ADL release identifier.
RM Release Indicator
An RM (Reference Model) Release identifier is mandatory in all archetypes, and is expressed as a string of the form rm_release=N.M, or N.M.P, where the version number indicates the release of the reference model on which the archetype is based.
Machine Identifiers
A unique identifier for the archetype in the form of a GUID can be specified using the syntax below:
archetype (adl_version=2.0.5; rm_release=1.0.3; uid=15E82D77-7DB7-4F70-8D8E-EED6FF241B2D)
This identifier is set at initial creation or at any time later, and never subsequently changes. It acts as an identifier for the physical artefact, regardless of what semantics are changed, including changes to the constituent parts of the multi-axial identifier.
A build_uid identifier can also be specified, with a GUID value, identifying the current artefact. This identifier changes whenever any change is made to the text of the archetype, and can thus be used to disambiguate subsequent versions.
Namespaces
A namespaced archetype has an identification section like the following examples:
archetype (adl_version=2.0.5; rm_release=1.0.2)
br.gov.saude::openEHR-EHR-OBSERVATION.haematology_result.v1.0.0
template (adl_version=2.0.5; rm_release=1.0.2)
uk.org.primary_care::openEHR-EHR-OBSERVATION.haematology_result.v1.2.15
archetype (adl_version=2.0.5; rm_release=1.0.2)
org.openehr::openEHR-EHR-OBSERVATION.haematology_result.v3.22.125-rc.7
Namespaces are used to distinguish locally created artefacts representing a given concept (such as 'haematology result') from an artefact created elsewhere intended to represent the same concept.
Once a namespace is attached to an archetype, it is considered a part of the identifier, and never changed, even if the archetype moves to a new publishing organisation. This ensures the constant relationship between archetypes and the data created using them.
Human Readable Archetype Identifier
The archetype identifier may include a namespace, in the form of a reverse domain name, which denotes the original authoring organisation. The lack of a namespace in the identifier indicates an ad hoc, uncontrolled artefact, not formally associated with any organisation, typical for experimental archetypes, and pre-ADL 1.5 archetypes not yet upgraded to have a namespace. The main part of the identifier is multi-axial concept identifier.
A typical identification sectionfor an ad hoc archetype is as follows:
archetype (adl_version=2.0.5; rm_release=1.0.2)
openEHR-EHR-OBSERVATION.haematology_result.v0.1.9
Deprecated: In ADL 1.4 and transitional forms of ADL 1.5, archetype identifiers included only a single version number, and this typically started at 1. Tools that deal with older archetypes should accept these identifiers, and convert the version part to 'v1.0.0' or any other appropriate identifier, obeying the openEHR Artefact Knowledge Identification specification.
The multi-axial archetype identifier identifies archetypes in a global concept space within a given namespace. It is also known as an 'ontological' identifier, since the concept space can be understood as an ontology of informational concepts on which the archetypes are based. The syntax of the identifier is described in the openEHR Identification Specification. The structure of the concept space is essentially two-level, with the first level being a reference model class (e.g. openEHR OBSERVATION class) and the second being a domain concept (e.g. 'haematology result').
Because namespaces are usually treated hierarchically, higher level namespaces (e.g. '.org' domains) are assumed to be includable by more local namespaces, with the result that the concept definition space is inherited as well.
Specialised Archetype Identification
The archetype identifier of any specialised archetype, including all templates, follows the same rules as for non-specialised archetypes.
Deprecated: in previous versions of ADL, the archetype identifier of a specialised archetype had a concept part that consisted of the concept part of the parent followed by '-' and a further specialised concept. For example, openEHR-EHR-OBSERVATION.haematology-cbc. v1 was a valid child of openEHR-EHR-OBSERVATION.haematology.v1. This restriction is no longer the case. The previous style of identifier is still legal, but the '-' no longer has any significance.
Version Identifiers
ADL 2 Archetypes contain 3-part version identifiers, with optional qualifiers, following the openEHR Artefact Knowledge Identification specification. Examples below:
br.ms::openEHR-EHR-OBSERVATION.haematology_result.v1.0.0
br.ms::openEHR-EHR-OBSERVATION.haematology_result.v1.2.15-alpha.45
br.ms::openEHR-EHR-OBSERVATION.haematology_result.v3.22.125-rc.7
The version identifier variants are summarised as follows:
-
N.M.P- 3-part version id with no qualifier indicates major.minor.path version -
N.M.P-alpha.N- a-alpha.Nqualifier indicates uncontrolled changes onN.M.P, leading to a new version that is yet to be decided -
N.M.P-rc.N- a-rc.Nqualifier indicates a release candidate.
Validity
The following syntax validity rule applies in the identification section:
SARID: archetype identifier validity. the identifier of the artefact must conform to the ARCHETYPE_ID identifier syntax defined in the openEHR BASE/Base Types Specification.
Generated Indicator
A flag indicating whether the archetype was generated or authored can be included after the version, as follows:
archetype (adl_version=2.0.5; rm_release=1.0.2; generated)
org.openehr::openEHR-EHR-OBSERVATION.haematology.v1.2.0
This marker is used to support the migration to differential archetype representation introduced in ADL 1.5, to enable proper representation of specialised archetypes. The 'generated' marker can be used on specialised archetypes - i.e. ADL 1.5 style .adls files - generated from flat archetypes - ADL 1.4 .adl files - and also in flat archetypes generated from differential files, by an inheritance-flattening process.
Controlled Indicator
A flag indicating whether the archetype is change-controlled or not can be included after the version, as follows:
archetype (adl_version=2.0.5; rm_release=1.0.2; controlled)
org.openehr::openEHR-EHR-OBSERVATION.haematology.v1.2.0
This flag may have the two values "controlled" and "uncontrolled" only, and is an aid to software. Archetypes that include the "controlled" flag should have the revision history section included, while those with the "uncontrolled" flag, or no flag at all, may omit the revision history. This enables archetypes to be privately edited in an early development phase without generating large revision histories of little or no value.
Specialise Section
This optional section indicates that the archetype is a specialisation of some other archetype, whose identity must be given. Only one specialisation parent is allowed, i.e. an archetype cannot 'multiply-inherit' from other archetypes. An example of declaring specialisation is as follows:
archetype (adl_version=2.0.5; rm_release=1.0.2)
openEHR-EHR-OBSERVATION.cbc.v1.0.0
specialise
openEHR-EHR-OBSERVATION.haematology.v1
Here the identifier of the new archetype is derived from that of the parent by adding a new section to its domain concept section. See the ARCHETYPE_ID definition in the identification package in the openEHR Support IM specification.
Note that both the US and British English versions of the word "specialise" are valid in ADL.
The following syntax validity rule applies in the specialisation section:
SASID: archetype specialisation parent identifier validity. for specialised artefacts, the identifier of the specialisation parent must conform to the ARCHETYPE_ID identifier syntax defined in the openEHR Support IM Specification.
Language Section
The language section includes meta-data describing the original language in which the archetype was authored (essential for evaluating natural language quality), and the total list of languages available in the archetype. There can be only one original_language . The translations list must be updated every time a translation of the archetype is undertaken. The following shows a typical example.
language
original_language = <[iso_639-1::en]>
translations = <
["de"] = <
language = <[iso_639-1::de]>
author = <
["name"] = <"Frederik Tyler">
["email"] = <"freddy@something.somewhere.co.uk">
>
accreditation = <"British Medical Translator id 00400595">
>
["ru"] = <
language = <[iso_639-1::ru]>
author = <
["name"] = <"Nina Alexandrovna">
["organisation"] = <"Dostoevsky Media Services">
["email"] = <"nina@translation.dms.ru">
>
accreditation = <"Russian Translator id 892230-3A">
>
>
Archetypes must always be translated completely, or not at all, to be valid. This means that when a new translation is made, every language dependent section of the description and terminology sections has to be translated into the new language, and an appropriate addition made to the translations list in the language section.
| some non-conforming ADL tools in the past created archetypes without a language section, relying on the terminology section to provide the original_language (there called primary_language) and list of languages (languages_available). In the interests of backward compatibility, tool builders should consider accepting archetypes of the old form and upgrading them when parsing to the correct form, which should then be used for serialising/saving. |
Description Section
The description section of an archetype contains descriptive information, or what some people think of as document "meta-data", i.e. items that can be used in repository indexes and for searching. The ODIN syntax is used for the description, as in the following example.
description
original_author = <
["name"] = <"Dr J Joyce">
["organisation"] = <"NT Health Service">
["date"] = <2003-08-03>
>
lifecycle_state = <"initial">
resource_package_uri = <"http://www.aihw.org.au/data_sets/diabetic_archetypes.html">
details = <
["en"] = <
language = <[iso_639-1::en]>
purpose = <"archetype for diabetic patient review">
use = <"used for all hospital or clinic-based diabetic reviews,
including first time. Optional sections are removed according to the particular review">
misuse = <"not appropriate for pre-diagnosis use">
original_resource_uri = <"http://www.healthdata.org.au/data_sets/diabetic_review_data_set_1.html">
other_details = <...>
>
["de"] = <
language = <[iso_639-1::de]>
purpose = <"Archetyp für die Untersuchung von Patienten mit Diabetes">
use = <"wird benutzt für alle Diabetes-Untersuchungen im
Krankenhaus, inklusive der ersten Vorstellung. Optionale
Abschnitte werden in Abhängigkeit von der speziellen
Vorstellung entfernt.">
misuse = <"nicht geeignet für Benutzung vor Diagnosestellung">
original_resource_uri = <"http://www.healthdata.org.au/data_sets/diabetic_review_data_set_1.html">
other_details = <...>
>
>
A number of details are worth noting here. Firstly, the free hierarchical structuring capability of ODIN is exploited for expressing the 'deep' structure of the details section and its subsections. Secondly, the ODIN qualified list form is used to allow multiple translations of the purpose and use to be shown. Lastly, empty items such as misuse (structured if there is data) are shown with just one level of empty brackets. The above example shows meta-data based on the openEHR Archetype Object Model (AOM).
The description section is technically optional according to the AOM, but in any realistic use of ADL for archetypes, it will be required. A minimal description section satisfying to the AOM is as follows:
description
original_author = <
["name"] = <"Dr J Joyce">
["organisation"] = <"NT Health Service">
["date"] = <2003-08-03>
>
lifecycle_state = <"initial">
details = <
["en"] = <
language = <[iso_639-1::en]>
purpose = <"archetype for diabetic patient review">
>
>
Deprecated Sections
Concept Section
A 'concept' section was required up until ADL 1.4. In ADL 1.5, the concept section is deprecated, but allowed, enabling ADL 1.4 archetypes to be treated as valid. It will be removed in a future version of ADL, since it is completely redundant.
All archetypes represent some real world concept, such as a "patient", a "blood pressure", or an "ante-natal examination". The concept is always coded, ensuring that it can be displayed in any language the archetype has been translated to. A typical concept section is as follows:
concept [at0000] -- haematology result
In this concept definition, the term definition of [at0000] is the proper description corresponding to the "haematology-cbc" section of the archetype identifier above.
The following syntax validity rule applies to the concept section, if present, allowing parsers to correctly ignore it:
SACO: archetype concept validity: if a concept section is present, it must consist of the 'concept' keyword and a single local term.
Definition Section
The definition section contains the main formal definition of the archetype, and is written in the Constraint Definition Language (cADL). A typical definition section is as follows:
definition
OBSERVATION[id1] ∈ { -- blood pressure measurement
name ∈ { -- any synonym of BP
DV_CODED_TEXT[id2] ∈ {
defining_code ∈ {
CODE_PHRASE[id3] ∈ {[ac1]}
}
}
}
data ∈ {
HISTORY[id4] ∈ { -- history
events cardinality ∈ {1..*} ∈ {
POINT_EVENT[id5] occurrences ∈ {0..1} ∈ { -- baseline
name ∈ {
DV_CODED_TEXT[id6] ∈ {
defining_code ∈ {
CODE_PHRASE[id7] ∈ {[ac2]}
}
}
}
data ∈ {
ITEM_LIST[id8] ∈ { -- systemic arterial BP
items cardinality ∈ {2..*} ∈ {
ELEMENT[id9] ∈ { -- systolic BP
name ∈ { -- any synonym of 'systolic'
DV_CODED_TEXT[id10] ∈ {
defining_code ∈ {
CODE_PHRASE[id11] ∈ {[ac2]}
}
}
}
value ∈ {
DV_QUANTITY[id12] ∈ {
magnitude ∈ {|0..1000|}
property ∈ {[properties::944]} -- "pressure"
units ∈ {[units::387]} -- "mm[Hg]"
}
}
}
ELEMENT[id79] ∈ { -- diastolic BP
name ∈ { -- any synonym of 'diastolic'
DV_CODED_TEXT[id14] ∈ {
defining_code ∈ {
CODE_PHRASE[id15] ∈ {[ac3]}
}
}
}
value ∈ {
DV_QUANTITY[id16] ∈ {
magnitude ∈ {|0..1000|}
property ∈ {[properties::944]} -- "pressure"
units ∈ {[units::387]} -- "mm[Hg]"
}
}
}
ELEMENT[id17] occurrences ∈ {0..*} ∈ {*} -- unknown new item
}
...
This definition expresses constraints on instances of the types ENTRY , HISTORY , EVENT , ITEM_LIST , ELEMENT , QUANTITY , and CODED_TEXT so as to allow them to represent a blood pressure measurement, consisting of a history of measurement events, each consisting of at least systolic and diastolic pressures, as well as any number of other items (expressed by the [id17] "any" node near the bottom).
Design-time and Run-time paths
All archetype object constraint nodes require a node identifier. When data are created according to the definition section of an archetype, the archetype node identifiers can be written into the data, providing a reliable way of finding data nodes, regardless of what other runtime names might have been chosen by the user for the node in question. There are two reasons for doing this. Firstly, querying cannot rely on runtime names of nodes (e.g. names like "sys BP", "systolic bp", "sys blood press." entered by a doctor are unreliable for querying); secondly, it allows runtime data retrieved from a persistence mechanism to be re-associated with the cADL structure which was used to create it.
An example which shows the difference between design-time meanings associated with node identifiers and runtime names is the following, from a SECTION archetype representing the problem/SOAP headings (a simple heading structure commonly used by clinicians to record patient contacts under top-level headings corresponding to the patient’s problem(s), and under each problem heading, the headings "subjective", "objective", "assessment", and "plan").
SECTION[id1] matches { -- problem
name matches {
DV_CODED_TEXT[id2] matches {
defining_code matches {[ac1]} -- any clinical problem type
}
}
}
In the above, the node identifier [id1] is assigned a meaning such as "clinical problem" in the archetype terminology section. The subsequent lines express a constraint on the runtime name attribute, using the internal code [ac1] . The constraint [ac1] is also defined in the archetype terminology section with a formal statement meaning "any clinical problem type", which could clearly evaluate to thousands of possible values, such as "diabetes", "arthritis" and so on. As a result, in the runtime data, the node identifier corresponding to "clinical problem" and the actual problem type chosen at runtime by a user, e.g. "diabetes", can both be found. This enables querying to find all nodes with meaning "problem", or all nodes describing the problem "diabetes". Internal [acNNNN] codes are described in [Local Constraint Codes].
Rules Section
the rules section as described below should not yet be considered stable, and it is expected that the use of inline paths will be replaced by separate bindings of symbolic variables to paths, along with rules for the semantics of such bindings.
|
The rules section in an ADL archetype contains statements representing assertions and computational expressions that relate to the entire archetype. Assertions in the rules section represent constraints that are not possible within the block structure of the definition section. Any constraint that references more than one property is in this category, as are constraints or expressions containing mathematical or logical formulae. Archetype rules are a subset of the openEHR Expression Language, described in the openEHR Expression Language specification.
Assertions
Semantically, an assertion is a first order predicate logic statement which can be evaluated to a Boolean result at runtime. Objects and properties are referred to using paths within an assertion.
A reference to an object in data, including a leaf value, is expressed using an archetype path. All such paths are absolute (i.e. contain a leading '/') and are understood to be with respect to the root of the current archetype.
Types of assertions used in archetypes include:
-
arithmetic identities: constraints involving more than one node in an archetype, such as an assertion stating that the sum of the five 0-2 value scores in an Apgar test (heartrate, breathing, muscle tone, reflex, colour) is equal to the Apgar total, recorded in a sixth node;
-
mathematical formulae: constraints involving a mathematical formulae that relate various items together, e.g. the pulse pressure and mean arterial pressure formulae used in cardiology;
-
value-dependent existence: in some cases optional archetype nodes are intended to be mandatory (or occasionally non-existent) if some other element within the same archetype has a specific value, for example a sub-tree that records details of 'tobacco use' may be considered mandatory if an earlier Boolean node representing 'tobacco user?' has a positive value.
Each of these is described below.
Arithmetic Identities
Assertions can be stated that make explicit intended arithmetic identities among value nodes in an archetype. For example, in an archetype representing Apgar Score, five values should sum to equal the total. This can be expressed as the following assertions:
rules
$respiratory_effort: Integer := /data[id3]/events[id4]/data[id2]/items[id10]/value[id39]/value
$heart_rate: Integer := /data[id3]/events[id4]/data[id2]/items[id6]/value[id40]/value
$muscle_tone: Integer := /data[id3]/events[id4]/data[id2]/items[id14]/value[id41]/value
$reflex_irritability: Integer := /data[id3]/events[id4]/data[id2]/items[id18]/value[id42]/value
$skin_colour: Integer := /data[id3]/events[id4]/data[id2]/items[id22]/value[id43]/value
$apgar_score: Integer := /data[id3]/events[id4]/data[id2]/items[id26]/value[id44]/magnitude
Apgar_total: $apgar_score = $respiratory_effort + $heart_rate + $muscle_tone + $reflex_irritability + $skin_colour
Mathematical Formulae
The following ADL example shows a rules section containing the Blood Pressure MAP and Pulse pressure formulae expressed using references to the relevant input and output values in the archetype.
rules
$pulse_pressure: Real := /data[id2]/events[id7]/data[id4]/items[id1008]/value/magnitude
$mean_arterial_pressure: Real := /data[id2]/events[id7]/data[id4]/items[id1007]/value/magnitude
$systolic_value: Real := /data[id2]/events[id7]/data[id4]/items[id5]/value/magnitude
$diastolic_value: Real := /data[id2]/events[id7]/data[id4]/items[id6]/value/magnitude
MAP_valid: $mean_arterial_pressure = $diastolic_value + 0.33 * ($systolic_value - $diastolic_value)
pulse_pressure: $pulse_pressure = $systolic_value - $diastolic_value
These assertions can be visualised in tools, e.g. as follows in the ADL Workbench.
More complex assertions make use of variable sub-paths and the for_all operator to check multiple values in a repeated structure, as in this example.
-- ensure that each mean arterial pressure value in a series of blood pressures
-- has the correct value.
for_all $event : /data[id2]/events
$event/data[id4]/items[id1007]/value/magnitude =
$event/data[id4]/items[id6]/value/magnitude + 0.33 *
($event/data[id4]/items[id5]/value/magnitude - $event/data[id4]/items[id6]/value/magnitude)
| the evolution toward separation of data context paths and expressions will enable this kind of expression to be made more readable in future. |
Value-dependent Existence
One specific type of logical expression that is commonly required in archetypes is used to state the mandation (or otherwise) of certain data points as conditional on another specific data point. An example is an archetype that documents Tobacco use. This will normally contain a data point representing substance 'use status', which may have values such as 'never used', 'occasional user', 'frequent user', etc; and another set of data points quantifying the use. Clearly, if the 'use status' is 'never', the latter set of data is not needed; conversely, if 'use status' is any other value, the quantifying data items are needed. To make them mandatory if the 'use status' is any value other than 'never used', rules like the following can be used.
rules
$substance_use_status: Boolean := /data[id2]/items[id3]/value[id18]
$substance_use_data: Object_ref := /data[id2]/items[id8|details of use|]
Substance_use: $substance_use_status /= [at17|never used|] implies
exists /data[id2]/items[id8|details of use|]
Computational Statements
The rules section may also include computational statements that can be used to compute values for specific fields, generally based on some published algorithm, rather than just asserting a relationship between various fields. The following shows a set of statements similar to the example above, but with the field bound to $mean_arterial_pressure now having its value set, not just tested. The assignment operator (:=) is used to achieve this.
rules
$mean_arterial_pressure: Real := /data[id2]/events[id7]/data[id4]/items[id1007]/value/magnitude
$systolic_value: Real := /data[id2]/events[id7]/data[id4]/items[id5]/value/magnitude
$diastolic_value: Real := /data[id2]/events[id7]/data[id4]/items[id6]/value/magnitude
$mean_arterial_pressure := $diastolic_value + 0.33 * ($systolic_value - $diastolic_value)
RM Overlay Section
Most content in an archetype consists of constraints expressed as an attribute/object structure based on a Reference Model. However, sometimes related meta-data need to be stated with respect to unconstrained RM attributes and paths. Such statements can be made in the rm_overlay section of an archetype, which is designed to be extensible. Specific categories of statement or constraint relating to RM attribute paths can be stated within dedicated sub-sections.
RM Visibility
One of the basic characteristics of any underlying information model which may be archetyped is that its class attributes are already named, typically in English, if the model is internationally shared or standardised. Archetyping solves effective renaming and language-independence of object nodes, via the mechanism of id-codes, but attribute names are by default unchangeable and mono-lingual. Experience in archetype-based modelling has shown that renaming of RM attributes within the context of an archetype is a common need, usually because the attribute name chosen in the original model is not sufficiently specific for some users of a particular archetype. An example is the openEHR class COMPOSITION, which has an attribute composer. For particular archetypes corresponding to specific sub-domains in healthcare, or specific geographies, a preferable name may be author; additionally, any such name (even the original) may be needed in multiple languages.
In ADL, re-labelling of RM attributes is called aliasing, and is achieved by mentioning an RM attribute path in the archetype and associating an alias with it, in the form of an at-code, defined according to the usual rules of specialisation. Aliasing may apply to any valid RM path in the archetype, i.e. any path through RM objects referenced in the archetype. If archetype-specific nodes are referenced in a path, the settings relate to those paths only in the data, but if not, the settings relate to any matching RM path through the data.
A second need, related to the above, is that archetype modellers sometimes need to know what elements are already in an information model, so they don’t try to remodel them again as redundant object nodes. In a simple implementation of an archetype authoring tool, attributes not so far archetyped will be all hidden, perhaps with a possibility of showing them all. However, commonly, finer-grained control is needed whereby particular attributes, possibly only on particular object nodes need to be made visible in a modelling tool, in order to indicate they need not be modelled.
For this reason a 'show' marker can be associated with the path of an non-constrained RM attribute, causing it to be made visible in a modelling tool. Taking into account archetype and template specialisation, it should also be possible to add a 'hide' marker, in order to hide an attribute marked as 'show' in a specialisation parent. It has also been found by experience that sometimes a constrained RM attribute from a parent archetype needs to be hidden in a specialisation child. Thus, the general case is that 'hide' and 'show' markers can be associated with any RM attribute path (constrained or unconstrained) in the archetype.
Since both of these needs relate to the visibility of RM attributes in an archetype, and are specfied in terms of RM attribute paths, an rm_overlay sub-section called rm_visibility is used to specify them. The following example illustrates the use of this section to force visibility and aliasing of one attribute, and hiding of another attribute within an archetype.
rm_overlay
rm_visibility = <
["/path/to[id4]/archetype/node[id213]/path/to/rm/attribute"] = <
visibility = <"show">
alias = <[local::at12]>
>
["/path/to[id5]/archetype/node[id64]/path/to/rm/attribute"] = <
visibility = <"hide">
>
>
terminology
term_definitions = <
["en"] = <
["at12"] = <
text = <"name in English">
description = <"description in English">
>
...
>
["de"] = <
["at12"] = <
text = <"name in German">
description = <"description in German">
>
...
>
>
Terminology Section
Overview
This section describes the syntax of the terminology section of an archetype. The following section, [Terminology Integration] describes the semantics.
The terminology section of an archetype is expressed in ODIN, and is where codes representing node identifiers, constraints on coded term values, and bindings to terminologies are defined. Linguistic language translations are added in the form of extra blocks keyed by the relevant language. The following example shows the general layout of this section.
terminology
term_definitions = <
["en"] = <
["id1"] = <...>
["at1"] = <...>
["ac1"] = <...>
>
["de"] = <
["id1"] = <...>
["at1"] = <...>
["ac1"] = <...>
>
>
value_sets = <
["ac1"] = <
id = <"ac1">
members = <"at1", "at2", "at3", ...>
>
>
term_bindings = <
["snomed_ct"] = <
["id4"] = <...>
["ac1"] = <...>
...
>
>
Term_definitions Sub-section
The term_definitions section is mandatory, and must contain definitions for all terms requiring them, in all translations in use in the archetype. Terms requiring definitions include:
-
all id-codes of object nodes under a container attribute or which are multiple alternative siblings under a single-valued attribute
-
all at-codes
-
all ac-codes
The following example shows an extract from the English and German term definitions for the archetype local terms in a problem/SOAP headings archetype. Each term is defined using a structure of name/value pairs, and must at least include the names "text" and "description", which correspond to the usual rubric and full definition found in terminologies like SNOMED CT. Each term object is then included in the appropriate language list of term definitions, as shown in the example below.
term_definitions = <
["en"] = <
["id1"] = <
text = <"problem">
description = <"The problem experienced by the subject of care to which the contained information relates">
>
["id2"] = <
text = <"problem/SOAP headings">
description = <"SOAP heading structure for multiple problems">
>
...
["id3"] = <
text = <"plan">
description = <"The clinician's professional advice">
>
>
["de"] = <
["id1"] = <
text = <"klinisches Problem">
description = <"Das Problem des Patienten worauf sich diese Informationen beziehen">
>
["id2"] = <
text = <"Problem/SOAP Schema">
description = <"SOAP-Schlagwort-Gruppierungsschema fuer mehrfache Probleme">
>
["id3"] = <
text = <"Plan">
description = <"Klinisch-professionelle Beratung des Pflegenden">
>
>
>
In some cases, term definitions may have been lifted from existing terminologies (only a safe thing to do if the definitions exactly match the need in the archetype). To indicate where definitions come from, a "provenance" tag can be used, as follows:
term_definitions = <
["en"] = <
...
["id3"] = <
text = <"plan">
description = <"The clinician's professional advice">
provenance = <"ACME_terminology(v3.9a)">
>
...
>
>
Note that this does not indicate a binding to any term, only the origin of its definition. Bindings are described below.
The term_definitions section also includes definitions for archetype-local constraint codes, which are of the form [acN] in the definition part of an archetype. Each such code refers to a terminology 'value set', i.e. a set of possible terms that could be used as the value of the data item being constrained. These constraints are defined in two parts. First, the ac code itself is defined - this names the value set. For example:
--- within a specialist diagnosis archetype
term_definitions = <
["en"] = <
...
["ac1"] = <
text = <"type of hepatitis">
description = <"any term which means a kind of viral hepatitis">
>
...
>
>
--- within a blood pressure measurement archetype
term_definitions = <
["en"] = <
...
["ac3"] = <
text = <"patient position">
description = <"patient position for blood pressure measurement">
>
>
>
Value_sets Sub-section
The second part is the value set contents. This can be defined either as an 'internal' value set consisting of at-codes, or else as being a value set defined in an external terminology and referenced via a binding. An internal value set is defined using an entry in the value_sets sub-section for the ac code, containing a list of at-code member values. Each of those members must have its own definition in the term_definitions section. The following shows the structures required.
terminology
term_definitions = <
["en"] = <
["ac1"] = <...>
["at1"] = <...>
["at2"] = <...>
["at3"] = <...>
>
>
value_sets = <
["ac1"] = <
id = <"ac1">
members = <"at1", "at2", "at3", ...>
>
>
Term_bindings Sub-section
A value set and/or its constituent terms may also have 'bindings' to externally defined terms and values sets. Object node id-codes may also have bindings, establishing external codings for the names of elements in an archetype. Binding is achieved in the term_bindings sub-section. Bindings are grouped under the target terminology they relate to, and each one consists of a key and a target. There are variations of each.
Keys can be any one of:
-
for id-coded object nodes:
-
just the id-code, e.g.
id4; -
an object node absolute path terminating in an id-code, e.g.
"/data[id2]/events[id3]/data[id1]/item[id4]";
-
-
an at-code;
-
an ac-code.
Binding targets are expressed as URIs that follow the model for terminology URIs published by IHTSDO [IHTSDO_URIs] or a similar model, in the case of terminologies other than SNOMED CT. Because URIs are native types in ADL/ODIN, they do not need quotes.
Bindings may be defined for a given set of terms for more than one terminology, enabling the different bindings to be used in different contexts, e.g. hospital deployment versus aged care.
The following is an extract from a test archetype based on the openEHR Apgar archetype, showing the different types of bindings:
--
-- Derived from openEHR-EHR-OBSERVATION.term_bindings_paths_use_refs.v1.adls
--
term_definitions = <
["en"] = <
["id1"] = <
text = <"Apgar score">
description = <"Clinical score derived from assessment of respiratory effort, heart rate, reflex irritability, muscle tone and skin colour.">
>
["id4"] = <
text = <"1 minute">
description = <"Apgar score 1 minute after birth.">
>
["id6"] = <
text = <"Heart Rate">
description = <"Recording of the infant's heart rate.">
>
["id26"] = <
text = <"Total">
description = <"The sum of the 5 ordinal scores for each component parameter.">
>
...
["at7"] = <
text = <"Absent">
description = <"No heart beat is seen, felt or heard.">
>
...
>
>
term_bindings = <
["snomed_ct"] = <
["/data[id3]/events[id4]/data[id2]/items[id26]"] = <http://snomedct.info/id/169895004> -- Apgar score at 1 minute
["id26"] = <http://snomedct.info/id/249228009> -- Total Apgar score (observable entity)
>
["loinc"] = <
["/data[id3]/events[id4]"] = <http://loinc.org/id/48334-7> -- 1-minute Apgar panel
["/data[id3]/events[id4]/data[id2]/items[id6]"] = <http://loinc.org/id/32407-9> -- 1 minute Apgar Heart rate
["at7"] = <http://loinc.org/id/LA6716-0> -- No heart rate
...
>
["umls"] = <
["id1"] = <http://umls.nlm.edu/id/C124305> -- apgar result
["id6"] = <http://umls.nlm.edu/id/C234305> -- cardiac score
>
>
The reason for code and path keys for id-codes is to enable two types of id-code bindings. A binding to a simple code such as id26|Total|, above, means that the bound term (referred to by the URI http://snomedct.info/id/249228009) has a context-independent correlation to the id-code. However, a 'pre-coordinated' code such as SNOMED CT 169895004|Apgar score at 1 minute| cannot be bound just to id26|Total|, but rather to the node representing the 1-minute total, i.e. at the path /data[id3]/events[id4|1 minute|]/data[id2]/items[id26]. Such paths can be considered as equivalent to a 'post-coordinated' code, and thus the binding establishes a correspondence between an internal post-coordination and an external pre-coordinated code.
In the example shown below, the id4 code identifies a 'temperature' node in an archetype, and the codes id3, id5, id6 etc correspond to various times such as 'any', '1-hour average', '1-hour maximum' and so on. Some terminologies (notably LOINC, the laboratory terminology in this example) define pre-coordinated codes, such as '1 hour body temperature'; these clearly correspond not to single codes such as id4 in the archetype, but to whole paths.
term_bindings = <
["LNC205"] = < -- LNC205 is a namespace corresponding to LOINC 205
["/data[id2]/events[id3]/data[id1]/item[id4]"] = <http://loinc.org/id/8310-5>
["/data[id2]/events[id5]/data[id1]/item[id4]"] = <http://loinc.org/id/8321-2>
["/data[id2]/events[id6]/data[id1]/item[id4]"] = <http://loinc.org/id/8311-3>
>
>
Bindings to external value sets are also included in the bindings section, also as URIs:
term_bindings = <
["snomed_ct"] = <
["ac1"] = <http://snomed.info/id/123456789>
["ac2"] = <http://snomed.info/id/987654321>
>
>
In this example, each local constraint code is formally defined to refer to a value set whose identifier is known in the SNOMED CT terminology.
The next section describes the semantics of term constraining, value sets and binding in some detail.
Deprecated Terminology Section Features
At-codes as identifiers
In ADL 2, at-codes are used only as code values, not node identifiers. Id-codes are used for the latter purpose. This provides a clear separation between node 'names' and node 'values', for the kind of nodes whose values are coded terms.
Terminologies_avalable sub-section
In ADL 1.4, a terminologies_available header statement was required to identify all terminologies for which term_bindings sections have been written. For example:
terminologies_available = <"snomed_ct", "loinc">
This is no longer required. In archetypes that have it, it is ignored, and should not be included in ADL 2 or later syntax output serialisation.
Separated defnitions and bindings sub-sections
In ADL 1.4, there were two separate definitions sections, term_definitions and constraint_definitions, used to defined at and ac codes respectively. In ADL 2, these are merged into one term_definitions section, containing the definitions for id, at and ac codes. Similarly there were bindings sections, term_bindings ` and `constraint_bindings. These have been merged into one term_bindings section.
Term_definitions Structure
The following shows the structure of the terminology section used in ADL 1.4 archetypes. The extra items attribute notes are removed by ADL 2 tools, and should be considered deprecated.
term_definitions = <
["en"] = <
items = <
["at0001"] = <...>
["at0002"] = <...>
>
>
>
Annotations Section
The annotations section of an archetype or template provides a place for ad hoc node-level meta-data to be added. This can be used during the design phase to track dependencies, design decisions, and specific resource references.
Annotations are divided into major named groups. Currently a documentation group is defined, intended for documentary (i.e. human-readable text) annotations. Other groups are likely to be defined in the future for various kinds of processing, where the annotations may be formal expressions or code fragments.
Each annotation is keyed by a path, and may have any number of tagged elements. The path key can either be:
-
the path of the archetype node being annotated, or
-
a pure RM path
The usual case is the first, since annotations mainly relate to nodes in an archetype. However, it may be the case that within the context of the archetype, there is a need to refer to a part of the Reference Model type on which the archetype is based (OBSERVATION, EVALUATION etc) that is not constrained within the archetype, in order to indicate how it is to be understood within that archetyped structure (remember that an archetype does not need to constrain all possible paths of an information model class, but that such structures may nevertheless be instantiated).
A typical annotations section looks as follows (archetype source). The /subject path is a non-constrained 'RM path'.
--
-- Extract from test archetype openEHR-EHR-EVALUATION.annotations_1st_child.v1.0.0
--
definition
EVALUATION[id1.1] matches { -- Exclusion statement - Adverse Reaction
/data[id2]/items matches {
...
ELEMENT[id0.8] occurrences matches {0..1} matches { -- No known allergic reaction to
value matches {
DV_TEXT[id0.6]
}
}
...
ELEMENT[id0.10] occurrences matches {0..1} matches { -- No known intolerance to
value matches {
DV_TEXT[id0.8] -- No known allergic reaction to
}
}
}
}
terminology
...
annotations
documentation = <
["en"] = <
["/subject"] = <
["design note"] = <"xxxxxx">
>
["/data[id2]/items[id0.8]"] = <
["design note"] = <"this is a design note on allergic reaction">
["requirements note"] = <"this is a requirements note on allergic reaction">
["medline ref"] = <"this is a medline ref on allergic reaction">
>
["/data[id2]/items[id0.10]"] = <
["design note"] = <"this is a design note on intelerance">
["requirements note"] = <"this is a requirements note on intolerance">
["national data dictionary"] = <"NDD ref for intolerance">
>
>
>
Because annotations are defined as a separate section, they can be easily removed in production versions of an archetype or template, and ignored in the generation of digital signatures.