## ----include = FALSE---------------------------------------------------------- knitr::opts_chunk$set(collapse = TRUE, comment = "#>") has_pkgs <- all(vapply( c("metacore", "pharmaverseadam", "r4subscore"), requireNamespace, logical(1), quietly = TRUE )) knitr::opts_chunk$set(eval = has_pkgs) ## ----eval = TRUE, echo = FALSE, results = "asis"------------------------------ if (!has_pkgs) { cat("> The packages needed to run this case study (metacore,", "pharmaverseadam, r4subscore) are not installed, so the code below is", "shown but not evaluated.\n") } ## ----setup-------------------------------------------------------------------- library(r4subpharma) # The CDISC pilot ADaM specification (covers ADSL, ADAE, ADLBC, ADADAS, ADTTE) e <- new.env() load(metacore::metacore_example("pilot_ADaM.rda"), envir = e) spec <- e$metacore # One of the admiral-built datasets adsl <- pharmaverseadam::adsl dim(adsl) ## ----score-adsl--------------------------------------------------------------- ctx <- r4subcore::r4sub_run_context("CDISCPILOT01", "PROD") spec_adsl <- metacore::select_dataset(spec, "ADSL", verbose = "silent") res <- submission_readiness(list(ADSL = adsl), spec_adsl, ctx) res ## ----pillars------------------------------------------------------------------ as.data.frame(res$sci$pillar_scores) ## ----gaps--------------------------------------------------------------------- ev <- res$evidence missing <- ev[ev$indicator_id == "T-ADAM-001" & ev$result == "fail", ] nrow(missing) sub(".*: ", "", missing$message) ## ----types-------------------------------------------------------------------- ev[ev$indicator_id == "Q-ADAM-001" & ev$result == "warn", c("location", "message")] ## ----package------------------------------------------------------------------ res_pkg <- submission_readiness( list(ADSL = pharmaverseadam::adsl, ADAE = pharmaverseadam::adae), spec, ctx ) res_pkg$sci$SCI as.data.frame(res_pkg$sci$pillar_scores)