Skip to contents

CDM Object

Create or transform a CDM reference object. These accept and return cdm objects.

assert_tables() assertTables()
Assert that tables exist in a cdm object
assert_write_schema() assertWriteSchema()
Assert that cdm has a writable schema
cdmCon()
Get underlying database connection
cdmDisconnect() cdm_disconnect()
Disconnect the connection of the cdm object
cdmFlatten() cdm_flatten()
Flatten a cdm into a single observation table
cdmName() cdm_name()
Get the CDM name
cdmSample() cdm_sample()
Subset a cdm object to a random sample of individuals
cdmSubset() cdm_subset()
Subset a cdm object to a set of persons
cdmSubsetCohort() cdm_subset_cohort()
Subset a cdm to the individuals in one or more cohorts
cdmWriteSchema()
Get cdm write schema
cdm_from_con() cdmFromCon()
Create a CDM reference object from a database connection
cdm_from_environment()
Create a CDM object from a pre-defined set of environment variables
cdm_from_files() cdmFromFiles()
Create a CDM reference from a folder containing parquet, csv, or feather files
cdm_from_tables()
Create a cdm object from local tables
cdm_select_tbl()
Select a subset of tables in a cdm reference object
copy_cdm_to() copyCdmTo()
Copy a cdm object from one database to another
dbSource()
Create a source for a cdm in a database.
snapshot()
Extract CDM metadata
stow()
Collect a list of lazy queries and save the results as files
tbl_group() tblGroup()
CDM table selection helper
validate_cdm() validateCdm()
Validation report for a CDM
version()
Get the CDM version

Cohort Creation and Transformation

A cohort is a set of person-days representing the time during which people in a CDM exhibited some observable characteristics. Cohorts are often the foundation of downstream analyses.

cohortAttrition() cohort_attrition()
Get attrition table from a cohort_table object
cohortSet() cohort_set()
Get cohort settings from a cohort_table object
cohort_count()
Get cohort counts from a generated_cohort_set object.
cohort_erafy() cohortErafy()
Collapse cohort records within a certain number of days
cohort_union() cohortUnion()
Union all cohorts in a cohort set with cohorts in a second cohort set
generateCohortSet() generate_cohort_set() experimental
Generate a cohort set on a cdm object
generateConceptCohortSet() generate_concept_cohort_set()
Create a new generated cohort set from a list of concept sets
intersect_cohorts() intersectCohorts()
Intersect all cohorts in a single cohort table
new_generated_cohort_set() newGeneratedCohortSet() superseded
Constructor for cohort_table objects
read_cohort_set() readCohortSet()
Read a set of cohort definitions into R
recordCohortAttrition() record_cohort_attrition()
Add attrition reason to a cohort_table object
union_cohorts() unionCohorts()
Union all cohorts in a single cohort table

dbplyr workarounds

Functions that can be used in cross database dplyr pipelines

appendPermanent() append_permanent()
Run a dplyr query and add the result set to an existing
asDate() as_date()
as.Date dbplyr translation wrapper
computeQuery() compute_query()
Execute dplyr query and save result in remote database
dateadd()
Add days or years to a date in a dplyr query
datediff()
Compute the difference between two days
datepart()
Extract the day, month or year of a date in a dplyr pipeline
inSchema() in_schema()
Helper for working with compound schemas
summarise_quantile() summarize_quantile() summariseQuantile() summarizeQuantile()
Quantile calculation using dbplyr
uniqueTableName() unique_table_name()
Create a unique table name for temp tables

DBI connection

Functions that accept DBI connections and are useful in cross database DBI code

dbms()
Get the database management system (dbms) from a cdm_reference or DBI connection
list_tables() listTables()
List tables in a schema

Eunomia example CDM

Easily create and use example CDMs in a duckdb database

downloadEunomiaData() download_eunomia_data()
Download Eunomia data files
eunomiaDir() eunomia_dir()
Create a copy of an example OMOP CDM dataset
eunomia_is_available() eunomiaIsAvailable()
Has the Eunomia dataset been cached?
exampleDatasets() example_datasets()
List the available example CDM datasets
requireEunomia() require_eunomia()
Require eunomia to be available. The function makes sure that you can later create a eunomia database with eunomiaDir().

Benchmarking

Run benchmarking of simple queries against your CDM reference

benchmarkCDMConnector()
Run benchmark of tasks using CDMConnector