
Build the diabetes cohort on the public CMS SynPUF OMOP dataset in BigQuery
Source:R/bigquery_demo.R
run_bigquery_demo.RdA software demonstration and smoke test: compiles inst/cohorts/diabetes_phenotype.circe.json to GoogleSQL
(CirceR + SqlRender), builds the cohort and baseline features (age, sex, race, prior-year utilization) in a scratch
dataset of your project, and writes demo_report.md, demo_summary.json, demo_features.csv and the SQL to
output_dir. The data are synthetic claims with no labs or vital signs; those features are reported as 100%
missing and never imputed. Results say nothing about clinical performance (see BIGQUERY_DEMO_DISCLAIMER).
Usage
run_bigquery_demo(
billing_project = NULL,
output_dir = "bigquery_demo_out",
dataset = NULL,
scratch_dataset = NULL,
vocabulary_dataset = NULL,
cohort_json = NULL,
cohort_id = 1L,
dry_run = FALSE,
runner = NULL
)Arguments
- billing_project
Your GCP project id. Defaults to
billing_projectinconfig/bigquery.yml.- output_dir
Where the report and SQL are written.
- dataset
Source CDM,
"project.dataset".- scratch_dataset
A writable
"project.dataset"(default<billing_project>.omop_duckdb_demo).- vocabulary_dataset
Where
concept_ancestorlives if not indataset.- cohort_json
Circe JSON; defaults to
inst/cohorts/diabetes_phenotype.circe.jsonrelative to the working directory (run from the repository root).- cohort_id
Cohort definition id.
- dry_run
TRUEcompiles and writes the SQL only (no BigQuery call, no credentials).- runner
For tests: a list with
execute(sql),fetch(sql)andensure_dataset(dataset).
Details
The public SynPUF copy has no visit_occurrence or measurement table. A missing one is replaced by an empty table
of the same shape in the scratch dataset (stub_visit_occurrence, stub_measurement), so the cohort still runs;
utilization is then 0 for everyone and labs are unavailable, and the report lists the stand-ins.
Reading the public dataset needs only a project to bill; the run also needs permission to run BigQuery jobs and
create a dataset in billing_project (or a scratch_dataset you already own). Authenticate once with
bigrquery::bq_auth().