Build Status codecov.io

Characterization is part of HADES.

Introduction

Characterization is an R package for performing characterization of a target and a comparator cohort.

Features

  • Compute time to event
  • Compute dechallenge and rechallenge
  • Computer characterization of target cohort with and without occurring in an outcome cohort during some time at risk
  • Run multiple characterization analyses efficiently
  • upload results to database
  • export results as csv files

Examples


library(Eunomia)
library(Characterization)

connectionDetails <- Eunomia::getEunomiaConnectionDetails()
Eunomia::createCohorts(connectionDetails = connectionDetails)

targetIds <- c(1,2,4)
  outcomeIds <- c(3)

  timeToEventSettings1 <- createTimeToEventSettings(
    targetIds = 1,
    outcomeIds = c(3,4)
  )
  timeToEventSettings2 <- createTimeToEventSettings(
    targetIds = 2,
    outcomeIds = c(3,4)
  )

  dechallengeRechallengeSettings <- createDechallengeRechallengeSettings(
    targetIds = targetIds,
    outcomeIds = outcomeIds,
    dechallengeStopInterval = 30,
    dechallengeEvaluationWindow = 31
  )

  aggregateCovariateSettings1 <- createAggregateCovariateSettings(
    targetIds = targetIds,
    outcomeIds = outcomeIds,
    riskWindowStart = 1,
    startAnchor = 'cohort start',
    riskWindowEnd = 365,
    endAnchor = 'cohort start',
    covariateSettings = FeatureExtraction::createCovariateSettings(
      useDemographicsGender = T,
      useDemographicsAge = T,
      useDemographicsRace = T
    )
  )

  aggregateCovariateSettings2 <- createAggregateCovariateSettings(
    targetIds = targetIds,
    outcomeIds = outcomeIds,
    riskWindowStart = 1,
    startAnchor = 'cohort start',
    riskWindowEnd = 365,
    endAnchor = 'cohort start',
    covariateSettings = FeatureExtraction::createCovariateSettings(
      useConditionOccurrenceLongTerm = T
    )
  )

  characterizationSettings <- createCharacterizationSettings(
    timeToEventSettings = list(
      timeToEventSettings1,
      timeToEventSettings2
      ),
    dechallengeRechallengeSettings = list(
      dechallengeRechallengeSettings
    ),
    aggregateCovariateSettings = list(
      aggregateCovariateSettings1,
      aggregateCovariateSettings2
      )
  )
  
runCharacterizationAnalyses(
  connectionDetails = connectionDetails,
  cdmDatabaseSchema = 'main',
  targetDatabaseSchema = 'main',
  targetTable = 'cohort',
  outcomeDatabaseSchema = 'main',
  outcomeTable = 'cohort',
  characterizationSettings = characterizationSettings,   
  outputDirectory = file.path(tempdir(), 'example', 'results'),
  executionPath = file.path(tempdir(), 'example', 'execution'),
  csvFilePrefix = 'c_',
  databaseId = 'Eunomia'
)

Technology

Characterization is an R package.

System Requirements

Requires R (version 4.0.0 or higher). Libraries used in Characterization require Java.

Installation

  1. See the instructions here for configuring your R environment, including Java.

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

install.packages("remotes")
remotes::install_github("ohdsi/Characterization")

User Documentation

Documentation can be found on the package website.

Support

Contributing

Read here how you can contribute to this package.

License

Characterization is licensed under Apache License 2.0

Development

Characterization is being developed in R Studio.