
Copy OMOP-shaped table(s) from BigQuery into the local DuckDB CDM database
Source:R/load_from_bigquery.R
load_from_bigquery.RdTwo uses:
Vocab refresh: point
datasetat a live/public OMOP vocab source andtablesatconcept,concept_ancestor,concept_relationship, etc. as an alternative toload_vocabulary()'s Athena-zip path.Demo/test data: point
datasetatbigquery-public-data.cms_synthetic_patient_data_omopandtablesat any CDM clinical tables to populate a working demo database without waiting on real PCORnet extracts.
Usage
load_from_bigquery(
billing_project = NULL,
dataset = NULL,
tables,
db_path = "omop_cdm.duckdb",
mode = c("overwrite", "append")
)Arguments
- billing_project
Your own GCP project ID, used for query billing/quota. Defaults to
billing_projectinconfig/bigquery.yml.- dataset
"source_project.dataset_id", e.g."bigquery-public-data.cms_synthetic_patient_data_omop". Defaults todatasetinconfig/bigquery.yml.- tables
Character vector of table names to copy.
- db_path
Path to the DuckDB database file.
- mode
"overwrite"deletes existing rows in the target table before loading;"append"adds to them.
Details
First run needs an interactive R session (not Rscript) to complete the
bigrquery/gargle browser OAuth flow once via bigrquery::bq_auth() –
subsequent non-interactive runs reuse the cached token. billing_project
is required even for public datasets – BigQuery needs a project to
attribute query cost/quota to.