We are working on implementing an ADL parser in python so that we can use it to retrieve and validate data from our legacy database systems. We are facing some challenges implementing the description part. I can’t imagine we are the first to work on such a tool. Does anyone have any pointers / leads (in any scripting/programming language) that may help us?
Hi Mark!
There are ANTLR4 grammars available for ADL: openEHR-antlr4/combined/src/main/antlr at master · openEHR/openEHR-antlr4 · GitHub
You can use ANTLR4 to generate your ADL parser in Python: Download ANTLR
Hi @markbouts . It may help you if you provided a bit more detail regarding your use case, if you’re able to of course.
Which version of ADL? Data validation can be performed using archetypes in theory, but in practice there are downstream artefacts built from artefacts and these are usually used for data validation. This high level concept applies a bit differently to ADL versions, that’s why I’m asking.
I think the community may be able to help you by giving you feedback about your goals and assumptions if you’re able to share a bit more. That may save you more time than getting your hands on a Python parser
Re the Python parser itself, @borut.jures 's input would be where I’d start, so I won’t add anything on top of that.
One shortcut might be to use the Better web template format which you can generate from Archetype Designer for any template you create, or from the Better/Ehrbase APIs
This is a pretty simple json format which contains most of the validation constraints and node descriptions you might need.
This GitHub - freshehr/wt2docx: Asciidoc generator for Archetype Designer web templates is in Typescript but should give you an idea and has some examples of web templates.
I’d second @seref recommendation of the work done by @borut.jures asa great start pint but you might also want to contact @surfer who is behind crs4 repositories · GitHub . I canlt see anything there specifically about ADL parsing but Giovanni might know more.
Sorry, I can’t help unfortunately. We didn’t implement any ADL parser yet.
Sure @Seref,
We currently have a working prototype system that can retrieve and process data from several legacy database systems. While we are aware of aql and it’s purposes, we are currently bounded to these legacy database systems. Our system uses archetypes and GDL-defined rules to retrieve the necessary data. From there we can use that data for various CDS-like purposes implemented in python. Currently we only make use of the ontology part of the archetype to retrieve the data. However to ensure data validity, we also want to make use of the definition part of the ADL. This to make sure that the retrieved data adheres to some basic data constraints.
Our initial thought was to also use GDL-defined rules, however this adds to the complexity of our overall system. We therefore prefer to use the data contraints included in the archetype itself. This to keep our system more scalable and maintainable
Before creating something ourselves, we wanted to make sure we are not re-inventing the wheel. @borut.jures already gave a nice suggestion which we are currently looking into.
Our system currently uses version 1.4 archetypes, but we are not bound to it
Hi Mark,
Interesting stuff. Using GDL for this I’ve not encountered before.
Your usecase seems similar to what Zuyderland @Timeterror is working on. And also MUMC / Maastricht University @Pascal. Both are working on data extraction of legacy systems for secondary use (not decision support afaik).
I’ve you can show more details like code or architecture, I’d be curious and as you’ve seen the community is quite eager to help:)
Also the OpenAPI ITS spec could be interesting, it allows (careful which OpenAPI version/variant) generation of classes in many languages.