Skip to content
Tool for extracting treatment cycle from single medication records in CDM database
R TSQL
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R
extras
inst
man
.Rbuildignore
.gitignore
DESCRIPTION
LICENSE
NAMESPACE
README.md
treatmentCycleExtraction.Rproj

README.md

treatmentCycleExtraction

Introduction

Tool for extracting treatment cycle from single medication records in CDM database

Technology

treatmentCycleExtraction is an R package.

Dependencies

  • SqlRender
  • DatabaseConnector
  • plotly
  • dplyr
  • ggplot2
  • data.table
  • rjson

Getting started

In R, use the following commands to download and install:

install.packages("devtools")

devtools::install_github("ABMI/treatmentCycleExtraction")

library('treatmentCycleExtraction')

How to run

Parameter setting for algorithm :

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')
# The name of the database schema where the study-specific cohorts will be instantiated:
cohortDatabaseSchema <-'cohort_Database_Schema.dbo'
cdmDatabaseSchema <- 'cdm_Database_Schema.dbo'
vocaDatabaseSchema <- 'voca_Database_Schema.dbo'
oncologyDatabaseSchema <- 'oncology_Database_Schema.dbo'

# The name of the table where the study-specific cohorts will be instantiated:
cohortTable <-'cohort'
episodeTable <- 'episode_table_name'
episodeEventTable <- 'episode_event_table_name'
createEpisodeAndEventTable <- FALSE

# Target regimen concept ids(blank = all):
targetRegimenConceptIds <- c(35806596,35804761)

# Target cohort definition id:
targetCohortId <- 272

# The number of cores in use
maxCores <- 4

Then run the following :

If you do not have cohort records, create the target cohort for treatmentCycleExtraction :

conceptIdSet <- c(443384,
                  4181344,
                  443381,
                  443390,
                  4180792,
                  4180791,
                  443382,
                  4180790,
                  443391,
                  435754,
                  443383,
                  4089661) #colorectal cancer

targetCohortId <- 272

createCohort(createCohortTable = FALSE,
             connectionDetails = connectionDetails,
             oracleTempSchema = NULL,
             cdmDatabaseSchema = cdmDatabaseSchema,
             cohortDatabaseSchema = cohortDatabaseSchema,
             vocabularyDatabaseSchema = vocaDatabaseSchema,
             cohortTable = cohortTable,
             conceptIdSet = conceptIdSet,
             includeConceptIdSetDescendant = TRUE,
             targetCohortId = targetCohortId
)

Generate episode and episode event table :

## Episode table and episode Event generation
episodeAndEpisodeEvent<-generateEpisodeTable(targetRegimenConceptIds,
                                             connectionDetails,
                                             cohortTable,
                                             cdmDatabaseSchema,
                                             cohortDatabaseSchema,
                                             targetCohortId,
                                             maxCores)

Insert table into database :

insertEpisodeToDatabase(connectionDetails,
                        oncologyDatabaseSchema,
                        episodeTable,
                        episodeEventTable,
                        createEpisodeAndEventTable,
                        episodeAndEpisodeEvent)

License

treatmentCycleExtraction is licensed under Apache License 2.0

Development

treatmentCycleExtraction is being developed in R Studio.

You can’t perform that action at this time.