Skip to content

Commit ac581c3

Browse files
committed
Simplify EEF.
1 parent 7290384 commit ac581c3

6 files changed

Lines changed: 27 additions & 77 deletions

File tree

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: dv.papo
22
Title: Patient Profile
3-
Version: 2.2.0-9001
3+
Version: 2.2.0-9002
44
Authors@R:
55
c(person("Boehringer-Ingelheim Pharma GmbH & Co.KG", role = c("cph", "fnd")),
66
person(given = "Korbinian",
@@ -35,14 +35,14 @@ Imports:
3535
shiny,
3636
shinyWidgets
3737
Suggests:
38-
dv.manager (>= 2.1.0),
38+
dv.manager (>= 3.0.0-9004),
3939
knitr,
4040
safetyData,
4141
shinytest2,
4242
testthat,
4343
jsonlite,
4444
withr,
4545
dplyr
46-
Remotes: boehringer-ingelheim/dv.manager
46+
Remotes: boehringer-ingelheim/dv.manager@372284-integrate_CM
4747
VignetteBuilder: knitr
4848
Config/testthat/edition: 3

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# dv.papo 2.2.0-9002
2+
3+
- [NOT USER-FACING] Move some EEF logic into dv.manager.
4+
15
# dv.papo 2.2.0-9001
26

37
- Wrap decode column into no more than two lines (to avoid overlap).

R/check_papo_call_manual.R

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,15 @@
33
# TODO: Generate from mod_patient_profile_API
44
# This function has been written manually, but mod_patient_profile_API carries
55
# enough information to derive most of it automatically
6-
check_papo_call <- function(datasets, module_id, subject_level_dataset_name, subjid_var,
7-
sender_ids, summary, listings, plots, afmm_module_names) {
6+
check_papo_call <- function(datasets, module_args, afmm_module_names) {
7+
module_id <- module_args[["module_id"]]
8+
subject_level_dataset_name <- module_args[["subject_level_dataset_name"]]
9+
subjid_var <- module_args[["subjid_var"]]
10+
sender_ids <- module_args[["sender_ids"]]
11+
summary <- module_args[["summary"]]
12+
listings <- module_args[["listings"]]
13+
plots <- module_args[["plots"]]
14+
815
warn <- character(0)
916
err <- character(0)
1017

R/dressing_room.R

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,40 +1222,3 @@ explorer_app <- function(datasets = NULL) {
12221222
enableBookmarking = "url"
12231223
)
12241224
}
1225-
1226-
app_creator_feedback_ui <- function(id) {
1227-
id <- paste(c(id, "validator"), collapse = "-")
1228-
ns <- shiny::NS(id)
1229-
return(shiny::uiOutput(ns("ui")))
1230-
}
1231-
1232-
app_creator_feedback_server <- function(id, warning_messages, error_messages, ui) {
1233-
id <- paste(c(id, "validator"), collapse = "-")
1234-
module <- shiny::moduleServer(
1235-
id,
1236-
function(input, output, session) {
1237-
output[["ui"]] <- shiny::renderUI({
1238-
res <- list()
1239-
warn <- warning_messages()
1240-
if (length(warn)) {
1241-
res[[length(res) + 1]] <- message_well("Module configuration warnings", Map(shiny::p, warn), color = "#fff7ef")
1242-
}
1243-
1244-
err <- error_messages()
1245-
if (length(err)) {
1246-
res[[length(res) + 1]] <- message_well("Module configuration errors", Map(shiny::p, err), color = "#f4d7d7")
1247-
}
1248-
1249-
if (length(error_messages()) == 0) res <- append(res, list(ui))
1250-
return(res)
1251-
})
1252-
1253-
# See: (ag4hj)
1254-
shiny::outputOptions(output, "ui", suspendWhenHidden = FALSE)
1255-
}
1256-
)
1257-
1258-
1259-
1260-
return(module)
1261-
}

R/mod_patient_profile.R

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -402,40 +402,8 @@ mod_patient_profile <- function(module_id = "",
402402

403403
mod <- list(
404404
# UI function
405-
ui = function(module_id) {
406-
app_creator_feedback_ui(module_id) # NOTE: original UI gated by app_creator_feedback_server
407-
},
408-
# Server function
405+
ui = mod_patient_profile_UI,
409406
server = function(afmm) {
410-
fb <- shiny::reactive({
411-
# NOTE: We check the call here and not inside the module server function because:
412-
# - app creators interact with the davinci module and not with the ui-server combo, so
413-
# errors reported with respect to the module signature will make sense to them.
414-
# The module server function might use a different function signature.
415-
# - Here we also have access to the unfiltered dataset, which allows us to ensure call
416-
# correctness independent of filter state or operation.
417-
# Also, as long as the unfiltered dataset does not change (and to date no davinci app
418-
# changes it dynamically) this check only runs once at the beginning of the application
419-
# and has no further impact on performance.
420-
# - "catch errors early"
421-
422-
# Overwrite first "argument" (the function call, in fact) with the datasets provided to module manager
423-
names(args)[[1]] <- "datasets"
424-
args[[1]] <- afmm[["unfiltered_dataset"]]()
425-
args[["afmm_module_names"]] <- afmm[["module_names"]]
426-
do.call(check_papo_call, args)
427-
})
428-
429-
fb_warn <- shiny::reactive(fb()[["warnings"]])
430-
fb_err <- shiny::reactive(fb()[["errors"]])
431-
432-
app_creator_feedback_server(
433-
id = module_id,
434-
warning_messages = fb_warn,
435-
error_messages = fb_err,
436-
ui = dv.papo::mod_patient_profile_UI(module_id)
437-
)
438-
439407
# set palette colours for range_plots
440408
grading_vals <- get_grading_vals(plots[["range_plots"]], afmm[["data"]])
441409
plots[["palette"]] <- fill_palette(grading_vals, plots[["palette"]])
@@ -503,7 +471,15 @@ mod_patient_profile <- function(module_id = "",
503471
return(unique(res))
504472
}),
505473
subject_level = subject_level_dataset_name
506-
)
474+
),
475+
check_mod_fn = function(afmm, dataset_list) {
476+
res <- check_papo_call(
477+
datasets = dataset_list,
478+
module_args = args[-1], # exclude function from the result of `match.call`
479+
afmm_module_names = afmm[["module_names"]]
480+
)
481+
return(res[["errors"]])
482+
}
507483
)
508484
)
509485
return(mod)

tests/testthat/test-all.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ test_that(
146146
'"variable":"SEX","values":["M"],"include_NA":true}]}]}},',
147147
'"dataset_list_name":"demo"}'
148148
), allow_no_input_binding_ = TRUE, priority_ = "event")
149-
pat_id <- app$wait_for_value(input = sel_id)
149+
app$wait_for_idle(duration = wait_for_idle_ms)
150150
testthat::expect_equal(app$get_value(input = sel_id), "01-701-1023")
151151

152152
# Check if no patient is selected when filtered accordingly

0 commit comments

Comments
 (0)