Skip to contents

Extracts covariates that occur during a cohort

Usage

getDbDuringCovariateData(
  connection,
  oracleTempSchema = NULL,
  cdmDatabaseSchema,
  cdmVersion = "5",
  cohortTable = "#cohort_person",
  rowIdField = "subject_id",
  aggregated = TRUE,
  cohortIds = c(-1),
  covariateSettings,
  minCharacterizationMean = 0,
  tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"),
  ...
)

Arguments

connection

The database connection

oracleTempSchema

The temp schema if using oracle

cdmDatabaseSchema

The schema of the OMOP CDM data

cdmVersion

version of the OMOP CDM data

cohortTable

the table name that contains the target population cohort

rowIdField

string representing the unique identifier in the target population cohort

aggregated

whether the covariate should be aggregated

cohortIds

cohort id for the target cohort

covariateSettings

settings for the covariate cohorts and time periods

minCharacterizationMean

the minimum value for a covariate to be extracted

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

...

additional arguments from FeatureExtraction

Value

A 'FeatureExtraction' covariateData object containing the during covariates based on user settings

Details

The user specifies a what during covariates they want and this executes them using FE

See also

Other CovariateSetting: createDuringCovariateSettings()

Examples


conDet <- exampleOmopConnectionDetails()
connection <- DatabaseConnector::connect(conDet)
#> Connecting using SQLite driver

settings <- createDuringCovariateSettings(
  useConditionOccurrenceDuring = TRUE,
  useConditionOccurrencePrimaryInpatientDuring = FALSE,
  useConditionEraDuring = FALSE,
  useConditionGroupEraDuring = FALSE
)

duringData <- getDbDuringCovariateData(
  connection <- connection,
  cdmDatabaseSchema = 'main',
  cohortIds = 1,
  covariateSettings = settings,
  cohortTable = 'cohort'
)
#> Constructing during cohort covariates
#> Executing SQL took 0.00301 secs
#> Executing SQL took 0.00299 secs
#> Executing during sql code for ConditionOccurrenceDuring
#> Executing SQL took 0.019 secs
#> Execution took 0.02 secs
#> Extracting covariates
#> Extracting covariates took 0.15 secs
#> Removing temp covariate tables

DatabaseConnector::disconnect(connection)