This function executes a large set of SQL statements against the database in OMOP CDM format to extract the data needed to perform the analysis.
getDbCohortMethodData( connectionDetails, cdmDatabaseSchema, oracleTempSchema = cdmDatabaseSchema, targetId, comparatorId, outcomeIds, studyStartDate = "", studyEndDate = "", exposureDatabaseSchema = cdmDatabaseSchema, exposureTable = "drug_era", outcomeDatabaseSchema = cdmDatabaseSchema, outcomeTable = "condition_occurrence", cdmVersion = "5", excludeDrugsFromCovariates = NULL, firstExposureOnly = FALSE, removeDuplicateSubjects = FALSE, restrictToCommonPeriod = FALSE, washoutPeriod = 0, maxCohortSize = 0, covariateSettings )
An R object of type
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'.
For Oracle only: the name of the database schema where you want all temporary tables to be managed. Requires create/insert permissions to this database.
A unique identifier to define the target cohort. If exposureTable = DRUG_ERA, targetId is a concept ID and all descendant concepts within that concept ID will be used to define the cohort. If exposureTable <> DRUG_ERA, targetId is used to select the COHORT_DEFINITION_ID in the cohort-like table.
A unique identifier to define the comparator cohort. If exposureTable = DRUG_ERA, comparatorId is a concept ID and all descendant concepts within that concept ID will be used to define the cohort. If exposureTable <> DRUG_ERA, comparatorId is used to select the COHORT_DEFINITION_ID in the cohort-like table.
A list of cohort IDs used to define outcomes.
A calendar date specifying the minimum date that a cohort index date can appear. Date format is 'yyyymmdd'.
A calendar date specifying the maximum date that a cohort index date can appear. Date format is 'yyyymmdd'. Important: the study end data is also used to truncate risk windows, meaning no outcomes beyond the study end date will be considered.
The name of the database schema that is the location where the exposure data used to define the exposure cohorts is available.
The tablename that contains the exposure cohorts. If
exposureTable <> DRUG_ERA, then expectation is
The name of the database schema that is the location where the data used to define the outcome cohorts is available.
The tablename that contains the outcome cohorts. If outcomeTable <> CONDITION_OCCURRENCE, then expectation is outcomeTable has format of COHORT table: COHORT_DEFINITION_ID, SUBJECT_ID, COHORT_START_DATE, COHORT_END_DATE.
Define the OMOP CDM version used: currently supports "5".
DEPRECATED: Should the target and comparator drugs (and their descendant concepts) be excluded from the covariates? Note that this will work if the drugs are actually drug concept IDs (and not cohort IDs).
Should only the first exposure per subject be included? Note
that this is typically done in the
Remove subjects that are in both the target and comparator
cohort? See details for allowed values.Note that this is typically done in the
Restrict the analysis to the period when both treatments are observed?
The minimum required continuous observation time prior to index
date for a person to be included in the cohort. Note that this
is typically done in the
If either the target or the comparator cohort is larger than
this number it will be sampled to this size.
An object of type
A CohortMethodData object.
Based on the arguments, the treatment and comparator cohorts are retrieved, as well as outcomes occurring in exposed subjects. The treatment and comparator cohorts can be identified using the DRUG_ERA table, or through user-defined cohorts in a cohort table either inside the CDM schema or in a separate schema. Similarly, outcomes are identified using the CONDITION_ERA table or through user-defined cohorts in a cohort table either inside the CDM schema or in a separate schema. Covariates are automatically extracted from the appropriate tables within the CDM.
Important: The target and comparator drug must not be included in the covariates, including any descendant
concepts. You will need to manually add the drugs and descendants to the
removeduplicateSubjects argument can have one of the following values:
"keep all": Do not remove subjects that appear in both target and comparator cohort
"keep first": When a subjects appear in both target and comparator cohort, only keep whichever cohort is first in time.
"remove all": Remove subjects that appear in both target and comparator cohort completely from the analysis."