How to design and run queries programmatically using AQL?

AQL is Krishagni's proprietary query language to query data without knowing the relational model of the underlying database. At present, there is no comprehensive documentation on AQL. Therefore we suggest users who are interested in running queries programmatically to use the below-mentioned approach:

  1. Create the desired query using the UI wizard. For more details, please watch the video Introduction to OpenSpecimen Query Tool - YouTube.
  2. Once you are satisfied with the query results, do the following
    1. Open the network tab in the browser's inspect mode.
    2. Rerun the query.
    3. You will notice a couple of API calls made to the resource /query using the HTTP POST method - one call for obtaining the counts and another to collect the data for display in the grid.
    4. The POST request body will have the required AQL for use in running the queries programmatically.
    5. Use the POST request body to invoke the query API and get the necessary data.

Refer to this document for more details on the Query API.

We agree. This sounds like a tedious method. Believe us, in the face of a continuously evolving software system, the working software itself serves as the comprehensive documentation about the topic you are interested in.