getDbExposureData: Get exposure data for cases and controls from a database

View source: R/GetExposureData.R

getDbExposureDataR Documentation

Get exposure data for cases and controls from a database

Description

If additional exposure data or covariate data is required, this function will send the information on the cases and controls back to the server.

Note: For PDW and RedShift, where uploading data can be excrutiatingly slow, you can use bulk loading by preparing the environment as described in the insertTable function in the DatabaseConnection package, and setting tempEmulationSchema to a schema where you have write privileges (bulk import can only upload to permanent tables).

Usage

getDbExposureData(
  caseControls,
  connectionDetails,
  tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"),
  exposureDatabaseSchema = NULL,
  exposureTable = "drug_era",
  exposureIds = c(),
  cdmDatabaseSchema = exposureDatabaseSchema,
  covariateSettings = NULL,
  caseData = NULL
)

Arguments

caseControls

A data frame as generated by the selectControls function.

connectionDetails

An R object of type
connectionDetails created using the function createConnectionDetails in the DatabaseConnector package.

tempEmulationSchema

Some database platforms like Oracle and Impala do not truly support temp tables. To emulate temp tables, provide a schema with write privileges where temp tables can be created.

exposureDatabaseSchema

The name of the database schema that is the location where the exposure data used to define the exposure cohorts is available. If exposureTable = DRUG_ERA, exposureDatabaseSchema is not used but assumed to be cdmSchema. Requires read permissions to this database.

exposureTable

The tablename that contains the exposure cohorts. If exposureTable <> drug_era, then expectation is exposureTable has format of COHORT table: cohort_definition_id, subject_id, cohort_start_date, cohort_end_date.

exposureIds

A list of identifiers to define the exposures of interest. If exposureTable = drug_era, exposureIds should be concept_id. If exposureTable <> drug_era, exposureIds is used to select the cohort_definition_id in the cohort-like table. If no exposureIds are provided, all drugs or cohorts in the exposureTable are included as exposures.

cdmDatabaseSchema

Needed when constructing covariates using FeatureExtraction: the name of the database schema that contains the OMOP CDM instance. Requires read permissions to this database. On SQL Server, this should specify both the database and the schema, so for example 'cdm_instance.dbo'.

covariateSettings

Either an object of type covariateSettings as created using the createCovariateSettings function in the FeatureExtraction package, or an object of type SimpleCovariateSettings as created using the createSimpleCovariateSettings function. If NULL then no covariate data is retrieved.

caseData

An object of type caseData as generated using the getDbCaseData function. If caseData is provided and contains the exposure data (see getExposures in the getDbCaseData function, and if no covariates need to constructed (covariateSettings = NULL) or only simple covariates need to be constructed, then the no connection to the database is used to create the exposure data. This may be much more efficient in some situations.


OHDSI/CaseControl documentation built on July 15, 2022, 6:33 a.m.