# 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:** 12

<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:** [22 November 2021 17:51 UTC](https://discourse.openehr.org/t/separating-models-from-implementation/2093/12 "2021-11-22T17:51:36Z")

</div>

First, I love your ironical nickname!

> [@ToStupidForOpenEHR](#):
>
> Something I can parse more easily…without having to use archie, or muck around with ANTLR etc

The “web template” format could be described as a kind of pre-parsed version of OPT (operational template), would that work? It can be exported from [Archetype Designer](https://tools.openehr.org/designer/):

 ![image](https://discourse.openehr.org/uploads/default/original/2X/8/8b661bb4775399e9528ac6564d8bf2fe10d6a9b2.png)

> [@ToStupidForOpenEHR](#):
>
> Was thinking [http://json-schema.org/](http://json-schema.org/)

Yes, for example auto-generation of a template-specific JSON-schema for the simplified “structured” format (that is a tree- version of the [same sematics as “flat format”](https://ehrbase.readthedocs.io/en/latest/02_getting_started/05_load_data/index.html#flat-format)) would be wonderful. I’d guess somebody with less rusty programming skills than me could easily make a generator that consumes a web template file and spits out a template-specific JSON schema…

Here is a piece of an instance example that should adhere to such a schema:

```auto
  "vital_signs": {
    "context": [
      {
        "context_detail": [
          {
            "tags": [
              "Example Tag 123"
            ]
          }
        ]
      }
    ],
    "body_temperature": [
      {
        "any_event": [
          {
            "temperature": [
              {
                "|magnitude": 38.8,
                "|unit": "°C"
              }
            ],
            "body_exposure": [
              {
                "|code": "at0033"
              }
            ],
            "description_of_thermal_stress": [
              "Description of thermal stress 51"
            ]
          }
        ],
        "site_of_measurement": [
          {
            "|code": "at0022"
          }
        ]
      }
    ],
    "blood_pressure": [
      { 
... and so on

```

Probably the schema should include the name of the at00XX-codes (at least as comments) to be readable, not only the codes.

---

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