Skip to content

Commit

Permalink
Merge pull request #170 from pharmaverse/devel
Browse files Browse the repository at this point in the history
PR for {admiralophtha} v0.2.0
  • Loading branch information
manciniedoardo authored Jun 12, 2023
2 parents 3c3a6c1 + 9677e3c commit 822e291
Show file tree
Hide file tree
Showing 48 changed files with 6,235 additions and 1,004 deletions.
12 changes: 11 additions & 1 deletion .Rprofile
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
if (Sys.getenv("GITHUB_ACTIONS") == "" || (Sys.getenv("GITHUB_ACTIONS") == "true" && getRversion()$major == 3 && getRversion()$minor == 6)) {
# Set renv profile base on R version.
if ((Sys.getenv("GITHUB_ACTIONS") == "") && (Sys.getenv("DOCKER_CONTAINER_CONTEXT") == "")) {
renv_profile <- paste(R.version$major, substr(R.version$minor, 1, 1), sep = ".")
if (file.exists("./renv/profile")) {
message("Using renv profile from `renv/profile` file.")
} else if (renv_profile %in% c("4.1", "4.2", "4.3")) {
message("Set renv profile to `", renv_profile, "`")
Sys.setenv("RENV_PROFILE" = renv_profile)
} else {
message("This repository do not contains the renv profile for your R version.")
}
source("renv/activate.R")
} else {
options(repos = c(CRAN = "https://cran.rstudio.com"))
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,25 @@ jobs:
uses: pharmaverse/admiralci/.github/workflows/style.yml@main
if: github.event_name == 'pull_request'
with:
r-version: "4.0"
r-version: "4.1"
spellcheck:
name: Spelling
uses: pharmaverse/admiralci/.github/workflows/spellcheck.yml@main
if: github.event_name == 'pull_request'
with:
r-version: "4.0"
r-version: "4.1"
readme:
name: Render README
uses: pharmaverse/admiralci/.github/workflows/readme-render.yml@main
if: github.event_name == 'push'
with:
r-version: "4.0"
r-version: "4.1"
validation:
name: Validation
uses: pharmaverse/admiralci/.github/workflows/r-pkg-validation.yml@main
if: github.event_name == 'release'
with:
r-version: "4.0"
r-version: "4.1"
check:
name: Check
uses: pharmaverse/admiralci/.github/workflows/r-cmd-check.yml@main
Expand All @@ -69,7 +69,7 @@ jobs:
uses: pharmaverse/admiralci/.github/workflows/pkgdown.yml@main
if: github.event_name == 'push'
with:
r-version: "4.0"
r-version: "4.1"
# Whether to skip multiversion docs
# Note that if you have multiple versions of docs,
# your URL links are likely to break due to path changes
Expand All @@ -79,7 +79,7 @@ jobs:
uses: pharmaverse/admiralci/.github/workflows/lintr.yml@main
if: github.event_name == 'pull_request'
with:
r-version: "4.0"
r-version: "4.1"
links:
name: Links
uses: pharmaverse/admiralci/.github/workflows/links.yml@main
Expand All @@ -91,7 +91,7 @@ jobs:
if: >
github.event_name == 'push' || github.event_name == 'pull_request'
with:
r-version: "4.0"
r-version: "4.1"
# Whether to skip code coverage badge creation
# Setting to 'false' will require you to create
# an orphan branch called 'badges' in your repository
Expand All @@ -102,10 +102,10 @@ jobs:
if: >
github.event_name == 'push' || github.event_name == 'pull_request'
with:
r-version: "4.0"
r-version: "4.1"
man-pages:
name: Man Pages
uses: pharmaverse/admiralci/.github/workflows/man-pages.yml@main
if: github.event_name == 'pull_request'
with:
r-version: "4.0"
r-version: "4.1"
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ vignettes/*.pdf
*.knit.md
# Web Documentation files
/docs/*
!/docs/pkgdown.yml
# R Environment Variables
.Renviron
# MacOS
Expand Down
2 changes: 0 additions & 2 deletions CRAN-RELEASE

This file was deleted.

23 changes: 13 additions & 10 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
Package: admiralophtha
Type: Package
Title: ADaM in R Asset Library - Ophthalmology
Version: 0.1.0
Version: 0.2.0
Authors@R: c(
person("Edoardo", "Mancini", email = "[email protected]", role = c("aut", "cre")),
person("Ritika", "Aggarwal", email = "[email protected]", role = c("aut")),
person("Jane", "Gao", email = "[email protected]",role = c("aut")),
person("William", "Holmes", email = "[email protected]", role = c("aut")),
person("Josie", "Jackson", email = "[email protected]", role = c("aut")),
person("Sonali", "Jain", email = "[email protected]", role = c("aut")),
person("Yuki", "Matsunaga", email = "[email protected]", role = c("aut")),
person("Gordon", "Miller", email = "[email protected]", role = c("aut")),
person("Ritika", "Aggarwal", role = "aut", email = "[email protected]"),
person("Jane", "Gao", role = "aut", email = "[email protected]"),
person("William", "Holmes", role = "aut", email = "[email protected]"),
person("Rachel", "Linacre", role = "aut", email = "[email protected]"),
person("Lucy", "Palmen", role = "aut", email = "[email protected]"),
person("Nandini", "R Thampi", role = "aut", email = "[email protected]")
person("Rachel", "Linacre", email = "[email protected]", role = c("aut")),
person("Lucy", "Palmen", email = "[email protected]", role = c("aut")),
person("Nandini", "R Thampi", email = "[email protected]", role = c("aut")),
person("Aldrich", "Salva", email = "[email protected]", role = c("aut"))
)
Description: Aids the programming of Clinical Data Standards Interchange Consortium
(CDISC) compliant Ophthalmology Analysis Data Model (ADaM) datasets in R. ADaM datasets are a
Expand All @@ -19,17 +23,17 @@ Description: Aids the programming of Clinical Data Standards Interchange Consort
implemented in accordance with the "Analysis Data Model Implementation Guide"
(CDISC Analysis Data Model Team, 2021, <https://www.cdisc.org/standards/foundational/adam/adamig-v1-3-release-package>).
License: Apache License (>= 2)
BugReports: https://github.com/pharmaverse/admiralophtha/issues
URL: https://pharmaverse.github.io/admiralophtha/, https://github.com/pharmaverse/admiralophtha/
Encoding: UTF-8
Language: en-US
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.1
RoxygenNote: 7.2.3
Depends: R (>= 3.5)
Imports:
admiral,
admiraldev,
assertthat,
dplyr,
lubridate,
magrittr,
Expand All @@ -53,7 +57,6 @@ Suggests:
rmarkdown,
roxygen2,
spelling,
styler,
tibble,
usethis,
covr,
Expand Down
4 changes: 0 additions & 4 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export(convert_etdrs_to_logmar)
export(convert_logmar_to_etdrs)
export(derive_var_afeye)
export(derive_var_bcvacritxfl)
export(derive_var_bcvacritxfl_util)
export(derive_var_studyeye)
importFrom(admiral,derive_param_computed)
importFrom(admiral,derive_var_merged_cat)
Expand All @@ -19,9 +18,6 @@ importFrom(admiraldev,assert_symbol)
importFrom(admiraldev,expect_dfs_equal)
importFrom(admiraldev,expr_c)
importFrom(admiraldev,quo_c)
importFrom(assertthat,"on_failure<-")
importFrom(assertthat,assert_that)
importFrom(assertthat,is.number)
importFrom(dplyr,arrange)
importFrom(dplyr,bind_cols)
importFrom(dplyr,bind_rows)
Expand Down
21 changes: 20 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
# admiralophtha 0.2.0

## Updates to Functions

- Added new parameter `loc_vals` to function `derive_var_afeye()` to allow users to specify values of `xxLOC` for which `AFEYE` is derived (issue #163).
- Updated function `derive_var_afeye()` to resolve bug when `STUDYEYE` is 'Bilateral' (issue #134).

## Updates to Templates

- Updated `ADOE` to refer to `OESTRESU` for `AVALU` creation (issue #139).
- Updated `ADOE` and `ADBCVA` `PARAM` mapping to include units where applicable (issue #139).
- Updated `ADOE`, `ADVFQ` and `ADBCVA` for the unique intermediate dataset name to avoid overwriting, corrected the link for Visit and Period variables Vignette in `ADVFQ` (issue #128).
- Corrected values of `DTYPE`, `VISIT`, `VISITNUM`, `OEDY`, `OEDTC` for derived parameters in `ADBCVA` template (issue #137).
- Updated `ADBCVA` and `ADOE` templates to include `AFEYE` (issue #133).

## Updates to Site

- Added a "Report a bug" link to `{admiralophtha}` website (issue #127).
- Fixed bug where the search bar didn't work for some searches (issue #141).

# admiralophtha 0.1.0

## New Features
Expand All @@ -10,4 +30,3 @@
- Created ophthalmology-specific test data for the `EX` SDTM domain, stored in `{admiralophtha}` package and accessible by calling `data(admiralophtha_ex)` (issue #36).
- Created ophthalmology-specific test data for the `SC` and `OE` SDTM domains, stored in `{admiral}` package and accessible by calling `data(admiral_sc)` or `data(admiral_oe)` (issues #11 and #13).
- Updated `AE` and `QS` test datasets in `{admiral}` to include ophthalmology-specific variables and records, such as laterality variables in `AE` and VFQ records in `QS` (issues #12 and #52).

1 change: 0 additions & 1 deletion R/admiralophtha-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#' flatten every modify_at modify_if reduce compose
#' @importFrom stringr str_c str_detect str_extract str_remove str_remove_all
#' str_replace str_trim str_to_lower str_to_title str_to_upper str_glue
#' @importFrom assertthat assert_that is.number on_failure<-
#' @importFrom lubridate as_datetime ceiling_date date days duration floor_date is.Date is.instant
#' time_length %--% ymd ymd_hms weeks years hours minutes
#' @importFrom tidyr drop_na nest pivot_longer pivot_wider unnest
Expand Down
18 changes: 14 additions & 4 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' @keywords datasets
#' @family datasets
#' @source
#' Constructed using `ex` from the `{admiral` package
#' Constructed using `ex` from the `{admiral}` package
#'
"admiralophtha_ex"

Expand All @@ -14,7 +14,7 @@
#' @keywords datasets
#' @family datasets
#' @source
#' Derived from the `oe` and `ADSL` datasets using `{admiral`, `{admiralophtha}` and
#' Derived from the `oe` and `ADSL` datasets using `{admiral}`, `{admiralophtha}` and
#' (\url{https://github.com/pharmaverse/admiralophtha/blob/main/inst/templates/ad_adbcva.R})
#'
"admiralophtha_adbcva"
Expand All @@ -25,7 +25,7 @@
#' @keywords datasets
#' @family datasets
#' @source
#' Derived from the `ADSL` and `qs` datasets using `{admiral`, `{admiralophtha}` and
#' Derived from the `ADSL` and `qs` datasets using `{admiral}`, `{admiralophtha}` and
#' (\url{https://github.com/pharmaverse/admiralophtha/blob/main/inst/templates/ad_advfq.R})
#'
"admiralophtha_advfq"
Expand All @@ -36,7 +36,17 @@
#' @keywords datasets
#' @family datasets
#' @source
#' Derived from the `oe` and `ADSL` datasets using `{admiral`, `{admiralophtha}` and
#' Derived from the `oe` and `ADSL` datasets using `{admiral}`, `{admiralophtha}` and
#' (\url{https://github.com/pharmaverse/admiralophtha/blob/main/inst/templates/ad_adoe.R})
#'
"admiralophtha_adoe"

#' Ophthalmology Questionnaires SDTM Dataset
#'
#' An example Questionnaires SDTM dataset with ophthalmology-specific questionnaire of NEI VFQ-25
#' @keywords datasets
#' @family datasets
#' @source
#' Constructed using `qs` from the `{admiral}` package
#'
"admiralophtha_qs"
31 changes: 22 additions & 9 deletions R/derive_var_afeye.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#' @param dataset_occ Input Occurence dataset
#' @param loc_var Location variable
#' @param lat_var Laterality variable
#' @param loc_vals `xxLOC`values for which `AFEYE` is derived
#'
#' @details
#' Affected Eye is derived in the occurrence dataset using laterality and Study
Expand All @@ -24,24 +25,36 @@
#' ~STUDYID, ~USUBJID, ~STUDYEYE, ~AELOC, ~AELAT,
#' "XXX001", "P01", "RIGHT", "EYE", "RIGHT",
#' "XXX001", "P01", "RIGHT", "EYE", "LEFT",
#' "XXX001", "P01", "RIGHT", "EYE", "",
#' "XXX001", "P01", "RIGHT", "", "RIGHT",
#' "XXX001", "P02", "LEFT", "", "",
#' "XXX001", "P02", "LEFT", "EYE", "LEFT",
#' "XXX001", "P04", "BILATERAL", "EYE", "RIGHT",
#' "XXX001", "P05", "RIGHT", "EYE", "RIGHT"
#' "XXX001", "P05", "RIGHT", "EYE", "RIGHT",
#' "XXX001", "P05", "RIGHT", "EYE", "BILATERAL",
#' "XXX001", "P06", "BILATERAL", "", "",
#' "XXX001", "P06", "BILATERAL", "", "RIGHT",
#' "XXX001", "P07", "BILATERAL", "EYE", "BILATERAL",
#' "XXX001", "P08", "", "EYE", "BILATERAL",
#' )
#'
#' derive_var_afeye(adae, AELOC, AELAT)
derive_var_afeye <- function(dataset_occ, loc_var, lat_var) {
#' adae <- derive_var_afeye(adae, AELOC, AELAT)
derive_var_afeye <- function(dataset_occ, loc_var, lat_var, loc_vals = "EYE") {
loc_var <- assert_symbol(enexpr(loc_var))
lat_var <- assert_symbol(enexpr(lat_var))
assert_data_frame(dataset_occ, required_vars = expr_c(loc_var, lat_var))
assert_character_vector(loc_vals)
assert_data_frame(dataset_occ, required_vars = expr_c(loc_var, lat_var, exprs(STUDYEYE)))

dataset_occ %>%
mutate(AFEYE = case_when(
!!loc_var == "" ~ "",
toupper(STUDYEYE) == "BILATERAL" ~ "Study Eye",
toupper(!!lat_var) == toupper(STUDYEYE) ~ "Study Eye",
toupper(!!lat_var) != toupper(STUDYEYE) ~ "Fellow Eye",
TRUE ~ ""
STUDYEYE != "" & !!lat_var == "BILATERAL" &
!!loc_var %in% loc_vals ~ "Both Eyes",
toupper(STUDYEYE) == "BILATERAL" & !!lat_var != "" &
!!loc_var %in% loc_vals ~ "Study Eye",
toupper(!!lat_var) == toupper(STUDYEYE) & STUDYEYE != "" & !!lat_var != "" &
!!loc_var %in% loc_vals ~ "Study Eye",
toupper(!!lat_var) != toupper(STUDYEYE) & STUDYEYE != "" & !!lat_var != "" &
!!loc_var %in% loc_vals ~ "Fellow Eye",
TRUE ~ NA_character_
))
}
3 changes: 1 addition & 2 deletions R/derive_var_bcvacritxfl.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
#' @author Edoardo Mancini
#'
#' @return The input ADBCVA dataset with additional columns `CRITx`, `CRITxFL`.
#' @keywords der_ophtha
#' @export
#' @keywords internal

derive_var_bcvacritxfl_util <- function(dataset,
critx_text,
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ remotes::install_github("pharmaverse/admiralophtha", ref = "devel")
## References and Documentation

* Please refer to the [{admiral} References and
Documentation](https://pharmaverse.github.io/admiral/pre-release/).
Documentation](https://pharmaverse.github.io/admiral/devel/).

## R Versions

Expand Down
6 changes: 3 additions & 3 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
url: https://pharmaverse.github.io/admiralophtha/main
url: https://pharmaverse.github.io/admiralophtha

template:
bootstrap: 5
Expand All @@ -8,7 +8,7 @@ search:
exclude: ['news/index.html']
repo:
url:
home: https://github.com/pharmaverse/admiralophtha/main
home: https://github.com/pharmaverse/admiralophtha
source: https://github.com/pharmaverse/admiralophtha/blob/main/
issue: https://github.com/pharmaverse/admiralophtha/issues/
user: https://github.com/
Expand Down Expand Up @@ -101,7 +101,7 @@ navbar:
articles:
text: User Guides
menu:
- text: Ophthalomology Standards
- text: Ophthalmology Standards
href: articles/standards.html
- text: Creating ADOE
href: articles/adoe.html
Expand Down
5 changes: 0 additions & 5 deletions cran-comments.md

This file was deleted.

Binary file modified data/admiralophtha_adbcva.rda
Binary file not shown.
Binary file modified data/admiralophtha_adoe.rda
Binary file not shown.
Binary file added data/admiralophtha_qs.rda
Binary file not shown.
Loading

0 comments on commit 822e291

Please sign in to comment.