Skip to content

Commit f800178

Browse files
committed
remove app continuing past wrong sender_ids
1 parent ff6e62b commit f800178

5 files changed

Lines changed: 2 additions & 81 deletions

File tree

R/check_papo_call_manual.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ check_papo_call <- function(datasets, module_id, subject_level_dataset_name, sub
9393
# TODO: sender_ids
9494
if (!missing(sender_ids) && !is.null(sender_ids)) {
9595
unknown_sender_ids <- setdiff(sender_ids, names(afmm_module_names))
96-
assert_warn(
96+
assert_err(
9797
length(unknown_sender_ids) < 1,
9898
sprintf(
9999
"The `sender_ids` - %s - are not available. The modules available are - %s.

R/mod_patient_profile.R

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ mod_patient_profile_UI <- function(id) { # nolint
3030
#' @param id `[character]` Unique shiny ID. Must match the ID provided to [mod_patient_profile_UI()].
3131
#' @param subject_level_dataset `[reactive(data.frame)]` Visit-independent subject information.
3232
#' @param extra_datasets `[reactive(data.frame(n))]` Visit-dependent subject datasets.
33-
#' @param sender_id_info `[NULL | list(2)]` NULL or named list containing original sender ids and the ones identified as available from module list.
34-
#' @param afmm_param `[list(1+) | NULL]` Named list of a selection of arguments from module manager. Expects
35-
#' at least 1 element: \code{module_names}, a character vector whose entries have the corresponding module IDs as names.
3633
#' @inheritParams mod_patient_profile
3734
#' @seealso [mod_patient_profile()] and [mod_patient_profile_UI()]
3835
#'
@@ -68,14 +65,6 @@ mod_patient_profile_server <- function(id, subject_level_dataset, extra_datasets
6865
id,
6966
function(input, output, session) {
7067
ns <- session[["ns"]]
71-
testing <- isTRUE(getOption("shiny.testmode"))
72-
if (testing) {
73-
exported_test_data <<- list()
74-
shiny::exportTestValues(test_data = exported_test_data)
75-
exported_test_data[["afmm_module_names"]] <<- afmm_param[["module_names"]]
76-
exported_test_data[["sender_ids"]] <<- sender_id_info[["sender_ids"]]
77-
exported_test_data[["known_sender_ids"]] <<- unlist(sender_id_info["known_sender_ids"])
78-
}
7968

8069
output[["ui"]] <- shiny::renderUI({
8170
res <- NULL
@@ -381,18 +370,12 @@ mod_patient_profile <- function(module_id = "",
381370
return(datasets[plot_dataset_names])
382371
})
383372

384-
# filter missing sender_ids so app doesn't error.
385-
known_sender_ids <- sender_ids
386-
if (!is.null(sender_ids)) {
387-
known_sender_ids <- intersect(sender_ids, names(afmm[["module_names"]]))
388-
}
389-
390373
dv.papo::mod_patient_profile_server(
391374
id = module_id,
392375
subject_level_dataset = subject_level_dataset,
393376
extra_datasets = extra_datasets,
394377
subjid_var = subjid_var,
395-
sender_ids = lapply(known_sender_ids, function(x) {
378+
sender_ids = lapply(sender_ids, function(x) {
396379
shiny::reactive(afmm[["module_output"]]()[[x]])
397380
}),
398381
summary = summary,

man/mod_patient_profile_server.Rd

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/apps/missing_sender_ids/app.R

Lines changed: 0 additions & 34 deletions
This file was deleted.

tests/testthat/test-all.R

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -348,26 +348,3 @@ test_that(
348348
app$stop()
349349
}
350350
)
351-
352-
test_that("missing sender_ids are identified and omitted and app continues." |>
353-
vdoc[["add_spec"]](c(specs$common$missing_sender_ids)), {
354-
app <- shinytest2::AppDriver$new(
355-
app_dir = "apps/missing_sender_ids/",
356-
name = "missing_sender_id_app"
357-
)
358-
vals <- app$get_value(export = "papo1-test_data")
359-
input_sender_ids <- c("random2", "listings1", "listings2", "random1")
360-
361-
expect_equal(vals$sender_ids, input_sender_ids)
362-
expect_length(vals$known_sender_ids, 0) # check missing sender_ids are identified and omitted.
363-
364-
vals <- app$get_value(output = "papo1-listings-listing") # check app continued to generate listings.
365-
expect_no_error(vals)
366-
367-
vals <- app$get_value(output = "papo1-selector")
368-
expect_true(grepl('option value="01-701-1015"', vals$html)) # check app continues past missing sender_ids.
369-
370-
app$stop()
371-
372-
}
373-
)

0 commit comments

Comments
 (0)