Format of AT codes

Apologies if I have missed it in the documentation, but is there a stated rule for the format of AT codes?
I have looked but don’t see one, the class model seems to just say they are a string.

Sidestepping, specialisations at the moment are the codes always ATnnnn (e.g. 4 digit numeric part)?

The reason I ask is that ANTLR parser using the combined grammar (ADL 1.4) currently returns the AT codes in two parts the fixed ‘AT’ and then a number for the numeric part. To reconstitute the actual AT code I need to know how many zeroes to add.

I haven’t tried a specialised archetype ADL file yet, but I see from the documentation that codes such as ‘AT0.1’ can be encountered - that will be the next challenge.

Thanks for your help.

The at codes in ADL 1.4 archetypes are not entirely regular - it’s one of the things we fixed in ADL2 with the id codes.

The codes in a top-level archetype are of the 4-digit form (for no good reason!) while those in specialised archetypes are regular, i.e. at1004.1.5 or at0.1.2.

I think you are referring to the following lexer rules from OpenehrPatterns.g4:

// ---------- legacy ADL14 patterns -------
ADL14_AT_CODE : 'at' ADL14_CODE_STR ;
ADL14_AC_CODE : 'ac' ADL14_CODE_STR ;
fragment ADL14_CODE_STR : [0-9]+ ( '.' NUMBER )* ;

So that last line could probably be:

fragment ADL14_CODE_STR : [0-9][0-9][0-9][0-9] ( '.' NUMBER )*  | '0' ( '.' NUMBER )+;

I don’t have time to test this right now, but if you do, I think you will find it matches 4-digit top-level codes so that the string you get in the parser will not require any zero-filling; otherwise it matches codes of the form ‘at0…’.

This kind of annoyance is among the many reasons we defined ADL2 :wink:

See this page for some background on these codes.

1 Like

Thanks Thomas, I will amend the grammar and give it another go.