From e7b32115eb99d15aecc33b92376f41cae7b73f9d Mon Sep 17 00:00:00 2001 From: Ming Yang Date: Tue, 2 Jul 2024 17:35:56 +0800 Subject: [PATCH 1/5] Add qc.Rmd to vignettes/ --- vignettes/qc.Rmd | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 vignettes/qc.Rmd diff --git a/vignettes/qc.Rmd b/vignettes/qc.Rmd new file mode 100644 index 0000000..87bb735 --- /dev/null +++ b/vignettes/qc.Rmd @@ -0,0 +1,32 @@ +--- +title: "Quality Control" +output: + rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Quality Control} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>", + echo = FALSE +) +``` + +```{r, params, echo = FALSE, include = FALSE} +val_param_rds <- "../inst/validation/results/val_param.rds" +val_param_rds_exists <- file.exists(val_param_rds) +if (file.exists(val_param_rds)) params <- readRDS(val_param_rds) +``` + +```{r, results = "asis", echo = FALSE} +if (val_param_rds_exists) { + res <- knitr::knit_child("../inst/validation/val_report_child.Rmd", quiet = TRUE, envir = environment()) + cat(res, sep = "\n") +} else { + "No quality control results found" +} +``` From 92a2a791efca603c402d2cc229030d8550e0ea60 Mon Sep 17 00:00:00 2001 From: Ming Yang Date: Tue, 2 Jul 2024 18:01:28 +0800 Subject: [PATCH 2/5] Update pkgdown config --- _pkgdown.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/_pkgdown.yml b/_pkgdown.yml index 8916d82..fc39932 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -1,10 +1,16 @@ ---- -url: https://Boehringer-Ingelheim.github.io/dv.filter - template: bootstrap: 5 navbar: - right: - - icon: fa-github - href: https://github.com/Boehringer-Ingelheim/dv.filter + type: inverse + structure: + left: [intro, reference, articles, tutorials, news, qc] + components: + qc: + text: Quality Control + href: articles/qc.html +home: + title: dv.filter + links: + - text: Browse source code + href: https://github.com/Boehringer-Ingelheim/dv.filter From 9a360852df89bc899bfdd14cf50570591ff5ef6c Mon Sep 17 00:00:00 2001 From: "Matthias,Korbinian (MED BDS) BIP-DE-B" Date: Thu, 4 Jul 2024 08:21:26 +0200 Subject: [PATCH 3/5] Update run_validation and utils_validation files --- inst/validation/run_validation.R | 12 +++--- inst/validation/utils-validation.R | 68 +++++++++++++++--------------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/inst/validation/run_validation.R b/inst/validation/run_validation.R index 66396c0..465c65c 100644 --- a/inst/validation/run_validation.R +++ b/inst/validation/run_validation.R @@ -5,19 +5,19 @@ test_results <- tibble::as_tibble(devtools::test()) local({ # This is evaluated inside a local because, otherwise, all the variables created in the chunks of the rendered # document leak into the environment - + validation_root <- "./inst/validation" validation_report_rmd <- file.path(validation_root, "val_report.Rmd") validation_report_html <- "val_report.html" validation_results <- file.path(validation_root, "results") val_param_rds <- file.path(validation_results, "val_param.rds") - + stopifnot(dir.exists(validation_root)) stopifnot(file.exists(validation_report_rmd)) - + stopifnot(dir.exists(validation_results)) unlink(list.files(validation_results)) - + saveRDS( list( package = pkg_name, @@ -26,7 +26,7 @@ local({ ), val_param_rds ) - + rmarkdown::render( input = validation_report_rmd, params = list( @@ -37,7 +37,7 @@ local({ output_dir = validation_results, output_file = validation_report_html ) - + # We use one of the leaked variables, created inside the validation report to asses if the validation is # succesful or not VALIDATION_PASSED diff --git a/inst/validation/utils-validation.R b/inst/validation/utils-validation.R index eeb9356..06eeb3d 100644 --- a/inst/validation/utils-validation.R +++ b/inst/validation/utils-validation.R @@ -67,29 +67,29 @@ local({ return(parent) } unlist(mapply(recursive_ids, - x, - paste(parent, names(x), - sep = if (identical(parent, character(0))) "" else "$" - ), - SIMPLIFY = FALSE, USE.NAMES = FALSE + x, + paste(parent, names(x), + sep = if (identical(parent, character(0))) "" else "$" + ), + SIMPLIFY = FALSE, USE.NAMES = FALSE )) } - + recursive_ids <- function(x, parent = character(0)) { if (!is.list(x)) { return(parent) } unlist(mapply(recursive_ids, x, - paste(parent, names(x), - sep = if (identical(parent, character(0))) "" else "$" - ), - SIMPLIFY = FALSE, USE.NAMES = FALSE + paste(parent, names(x), + sep = if (identical(parent, character(0))) "" else "$" + ), + SIMPLIFY = FALSE, USE.NAMES = FALSE )) } - - + + spec_id_list <- recursive_ids(specs) - + list( specs = specs, spec_id_list = spec_id_list, @@ -102,11 +102,11 @@ local({ } else { spec_id <- list(s_spec) # Otherwise the posterior vapply iterates over the expression } - + spec_id_chr <- vapply(spec_id, function(x) { sub("^[^$]*\\$", "", deparse(x)) }, FUN.VALUE = character(1)) - + if (!all(spec_id_chr %in% spec_id_list)) { stop("At least one spec is not declared in the spec list") } # This should be covered by pack of constants but just in case @@ -117,39 +117,39 @@ local({ }, get_spec = function(test, specs) { spec_ids <- utils::strcapture( - pattern = "__spec_ids\\{(.*)\\}", - x = test, - proto = list(spec = character()) - )[["spec"]] + pattern = "__spec_ids\\{(.*)\\}", + x = test, + proto = list(spec = character()) + )[["spec"]] spec_ids <- strsplit(spec_ids, split = ";") - + specs_and_id <- list() - + for (idx in seq_along(spec_ids)){ ids <- spec_ids[[idx]] if (all(!is.na(ids))) { this_specs <- list() - for (sub_idx in seq_along(ids)) { - id <- ids[[sub_idx]] - this_specs[[sub_idx]] <- eval(str2expression(paste0("specs$", id))) - } - specs_and_id[[idx]] <- list( - spec_id = ids, - spec = this_specs - ) + for (sub_idx in seq_along(ids)) { + id <- ids[[sub_idx]] + this_specs[[sub_idx]] <- eval(str2expression(paste0("specs$", id))) + } + specs_and_id[[idx]] <- list( + spec_id = ids, + spec = this_specs + ) } else { specs_and_id[[idx]] <- list( - spec_id = NULL, - spec = NULL - ) + spec_id = NULL, + spec = NULL + ) } } specs_and_id } - + ) }) -# nolint end cyclocomp_linter +# nolint end cyclocomp_linter \ No newline at end of file From f87cf58b7979560c074342f5b7267aacfab15905 Mon Sep 17 00:00:00 2001 From: sorinvoicu <61691256+sorinvoicu@users.noreply.github.com> Date: Fri, 5 Jul 2024 11:23:58 +0000 Subject: [PATCH 4/5] rename dv.filter.Rmd to fix blob reference --- vignettes/dv_filter.Rmd | 48 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 vignettes/dv_filter.Rmd diff --git a/vignettes/dv_filter.Rmd b/vignettes/dv_filter.Rmd new file mode 100644 index 0000000..ab63f0f --- /dev/null +++ b/vignettes/dv_filter.Rmd @@ -0,0 +1,48 @@ +--- +title: "Getting Started" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Getting Started} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r setup, include = FALSE} +knitr::opts_chunk$set( + eval = FALSE, + collapse = TRUE, + comment = "#>" +) +``` + +Run the code below to launch a demo app. + +```{r, eval=FALSE} +data <- shiny::reactive(pharmaverseadam::adsl) + +ui <- shiny::fluidPage( + shiny::sidebarLayout( + shiny::sidebarPanel( + dv.filter::data_filter_ui("data_filter") + ), + shiny::mainPanel( + shiny::dataTableOutput("data_table") + ) + ) +) + +server <- function(input, output, session) { + selected <- dv.filter::data_filter_server("data_filter", data = data) + + output$data_table <- shiny::renderDataTable({ + data()[selected(), ] + }) +} + +shiny::shinyApp(ui, server) +``` + +Inside the app, `dv.filter::data_filter_ui()` and `dv.filter::data_filter_server()` +are called to invoke the module. + +![](../man/figures/demo.png){width=100%} From ae4abf7fd86147d3873b20b3f8a4159984d9e7f5 Mon Sep 17 00:00:00 2001 From: sorinvoicu <61691256+sorinvoicu@users.noreply.github.com> Date: Fri, 5 Jul 2024 12:23:40 +0000 Subject: [PATCH 5/5] add repo url to _pkgdown.yml --- _pkgdown.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/_pkgdown.yml b/_pkgdown.yml index fc39932..28b67a4 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -12,5 +12,9 @@ navbar: home: title: dv.filter links: - - text: Browse source code - href: https://github.com/Boehringer-Ingelheim/dv.filter + - text: Browse source code + href: https://github.com/Boehringer-Ingelheim/dv.filter + +repo: + url: + home: https://github.com/Boehringer-Ingelheim/dv.filter