Skip to content

RM 1.0.4 compliance, new P_BMM, Example instance construction and native ODIN serialization

Compare
Choose a tag to compare
@pieterbos pieterbos released this 12 Feb 10:32
· 1305 commits to master since this release
7051ace

This version contains:

  • The RM implementation has been verified against the 1.0.4 BMM models, and fixed where needed
  • The ExampleJsonInstanceGenerator, a tool that constructs valid json example instances of RM Objects, based on an operational template.
  • A Jackson dataformat implementation for ODIN: Native ODIN serialization of arbitrary java objects
  • A complete rewrite of the P_BMM implementation, with improved validation.
  • Android 8.0/API level 26 support, including faster initialization time

P_BMM implementation: Breaking changes

The P_BMM implementation removes all state from the P_BMM models, and makes the code much easier to understand and maintain for future releases.
This does mean the P_BMM models do not entirely match the P_BMM specification anymore, because the specification contains processing state in the models. For example, the P_BMM model no longer contains a reference to BmmModel, but a separate class has been made that is the result of a P_BMM to a Bmm conversion. Where the processing state is not involved, the new P_BMM implementation aligns more closely to the specification and is directly mapped to and from ODIN.
See the Readme for more details.
The old P_BMM implementation has been deprecated and will be removed in 0.7.0. If you use only the BuiltinReferenceModels with the built in tools, you will not have to change anything. If you use your own tools based upon the BMM, you may need to do some minor changes. If you have your own tools based upon the P_BMM, there may be bigger changes to your code needed.

ExampleJsonInstanceGenerator

Generates RM Object instances based on a BMM model. Because the BMM model does not contain enough information to do this in all cases, this is currently OpenEHR RM specific. It is possible to extend this implementation for other reference models - all the OpenEHR RM specific parts are in separate methods.

Native ODIN serialization in Jackson

This outputs native ODIN for any class that is annotated with jackson annotations. See the Readme for usage details. All ODIN generation in Archie, for example in serializing Archetypes and P_BMM, has been replaced with this implementation.
There are some tricky situations where the generated odin cannot be automatically parsed in Archie without extra annotations or custom mapping. This is especially the case when serializing lists of non-primitive objects: ODIN requires a Map syntax in this case ('keyed/indexed list', which is the exact same syntax as a Map!), so the serializer then must serialize to a Map with an integer index as key.
As this is a rather unusual syntax, there is no standard support in Jackson. So, this cannot be automatically be parsed/mapped to a List by Jackson, meaning this will either require custom mapping, or will require a Map in your java-object instead of a List.
This does not apply to Lists of Strings, Integers, Longs, Reals, Doubles, URIs, Date, DateTime, Time, Duration and Period objects, which in ODIN can just be lists without an index.

RM 1.0.4 compliance: Breaking changes

The verification against the BMM has resulted in some changes in the model, and some changes in the official BMM release where it did not match the specification. This means there are some backwards incompatibilities. The JSON by Archie versions 0.5.5 and earlier should be parsable by this release, it accepts all earlier misspellings. JSON generated by version 0.6.0 will not be parsable by releases 0.5.6 and earlier, and should mostly but not completely be parsable by version 0.5.7.