AQL using matches to match RM classes (discussion)
This example was taken out from the current AQL spec, because it is not specified.
This case is related with a conversation at Discourse (https://discourse.openehr.org/t/safety-features-in-aql-subject/137), where a use case to query filtering by the class in ENTRY.subject was discussed. This sample query is similar because is trying to match the class in COMPOSITION.composer.
Some discussion points and options are:
Do we want to use the “matches” operator to check for classes in AQL?
Is the rm_type_name attribute available on AQL? Having access to that, would be very easy to verify by using normal “=” and the name of the class as a string, like: WHERE e/subject/rm_type_name = “PARTY_IDENTIFIED”
Could that be done using an extra operator? like “IS“: WHERE e/subject IS PARTY_IDENTIFIED
[cols="1,4a",options="header",separator=¦]
|===
¦*Clinical Scenario 10* ¦Requires all reports composed by patient self
¦*AQL Fragment* ¦
----
SELECT c
FROM EHR e[ehr_id=$ehrUid] CONTAINS COMPOSITION c
WHERE c/composer matches {PARTY_SELF}
----
|===