PhenotypeR

Review codelists and cohorts in OMOP CDM

2025-06-12

Introduction

  • PhenotypeR package is designed to review cohorts in OMOP CDM.
  • The code is publicly available in OHDSI’s GitHub repository PhenoypeR.
  • PhenotypeR 0.1.5 is available in CRAN.
  • Vignettes with further information can be found in the package website.

Set of Functions: Individual Diagnostics Assessment

  • Database diagnostics

  • Cohort diagnostics

    • Summarises baseline characteristics, attrition, overlap, and large-scale characteristics. It also allows to compare our results with a matched cohort.
    • cohortDiagnostics()

Set of Functions: Phenotype Diagnostics

  • Comprises all the diagnostics that are being offered in this package.
result <- phenotypeDiagnostics(
  cohort,
  databaseDiagnostics = TRUE,
  codelistDiagnostics = TRUE,
  cohortDiagnostics = TRUE,
  match = TRUE,
  matchedSample = NULL,
  populationDiagnostics = TRUE,
  populationSample = NULL,
  populationDateRange = as.Date(c(NA,NA))
)
  • Create a shiny app to visualize all the results
shinyDiagnostics(result, directory = here())

Run Phenotype Diagnostics - Example

install.packages("PhenotypeR")

library(CDMConnector)
library(CodelistGenerator)
library(CohortConstructor)
library(CohortCharacteristics)
library(dplyr)
library(PhenotypeR)
library(here)

requireEunomia(datasetName = "synpuf-1k", cdmVersion = "5.3")

con <- DBI::dbConnect(duckdb::duckdb(), dbdir = eunomiaDir(datasetName = "synpuf-1k", cdmVersion = "5.3"))
cdm <- cdmFromCon(
  con, 
  cdmSchema = "main", 
  writeSchema = "main",
  writePrefix = "my_study_",
  achillesSchema = "main"
)

drug_codes <- getDrugIngredientCodes(
  cdm = cdm, 
  name = c("diclofenac", "acetaminophen"),
  nameStyle = "{concept_name}"
)

cdm$medications <- conceptCohort(
  cdm = cdm, 
  conceptSet = drug_codes, 
  name = "medications"
)

# Run Phenotype Diagnostics 
result <- phenotypeDiagnostics(cdm$medications,
                     databaseDiagnostics = TRUE,
                     codelistDiagnostics = TRUE,
                     cohortDiagnostics = TRUE,
                     matchedAnalysis = TRUE,
                     matchedSample = NULL,
                     populationDiagnostics = TRUE,
                     populationSample = NULL,
                     populationDateRange = as.Date(c(NA,NA)))

shinyDiagnostics(result, here::here())

Visualise the results

See the results in the shiny app