Query data from flat views
Last updated
Was this helpful?
Last updated
Was this helpful?
Once you've saved your View Definition, the corresponding flat view will be created in a database in sof
schema. For example, to select all the rows from a view named patient_view
you'll need a query like this:
Note that in the current version of Aidbox, View Definitions can be materialized as SQL views only.
From here, you can use your flat views however you like. Popular use cases include building complex queries for data analysis and using BI-tools to build dashboards.
ViewDefinitions do not directly implement across resources. Therefore, to find all patients who was born after or in 1970 and who were diagnosed with COVID after or in 2021, you'll need to define 2 views.
With these views defined, you can query the information you need with the following query.
To find all times patients had an encounter in 2020 or later in a location managed by a given organization you'll need to define 3 views.
Then, your query will look like this.