📄️ Introduction
The Archetype Query Language (AQL) is an essential part of the openEHR specifications. It allows to retrieve data from any compliant openEHR system while abstracting from the underlying database model. This means that only Archetypes need to be known in order to create and execute queries.
📄️ AQL SELECT
The SELECT statement allows retrieving single values or objects defined in the CONTAINS clause. The syntax always starts with the keyword SELECT, optionally followed by DISTINCT, and then one or more column expressions.
📄️ FROM ... CONTAINS
The CONTAINS operator allows filtering compositions based on the openEHR Reference Model objects (and archetype_IDs) present inside the particular data instance.
📄️ WHERE
A WHERE clause is used to represent further criteria applied to the data items within the objects declared in the FROM (and CONTAINS) clause. A WHERE clause expresses the query criteria that cannot be represented in other AQL clauses, such as criteria on archetype id, composition committal date/time, and the criteria on in which order the returned results should be listed.
📄️ ORDER BY
The ORDER BY clause is used to sort the returned results.
📄️ (UN)COMMON QUERIES
This page provides a collection of very common or very specific queries to quickly provide some reference for building your queries.
📄️ Configuration
EHRbase comes with some options to customize how the AQL engine behaves.