Fix archetypeNodeId pattern
Description
Activity
I’ve updated regular expression to accept more than 4 digits.
Latest version can be now checked at https://regex101.com/r/IX5KjF/8
This is also not clear for me.
I did not find the specs about it (perhaps I don't know where to look), other than the ANTLR syntax @Sebastian Garde mentioned above.
@Thomas Beale, according to current AM specs, should this syntax support more than 4 digits per level? (e.g. at12345 or at12345.67899.99999) ? If yes I need to change the regexp above around the (?:at|id)\d{1,4}(?:.\d{1,4})*
part.
So, do we need more than four digits supported? In the form proposed here, it is already a lot better than it was before - it now supports much more valid data, such as data derived from ADL 2 archetypes. So I wouldn’t mind adding my acceptance, but if we need more than four, it may be better to do that right away.
The 4-digit thing is ADL1.4, but even worse, only for top-level archetypes. Specialised archetypes can have codes like at0.3, at0.2.5 etc. This is one of the many problems I tried to fix with the more regular id-codes in ADL2. The id9999 special code for primitive nodes was just a specific code I thought would never be used for anything else. I have never been entirely happy with this solution (maybe it could have been id0, but I seem to remember finding a problem with that), but it seems to work ok. ANyway, id9999 will match any of the more general regex patterns.
id9999 is the node id of all C_PRIMITIVE_OBJECTS that do not have a node id, but yes, could be.
I found a patched from 2012-2013 definition of the archetypeNodeId type pattern.
Still need to investigate what was the initial problem at that time:
```
fix for archetypeNodeId (https://openehr.atlassian.net/browse/SPECPR-260#icft=SPECPR-260) - see support_im.pdf 4.3.10.1 Archetype ID Syntax
([a-zA-Z][\w_]-[\w][\w_][\w][\w_]\.[\w][\w_]([\w][\w_])\.v\d+(\.\d))|(at(0\.[0-9]{1,4}|[0-9]{4})(\.[0-9]{1,3}))
vs
([a-zA-Z]\w+([a-zA-Z]\w+){2}\.[a-zA-Z]\w+([a-zA-Z]\w+)\.v[1-9]\d)|(at(0\.[0-9]{1,4}|[0-9]{4})(\.[0-9]{1,3})*)
```
perhaps this might be rejected eventually
----------
final version can be checked at https://regex101.com/r/IX5KjF/5