This function builds the Cohort and Regimen Tables for the algorithm the derives the antineoplastic combinations. Since the Regimen Table will be directly transformed via the algorithm, a copy of the Regimen Table is made as a Regimen Staging Table to reference back to for optimization and bug fixing purposes.

buildCohortRegimenTable(
  conn,
  cdmDatabaseSchema,
  cohortDefinitionId = NULL,
  cohortDefinitionIdSchema = NULL,
  writeDatabaseSchema,
  drugExposureIngredientTable,
  cohortTable,
  regimenTable,
  drug_classification_id_input = c(OncoRegimenFinder::atc_antineoplastic_id,
    OncoRegimenFinder::hemonc_classes),
  false_positive_id = OncoRegimenFinder::falsepositives,
  renameTable = FALSE
)

Arguments

conn

Connection object to the database engine

cdmDatabaseSchema

Source CDM Drug Exposure Table schema

cohortDefinitionId

(optional) Cohort Definition Id that filters the CDM Drug Exposure Table to create cohort-specific tables, if desired.

cohortDefinitionIdSchema

(optional) If a cohortDefinitionId is provided, the schema in which the cohort table is located.

writeDatabaseSchema

Schema where the OncoRegimenFinder tables will be written to.

cohortTable

Name of the Cohort Table OncoRegimenFinder requires to execute the algorithm

regimenTable

Name of the Regimen Table OncoRegimen will execute the algorithm on.

drug_classification_id_input

OMOP Concept Ids for Drug Classes curated from the OMOP Vocabulary that are used to identify antineoplastic drugs in the Drug Exposures Table. OncoRegimenFinder is packaged with a default vector of values (c(OncoRegimenFinder::atc_antineoplastic_id, OncoRegimenFinder::hemonc_classes)).

false_positive_id

OMOP Concept Ids for Drugs that are often classified as antineoplastics, but are more likely be used in a non-cancer clinical setting, such as retinoids and certain antibiotics. Default: OncoRegimenFinder::falsepositives.

Value

Cohort, Regimen, and Regimen Staging Tables in the writeDatabaseSchema

Details

If the Cohort, Regimen, and Regimen Staging Tables already exist, these tables are renamed with the system date appended in the format "_YYYY_MM_DD". The renaming is skipped and the existing Cohort, Regimen and Regimen Staging Tables are dropped if the dated table already exists, indicating that the OncoRegimenFinder was already run once for that system date.

See also

atc_antineoplastic_id,hemonc_classes,falsepositives lsTables,renameTable,appendDate,execute render,readSql