Work together with QA department to setup a qualified R environment
Risk-based quality control of the report output (e.g. spot-checks of specific TLFs)
Level of QC according to risk on patient safety (e.g. adverse events > medical history)
Quality control of the R packages: unit tests (testthat) + test coverage (covr)
Example of unit tests of the reporting workflow:
context("Test reporting template functions")
library(yaml)
test_that("Test check of config file parameters", {
# create example of incomplete config file
configFile <- tempfile("configDivision", fileext = ".yml")
write_yaml(list(reportTitle = "Study name"), configFile)
# check config file versus JSON schema
refConfig <- system.file(package = "medicalMonitoring", "template", "divisionTemplate.json")
expect_error(checkConfigFile(configFile, refConfig))
})