Good suggestion, it also matches the approach in Cambio’s form editor (see screenshot below) where each node used in a form is assigned a short default id (based on the template’s node name) that can be changed manually.
Just as in ADL Cambio’s rules (called actions) are collected in a single place (not attached to each node).
Edited at 18:00, adding info aboout Better:
In Better’s form editor the rules are anchored to a specific node but can read and modify any node (see “Method code equals Auscultation” in screenshot below), not just the node it is anchored to, so I guess ther rules are actually as free-standing as in Cambio’s solution
For template tools that do not handle rules (yet) we could then perhaps add an “id” annotation that will through post-processing create a symbol binding based on the path of the annotated node.
Edited: added the (namespace)prefix ‘a.’ to the examples below to reduce risk of name clashes and to make it work better in Ocean’s template designer tool. The letter ‘a’ being the first in the word ‘automation’
Example based on the structrue from post 13:
items
+--- tobacco user: Y/N <-- ANNOTATION POSITION A
+--- tobacco use details <-- ANNOTATION POSITION B
+--- amount per week
+--- cessation attempts
| +--- xxxx
+--- yyy
Annotation position | Annotation Key | Annotation value |
---|---|---|
A | a.id | tobacco_user |
B | a.rule | tobacco_user = ‘Y’ implies exists THIS |
Or if choosing to manually giving an ID to both nodes, more like below. Below an alternative rule version using the ADL2 syntax desctibed in [Archetype Definition Language 2 (ADL2)](https://section 7.11.2.2. (Value-dependent Existence)) and a cambio inspired one is also provided
Annotation position | Annotation Key | Annotation value |
---|---|---|
A | a.id | tobacco_user |
B | a.id | tobacco_details |
root of template? | a.rule.adl | tobacco_user = ‘Y’ implies exists tobacco_details |
root of template? | a.rule.adl2 | check tobacco_user = ‘Y’ implies defined (tobacco_details) |
root of template? | a.rule.cambio-style | tobacco_user == ‘Y’ ASSIGN tobacco_details.hidden = false OTHERWISE tobacco_details.hidden = true |
root of template? | a.rule.better-style | tobacco_user = ‘Y’ THEN tobacco_details show OTHERWISE tobacco_details hide |
In the Cambio/Better-style rows above, the CAPITALIZED words correspond to the rule section headers in the rule editors, see screenshots above. I skipped the first (constant) “WHEN” in order to sugest shorter syntax.