I can read my first OPT2 JSON
…and I have to write only a single line of code to do it:
…everything else is generated from the BMM files.
When I started working with openEHR I hoped this could be done. 40 days later I know it can be done. All thanks to the computable specifications.
I’m especially thankful to @thomas.beale and @pieterbos for their help.
All the changes to the BMMs and JSON I had to do:
Changed BMMs:
- original_language
- “Terminology_code” in openehr_base_104.bmm has “uri” as “is_mandatory=true”. Changed it to “false”.
- Latest online version has “uri” as optional.
- archetype_id
- “ARCHETYPE_HRID” in openehr_base_110.bmm has “namespace” as “is_mandatory=true”. Changed it to “false”.
- Online version has “namespace” as optional.
- constraint
- “C_TERMINOLOGY_CODE” in openEHR_am_206.bmm has "constraint.type = <“String”>.
- “C_TERMINOLOGY_CODE” in openEHR_aom_206-generated.bmm (generated from Archie) has "constraint.type_def = (P_BMM_CONTAINER_TYPE).
- Online version has "constraint.type = <“String”>.
- “C_STRING” in openEHR_am_206.bmm has “constraint.type” = P_BMM_CONTAINER_PROPERTY.
- I changed “C_TERMINOLOGY_CODE.constraint.type” in openEHR_am_206.bmm to P_BMM_CONTAINER_PROPERTY like it is already used for “C_STRING”.
- “Iso8601_type”
- “value” is missing “is_mandatory = True” in openehr_base_104.bmm and openehr_base_110.bmm.
- Online version has “value” as mandatory.
Renamed properties in JSON:
- generated => is_generated
- differential => is_differential
- multiple => is_multiple
Added properties in JSON:
- terminology.is_differential
- “ARCHETYPE_TERMINOLOGY” in openEHR_am_206.bmm has “is_differential” as mandatory. Added property “terminology.is_diffrential” to the JSON.
- Online version has “is_differential” as mandatory.
- terminology.term_definitions
- “ARCHETYPE_TERM” in openEHR_am_206.bmm has “code” as mandatory. Added the “terminology.term_definitions.code” property to the JSON.
- Search:
("[a-z]+\d+") : \{ "@type" : "ARCHETYPE_TERM",
- Replace:
$1 : \{ "@type" : "ARCHETYPE_TERM", "code" : $1,
- Search:
- Online version has “code” as mandatory.
- “ARCHETYPE_TERM” in openEHR_am_206.bmm doesn’t have “text”, “description”, “other_items” properties.
- “ARCHETYPE_TERM” in openEHR_am_206.bmm has “code” as mandatory. Added the “terminology.term_definitions.code” property to the JSON.
Unnecessary properties (I skipped them):
- “attributes” ("@type" : “C_ATTRIBUTE”) properties have a “mandatory” which is not part of the specification.
- “occurrences” ("@type" : “MULTIPLICITY_INTERVAL”) properties have a “mandatory” which is not part of the specification.
Now I can continue with a forms entry application based on an OPT
Should I generate it from BMMs?