@Sidharth_Ramesh I have been following your research into using archetypes as tables in a relational database. While storing Reference Model (RM) data relationally is challenging, I am not convinced that simplifying the RM is the best approach.
I believe it is possible to maintain the full RM when persisting compositions in a purely relational way. Ultimately, we do not have to make compromises when storing and querying RM data. You can find more details on this approach here: Querying an openEHR CDR with SQL, Cypher, and GraphQL? Yes, it’s possible.
SELECT $blood_pressure.data.events.data.items AS blood_pressure,
$pulse.data.events.data.items AS pulse
FROM `openEHR-EHR-COMPOSITION.encounter.v1`
LET $blood_pressure = out('has_openEHR-EHR-OBSERVATION.blood_pressure.v2'),
$pulse = out('has_openEHR-EHR-OBSERVATION.pulse.v2'),
WHERE $blood_pressure CONTAINS (data.events CONTAINS (data.items CONTAINS (
archetype_node_id = "at0004" AND -- Systolic
value.magnitude > 140 AND value.units = "mm[Hg]"))) AND
$pulse CONTAINS (data.events CONTAINS (data.items CONTAINS (
archetype_node_id = "at0004" AND -- Rate
value.magnitude > 80 AND value.units = "/min")))