Software Development Kit for app development

Hi everybody,

as you might know, we are working on an open source SDK (GitHub - ehrbase/openEHR_SDK) with the aim to make application developers love to work with openEHR. As this is developed against the official openEHR REST API and aims to be 100% vendor-neutral, this is something that should be of general interest to the community, including other vendors. From my point of view, it is absolutely crucial that people who are new to openEHR are able to get their first application up and running within a few hours.

As of now, we have functions to create DTOs from Templates, provide encapsulation of REST calls and the management of templates. We can also use the DTOs to create AQL queries. In the near future, we will also start to support the flat formats.

However, before we do further steps, we would like to discuss the requirements with the community. What are the things bothering people when they want to build applications?

We envision a web call where we demonstrate the functions of the SDK and then discuss what would provide value. Presentations of your (commercial) SDKs would also be welcome, if this is not an issue from a business perspective.

Of course this only makes sense if there is an interest by the community, hence, I’d like to hear from you if this is of interested and you would be willing to spend 2-3 hours to get into this conversation. So please provide some feedback if this is of interest for you (or drop a comment why this might not be the right approach :slight_smile:

4 Likes

Most of the clinician facing apps are web-based. While having a Java client is great, a TypeScript/Javascript project would be very useful for making REST calls and AQLs directly from the client. I think other people will be interested in this as well. Maybe with your guidance, we can explore the openEHR SDK repository and create a Javascript equivalent. Can you tell me how to get started?

1 Like

We considered that, but there are some things to keep in mind: the SDK heavily relies on the openEHR Reference Model implementation Archie. Hence, I assume that this library would have to be replicated in Typescript to get started.

Moreover, to my understanding, the SDK uses reflections quite a lot in the template introspect, which is a key component. I’m not an expert on Javascript and Typescript but my understanding is that reflections are only poorly supported in these languages (in the end, Typescript is still Javascript). This would prevent a straight forward translation from Java. I’m quite sure there is an alternative approach but this might require some fiddling and exploration to get this right.

Besides these two obstacles, I think it should be quite doable but would require ~10 months development time by a senior developer.

However, this is only my perspective and I’m really open to receive some feedback from the community. We are really happy to support anyone who likes to create a port of the SDK!

4 Likes

Hi everybody,

you can get the latest build of EHRbase with beta support of flat format and webtemplates using the following docker command:

docker run --name ehrbase --network ehrbase-net -d -p 8080:8080 -e DB_URL=jdbc:postgresql://ehrdb:5432/ehrbase -e DB_USER=ehrbase -e DB_PASS=ehrbase -e SYSTEM_NAME=local.ehrbase.org ehrbaseorg/ehrbase:next

Remember to have postgres up and running beforehand:

docker network create ehrbase-net
docker run --name ehrdb --network ehrbase-net -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 ehrbaseorg/ehrbase-postgres:latest

Please find a postman collection with an example

Flat.postman_collection.json (1.2 MB)

The implementation is still subject to change and should not yet be used for production. Have fun and we are looking forward to receive your feedback and issues.

If you want to take a look at the source code, check the dev branch on the openEHR SDK: https://github.com/ehrbase/openEHR_SDK

PS: we are also missing an example generator which makes life a bit harder but sending via canonical JSON/XML and then getting an example in the flat format via GET is well possible

4 Likes

Thanks EHRBase team,
This will make testing a lot easier for a lot of developers.

In the postman collection, I do not see an API to generate a sample FLAT composition from a template. Is it not done or missed out? Is the suggested method to use Ethercis APIs for this?

Also is webtemplates same as the flat JSON format or am I missing something else? I do not see any separate APIs for webtemplates in the collection.

regards

Hi Dileep,

yes, this should be added to the example. It follows the pattern of the EHRSCAPE API. Generally, I think we should refine the official REST API to deal with webtemplates and flat.

Just tried this examples:

GET http://localhost:8080/ehrbase/rest/ecis/v1/template/Corona_Anamnese

to obtain the webtemplate representation of the OPT and this works. I updated the collection in my post.

As mentioned above, having the sample/example composition would be a good addition and I’m quite sure that we will add this in the somewhat near future.

Hi Birger,
Thanks for the reply. That helps complete the loop.

And yes the openEHR REST API documentation has to keep up with you now!!

regards

1 Like

Hello Birger,
What tool did you use to generate the Corona_Anamnese template? I tried to upload a template generated using https://tools.openehr.org/designer/ and it resulted in this issue.

Until the bug is patched, I’d like to use the same tool as you to generate templates.

Thank you!

We have an interest in this for our dev team in NHS Wales Informatics Service. Unfortunately we are predominantly a Microsoft .NET MVC and I am looking for ways to support them using native openEHR APIs.

I think there is a difference within the description tag inside the OPT between Ocean Template Designer and ADL Designer that EHRbase does not like at the moment. Unfortunately, I don’t have the time right now to take a deeper look. Hence, please try with the Ocean Template Designer and I would highly appreciate if you can report back and then we can hopefully fix the issue.

1 Like

Hi John,

I think the best we can offer at the moment for .NET devs is the flat format and potentially the STRUCTURED format once there is some serious requests by users.

We have considered internally removing all openEHR specific syntax - even the Better flat and structured JSON has a bunch of pipes for no apparent reason - to create a lean, basic JSON payload or developer friendly syntax :wink:

1 Like

Hi Birger,

With the postman collection you mentioned above, i am not able generate flat composition for a template.
{
“error”: “Unexpected value of CompositionFormat: ‘FLAT’”,
“status”: “Internal Server Error”
}
i am getting this error

Example composition is not supported (yet).

HI,
GET http://localhost:8080/ehrbase/rest/ecis/v1/template/Corona_Anamnese
will this api give webtemplate in flat format

Navaneeth,
Are you using the ehrbaseorg/ehrbase:next image? You’ll get the error if you’re using the ehrbaseorg/ehrbase image instead. I am able to post compositions without any issue.

i am using ehrbaseorg/ehrbase:next
i am able to post composition
will i be able to get compositions in flat format ,also webtemplate?

Yes to both.
To get composition in flat format use format=FLAT
Example:
http://localhost:8080/ehrbase/rest/ecis/v1/composition/62839a78-b2b8-4cf8-ac4f-7af7b799534c?format=FLAT
To get webtemplate, you can just make a GET requests to the ecis template endpoint
Example:
http://localhost:8080/ehrbase/rest/ecis/v1/template/<templateId>

1 Like

when i am using FLAT it is giving me error

More details on the error would be helpful.