Queries are made using a JSON is used to perform real-time querying of a specific dataset as well as the building block of concepts and cohort definitions.

The query is submitted as a dictionary with 4 key-value pairs:

{
  "table": "the table in the dataset you want to query",
  "column": "the column in the table you want to query",
  "operator": "the operator that relates the value to the column e.g. ('0', 'in', 'gt')",
  "value": "the value with which to query the column in regards to the operator"
}

We then translate this into a SQL query.

For example the following SSQ submission:

{
  "table": "allergy",
  "column": "description",
  "operator": "=",
  "value": "peanut butter"
}

gets converted into the SQL query:

SELECT * FROM allergy WHERE allergy.description = 'peanut butter';

Why do we structure queries in this way?

Alone, these simple queries ensure the user can query specific tables getting real-time feedback as they think about creating concepts and cohort definitions.

Together these queries form the basis of concepts and cohort definitions allowing a simple framework for users to interact with.

We are continually working to provide more flexibility in how users can interact with the data, if you have any specific ideas or concerns please reach out to us at [email protected]