Hi,
I am trying to test the EHRBase APIs and have been able to create EHR and sample templates(did not return success though the template was created) . The next is to create compositions.
Here I am stuck as the API expects the native JSON format for the composition. How can I create the JSON composition format from OPT? Is there any tool that I can use? In Ethercis, I used the template example format API to get a sample that I can use for compositions, but could not find something similar in EHRBase.
Also is the git repository the preferred location to log bugs ?
My suggestion (for now) is to create the template composition example in Ethercis, save that composition, Get the composition in RAW JSON format and bingo, you have a JSON RAW format composition.
Might be quite easy to string together with a wee bit of code.
I would be pretty sure that Github is the preferred option for reporting bugs
Then upload the composition to the EHRbase Server with the following headers to get it back in JSON format:
Prefer: return=representation
Accept: application/json
Just make sure that your build of the EHRbase server is at least commit 638a0fb if your template contains clusters.
Iâm working to make the CaboLabs openEHR Toolkit to generate canonical JSON instances directly, since the current JSON instances we generate are just a transformation from the canonical XML to JSON
Is there anything out there like https://github.com/ehrbase/ehrbase_client_library but for Javascript/Typescript instead? Something that exposes the RM or generate template-specific classes to client javacript code?
@erik.sundvall itâs not as convenient, but it should be possible to convert the JPA like classes to a simplified JSON format, allowing to build form specific REST interfaces. I know that this is not the same as directly setting values in the class but could be a nice method while we are waiting for such a tool to occur
Ok, I agree with @ian.mcnicoll, so letâs figure out a simple way to get started, and then a way to do it properly. I mixed two tings in one post, iâll try to split and name the twoâŚ
Project RM2TS: from RM BMM-files, JSON-schema etc via some tooling/code to Typescript classes with generic RM names
I bet somebody has already set up a toolchain that can parse BMM (https://github.com/openEHR/specifications-ITS-BMM) and then output RM-objects in their favourite programming language using some templating language or configurable generator that could be modified to output Typescript classes instead. If they can/want to share that toolchain or not is of course a question.
But on the other hand there is likely some general tool that can take the openEHR JSON schemas at https://github.com/openEHR/specifications-ITS-JSON and turn into beatiful TypeScript hopefully with serializer & deserializer if needed⌠Any suggestions? @sebastian.iancu what did you use to generate those schemas?
Project OPT2TS: from operational templates (OPT) via some tooling/code to template-specific Typescript classes with use-case-meaningful names
For RM2TS or RM2xyz, be aware that BMM has been upgraded significantly to cover pretty much all semantics of normal specification languages, i.e. the same semantics of most programming languages at interface level, and expressions. The only thing missing (I donât think itâs needed right now) is procedural control structure statements like if/then/else etc.
Some of the most recent changes:
support for agents (aka lambdas), as calls, delayed calls, and âsignatureâ types
fully described routine definitions, including pre- and post-conditions
class invariants
better meta-data and documentation structures
Of course, these still need to be transferred into projects like Archie (@pieterbos - be afraid, be very afraid but the general direction is that the primary definition of all openEHR information models (RM, BASE, TP etc) will be in BMM in sufficient precision to enable generation of any code interfaces in any reasonable OO+FP language.
If there is a tool that can be used to generate JSON data from a JSON schema, I added JSON schema generation to LinkEHR some time ago, maybe itâs enough for your use case.
I think we are a little behind BMM latest changes thoughâŚ
A drawback is likely that the route via json schema likely removes some detail from the BMM that typescript (or extension classes/libraries) could handle better than JSON can. I am guessing a bit, so I could be wrong, https://spin.atomicobject.com/2018/03/26/typescript-data-validation/ that describes
this approach says âJSON schema actually provides a superset of the basic features of the TypeScript type system for runtime validationâ.
Modifying the pipeline in your tool to outputting typescript directly (instead of just json schema) from BMM might be even more interesting. Is that part open sourced? @yampeku could you post a link to the part/classes/code that does the conversion?
Those are generated using of min PHP code from the UML .xmi files we have.
However, those schemas still needs some work to make them more accurate, to remove annotations, and potentially to be generated from BMM instead of UML.
Itâs not from BMM directly, but from any given archetype (which can be derived from RM archetypes based on BMM). This functionality is fully available on LinkEHR, if itâs from an end user perspective maybe easiest thing would be to download an use it from there. Code is not currently open, but I can liberate this part without problems. Has dependencies to the old java libs (not archie) and code is quite âhandcraftedâ, but does the job. If you are interested I could clean it a little and publish it in a git repo or something.
@yampeku donât put too much time into publishing that for our sake yet, letâs explore some other options first. Or are your âRM archetypesâ already auto generated from BMMs in some other pipeline? Iâd like to find a (semi)automated way from BMM to Typescript/Javascript-library or some already actively maintained library.
@bna I believe you mentioned the other day that DIPS already has some TypeScript library for openEHR that makes Intellisense etc in IDEs work. When looking at https://github.com/DIPSAS/ehrcraft-pre-procurement-demo/tree/master/typescript, the files in the â/srcâ-directory seem to import openEHR types such as DvQuantity, DvBoolean, DvCodedText.
Where are those classes imported from?
Are they available as open source (or could be made available)?
How did you create them - handcrafted, BMM-conversion or something else?
You are right @erik.sundvall. There is a Typescript library for the Form script types. Itâs not a real implementation just the API definitions to make dev of Form scripts faster. The package is published to NPM and should be available for anyone.
Handcrafted. It was a need using the platform to get intellisense building Form scripts. It was also a minor RD project to test if it was possible to do it like this.
The hardest part was actually compiling TS into supported JS syntax without upgrading the Form Designer. This is done by some tricks in the Gulp script also added to the Github project.
Yep, thatâs what linkehr uses for rm representation. RM is defined as archetypes with special atcodes. These are bundled with every linkehr, available in the data/rm folder. There you will find rm archetypes for openEHR, CDA, ISO13606 and even some FHIR STU3 Resources
Hi all,
Reconnecting to the first question of the post, do you have a couple template-composition that works in Ehrbase? (Iâm on the latest, ehrbase-0.10.0)
And can you explicit the header and parameter settings needed?
I tried many couple, in xml, (that works with ThinkEHR and/or Ethercis) with no success.
Then I tried the procedure proposed by @ian.mcnicoll , that is get in JSON a composition saved in Ethercis in XML, but the only format Ethercis can export to seems to be XML and ECISFLAT. I tried to insert the ECISFLAT in Ehrbase but I failed.
I also created a composition from the cloudehrserver tool mentioned by @backbord. I tried both the xml and the json composition but it didnât work.