Compute time at risk exposed and time at risk unexposed for risk window parameters. See `getSccRiskWindowStats` for example usage.

runSccRiskWindows(
  connection,
  cdmDatabaseSchema,
  cdmVersion = 5,
  tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"),
  oracleTempSchema = NULL,
  exposureIds = NULL,
  exposureDatabaseSchema = cdmDatabaseSchema,
  exposureTable = "drug_era",
  firstExposureOnly = TRUE,
  minAge = "",
  maxAge = "",
  studyStartDate = "",
  studyEndDate = "",
  addLengthOfExposureExposed = TRUE,
  riskWindowStartExposed = 1,
  riskWindowEndExposed = 30,
  addLengthOfExposureUnexposed = TRUE,
  riskWindowEndUnexposed = -1,
  riskWindowStartUnexposed = -30,
  hasFullTimeAtRisk = FALSE,
  washoutPeriod = 0,
  followupPeriod = 0,
  riskWindowsTable = "#risk_windows",
  resultsDatabaseSchema = NULL
)

Arguments

connection

DatabaseConnector connection instance

cdmDatabaseSchema

Name of database schema that contains the OMOP CDM and vocabulary.

cdmVersion

Define the OMOP CDM version used: currently support "4" and "5".

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.

oracleTempSchema

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.

exposureIds

A vector containing the drug_concept_ids or cohort_definition_ids of the exposures of interest. If empty, all exposures in the exposure table will be included.

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 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_concept_id, SUBJECT_ID, COHORT_START_DATE, COHORT_END_DATE.

firstExposureOnly

If TRUE, only use first occurrence of each drug concept id for each person

minAge

Integer for minimum allowable age.

maxAge

Integer for maximum allowable age.

studyStartDate

Date for minimum allowable data for index exposure. Date format is 'yyyymmdd'.

studyEndDate

Date for maximum allowable data for index exposure. Date format is 'yyyymmdd'.

addLengthOfExposureExposed

If TRUE, use the duration from drugEraStart -> drugEraEnd as part of timeAtRisk.

riskWindowStartExposed

Integer of days to add to drugEraStart for start of timeAtRisk (0 to include index date, 1 to start the day after).

riskWindowEndExposed

Additional window to add to end of exposure period (if addLengthOfExposureExposed = TRUE, then add to exposure end date, else add to exposure start date).

addLengthOfExposureUnexposed

If TRUE, use the duration from exposure start -> exposure end as part of timeAtRisk looking back before exposure start.

riskWindowEndUnexposed

Integer of days to add to exposure start for end of timeAtRisk (0 to include index date, -1 to end the day before).

riskWindowStartUnexposed

Additional window to add to start of exposure period (if addLengthOfExposureUnexposed = TRUE, then add to exposure end date, else add to exposure start date).

hasFullTimeAtRisk

If TRUE, restrict to people who have full time-at-risk exposed and unexposed.

washoutPeriod

Integer to define required time observed before exposure start.

followupPeriod

Integer to define required time observed after exposure start.

riskWindowsTable

String: optionally store the risk windows in a (non-temporary) table.

resultsDatabaseSchema

Schema to oputput results to. Ignored if resultsTable and riskWindowsTable are temporary.