OHDSI / TxPathways

[under development] OHDSI tool to build treatment history of population and derive summary statistics of patterns of treatment
Apache License 2.0
0 stars 1 forks source link

TxPathways

The goal of TxPathways is to provide a module to run drug utilization. This includes calculating:

More to come.....

Installation

Users can install the current development version of TxPathways from GitHub with:

# install.packages("devtools")
devtools::install_github("ohdsi/TxPathways")

Example

This is a basic example of the availabe functionality in TxPathways:

library(TxPathways)

connectionDetails <- DatabaseConnector::createConnectionDetails(
  dbms = "redshift",
  connectionString = "<jdbc_string>",
  user = "<user>",
  password = "<password>"
)
connection <- DatabaseConnector::connect(connectionDetails)

# call atlas results 
workDatabaseSchema <- "<scratch_johndoe>" # your scratch schema, or the ATLAS results schema
cohortTable <- "cohort"
targetCohortId <- 1
eventCohortIds <- c(2, 3)

# Make the treatment history table
createTxHistoryTable(
  connection = connection,
  workDatabaseSchema = workDatabaseSchema,
  cohortTable = cohortTable,
  targetCohortId = targetCohortId,
  eventCohortIds = eventCohortIds
)

targetCohortKey <- tibble::tibble(
  target_cohort_id = 1,
  target_cohort_name = "cohort"
)

eventCohortKey <- tibble::tibble(
  event_cohort_id = c(2, 3),
  event_cohort_name = c("drugA", "drugB")
)

th <- getTxHistoryTable(connection = connection,
                        targetCohortKey = targetCohortKey,
                        eventCohortKey = eventCohortKey)

viewSankey(th, maxPathLength = 2)

# check how many of each event

howManyHaveSingleTreatment(th)
howManyHaveMultipleTreatments(th)
howManyHaveComboTreatments(th)

# check denominator - currently all
howManySwitchedFromAtoB(th, depth = 2)
# check denominator - currently all
howManyHadInterruption(th, seqGap = '1-2', interruption = "30-60")
howManyHadInterruption(th, seqGap = '1-2', interruption = "60-9999")
howManyStoppedBefore(th, days = 365)

# check how long til event
howLongUntilFirstTreatment(th)
howLongUntilNextTreatment(th, seqGap = '1-2')
howLongAreDrugEras(th)