We're updating the issue view to help you get more done. 

Enable replacement of an internal code set with another in templating


The use case is to complete replace an internal code set with another external one. For example, in the OBSERVATION.laboratory_test_result archetype (https://ckm.openehr.org/ckm/#showArchetype_1013.1.2191), the “Overall test status” elements has internal codes that work for a significant number of cases, and we’d like to keep them in there.

In a Norwegian use case however, the entire internal code set would be replaced by this code set: https://volven.no/produkt.asp?id=369953&catID=3&subID=8. To be able to do this, we have to be able to in the template constrain out the DV_CODED_TEXT data type with the internal value set of the archetype, constrain the remaining DV_TEXT to DV_CODED_TEXT, and add this code set to that data type.

Example: the following is in an archetype:

ELEMENT[at0073] occurrences matches {0..*} matches { – Overall test status
value matches {
DV_CODED_TEXT matches {
defining_code matches {
at0107, – Registered
at0037, – Partial
at0120, – Preliminary
at0038, – Final
at0040, – Amended
at0115, – Corrected
at0119, – Appended
at0074, – Cancelled
at0116] – Entered in error
DV_TEXT matches {*}

And modeller wants to replace in template with a totally different (unrelated) set: https://volven.no/produkt.asp?id=369953&catID=3&subID=8

1 Revidert
2 Foreløpig
3 Endelig
4 Tillegg
5 Henvisning registrert
6 Prosedyrer registrert/planlagt
7 Tildelt time
8 Undersøkelse gjennomført
9 Diktert
10 Skrevet (usignert svar foreligger)
11 Signert
12 Korrigert (usignert tilleggsbeskrivelse foreligger)
13 Signert korrigert/tilleggsbeskrivelse foreligger
14 Undersøkelse slettet
15 I prosess

This is a modelling pattern that’s in extensive use in published archetypes, and which is possible to do in Template Designer.

One obvious interpretation of the above is that an internal value set is being replaced by an external one, whichh can be done via binding, as described in 'alternative #3' in this part of the ADL2 spec. (https://specifications.openehr.org/releases/AM/latest/ADL2.html#_terminology_integration). Then read the following section, 8.3

One problem is that the replacement valueset may be externally defined logically (e.g. on a web page), but is not formalised into a value set that is available in a terminology service.

The current approach has been to model the replacement value set within the archetype as well.

To accommodate this in ADL2, this would mean allowing external value sets to be defined inside an archetype or template.



Change Description


Impact Analysis






Thomas Beale


Affects versions

AM version 2.0.6