Skip to content

Commit 5be4d4e

Browse files
authored
Merge pull request #28 from Boehringer-Ingelheim/303774-app_creator_vignette
Review functionality vignette
2 parents c595979 + 650f5df commit 5be4d4e

13 files changed

Lines changed: 488 additions & 381 deletions

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# formatting
2+
23b125d3d44eda8230e873fcbd88f2a20175d087
3+
a5a5d133ad5ef0df7fd40be2ec4f9cd22ab0fa9d

.lintr.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ linters <- lintr::modify_defaults(
99
, object_length_linter = NULL # we don't type long var names just because
1010
, pipe_continuation_linter = NULL # wickham being overly prescriptive
1111
, trailing_blank_lines_linter = NULL # natural extension of trailing_whitespace_linter, present on the template
12+
, semicolon_linter = NULL # used to highlight checks that lead to the early out on a function
1213
)
1314

1415
if(identical(Sys.getenv('CI'), "true")){

R/mock_listings.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ mock_listings_mm <- function() {
130130
)
131131
}
132132

133-
mock_cqm <- function() {
133+
mock_review <- function() {
134134
ae <- safetyData::sdtm_ae
135135
dm <- safetyData::sdtm_dm
136136

@@ -247,7 +247,7 @@ mock_cqm <- function() {
247247

248248
# Step 5 - Run app
249249
dv.manager::run_app(
250-
data = list("CQM_AE_list" = data_list),
250+
data = list("AE_list_review" = data_list),
251251
module_list = list(
252252
"Listing" = listing,
253253
"Signal receiver" = mod_receiver(module_id = "papo", sender_id = "listing")

R/mod_listings.R

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,11 @@ listings_UI <- function(module_id) { # nolint
217217
#' @param on_sbj_click `[function()]`
218218
#'
219219
#' Function to invoke when a subject ID is clicked in a listing
220+
#'
221+
#' @param review `[list()]`
222+
#'
223+
#' Configuration of the experimental data review feature.
224+
#' For more details, please refer to `vignette("data_review")`.
220225
#'
221226
#' @export
222227
listings_server <- function(module_id,
@@ -389,7 +394,7 @@ listings_server <- function(module_id,
389394
"clear_filters",
390395
# NOTE(miguel): Added here for easier merge with other branches
391396
# TODO(miguel): Move elsewhere after merging
392-
REV_UI(ns = ns, roles = review[["roles"]])[["input_ids_to_exclude_from_bookmarking"]]
397+
REV_UI(ns = ns, roles = character(0))[["input_ids_to_exclude_from_bookmarking"]]
393398
))
394399

395400
# Bookmarking (end)
@@ -429,6 +434,10 @@ listings_server <- function(module_id,
429434
} else {
430435
fs_client <- fs_init(fs_callbacks, review[["store_path"]])
431436
}
437+
438+
# Overly restrictive sanitization of role strings, as they will be used for file names:
439+
# TODO: Consider adapting https://github.com/r-lib/fs/blob/main/R/sanitize.R instead to allow alternative charsets
440+
review[["roles"]] <- gsub("[^a-zA-Z0-9 _.-]", "", review[["roles"]]) # Accepts alpha+num+space+'.'+'_'+'-'
432441

433442
output[[TBL$REVIEW_UI_ID]] <- shiny::renderUI(
434443
shinyWidgets::dropdownButton(
@@ -919,12 +928,12 @@ check_mod_listings <- function(afmm, datasets, module_id, dataset_names,
919928
) &&
920929
CM$assert(
921930
container = err,
922-
cond = (checkmate::test_character(info[["tracked_vars"]], min.chars = 1, unique = TRUE) &&
931+
cond = (checkmate::test_character(info[["tracked_vars"]], min.chars = 1, min.len = 3, unique = TRUE) &&
923932
checkmate::test_subset(info[["tracked_vars"]], names(dataset))),
924933
msg = sprintf(
925934
paste(
926-
"`review$datasets$%s$tracked_vars` should be a character vector listing a subset of the columns",
927-
"available in dataset `%s`"
935+
"`review$datasets$%s$tracked_vars` should be a character vector listing a subset of",
936+
" at least three columns available in dataset `%s`"
928937
), domain, domain
929938
)
930939
)

R/review.R

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ REV_include_review_info <- function(annotation_info, data, col_names, extra_col_
6969
}
7070

7171
REV_UI <- function(ns, roles) {
72-
choices <- setNames(c("", roles), c("<select reviewer role>", make.names(roles)))
72+
choices <- setNames(c("", roles), c("<select reviewer role>", roles))
7373

7474
res <- list()
7575
res[["ui"]] <- shiny::tagList(
@@ -108,8 +108,6 @@ REV_load_annotation_info <- function(folder_contents, review, dataset_lists) {
108108
folder_IO_plan <<- c(folder_IO_plan, list(action))
109109
}
110110

111-
review[["roles"]] <- make.names(review[["roles"]])
112-
113111
for (dataset_lists_name in names(dataset_lists)) {
114112
sub_res <- list()
115113
dataset_list <- dataset_lists[[dataset_lists_name]]
@@ -590,7 +588,7 @@ REV_logic_2 <- function(ns, state, input, review, datasets, selected_dataset_lis
590588
SH$double_to_raw(timestamp)
591589
)
592590

593-
fname <- paste0(dataset_name, "_", make.names(role), ".review")
591+
fname <- paste0(dataset_name, "_", role, ".review")
594592

595593
IO_plan <- list(
596594
list(

0 commit comments

Comments
 (0)