Skip to contents

Two uses:

  1. Vocab refresh: point dataset at a live/public OMOP vocab source and tables at concept, concept_ancestor, concept_relationship, etc. as an alternative to load_vocabulary()'s Athena-zip path.

  2. Demo/test data: point dataset at bigquery-public-data.cms_synthetic_patient_data_omop and tables at 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_project in config/bigquery.yml.

dataset

"source_project.dataset_id", e.g. "bigquery-public-data.cms_synthetic_patient_data_omop". Defaults to dataset in config/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.

Value

Invisibly, db_path.

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.