OPT Generator
AM classes generated with the AM / RM Generator are used to read the OPT2 JSON files. The correct AM Release is used based on the information found in the OPT2.
Only a single line of code is needed to load an operational template:
This starts a cascade of fromJson() calls to read the entire JSON file:
...another level (loading 'original_language' from above):
...code for reading HashMaps with generic types:
(there are 10 pages of code like this - who would want to write this by hand?
...and maintain release specific changes for every release?)
openEHR SDK for Operational Templates (OPT)
The idea is to have native classes that can be used by developers without requiring them to know anything about openEHR.
Instead of giving them the OpenAPI schema and asking them to send data to the openEHR CDR, let them use simple classes in their favorite programming language they are used to work with. These classes (SDK) take care of everything openEHR related and can be used in “frontend” languages that web developers are familiar with.
The RM classes are also generated and are imported in the first line of the screenshot below. The RM release (e.g. 1.1.0 in this case) is automatically looked-up from the OPT.
A sample code of how OPT model class is used:
This is the BloodPressure class generated from the OPT:
There are 893 lines of similar classes - they stop when constrained RM data types are reached:
A sample code of how COMPOSITION model class is used:
This is the COMPOSITION class generated from the OPT:
This is an OBSERVATION class generated from the OPT for blood pressure showing how toJson() methods add overridden properties to the standard RM OBSERVATION class:
And this is the resulting JSON:
openEHR SDK for OPTs as Dart Code
Above are just a few screenshots. A complete SDK is available for the Vital signs template.
openEHR SDK for OPTs as JSON
In the SDK as a JSON you get all that was used for the above code as a nested (or flat) list of types (e.g. OO classes).
Builder
Learn more about generating openEHR applications
Computable Specifications
Learn more about openEHR AM / RM generator
Programming Language
Learn more about languages supported by the openEHR SDK generator