Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
zsigmas committed Aug 26, 2024
0 parents commit f44ffdb
Show file tree
Hide file tree
Showing 401 changed files with 58,401 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.*Rproj
^\.Rproj\.user$
^LICENSE$
^README\.Rmd$
^README\.md$
^_pkgdown\.yml$
^docs$
^pkgdown$
.lintr
inst/validation/results/.gitempty
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @boehringer-ingelheim/davinci
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Checks 🧩

on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
branches:
- main
push:
branches:
- main
workflow_dispatch:

jobs:
run-shared-ci:
name: Shared
uses: boehringer-ingelheim/dv.templates/.github/workflows/shared_ci.yml@main
97 changes: 97 additions & 0 deletions .github/workflows/mytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
name: Test and QC 🧪

on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
branches:
- main
push:
branches:
- main
workflow_dispatch:

concurrency:
group: test-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
TEMPLATE_REF: main
TEMPLATE_REPO: boehringer-ingelheim/dv.templates

jobs:
test:
name: ${{ vars.CI_IMAGE }}
runs-on: ubuntu-latest
container:
image: ${{ vars.CI_IMAGE }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Checkout project ⬇️
uses: actions/checkout@v4

- name: Checkout templates repo ⬇️
uses: actions/checkout@v4
with:
ref: ${{env.TEMPLATE_REF}}
repository: ${{env.TEMPLATE_REPO}}
sparse-checkout: |
scripts/
inst/validation
path: templates

- name: Overwrite quality control scripts with dv.templates ones 🧹
shell: bash
run: |
TEMPLATE_DIR="templates/inst/validation"
REPO_DIR="inst/validation"
if test ! -d "${REPO_DIR}"; then
echo "### Quality Control documentation is not present"
echo "### Include quality control documentation or skip it by creating following file 'inst/validation/skip_qc'"
exit 1
fi
if test -f "${REPO_DIR}/skip_qc"; then
echo "skip_qc file found skipping qc documentation"
exit 0
fi
# Conserve specs.R file
cp "${REPO_DIR}/specs.R" "${TEMPLATE_DIR}/specs.R"
set +e # Disable immediate exit in conflicting parts on error for diff command
DIFF_OUTPUT=$(diff -qr "${TEMPLATE_DIR}" "${REPO_DIR}")
set -e # Enable immediate exit on error after diff command
echo "# Quality control files" | tee -a "${GITHUB_STEP_SUMMARY}"
if [ -n "${DIFF_OUTPUT}" ]; then
echo "Warning: The contents of the directories are different!" | tee -a "${GITHUB_STEP_SUMMARY}"
echo "Modified files:" | tee -a "${GITHUB_STEP_SUMMARY}"
echo "$DIFF_OUTPUT" | tee -a "${GITHUB_STEP_SUMMARY}"
else
echo "The directories are identical." | tee -a "${GITHUB_STEP_SUMMARY}"
fi
rm -rf "${REPO_DIR}"
mv "${TEMPLATE_DIR}" "${REPO_DIR}"
- name: Install package dependencies 📄
uses: boehringer-ingelheim/dv.templates/.github/actions/dependencies@main

- name: Test and QC2 🧪
run: Rscript templates/scripts/test_qc_pkg.R

- name: Archive snap results ⬆️
uses: actions/upload-artifact@v4
with:
name: snap_results
path: tests/testthat/_snaps

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.vscode
.Rproj.user
.Rhistory
*.Rproj
docs/
8 changes: 8 additions & 0 deletions .lintr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
linters: linters_with_defaults(
line_length_linter(120),
object_usage_linter = NULL,
indentation_linter = NULL,
trailing_whitespace_linter = NULL
)


32 changes: 32 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Package: dv.biomarker.general
Type: Package
Title: Biomarker Visualization Modules
Version: 0.0.4-900
Authors@R: c(
person("Boehringer-Ingelheim Pharma GmbH & Co.KG", role = c("cph", "fnd")),
person(given = "Luis", family = "Moris Fernandez", role = c("aut", "cre"), email = "[email protected]"),
person(given = "Miguel", family = "Lechon", role = c("aut"), email = "[email protected]")
)
Description: not-EBAS Modules.
License: Apache License (>= 2)
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
Suggests: dv.manager (>= 1.0.9.129), jsonlite, rmarkdown, testthat (>=
3.0.0), shinytest2, devtools, vdiffr, rvest, stringr, knitr,
safetyData, png, rsvg, withr
Config/testthat/edition: 3
Config/testthat/parallel: false
Imports: shiny (>= 1.7.1),dplyr (>= 1.0.7), broom (>= 0.7.9), ggplot2
(>= 3.3.5), DT (>= 0.19), purrr (>= 0.3.4), tidyr (>= 1.1.4),
digest, rlang, tibble, checkmate (>= 2.0.0), GGally,
fontawesome, shinyvalidate, htmltools, RColorBrewer, scales,
shinyWidgets, r2d3, stats, Hmisc, base64enc, viridisLite,
vegawidget, pROC, gt, utils, precrec, glue
Depends: R (>= 4.0)
Date: Tue May 31 12:12:27 2022
Branch: dev
ParentCommit: 9edd5ae0b32a3c7afbcf7215187748f310087a8a
VignetteBuilder: knitr
Remotes: boehringer-ingelheim/[email protected]
13 changes: 13 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2024 Boehringer-Ingelheim Pharma GmbH & Co.KG

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
67 changes: 67 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Generated by roxygen2: do not edit by hand

S3method("$",pack_of_constants)
S3method("[",pack_of_constants)
S3method("[[",pack_of_constants)
export(boxplot_UI)
export(boxplot_server)
export(corr_hm_UI)
export(corr_hm_server)
export(forest_UI)
export(forest_server)
export(get_lbl)
export(get_lbl_robust)
export(get_lbls)
export(get_lbls_robust)
export(lineplot_UI)
export(lineplot_server)
export(lp_mean_summary_functions)
export(lp_median_summary_functions)
export(mock_app_boxplot)
export(mock_app_boxplot_mm)
export(mock_app_corr_hm)
export(mock_app_correlation_hm_mm)
export(mock_app_forest)
export(mock_app_hmcat)
export(mock_app_hmcont)
export(mock_app_hmpar)
export(mock_app_lineplot)
export(mock_app_scatterplot)
export(mock_app_scatterplotmatrix)
export(mock_app_wf)
export(mock_app_wfphm)
export(mock_app_wfphm2)
export(mock_roc_app)
export(mock_roc_mm_app)
export(mock_wfphm_mm_app)
export(mod_boxplot)
export(mod_boxplot_papo)
export(mod_corr_hm)
export(mod_forest)
export(mod_lineplot)
export(mod_roc)
export(mod_scatterplot)
export(mod_scatterplotmatrix)
export(mod_wfphm)
export(odds_ratio)
export(pearson_correlation)
export(roc_UI)
export(roc_server)
export(scatterplot_UI)
export(scatterplot_server)
export(scatterplotmatrix_UI)
export(scatterplotmatrix_server)
export(set_lbl)
export(set_lbls)
export(spearman_correlation)
export(spm_subset_data)
export(tr_gini)
export(tr_identity)
export(tr_min_max)
export(tr_percentize)
export(tr_trunc_z_score)
export(tr_z_score)
export(wfphm_UI)
export(wfphm_server)
importFrom(dplyr,.data)
importFrom(rlang,":=")
60 changes: 60 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# dv.biomarker.general 0.0.4

* Correlation heatmap:
* NA and Inf values are removed before the scatterplot to avoid spurious points
* Lineplot:
* Lineplot does no longer crash when dataset is empty
* Populates inline titles with column names when labels are not available
* Brush selection behaves correctly when sidebar is expanded in dv.manager and it does not crash when the selection
is empty
* Prevents visit reset when dataset changes in module manager


* Migrated Waterfall plus heatmap module to dv.biomarker.general
* Migrated dv.roc to dv.biomarker.general

# dv.biomarker.general 0.0.3

* Lineplot:
* Added summary data listing with aggregated centrality (mean, median, ...) and
dispersion (standard deviation, confidence interval, ...) scores.

* Correlation heatmap:
* Selection interface now allows multiple, independent cross-visit and cross-parameter combinations.
* Faster plot rendering.
* Cleaner graphic output and better management of long axis labels.

# dv.biomarker.general 0.0.2

* Common:
* Each module now explicitly specifies the value column used to generate the figures.
* Default values are included in all modules.
* Menus have been redesigned using shinyvalidate to provide more informative feedback regarding errors or missing selections.

* Boxplot:
* Added functionality for saving/loading visualization states.

* Lineplot:
* Added functionality for integration with other modules
* Supports custom centrality and dispersion measures

* Fix:
* Rectified issue where Boxplot added jitter in the y-axis unnecessarily.
* Renamed `value_var` to `value_vars` in the Scatter Plot Matrix module to adhere to DV standards.
* Improved error handling for correlation calculations in Scatter plot matrix

* Other:
* Replaced the magrittr pipeline `%>%` with the base pipeline `|>`.
* Resolved the issue with `subset_ds` for single column selections.
* Implemented new synthetic datasets in mock_* functions and testing procedures.
* Replaced `dv.selector` with locally developed selectors

# dv.biomarker.general 0.0.1

* Initial release with the following modules:
* Boxplot: `vignette("boxplot")`
* Scatterplot: `vignette("scatterplot")`
* Lineplot: `vignette("lineplot")`
* Scatterplotmatrix: `vignette("scatterplotmatrix")`
* Forest plot: `vignette("forest")`
* Scatterplot heatmap plot: `vignette("correlation_heatmap")`
70 changes: 70 additions & 0 deletions R/aaa_preface.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# THIS FILE IS NAMED aaa_preface.R SO IT IS LOADED BEFORE ALL OTHER FILES
# DO NOT CHANGE ITS NAME. IT MUST BE THE FIRST ONE ALPHABETICALLY.

#' Build a collection of named constants
#'
#' @param ... Named parameters to be collected as constants
#' @details
#' Shiny uses strings as IDs to link UI and server elements. E.g:
#' foo_UI(id = ns("foo")) ...
#' foo_server(id = "foo")
#'
#' This pattern makes it easy for programmers to fall on the trap of modifying one instance of the string literal "foo"
#' without modifying the rest and be unaware of the problem until a bug is hit. It's also easy to mistakes uses of "foo"
#' as an identifier from other uses (text labels, ...) when, as it's often the case, the parameter is not explicitly
#' named.
#' One easy fix consists in using global variables instead of plain string literals. In the case of the previous
#' example, that would mean:
#' ID_FOO <- "foo"
#' foo_UI(ns(ID_FOO)) ...
#' foo_server(ID_FOO)
#'
#' That simple addition makes the purpose of ID_FOO clear and also fails gracefully when not all ID_FOO instances are
#' updated synchronously along a codebase. It has the drawback of polluting the global namespace with identifier
#' variables. That's easily solved by creating a container of constants, which is the purpose of this pack_of_constants
#' alias.
#' ID <- pack_of_constants(FOO = "foo", BAR = "bar")
#' ID$FOO
#' "foo"
#' ID$BA
#' Error in `$.pack_of_constants`(ID, BA) :
#' Pack of constants "ID" does not contain "BA"
#'
#' The pack of constants is a plain named list that enforces that all elements have unique, non-null names.
#' It is tagged as an S3 object to override its extraction operators.
#'
#' The use of checkmate is unnecessary, but it's a Good Library(TM) and your module should rely on it anyways
#' @keywords internal
pack_of_constants <- function(...) {
result <- list(...)
checkmate::assert_list(result, any.missing = FALSE, names = "unique")
class(result) <- c("pack_of_constants", class(result))
result
}

#' Extract constant from pack
#'
#' @param pack pack_of_constants
#' @param name target constant
#'
#' This function differs from the base list extraction method in that it avoids partial matching of keys and throws
#' an error if the looked-for constant is not contained within the pack.
#' @keywords internal
#' @export
`$.pack_of_constants` <- function(pack, name) {
checkmate::assert_true(name %in% names(pack), .var.name = paste0(deparse(substitute(pack)), "$", name))
NextMethod()
}

# This exports are recent requirement for devtools check https://github.com/r-lib/roxygen2/issues/1592#issue-2121199122
#' @keywords internal
#' @export
`[[.pack_of_constants` <- `$.pack_of_constants`

#' @export
#' @keywords internal
`[.pack_of_constants` <- function(pack, name) {
stop("Invalid pack_of_constants method")
}

poc <- pack_of_constants
Loading

0 comments on commit f44ffdb

Please sign in to comment.