Skip to content

Commit a366603

Browse files
gowthamraoazimov
andauthored
Make package HADES (#33)
#30 * Added tests * Add vignette * Update DESCRIPTION * Package maintenance Co-authored-by: Jamie Gilbert <JGilber2@its.jnj.com> Co-authored-by: Jamie Gilbert <JGilber2@its.jnj.com>
1 parent e6d4b45 commit a366603

22 files changed

Lines changed: 615 additions & 58 deletions

‎DESCRIPTION‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
Package: PhenotypeLibrary
22
Type: Package
33
Title: The OHDSI Phenotype library
4-
Version: 3.1.0
5-
Date: 2022-07-06
4+
Version: 3.1.1
5+
Date: 2022-07-07
66
Author: Gowtham Rao [aut, cre]
77
Maintainer: Gowtham Rao <rao@ohdsi.org>
88
Description: A repository to store the content of the OHDSI Phenotype library.
99
Imports:
10+
checkmate,
1011
readr,
1112
dplyr,
12-
rlang,
13-
checkmate
13+
rlang
14+
Suggests:
15+
DatabaseConnector,
16+
testthat,
17+
rmarkdown,
18+
knitr
1419
License: Apache License
1520
RoxygenNote: 7.2.0
1621
Roxygen: list(markdown = TRUE)
1722
Encoding: UTF-8
1823
Language: en-US
24+
VignetteBuilder: knitr
1925
URL: https://ohdsi.github.io/PhenotypeLibrary/, https://github.com/OHDSI/PhenotypeLibrary
2026
BugReports: https://github.com/OHDSI/PhenotypeLibrary/issues

‎NEWS.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
PhenotypeLibrary 3.1.1
2+
======================
3+
4+
Added Vignette: How to use Phenotype Library R Package
5+
Added tests to conform to HADES
6+
This package is now part of OHDSI HADES.
7+
18
PhenotypeLibrary 3.1.0
29
======================
310

‎R/Phenotypes.R‎

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,56 +21,58 @@
2121
#'
2222
#' @examples
2323
#' listPhenotypes()
24-
#'
24+
#'
2525
#' @export
2626
listPhenotypes <- function() {
2727
cohorts <- readr::read_csv(system.file("Cohorts.csv", package = "PhenotypeLibrary"), col_types = readr::cols())
28-
return(cohorts)
28+
return(cohorts)
2929
}
3030

3131
#' Get a cohort definition set
3232
#'
3333
#' @param cohortIds IDs of cohorts to extraction from the library.
3434
#'
3535
#' @return
36-
#' A tibble with the cohort ID, name, sql, and JSON for the provided cohort IDs. Can be used by the
36+
#' A tibble with the cohort ID, name, sql, and JSON for the provided cohort IDs. Can be used by the
3737
#' `CohortGenerator` package.
38-
#'
38+
#'
3939
#' @examples
4040
#' cohorts <- listPhenotypes()
4141
#' subsetIds <- cohorts$cohortId[1:3]
4242
#' getPlCohortDefinitionSet(subsetIds)
43-
#'
43+
#'
4444
#' @export
4545
getPlCohortDefinitionSet <- function(cohortIds) {
4646
errorMessages <- checkmate::makeAssertCollection()
4747
checkmate::assertIntegerish(cohortIds, min.len = 1, add = errorMessages)
4848
checkmate::reportAssertions(collection = errorMessages)
49-
50-
cohorts <- listPhenotypes() %>%
49+
50+
cohorts <- listPhenotypes() %>%
5151
filter(.data$cohortId %in% cohortIds)
5252
jsonFolder <- system.file("cohorts", package = "PhenotypeLibrary")
5353
sqlFolder <- system.file("sql", "sql_server", package = "PhenotypeLibrary")
54-
54+
5555
readFile <- function(fileName) {
5656
if (file.exists(fileName)) {
5757
return(paste(readr::read_lines(fileName), collapse = "\n"))
5858
} else {
5959
stop(paste0("File not found: ", fileName))
6060
}
6161
}
62-
62+
6363
getJsonAndSql <- function(i) {
6464
json <- readFile(file.path(jsonFolder, paste0(cohorts$cohortId[i], ".json")))
6565
sql <- readFile(file.path(sqlFolder, paste0(cohorts$cohortId[i], ".sql")))
6666
cohorts[i, ] %>%
67-
mutate(json = !!json,
68-
sql = !!sql) %>%
69-
return()
67+
mutate(
68+
json = !!json,
69+
sql = !!sql
70+
) %>%
71+
return()
7072
}
71-
73+
7274
result <- lapply(seq_len(nrow(cohorts)), getJsonAndSql) %>%
7375
bind_rows()
74-
76+
7577
return(result)
76-
}
78+
}

‎README.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ PhenotypeLibrary
66

77
Introduction
88
============
9-
PhenotypeLibrary is a repository to store the content of the OHDSI Phenotype library.
9+
PhenotypeLibrary is a repository to store the content of the OHDSI Phenotype library. These phenotype/cohort definitions have under gone an OHDSI best practice Phenotype Development and Evaluation Process by the OHDSI Phenotype Development and Evaluation work group. This [workgroup](https://forums.ohdsi.org/t/ohdsi-phenotype-library-announcements/16910), through a OHDSI community wide collaboration effort, evaluates and maintains cohort definitions in an [Atlas instance](https://atlas-phenotype.ohdsi.org/#/home). Definitions that have graduated through this process are published in this repository, and are thus considered high quality cohort definitions.
10+
11+
cohortId's in this repository are persistent (similar to OMOP Concept Id) i.e. once published it maybe expected to stay the same between releases of the Phenotype library (i.e. backward compatible). Version numbers in this repository follows [HADES](https://ohdsi.github.io/Hades/index.html) convention, and changes (addition or deletions) are reported as [News](https://ohdsi.github.io/PhenotypeLibrary/news/index.html). Phenotype Development and Evaluation Workgroup will be responsible to maintain a cadence for the cohort life cycle - including deprecation and additions.
1012

1113
Features
1214
========
13-
- Contains all approved phenotypes (ie. cohort definitions) of the OHDSI Phenotype Library.
15+
- Contains all phenotypes (ie. cohort definitions) that have been approved by the OHDSI Phenotype Development and Evaluation workgroup.
1416
- Phenotypes are available as SQL statements and JSON.
15-
- Can directly be used with the OHDSI [CohortGenerator](https://ohdsi.github.io/CohortGenerator/) package to instantiate cohorts.
17+
- Can provide cohortDefinitionSet object that maybe directly used as input by other OHDSI R packages like OHDSI [CohortGenerator](https://ohdsi.github.io/CohortGenerator/) and [CohortGenerator] (https://ohdsi.github.io/CohortDiagnostics/). See accompanying vignettes.
1618

1719
Technology
1820
============

‎docs/404.html‎

Lines changed: 13 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)