vignettes/HowToUsePhenotypeLibraryRPackage.Rmd
HowToUsePhenotypeLibraryRPackage.Rmd
PhenotypeLibrary is part of HADES
remotes::install_github("OHDSI/PhenotypeLibrary")
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>
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~
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
)
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
)