PhenotypeLibrary is part of HADES


  • This is an installable R-package that may be installed as follows:


  • The list of cohort definitions available may be retrieved as follows:
#> # A tibble: 599 x 80
#>    cohortId cohortName        cohortNameAtlas cohortNameFormatted cohortNameLong
#>       <dbl> <chr>             <chr>           <chr>               <chr>         
#>  1        3 Cough or Sputum   [P] Cough or S~ Cough or Sputum     Cough or Sput~
#>  2        4 Diarrhea          [P] Diarrhea    Diarrhea            Diarrhea      
#>  3        5 Dyspnea           [P] Dyspnea     Dyspnea             Dyspnea       
#>  4        6 Fever             [P] Fever       Fever               Fever         
#>  5        7 Headache or Head~ [P] Headache o~ Headache or Headac~ Headache or H~
#>  6        8 Altered smell or~ [P] Altered sm~ Altered smell or t~ Altered smell~
#>  7        9 Sore throat       [P] Sore throat Sore throat         Sore throat   
#>  8       10 Nausea or Vomiti~ [P] Nausea or ~ Nausea or Vomiting  Nausea or Vom~
#>  9       11 Malaise and or f~ [P] Malaise an~ Malaise and or fat~ Malaise and o~
#> 10       12 Rhinitis or comm~ [P] Rhinitis o~ Rhinitis or common~ Rhinitis or c~
#> # i 589 more rows
#> # i 75 more variables: librarian <chr>, status <chr>, addedVersion <chr>,
#> #   logicDescription <chr>, hashTag <chr>, isCirceJson <dbl>,
#> #   contributors <chr>, contributorOrcIds <chr>,
#> #   contributorOrganizations <chr>, peerReviewers <chr>,
#> #   peerReviewerOrcIds <dbl>, recommendedReferentConceptIds <chr>,
#> #   ohdsiForumPost <chr>, createdDate <date>, modifiedDate <date>, ...
  • You can extract one or more cohort definitions into a cohortDefinitionSet object as
cohortDefinitionSet <- PhenotypeLibrary::getPlCohortDefinitionSet(cohortIds = c(1, 2, 3))

#> # A tibble: 2 x 4
#>   cohortId cohortName                                   json               sql  
#>      <dbl> <chr>                                        <chr>              <chr>
#> 1        2 COVID-19 diagnosis or SARS-CoV-2 test (1pos) "{\n\t\"cdmVersio~ "CRE~
#> 2        3 Cough or Sputum                              "{\n\t\"cdmVersio~ "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.


connectionDetails <-
    dbms = "postgresql",
    server = "",
    user = "joe",
    password = "secret"
cdmDatabaseSchema <- "cdm_synpuf"
cohortDatabaseSchema <- "scratch.dbo"
cohortTables <- CohortGenerator::getCohortTableNames()
  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."

  cohortDefinitionSet = cohortDefinitionSet,
  exportFolder = outputFolder,
  databaseId = databaseId,
  databaseName = databaseName,
  databaseDescription = databaseDescription,
  cohortDatabaseSchema = cohortDatabaseSchema,
  cdmDatabaseSchema = cdmDatabaseSchema,
  connectionDetails = connectionDetails,
  cohortTableNames = cohortTableNames