Rm_version is needed at the EHR to be able to schema validate and parse JSON/XML correctly

I’m working on reviewing the JSON schemas based on the RM and adapting them to the API payloads.

Since my use case is openEHR spec conformance verification, I need to be able to consider any version of the RM serialized to JSON or XML. For LOCATABLE types (COMPOSITION, FOLDER, EHR_STATUS, etc.) we have the archetype_details.rm_version which tells which RM version is used. But when we deal with EHRs in JSON/XML, the EHR is not LOCATABLE and doesn’t have any information inside that allows to know which RM version it complies with.

One hack would be to do a lookup for EHR.ehr_status, which is an OBJECT_REF, so we actually need to read the ID there then get the corresponding EHR_STATUS, then check it’s archetype_details.rm_version, which is technically possible but far from ideal since in some types of systems that lookup might not be possible, only CDRs might have the EHR_STATUS instance pointed by the OBJECT_REF.

I would propose that any type serialized to JSON/XML should have some property that actually states which RM version it complies with. Note that is not needed for the LOCATABLEs, just needed for the non-LOCATABLE types.

Note I’m not saying to modify the RM, just to add an extra property in the schemas for serialization, parsing and validation purposes.

What do others think?