PhenotypeLibrary is part of HADES

Installation

  • This is an installable R-package that may be installed as follows:
remotes::install_github("OHDSI/PhenotypeLibrary")

Retrieval

  • The list of cohort definitions available may be retrieved as follows:
PhenotypeLibrary::listPhenotypes()
#> # A tibble: 281 x 16
#>    cohortId cohortName            description createdDate modifiedDate librarian
#>       <dbl> <chr>                 <chr>       <date>      <date>       <chr>    
#>  1        2 [W] COVID-19 diagnos~ "Status: W~ 2021-09-22  2023-03-14   rao@ohds~
#>  2        3 [P] Cough or Sputum ~ "Status: P~ 2021-09-22  2023-01-03   rao@ohds~
#>  3        4 [P] Diarrhea (3Pe, 3~ "Status: P~ 2021-09-23  2023-01-03   rao@ohds~
#>  4        5 [P] Dyspnea (7Pe, 90~ "Status: P~ 2021-09-23  2023-01-03   rao@ohds~
#>  5        6 [P] Fever (3Pe, 30Er~ "Status: P~ 2021-09-23  2023-02-12   rao@ohds~
#>  6        7 [P] Headache or Head~ "Status: P~ 2021-09-23  2023-02-12   rao@ohds~
#>  7        8 [P] Altered smell or~ "Status: P~ 2021-09-23  2023-02-12   rao@ohds~
#>  8        9 [P] Sore throat (3Pe~ "Status: P~ 2021-09-23  2023-02-12   rao@ohds~
#>  9       10 [P] Nausea or Vomiti~ "Status: P~ 2021-09-23  2022-12-06   rao@ohds~
#> 10       11 [P] Malaise and or f~ "Status: P~ 2021-09-23  2023-02-12   rao@ohds~
#> # i 271 more rows
#> # i 10 more variables: cohortNameFormatted <chr>, lastModifiedBy <lgl>,
#> #   status <chr>, logicDescription <chr>, hashTag <chr>, contributor <chr>,
#> #   Forum <chr>, addedVersion <chr>, peer <chr>, Reviewer <lgl>
  • You can extract one or more cohort definitions into a cohortDefinitionSet object as
cohortDefinitionSet <- PhenotypeLibrary::getPlCohortDefinitionSet(cohortIds = c(1, 2, 3))

cohortDefinitionSet
#> # A tibble: 2 x 4
#>   cohortId cohortName                                                json  sql  
#>      <dbl> <chr>                                                     <chr> <chr>
#> 1        2 [W] COVID-19 diagnosis or SARS-CoV-2 test (1pos) (3Ps, 7~ "{\n~ "CRE~
#> 2        3 [P] Cough or Sputum (3Pe, 30Era)                          "{\n~ "CRE~
  • cohortDefinitionSet is now a data.frame with specifications for the cohort ids 1, 2 and 3. For cohorts that conform to OHDSI Circe specifications, the field json is the cohort json specification that may be posted into your Atlas instance. The SQL is the SQL rendered from the JSON. For cohorts that do not conform to OHDSI Circe specification, only the SQL is provided and the json is left empty.

Use

connectionDetails <-
  DatabaseConnector::createConnectionDetails(
    dbms = "postgresql",
    server = "some.server.com/ohdsi",
    user = "joe",
    password = "secret"
  )
cdmDatabaseSchema <- "cdm_synpuf"
cohortDatabaseSchema <- "scratch.dbo"
cohortTables <- CohortGenerator::getCohortTableNames()
CohortGenerator::generateCohortSet(
  connectionDetails = connectionDetails,
  cdmDatabaseSchema = cdmDatabaseSchema,
  cohortDatabaseSchema = cohortDatabaseSchema,
  cohortTableNames = cohortTables,
  cohortDefinitionSet = cohortDefinitionSet
)
  • You can also run cohort diagnostics on this cohortDefinitionSet object as follows:
databaseId <- "synpuf"

databaseName <-
  "Medicare Claims Synthetic Public Use Files (SynPUFs)"

databaseDescription <-
  "Medicare Claims Synthetic Public Use Files (SynPUFs) were created to allow interested parties to gain familiarity using Medicare claims data while protecting beneficiary privacy. These files are intended to promote development of software and applications that utilize files in this format, train researchers on the use and complexities of Centers for Medicare and Medicaid Services (CMS) claims, and support safe data mining innovations. The SynPUFs were created by combining randomized information from multiple unique beneficiaries and changing variable values. This randomization and combining of beneficiary information ensures privacy of health information."

CohortDiagnostics::executeDiagnostics(
  cohortDefinitionSet = cohortDefinitionSet,
  exportFolder = outputFolder,
  databaseId = databaseId,
  databaseName = databaseName,
  databaseDescription = databaseDescription,
  cohortDatabaseSchema = cohortDatabaseSchema,
  cdmDatabaseSchema = cdmDatabaseSchema,
  connectionDetails = connectionDetails,
  cohortTableNames = cohortTableNames
)