knitr::opts_chunk$set( collapse = TRUE, comment = "#>", out.width = "100%" ) SERVER <- "https://opal-demo.obiba.org" # The examples need OBiBa's public Opal demo server. If it cannot be reached # (e.g., when building offline), the code is shown but not run. demo_available <- local({ old <- options(timeout = 5) on.exit(options(old)) tryCatch( { con <- url(SERVER, open = "rb") close(con) TRUE }, error = function(e) FALSE, warning = function(w) FALSE ) }) knitr::opts_chunk$set(eval = demo_available)
A federated study usually spans several DataSHIELD servers (sites). Both
audit() and report() accept a named list of connections, one per site,
and return one audit per element plus a combined report.
If you have not used audit() and report() before, start with
vignette("getting-started", package = "dsROCrate").
library(dsROCrate)
In a real study, each connection points to a different server. To keep this
example self-contained, we open two connections to the same demo server and
name them as if they were two sites. Use an administrator or Audit system
account at every site.
USERNAME <- "administrator" USERPASS <- "password" cons <- list( site_a = opalr::opal.login(USERNAME, USERPASS, url = SERVER), site_b = opalr::opal.login(USERNAME, USERPASS, url = SERVER) )
The arguments of audit() are applied to every site, so the project (and, if
given, the user and tables) must exist in each of them.
study_audit <- cons |> audit(project = "CNSIM", tables = "CNSIM1", user = "dsuser") # one RO-Crate per site names(study_audit) print(study_audit$site_a)
As for a single crate, we can first generate only the contents of the report:
report_file <- tempfile(fileext = ".Rmd") study_parts <- study_audit |> report(filepath = report_file, render = FALSE) # overview diagram study_parts$overview_diagram # overview table (Safe People, Safe Project and Safe Data) knitr::kable(study_parts$overview_data)
and render the full report (HTML) with:
study_audit |> report( filepath = report_file, title = "DataSHIELD study audit", render = TRUE, overwrite = TRUE )
invisible(lapply(cons, opalr::opal.logout))
unlink(report_file, force = TRUE)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.