We have two compositions
(COMPOSITION c1 CONTAINS OBSERVATION o1) OR
(COMPOSITION c2 CONTAINS EVALUATOIN e1)
We want to join these two composition .
First template has sign and symptom screening which has symptom values like ‘Depression’
and second is a Person details which has Gender ‘Female/Male’.
We want to be able to get count of all Female(from c2) who have Depression(from c1)
Following AQL does not work:
SELECT c1 FROM EHR e
CONTAINS
(COMPOSITION c1 CONTAINS OBSERVATION o1) OR
(COMPOSITION c2 CONTAINS EVALUATOIN e1)
WHERE e1/path/to/attribute=‘Female’ and (o1/path/to/attribute=‘Depression’ and o1/path/to/attribute=‘Yes’)
AND
SELECT o1, e1 FROM EHR e
CONTAINS
(COMPOSITION c1 CONTAINS OBSERVATION o1) OR
(COMPOSITION c2 CONTAINS EVALUATOIN e1)
The Following two AQLs work:
SELECT o1 FROM EHR e1
CONTAINS
(COMPOSITION c1 CONTAINS OBSERVATION o1) OR
(COMPOSITION c2 CONTAINS EVALUATOIN e1)
WHERE o1/path/to/attribute=‘value’
AND
SELECT e1 FROM EHR e
CONTAINS
(COMPOSITION c1 CONTAINS OBSERVATION o1) OR
(COMPOSITION c2 CONTAINS EVALUATOIN e1)
WHERE e1/path/to/attribute=‘value’
But when we combine the two compositions either in select or where clause, it does not work.
How do we specify JOIN queries in AQL. Here we want to join on ehrId’s