Skip to content

Commit 179ccbc

Browse files
authored
Merge branch 'test' into 257261_default_col_palette
2 parents 6cf0148 + 47545d2 commit 179ccbc

6 files changed

Lines changed: 32 additions & 5 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: dv.papo
22
Title: Patient Profile
3-
Version: 2.0.5-900
3+
Version: 2.0.6-900
44
Date: 2024-08-13
55
Authors@R:
66
c(person("Boehringer-Ingelheim Pharma GmbH & Co.KG", role = c("cph", "fnd")),

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# dv.papo 2.0.6-900
2+
- Update to provide early error feedback if a sender_id is not available in list of modules.
3+
14
# dv.papo 2.0.5-900
25
- Fixes missing palette colours for AE, CM grading values.
36

R/check_papo_call_manual.R

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This function has been written manually, but mod_patient_profile_API carries
55
# enough information to derive most of it automatically
66
check_papo_call <- function(datasets, module_id, subject_level_dataset_name, subjid_var,
7-
sender_ids, summary, listings, plots) {
7+
sender_ids, summary, listings, plots, afmm_module_names) {
88
warn <- character(0)
99
err <- character(0)
1010

@@ -91,6 +91,18 @@ check_papo_call <- function(datasets, module_id, subject_level_dataset_name, sub
9191
}
9292

9393
# TODO: sender_ids
94+
if (!missing(sender_ids) && !is.null(sender_ids)) {
95+
unknown_sender_ids <- setdiff(sender_ids, names(afmm_module_names))
96+
assert_err(
97+
length(unknown_sender_ids) < 1,
98+
sprintf(
99+
"The `sender_ids` - %s - are not available. The modules available are - %s.
100+
Please check spelling of `sender_ids` in case there's a typo!",
101+
paste0("'", unknown_sender_ids, "'", collapse = ", "),
102+
paste0("'", names(afmm_module_names), "'", collapse = ", ")
103+
)
104+
)
105+
}
94106

95107
# summary
96108
if (!missing(summary) && !is.null(summary)) {

R/mod_patient_profile.R

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ mod_patient_profile <- function(module_id = "",
338338
# Overwrite first "argument" (the function call, in fact) with the datasets provided to module manager
339339
names(args)[[1]] <- "datasets"
340340
args[[1]] <- afmm[["unfiltered_dataset"]]()
341-
341+
args[["afmm_module_names"]] <- afmm[["module_names"]]
342342
do.call(check_papo_call, args)
343343
})
344344

@@ -374,12 +374,18 @@ mod_patient_profile <- function(module_id = "",
374374
return(datasets[plot_dataset_names])
375375
})
376376

377+
# filter missing sender_ids so app error doesn't conflict with early error feedback.
378+
known_sender_ids <- sender_ids
379+
if (!is.null(sender_ids)) {
380+
known_sender_ids <- intersect(sender_ids, names(afmm[["module_names"]]))
381+
}
382+
377383
dv.papo::mod_patient_profile_server(
378384
id = module_id,
379385
subject_level_dataset = subject_level_dataset,
380386
extra_datasets = extra_datasets,
381387
subjid_var = subjid_var,
382-
sender_ids = lapply(sender_ids, function(x) {
388+
sender_ids = lapply(known_sender_ids, function(x) {
383389
shiny::reactive(afmm[["module_output"]]()[[x]])
384390
}),
385391
summary = summary,

tests/testthat/apps/misconfigured_app/app.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ dataset_list <- list(
44

55
dv.manager::run_app(
66
data = dataset_list,
7-
module_list = list("Papo" = dv.papo::mod_patient_profile(module_id = "papo")),
7+
module_list = list(
8+
"Papo" = dv.papo::mod_patient_profile(
9+
module_id = "papo", sender_ids = "random1"
10+
)
11+
),
812
filter_data = "adsl"
913
)

tests/testthat/test-all.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ test_that(
8989
validation_errors <- app$get_html(selector = "#papo-validator-ui")
9090
expect_true(grepl("`subject_level_dataset_name` missing", validation_errors, fixed = TRUE))
9191
expect_true(grepl("`subjid_var` missing", validation_errors, fixed = TRUE))
92+
expect_true(grepl("The `sender_ids` - 'random1' - are not available.",
93+
validation_errors, fixed = TRUE))
9294

9395
app$stop()
9496
}

0 commit comments

Comments
 (0)