getDbIctpdData: Get ICTPD counts from database

View source: R/ICTPD.R

getDbIctpdDataR Documentation

Get ICTPD counts from database

Description

This function is used to load the counts needed to compute the ICTPD from a database in OMOP CDM format.

Usage

getDbIctpdData(
  connectionDetails,
  cdmDatabaseSchema,
  oracleTempSchema = NULL,
  tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"),
  cdmVersion = "5",
  exposureOutcomePairs,
  exposureDatabaseSchema = cdmDatabaseSchema,
  exposureTable = "drug_era",
  outcomeDatabaseSchema = cdmDatabaseSchema,
  outcomeTable = "condition_era",
  controlPeriodStart = -1080,
  controlPeriodEnd = -361,
  riskPeriodStart = 1,
  riskPeriodEnd = 30,
  censor = FALSE
)

Arguments

connectionDetails

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

cdmDatabaseSchema

Name of database schema that contains OMOP CDM and vocabulary.

oracleTempSchema

DEPRECATED: use 'tempEmulationSchema' instead.

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.

cdmVersion

Define the OMOP CDM version used: currently supports "5".

exposureOutcomePairs

A data frame with at least two columns:

  • "exposureId" containing the drug_concept_ID or cohort_concept_id of the exposure variable

  • "outcomeId" containing the condition_concept_ID or cohort_concept_id of the outcome variable

exposureDatabaseSchema

The name of the database schema that is the location where the exposure data is available. If exposureTable = DRUG_ERA, exposureSchema is not used by 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.

outcomeDatabaseSchema

The name of the database schema that is the location where the data used to define the outcome cohorts is available. If exposureTable = CONDITION_ERA, exposureSchema is not used by assumed to be cdmSchema. Requires read permissions to this database.

outcomeTable

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.

controlPeriodStart

start of the control period - can be set between -99999 and 0, default is -1080.

controlPeriodEnd

end of the control period - can be set between -99999 and 0, default is -361.

riskPeriodStart

start of the risk period - can be set between 0 and 99999, default is 1.

riskPeriodEnd

end of the risk period - can be set between 0 and 99999, default is 30.

censor

a flag indicating wether the method should censor the observation period at the end of exposure or not. Available input is 0 or 1 with default = 0.

Value

An object of type ictpdData containing counts that can be used in the calculateStatisticsIc function.

Examples

## Not run: 
library(SelfControlledCohort)

connectionDetails <- createConnectionDetails(dbms = "postgresql",
                                             user = "joe",
                                             password = "secret",
                                             server = "myserver")
exposureOutcomePairs <- data.frame(outcomeId = c(196794, 196794, 312648),
                                   exposurId = c(1501700, 1545958, 1551803))
ictpdData <- getDbIctpdData(connectionDetails,
                            cdmDatabaseSchema = "cdm_schema.dbo",
                            exposureOutcomePairs = exposureOutcomePairs)
ictpdResults <- calculateStatisticsIC(ictpdData)
ictpdResults

## End(Not run)

OHDSI/IcTemporalPatternDiscovery documentation built on Sept. 16, 2022, 1:11 p.m.