knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(OncoRegimenFinder)
library(fantasia) conn <- fantasia::connectOMOP()
It is recommended that the parameters are centralized at the start of execution to ensure that arguments remain consistent across all function calls.
# Schema of Source Person and Drug Exposure Tables cdmDatabaseSchema = "omop_cdm_2" # Output Schema and Tables writeDatabaseSchema = "patelm9" cohortTable = "oncoregimenfinder_cohort" regimenTable = "oncoregimenfinder_regimen" regimenStagingTable = "oncoregimenfinder_regimen_staging" vocabularyTable = "oncoregimenfinder_vocabulary" regimenIngredientTable= "oncoregimenfinder_regimen_ingredients" # OMOP Vocabulary Drug Classes to filter Drug Exposures for drug_classification_id_input = c(21601387, 35807188, 35807277, 35807189) # Date difference when assessing for drug combinations in the Drug Exposures table date_lag_input = 30 regimen_repeats = 5
OncoRegimenFinder::buildCohortRegimenTable(conn = conn, cdmDatabaseSchema = "omop_cdm_2", writeDatabaseSchema = "patelm9", cohortTable = "oncoregimenfinder_cohort", regimenTable = "oncoregimenfinder_regimen", drug_classification_id_input = c(21601387, 35807188, 35807277, 35807189))
The Cohort Table
includes the Person Id, Drug Exposure Id with Start and End Dates, and Ingredient representing that Drug Exposure filtered for all descendants of the Drug Classification Concept Id argument.
cohortTable <- pg13::query(conn = conn, sql_statement = pg13::buildQuery(schema = "patelm9", tableName = "oncoregimenfinder_cohort", n = 20, n_type = "random")) print(cohortTable)
The Regimen and Regimen Staging Tables, are identical to one another at this point, are a subset of Cohort Table of the Person Id, Drug Exposure Id, Ingredient Name, and the Start Date of exposure to that Ingredient. The Regimen Table will be processed further while the Regimen Staging Table serves as a reference back to the Regimen Table's original state before being processed by algorithm.
regimenStagingTable <- pg13::query(conn = conn, sql_statement = pg13::buildQuery(schema = "patelm9", tableName = "oncoregimenfinder_regimen_staging", n = 20, n_type = "random")) print(regimenStagingTable)
The Regimen Table is grouped by Person Id, Drug Exposure Id, Ingredient and Ingredient Start Date and joined onto itself based on overlapping window of time by +/= the Date Lag Input parameter and iterated on based on the Regimen Repeats given.
OncoRegimenFinder::processRegimenTable(conn = conn, writeDatabaseSchema = "patelm9", regimenTable = "oncoregimenfinder_regimen", date_lag_input = 30, regimen_repeats = 5)
regimenTable <- pg13::query(conn = conn, sql_statement = pg13::buildQuery(schema = "patelm9", tableName = "oncoregimenfinder_regimen", n = 20, n_type = "random")) print(regimenTable)
OncoRegimenFinder::createVocabTable(conn = conn, writeDatabaseSchema = "patelm9", cdmDatabaseSchema = "omop_cdm_2", vocabularyTable = "oncoregimenfinder_vocabulary")
vocabularyTable <- pg13::query(conn = conn, sql_statement = pg13::buildQuery(schema = "patelm9", tableName = "oncoregimenfinder_vocabulary", n = 20, n_type = "random")) print(vocabularyTable)
createRegimenIngrTable(conn = conn, writeDatabaseSchema = "patelm9", cohortTable = "oncoregimenfinder_cohort", regimenTable = "oncoregimenfinder_regimen", regimenIngredientTable = "oncoregimenfinder_regimen_ingredients", vocabularyTable = "oncoregimenfinder_vocabulary")
regimenIngrTable <- pg13::query(conn = conn, sql_statement = pg13::buildQuery(schema = "patelm9", tableName = "oncoregimenfinder_regimen_ingredients", n = 20, n_type = "random")) print(regimenIngrTable)
fantasia::dcOMOP(conn = conn, remove = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.