Unable to save composition using EHRBase SDK

Hi…I’m new to openEHR implementation. I’m able to work with compositions using Flat format and REST APIs.

Now I’m trying to work with EHRBase SDK.

I’m able to successfully do the following from the OPT file using the SDK’s generator:

a) Generate the java entity objects .
b) Create a template (using the REST API Endpoint)
c) Create empty EHR (that returns ehrid)
d) Populate the java entity objects with data from the client application.

However, I’m facing issues while trying to create/save a composition to the EHRBase db using the composition.java that was generated by the SDK.

I see that any property that has a complex datatype (such as TemporalAmount, TemporalAccess, Category, PartyProxy etc is not recognized while working with the Default Restrictions Client endpoints.

Is it a limitation that can be overcome by writing our own mappers to deserialize or is there a better approach to work with them?

I’m working with May’21 release of SDK.


Hi Anupama,

just for my better understanding: are you sending anything through a custom REST API or are you only using the DTO classes generated by the SDK inside Java? When deserializing from REST, there can be cases that require some custom processing. Have you seen the example application? https://github.com/ehrbase/angular-sdk-example

In doubt, please try with the latest version and it would be great if you can also give more details about your case. Feel also encouraged to open a detailed issue on the GitHub page.

Thanks for the reply @birger.haarbrandt
I’m only using the SDK Generated DTO classes to save the composition.

I’ll look into the angular-sdk example you’ve shared. I have been using v1.4 of SDK. I see that another new release is now available. I’ll try with that too.

I’ve attached the OPT used for generating the DTO and Composition.


gdl_template_4.en.v0.opt (76.2 KB)