Tool for extracting treatment cycle from single medication records in CDM database
treatmentCycleExtraction is an R package.
install.packages("listviewer")
install.packages("jsonlite")
install.packages("collapsibleTree")
install.packages("rjson")
install.packages("data.table")
install.packages("dplyr")
install.packages("tidyr")
install.packages("DatabaseConnector")
install.packages("ParallelLogger")
install.packages("SqlRender")
In R, use the following commands to download and install:
install.packages("devtools")
devtools::install_github("ABMI/treatmentCycleExtraction")
library('treatmentCycleExtraction')
Database parameters :
# Details for connecting to the server:
connectionDetails <- DatabaseConnector::createConnectionDetails(dbms='pdw',
server=Sys.getenv("PDW_SERVER"),
schema='cdmDatabaseSchema',
user=NULL,
password=NULL,
port='port')
oracleTempSchema <- NULL
cdmDatabaseSchema <- "cdm_database_schema.dbo"
cohortDatabaseSchema <- "cohort_database_schema.dbo"
vocaDatabaseSchema <- "voca_database_schema.dbo"
oncologyDatabaseSchema <- "oncology_database_schema.dbo" # Schema for Episode table and Episode_eventtable, default = cdmDatabaseSchema
cohortTableCreation = FALSE # Create cohort table for your cohort table
episodeTableCreation = FALSE # warning: existing table might be erased
generateTargetCohort = FALSE # Create target cohort ,i.e., 'colorectal cancer'
episodeTable <- "episode_table"
episodeEventTable <- "episode_event_table"
cohortTable <- "cohort"
maxCores <- 4
Generate episode and episode event table :
executeExtraction(connectionDetails,
oracleTempSchema = NULL,
cdmDatabaseSchema,
vocaDatabaseSchema,
cohortDatabaseSchema,
oncologyDatabaseSchema,
cohortTable,
episodeTable,
episodeEventTable,
includeConceptIdSetDescendant = TRUE,
maxCores,
cohortTableCreation = FALSE,
episodeTableCreation = FALSE,
generateTargetCohort = FALSE)
If you need a modification in the rule for algorithm :
targetRegimenIds <- c(35806596,35804761)
newJson <- ruleEditor(targetRegimenIds) # Edit your rule
newJson <- ruleEditor(new= TRUE) # Add a new rule
ruleSave(newJson,targetRegimenIds) # Save your rule
treatmentCycleExtraction is licensed under Apache License 2.0
treatmentCycleExtraction is being developed in R Studio.