Filtering signed documents in AQL

Hi everyone,
we are having a question regarding AQL, and it would be great to have some input from the community. When querying our data, we need to be able to filter out non-signed entries (without ATTESTATION) . We are looking at different solutions, but all seem quite cumbersome. It becomes even harder when you have different signers for different parts of the composition. It seems like a common use case, but we were not able to find any info about it. Has anyone thought on how to solve this problem before? Is there is a simple way to do this (complying with the specs)?
Thanks!
(great work with the new forum btw ! )

Cheers,

iago

Can you share your current approach/query and comment on what you found to be cumbersome?

1 Like

Hi Seref,
we were considering something of this sort:

SELECT a
FROM EHR e[ehr_id/value=“XXX”]
CONTAINS ORIGINAL_VERSION
CONTAINS ATTESTATIONS a[is_pending = false]
CONTAINS (OBSERVATION b[openEHR-EHR-OBSERVATION.blood_pressure.v1])

even if this is correct (lot’s of gaps here, I’m not even sure if ORIGINAL_VERSION and ATTESTATIONS are addressable in AQL specs), this would only be a solution that would cover a single sign per composition scenario (attestations/items is not being evaluated to see if the OBSERVATION entry is covered). This AQL might not seen cumbersome, but the implementation is far from trivial.

Cheers,

iago

Just to let you know that I saw your response. I’ll try to take a look at this with a cup of coffee at some point. Thanks for providing the details.

I don’t think this is possible with the current specs. The quicker solution would be to query for the needed data and post process the result sets. Then if more data is needed, the REST API could be used to get specific full COMPOSITIONS.