# Separating Models from Implementation

**URL:** https://discourse.openehr.org/t/separating-models-from-implementation/2093
**Category:** New to openEHR?
**Created:** [22 November 2021 13:56 UTC](https://discourse.openehr.org/t/separating-models-from-implementation/2093 "2021-11-22T13:56:51Z")
**Posts on this page:** 1
**Showing post:** 61

<div class="post-metadata">

### Author: ![erik.sundvall](https://discourse.openehr.org/user_avatar/discourse.openehr.org/erik.sundvall/32/1961_2.png) [@erik.sundvall](https://discourse.openehr.org/u/erik.sundvall)
#### Post date: [26 November 2021 07:29 UTC](https://discourse.openehr.org/t/separating-models-from-implementation/2093/61 "2021-11-26T07:29:48Z")

</div>

When creating a generator that parses an operational template definition (in OPT, webtemplate or other format) it would likely not be too hard to create both JSON schema and OpenAPI outputs in the process (they have a lot of similarities). Some tools like Altova Mapforce (and perhaps Mirth?) support Json schema and many code generators support openAPI.

A quick dirty hack POC version of schema+OpenAPI generator might be drummed up basing code on @bna’s web template → Asciidoc script that @ian.mcnicoll has continued on at [https://github.com/freshehr/wt2doc](https://github.com/freshehr/wt2doc) (mentioned in [post 20 above](https://discourse.openehr.org/t/separating-models-from-implementation/2093/20)) and replace the DocBuilder.ts class etc. A better more properly model based converter may could likely be done fairly quickly by @borut.jures and his nice builder code or by something from @pieterbos & Co at Nedap or somebody else.

There could of course be many improved JSON structures to target, but to start with the simplified “structured” JSON that Better, EHRbase and others are using would be good to hav for integration tools that may want to loop over a structure. It’s called _structSDT_ in [Simplified Data Template (SDT) specification](https://specifications.openehr.org/releases/ITS-REST/latest/simplified_data_template.html#_json_formats) and COMPOSITION data instances can be both imported and exported in platforms like Ehrscape, see images below of the non-standardized way:

 ![image](https://discourse.openehr.org/uploads/default/original/2X/3/30dd0aed7fec97445c3301906d5853bd079a4b15.png) ![image](https://discourse.openehr.org/uploads/default/original/2X/2/2ea4bc115eb29b95d1946c9daa960da0ab084378.png)

If using t[he standardised openEHR REST API](https://specifications.openehr.org/releases/ITS-REST/Release-1.0.2) I hope the same could be accomplished using the string `application/openehr.wt.structured+json` in the http-header `Content-Type` in the requests as described in the [Alternative data formats](https://specifications.openehr.org/releases/ITS-REST/Release-1.0.2/overview.html#header-alternative-data-formats) section of the REST spec overview, when [POSTing and GETting COMPOSITIONS](https://specifications.openehr.org/releases/ITS-REST/Release-1.0.2/ehr.html#composition). How many openEHR implementations support this already - ping @birger.haarbrandt@bna @pieterbos @borut.fabjan @stoffe @Seref and others?

---

_[View the full topic](https://discourse.openehr.org/t/separating-models-from-implementation/2093)._
