Could we add to the description of this category the suggestion to format all posted AQL queries before posting a new topic? This way it’s much easier for people to read and respond to the question.
Example:
SELECT c FROM COMPOSITION c[openEHR-EHR-COMPOSITION.report.v1] CONTAINS EVALUATION d[openEHR-EHR-EVALUATION.problem_diagnosis.v1] WHERE d/name/value = 'Primary diagnosis' AND (d/data[at0001]/items[at0002 and name/value='Diagnosis']/value/defining_code/code_string = 'C50' OR d/data[at0001]/items[at0002 and name/value='Diagnosis']/value/defining_code/code_string = 'C18')
vs
SELECT
c
FROM
COMPOSITION c[openEHR-EHR-COMPOSITION.report.v1]
CONTAINS EVALUATION d[openEHR-EHR-EVALUATION.problem_diagnosis.v1]
WHERE
d/name/value = 'Primary diagnosis'
AND (d/data[at0001]/items[at0002 and name/value='Diagnosis']/value/defining_code/code_string = 'C50'
OR d/data[at0001]/items[at0002 and name/value='Diagnosis']/value/defining_code/code_string = 'C18')
(Also, is it possible to add ADL and AQL syntax highlighting to Discourse?)
Thanks Silje for the suggestion/request!
I fully support and subscribe to it, and was about to right the same for, as reading AQL-in-json {q:“select …”} is a similar problem and is getting very annoying.
SELECT
c
FROM
COMPOSITION c[openEHR-EHR-COMPOSITION.report.v1]
CONTAINS EVALUATION d[openEHR-EHR-EVALUATION.problem_diagnosis.v1]
WHERE
d/name/value = 'Primary diagnosis'
AND (d/data[at0001]/items[at0002 and name/value='Diagnosis']/value/defining_code/code_string = 'C50'
OR d/data[at0001]/items[at0002 and name/value='Diagnosis']/value/defining_code/code_string = 'C18')
If you add sql to the codeblock i.e. ```sql it looks a little better, and definitely add the name of the CDR. Ideally examples of the template(s) used and a couple of compositions instance examples would make the process much faster for a response.
I understand @marcusbaw has been asking the Discourse gurus about what is needed to get AQL and ADL formatting supported. Personally not too bothered by ADL as we rarely post that.
(I think that having a JS-based AQL/ADL syntax highlighter would also mean the same highlight code would work in Electron-based code editors like VSCode and Atom.)