Allowing open name constraint to support formal FOLDER models, why not?

Current modeling tools don’t allow to add constraints to the name field like we can add constraints to any other field on a LOCATABLE subclass. Names are special. Most of the time those just have an implicit constraint in the ontology part of the archetype, but in some cases names are constrained, and in those cases the only option is to set it as a DV_CODED_TEXT with one or more options.

  1. Note modeling tools don’t allow alternative constraints for the name, that is: two sibling DV_TEXT/DV_CODED_TEXT constraints, and,
  2. Tools don’t allow open constraints, like:

```adl
ELEMENT[at0007] occurrences matches {0..1} matches {
name matches {
DV_TEXT matches {*}
}
}
```
Though in other attributes of the RM we can do both things (alternatives).

The second one, the open constraint for the name, is specially useful if you want to formally model FOLDERs, since you need to allow FOLDERs to have any name, and with the current capabilities the only option is to set a DV_CODED_TEXT with all the possible options, which is not practical.

Another observation is that Archetype Designer and other modeling tools do not support archetypes for FOLDERs, tough I think LinkEhr does support it because it’s pretty generic, though I’m not sure if it supports the constraints I mentioned above (ping @damoca @yampeku).

If I would create a modeling tool tomorrow, I would allow both types of constraints in all the RM classes, EHR and DEMOGRAPHIC, but why isn’t that possible today? Is it a matter of self-imposed constraints from clinical modelers or we just assume that FOLDERs don’t need archetypes?

2 Likes

Apologies if I’m misunderstanding your intent, but is this in any way related to this topic? Coding element and event names - Specifications - openEHR

We’ve asked for the ability to use DV_CODED_TEXT instead of just DV_TEXT in node names for a while, but AFAIK not much has come out of it.

Yes, as LinkEHR is essentially an editor based on the AOM, everything that should be technically possible, it is possible using the generic editor. Including FOLDER archetypes and any valid alternative for all attributes, including the name.

BTW. Although it is no longer actively developed, this year is the 20th anniversary of LinkEHR. Probably we should celebrate it :smiling_face_with_tear:

4 Likes

@siljelb for context, a name: DV_TEXT attributes in the RM (which is an attribute of all LOCATABLE subclasses, from COMPOSITION to CLUSTER and ELEMENT, passing through OBSERVATION and EVENT, etc), by the specs is just a normal attribute that can be constrained.

By the AOM, for a DV_TEXT attribute you can:

  1. Define a single DV_TEXT constraint, which could use the C_STRING ( Archetype Object Model 1.4 (AOM1.4) ) constraint on the DV_TEXT.value, with all possible primitive constraints.
  2. Define a single DV_CODED_TEXT constraint, which can use the C_CODE_PHRASE constraint (from the archetype profile spec), which is a subclass of C_DOMAIN_TYPE from the AOM 1.4 spec ( Archetype Object Model 1.4 (AOM1.4) ).
  3. Have multiple alternative constraints (since name is a single attribute, it will be constrained by the C_SINGLE_ATTRIBUTE class from AOM (link above), then in its children you can have two or more constraints for DV_TEXT (like in 1. but two siblings that are alternatives) or two, or more, DV_CODED_TEXT alternatives or a mix of DV_TEXT and DV_CODED_TEXT constraint alternatives.

In that list, what you are asking for is point 2. which is actually supported by the Archetype Designer, and IIRC by the Archetype Editor too, also @damoca mentioned that’s supported by LinkEHR. I have created this archetype yesterday in the AD to test queries in Atomik:

openEHR-EHR-OBSERVATION.alternative_name_constraints.v0.adl (3.1 KB)

Though I tested on the Archetype Designer, where 1. and 3. are not possible.

Point 1. is important because on some cases we might want to allow “any” name, which is in the case of the FOLDER, the problem is that FOLDERs are not normally constrained by archetypes, and formally they should, because: a. FOLDERs are LOCATABLES and LOCATABLES are archetyped, again, we have a normal RM class that has special treatment, b. technically we have syntactic validation and semantic validation (against ADL and/or OPTS), not having an archetype or template formally linked to a FOLDER, makes them to be a special case in terms of validation. There is a real issue about having all this “special” cases, it makes the RM/AOM not really generic, adding complexity to implementations that need to handle a lot of things as exceptional/special cases (a FOLDER shouldn’t be different than a COMPOSITION in modeling or data management).

Point 3. is important because that’s what the AOM allows modelers to do, and if modeling tools don’t support what could be done anywhere else in the RM, we are constraining what modelers can do. It’s not a matter of “this won’t be used” it’s a matter of “if the openEHR specs allow this, we should allow it”, and I think that was the approach on LinkEHR, sadly it’s not being used by most modelers today.
Having alternative constraints basically says, for instance, we allow this DV_TEXT with these constraints … and we also allow this DV_CODED_TEXT with these constraints …, and the actual name in the data should comply with one of those types and constraints to be valid.

Side note:

What I realized is that while our RM claims to be generic, the LOCATABLE.name is a very special attribute, for which adding DV_TEXT constraints might not be possible because of the ontology: all names are defined by the nodeID in archetypes and the entry in the ontology with text and description, for each supported language. The problem is that the translation is not considered a normal constraint in AOM, it was just designed outside the AOM framework. This is a very deep realization: first, the AOM is not expressive enough to allow adding linguistic constraints (translations), and, second, we have special cases in our RM which are managed outside the ‘normal’ framework. If we were able to constrain any DV_TEXT node in the same way, and supporting linguistic constraints, our models would be truly generic. Just a thought.

Why not open source it to celebrate? I would love to take a look, and maybe run some AI to improve stuff.