If a human wrote computable specifications then there is no need for another human to implement them in code. The code should be generated by a computer.

NeoEHR.com

Introduction

Computable Specifications

From my experience, modern applications cannot be written by hand anymore. There are 100s of similar web forms and components to write (and all the plumbing that is needed). Even if a team writes them by hand, they are hard to maintain and the application usually remains on old framework versions even before it is released.

When I was reading the openEHR architecture overview I couldn't stop thinking that many things could be generated from the computable specifications.

I decided to generate code to enable high performance scenarios - integrations, data transfer on the server-side and validations of data in the frontend applications to make it more responsive to the users. Data is also validated on the server-side.

openEHR specifications are detailed but also complex. Why risk introducing bugs while converting them into code? Why not generate as much code as possible?

Overview

Overview of the Generators

overview

BMM

Basic Meta Model

openEHR uses Basic Meta Model (BMM) files for the representation of object models. These files are found in the specifications-ITS-BMM repository.

All generators use these BMM files as their starting point. They are read directly from the repository.

BMM Parser reads the BMM files and prepares an in-memory model for the included object models. All generators use this in-memory model to get information about types, attributes,...

ODIN Parser is a library used by the BMM Parser and the ADL Parser.

ADL Parser reads the OPT2 files and prepares an in-memory model for the included operational templates. It converts OPT2 (ADL) to JSON.

AM / RM

AM / RM Models Generator

Using the in-memory AM / RM models the AM / RM Generator generates classes in a target programming language.

AM / RM Generator Code

am-rm-write-class

Generated AM classes:

ARCHETYPE Class Properties and Constructor

generators-am-archetype-properties

ARCHETYPE Class fromJson/toJson Methods

generators-am-archetype-serialization

In the same way the RM classes are generated.

CODE_PHRASE Class

generators-rm-code-phrase

Generating enumerations is fully supported

Two objects are created - one that holds the enumeration value and one that is the enumeration type (it holds item names/values)

Enumeration Value Class

enum

Enumeration Type Class

enum-type

...even when they extend another enumeration

enum-type-ancestor

Builder

Learn more about generating openEHR applications

openEHR SDK

Learn more about openEHR SDK generator

Programming Language

Learn more about languages supported by the openEHR SDK generator