Querying the Database
This guide shows how to query the database using the
filtering page. You are able to filter, sort, fetch, and download data uploaded to The Data Grid.
Query Options
Database
This option is the name of the Database you are querying from. You are able to select the database to query from, and query from databases outside of your organization if they are visible. Currently, the only publicly visible database is "UCLA Audits".
Query Type
This option is a selection of either viewing
items or
observations. Items are static (do not change over time) and are often physically existent, while observations are dynamic "snapshots" of items over time, where multiple observations can be made for a single item. For example, each individual sink is a unique item, and every time it is audited for flow rate a new observation is recorded. There can then be multiple observations of the same sink, or no observations of that sink. Note how there are more available
Fields when viewing observations. This is because when viewing items, dynamic fields that change over time are not included. The item-observation dichotomy is core to TDG's data model, and can be read about in more depth in the
"Custom Schema" guide.
Feature
Use the feature field to select the type of item you are querying. Databases can contain many items that relate to each other, or as little as one.
Fields
A multiselect list of fields you can use to query more or less columns of data per item or observation. Each field selected will appear in the results table after running the query.
Query Builder
The query builder allows one to create complex logical filters to constrain the results of the query. Every entry of the query builder is a single constraint that the data must pass ino order to be shown in the results (i.e. a filter). Using the "Add rule" and "Add group" buttons, individual filters can be combined with either a
logical or, or
logical and. Every filter is made upon one of the available fields shown in the
Fields dropdown. Depending on the type of field, different filtering options are shown. In the example below, the query will return all results where "Factor" equals "YRL", or "Text" and "Boolean" equal "Clean" and "true" respectively. Arbitrarily complex filters can be made using the query builder.

Sort
After all your criteria are selected, you can sort the data first by selecting a field, and then choosing ascending or descending order.
Viewing and Downloading the data
After you click the "Run Query" button, your results will display in the table and are ready to be downloaded. The download button is at the bottom left of the results shown on the page. You can choose either CSV or JSON format.
