AQL Manager
This webpage can be used to store and format openEHR compliant AQL queries.
Disclaimer
AQL Manager (“the Software”) is provided as an open‑source project on an “AS IS” and “AS AVAILABLE” basis, without any warranties of any kind, express or implied.
To the maximum extent permitted by applicable law, the authors and contributors of the Software disclaim all warranties, including, but not limited to, implied warranties of merchantability, fitness for a particular purpose, non‑infringement, and any warranties arising out of course of dealing or usage of trade.
The Software is intended for use by technically competent users. You are solely responsible for:
- Evaluating the accuracy, completeness, and suitability of the Software for your use case.
- Validating all queries, configurations, and outputs before using them in production or on live data.
- Maintaining appropriate backups, security controls, and access restrictions for any systems or data used with the Software.
In no event shall the authors or contributors be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the Software or the use of, or other dealings in, the Software. This includes, without limitation, any loss or corruption of data, business interruption, security breach, or other indirect, incidental, special, exemplary, or consequential damages.
By using the Software, you agree that you do so at your own risk and that you will comply with all applicable laws, regulations, and internal policies governing your use of the Software and any associated data.
Precautions
Take into account:
- Reloading the HTML page might make you lose your progress. Please save often!
- Be aware that changes to your AQL collection get saved in a new file every time you save. Be sure to keep the last downloaded file for your next session.
GUI overview

Elements of the User Interface
- Input: AQL list is filtered by the input
- Checkbox: Includes the description of the AQL in the filter
- List of AQL currently in memory
- Button: Add a new AQL to the list
- Button: Delete the selected AQL
- Button: Upload an AQL collection from a local JSON file
- Button: Download the whole AQL collection
- Button: Create a text summary of the current AQL
- Button: Clear local storage
- Button: Switch between dark and light mode for the formatted AQLs
- Input: Title of the selected AQL
- Input: Folder path. For example "Examples/Test/final/"
- Input: Description of the selected AQL
- Input: If variables have been defined in the AQL editor, descriptions for the variable can be added.
- Button: Auto-format the AQL input field
- Input: Editor for the AQL
- Button: Download an image of the formatted AQL
- Output: AQL with highlighted keywords
- Button: Copy the cleaned up AQL to the clipboard
- Output: Cleaned up AQL as an online text without tabs or comments
- Input: If variables have been defined in the AQL editor, example values for the variable can be added.
- Button: Copy the AQL formatted as payload for EHRbase to the clipboard
- Output: AQL formatted as payload for EHRbase
- Link: Open user manual in a new browser tab.
User Guide
Starting from scratch
Adding an AQL
Press the “Add AQL” button to add a new AQL to the list.

You get a new empty AQL in the main section.

New AQLs are in the “Unsorted” section of the AQL list. You can determine in which folder the AQL is located by changing the “Folder Path”. For example "Examples/Manual/Test/Final" will move the AQL to the location.

Change the title, the description and finally add your AQL to the “AQL Input”.

Formatting an AQL
Auto-Formatting
For formatting your AQL, you can press the “auto-format” button.
![]()
This will create a fast first format, that adds line breaks and tabs before and after certain keywords.

Manual Formatting
You can format your AQL input with line breaks, spaces and tabs.
You can use the auto-format button to enter automatically line breaks at the major keywords.
Use // to enter comments.
Use $ to add variables (for example $ehr_id).
You can optionally add values for these parameters by adding comments in the format of // @param template_id = "my_awesome_template_v0".

Formatted AQL
The “Formatted AQL” section shows you a version of the input AQL with keyword highlights. The style can be changed between “dark” and “light” by pressing the style button.

The following text gets highlighted:
- Parameters starting with $
- ['SELECT','FROM','CONTAINS','WHERE','ORDER BY','LIMIT','OFFSET']
- ['VERSION','EHR','CONTENT_ITEM','ENTRY','CARE_ENTRY','EVENT','ITEM_STRUCTURE','ITEM','COMPOSITION','FOLDER','EHR_STATUS','EVENT_CONTEXT','SECTION','GENERIC_ENTRY','ADMIN_ENTRY','OBSERVATION','INSTRUCTION','ACTION','EVALUATION','ACTIVITY','HISTORY','POINT_EVENT','INTERVAL_EVENT','ITEM_LIST','ITEM_SINGLE','ITEM_TABLE','ITEM_TREE','CLUSTER','ELEMENT']
- ['DESC','ASC','AS','DISTINCT','AND','OR','NOT','LIKE','matches','exists','<','>','=','!','true','false','NULL']
- Inline comments that start with //
This view of the AQL can be exported as a PNG file. Press the snapshot button:
![]()
Automatically the image gets downloaded as formatted_aql.png.
Clean AQL
For many applications an AQL without line breaks, tabs or comments is needed. Therefore we present a cleaned up version in the “Clean AQL” section:

This AQL can be copied to the clipboard by pressing the “copy to clipboard” button:
![]()
Pre-formatted payload for EHRbase
For the use of the AQL for EHRbase via Postman, for example, the AQL has to be included in a JSON structure. For your convenience, this is done in the “Postman payload for EHRbase” section.

If previously query parameters have been defined in the AQL (for example $template_id), a value for this query parameter can be added in the “Query parameters” section.
This AQL payload can be copied to the clipboard by pressing the “copy to clipboard” button:
![]()
Delete an AQL
To delete an AQL from the collection, select the AQL you want to delete in the list on the left hand side.
Press the “Delete AQL” button to delete the AQL:

Changing an AQL
To modify an AQL, select the AQL you want to change in the list on the left hand side.
When an AQL is selected you can make changes to the title, description and input.
Don’t forget to save the selection after making changes.
Searching for an AQL
You can filter the list of AQL on the left hand side, by typing in the search bar above the list. By default, only the AQL titles are filtered. You can select the “Include description in filter” checkbox to include also the AQL descriptions in the filter.

Starting with an AQL collection
Instead of starting from scratch, you can load a JSON file with an AQL collection. Use the “Select file” button to do so:
![]()
Note that the format of the saved file has to be a list of elements that have 5 attributes: title, description, AQL, folder path and query parameter values:

Saving the AQL collection
Use the “Download AQL collection” button to download the whole AQL collection:

The whole AQL selection gets saved in an aql_store_file.json file. If this file already exists, a new file with “(N)” added to the name:

⚠️ The save button does not “update” a local file selected previously. Be sure to save the downloaded AQL collection for a future session.
Deleting the local browser storage
The webpage uses the local storage of the web browser, so nothing gets lost when you close or reload the page. If you want to delete the AQL data in local storage, you can do so with the “Clear Local Storage” button:
![]()
License
© 2026 CatSalut. Servei Català de la Salut. Licensed under Apache 2.0. Author: Martin A. Koch, PhD.