vignettes/HowToUsePhenotypeLibraryRPackage.Rmd
HowToUsePhenotypeLibraryRPackage.Rmd
PhenotypeLibrary is part of HADES
remotes::install_github("OHDSI/PhenotypeLibrary")
PhenotypeLibrary::getPhenotypeLog()
#> # A tibble: 599 × 88
#> 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…
#> # ℹ 589 more rows
#> # ℹ 83 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>, …
cohortDefinitionSet <- PhenotypeLibrary::getPlCohortDefinitionSet(cohortIds = c(1, 2, 3))
cohortDefinitionSet
#> # A tibble: 2 × 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…
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
)