Flat format to canonical Composition vice versa (or opt to web template), how?

Hi,

Can somebody explain how the often used flat format is created and can be imported to a proper canonical composition?
Based on this example:

{
  "growth_chart/category|code": "433",
  "growth_chart/category|value": "event",
  "growth_chart/category|terminology": "openehr",
  "growth_chart/context/start_time": "2022-02-03T04:05:06",
  "growth_chart/context/setting|terminology": "openehr",
  "growth_chart/context/setting|code": "225",
  "growth_chart/context/setting|value": "home",
  "growth_chart/context/_end_time": "2022-02-03T04:05:06",
  "growth_chart/context/_health_care_facility|name": "DOE, John",
  "growth_chart/body_weight/birth/weight|unit": "kg",
  "growth_chart/body_weight/birth/weight|magnitude": 500.0,
  "growth_chart/body_weight/birth/comment": "Lorem ipsum",
  "growth_chart/body_weight/birth/state_of_dress|code": "at0013",
  "growth_chart/body_weight/birth/state_of_dress|value": "Naked",
  "growth_chart/body_weight/birth/state_of_dress|terminology": "local",
  "growth_chart/body_weight/birth/confounding_factors:0": "Lorem ipsum",
  "growth_chart/body_weight/birth/time": "2022-02-03T04:05:06",
  "growth_chart/body_weight/any_event:0/weight|magnitude": 501.0,

I have the following questions:

  1. the json property path starts with “growth_chart” but why?
    I have found 2 places where this might be taken from, the archetype_id being openEHR-EHR-COMPOSITION.growth_chart.v0 and the template name being “Growth Chart”
  2. It looks like the convention is to take the element name (like “Confounding factors") and then make lowercase and replace spaces with underscores. Is that it?
  3. Probably related, I noticed the path elements for the parts match with the id in web templates.
    Can someone explain how to translate ADL to a web template?

Thanks in advance for any help and guidance you can give!

Hi Theo,

The flattening might be indeed unclear on some aspects, but I would say that nowadays, the best page to visit to clarify your assumptions is Simplified Formats for openEHR Data.
This specification is not yet released (hence the ‘development’ in url), but it will be soon part of Rest 1.1.0 specs.
It still contains a few small issues which I need to fix it before releasing, hopefully I in the next 2w-4w.

Besides this spec, another thing to try: the vendor APIs have an ‘example’ endpoint usually (which is also now newly specified in this upcoming spec release), and you can control the output with Accept header. There might be a few extra options between the official spec and vendor implementation of flat-format, usually this is documented or known by the vendor itself.

Hopefully you find this general information useful.

In particular to your 3 questions:

  • ‘growth_chart’ it comes from the template
  • names are transformed (lowercase, space eliminated, etc) as mentioned in the spec
  • ADLs are translated to web-template by Archetype Designer tool by Better, I guess there is some open-source code available on their github that might answer your question.
1 Like

Hi Sebastian,

Those links link are definitely helpful! For now I have what I need.

Thanks,

Theo

2 Likes