Auditing Studies Across Several Servers

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)

1. Connect to each site

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)
)

2. Audit the study

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")
#>  Found 179 records... Imported 179 records. Simplifying...
#>  Found 179 records... Imported 179 records. Simplifying...

# one RO-Crate per site
names(study_audit)
#> [1] "site_a" "site_b"

print(study_audit$site_a)
#> {
#>   "@context": "https://w3id.org/ro/crate/1.2/context",
#>   "@graph": [
#>     {
#>       "@id": "ro-crate-metadata.json",
#>       "@type": "CreativeWork",
#>       "about": {
#>         "@id": "./"
#>       },
#>       "conformsTo": {
#>         "@id": "https://w3id.org/ro/crate/1.2"
#>       }
#>     },
#>     {
#>       "@id": "./",
#>       "@type": "Dataset",
#>       "name": "",
#>       "description": "",
#>       "datePublished": "2026-10-15",
#>       "license": {
#>         "@id": "http://spdx.org/licenses/CC-BY-4.0"
#>       },
#>       "conformsTo": {
#>         "@id": "https://w3id.org/5s-crate/0.4"
#>       },
#>       "hasPart": [
#>         {
#>           "@id": "20261015T061348-dslogs-dsuser.log"
#>         },
#>         {
#>           "@id": "20261015T061349-dslogs-dsuser_mappings.csv"
#>         }
#>       ]
#>     },
#>     {
#>       "@id": "https://w3id.org/5s-crate/0.4",
#>       "@type": ["CreativeWork", "Profile"],
#>       "name": "Five Safes RO-Crate profile"
#>     },
#>     {
#>       "@id": "#person:a0af2a94926db1b49ad7a812eef509d2",
#>       "@type": "Person",
#>       "name": "dsuser"
#>     },
#>     {
#>       "@id": "#project:7ba189863f9f641196596cb28e04aa14",
#>       "@type": "Project",
#>       "name": "CNSIM",
#>       "dateCreated": "2026-10-15T04:36:56.200Z",
#>       "dateModified": "2026-10-15T04:37:01.258Z",
#>       "hasPart": [
#>         {
#>           "@id": "#asset:fad6faf661584d53e58f9730b14c5aae"
#>         }
#>       ]
#>     },
#>     {
#>       "@id": "#perm:9bf7f75b6c5b07d02830b95652cd39a0-dict-summary-read",
#>       "@type": "ReadAction",
#>       "agent": {
#>         "@id": "#person:a0af2a94926db1b49ad7a812eef509d2"
#>       },
#>       "object": {
#>         "@id": "#asset:fad6faf661584d53e58f9730b14c5aae"
#>       },
#>       "actionStatus": "PotentialActionStatus",
#>       "description": "User may view table dictionary and summary statistics only; access to individual values is restricted."
#>     },
#>     {
#>       "@id": "#asset:fad6faf661584d53e58f9730b14c5aae",
#>       "@type": "Dataset",
#>       "name": "CNSIM1",
#>       "description": "",
#>       "url": "/datasource/CNSIM/table/CNSIM1",
#>       "dateCreated": "2026-10-15T04:00:00Z",
#>       "dateModified": "2026-10-15T04:00:00Z",
#>       "isPartOf": {
#>         "@id": "#project:7ba189863f9f641196596cb28e04aa14"
#>       }
#>     },
#>     {
#>       "@id": "#disc:27d8c1d2233ecb654a24b635fd4dbd78",
#>       "@type": "PropertyValue",
#>       "name": "datashield.privacyLevel",
#>       "value": "5"
#>     },
#>     {
#>       "@id": "#disc:46b65707a6b998f3b1364bc10e6d9b4b",
#>       "@type": "PropertyValue",
#>       "name": "default.datashield.privacyControlLevel",
#>       "value": "banana"
#>     },
#>     {
#>       "@id": "#disc:7769282e7b0a1cb8887f60886c7b56ae",
#>       "@type": "PropertyValue",
#>       "name": "default.nfilter.glm",
#>       "value": "0.33"
#>     },
#>   ❗ <file truncated, set `options(max_lines = Inf)` to display all>
#>   ]
#> }

3. Create a study report

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)
#> 1 'Author' entity was found!
#> 1 asset entity was found!
#> 1 'Project' entity was found!
#> 22 'CreativeWork', 'PropertyValue' OR 'SoftwareApplication' entities were found!
#> 2 'File' entities were found!
#> 1 'Author' entity was found!
#> 1 asset entity was found!
#> 1 'Project' entity was found!
#> 22 'CreativeWork', 'PropertyValue' OR 'SoftwareApplication' entities were found!
#> 2 'File' entities were found!

# overview diagram
study_parts$overview_diagram

# overview table (Safe People, Safe Project and Safe Data)
knitr::kable(study_parts$overview_data)
Server Project Data Access Level People Function Timestamp
site_a CNSIM CNSIM1 read dsuser 2026-10-15T08:51:51Z
site_a CNSIM CNSIM1 read dsuser DSI::datashield.assign.table 2026-10-15T08:51:52Z
site_a CNSIM CNSIM1 read dsuser base::exists 2026-10-15T08:51:54Z
site_a CNSIM CNSIM1 read dsuser dsBase::classDS 2026-10-15T08:51:54Z
site_a CNSIM CNSIM1 read dsuser dsBase::isValidDS 2026-10-15T08:51:54Z
site_a CNSIM CNSIM1 read dsuser dsBase::dimDS 2026-10-15T08:51:55Z
site_a CNSIM CNSIM1 read dsuser dsBase::colnamesDS 2026-10-15T08:51:55Z
site_a CNSIM CNSIM1 read dsuser 2026-10-15T08:53:43Z
site_a CNSIM CNSIM1 read dsuser DSI::datashield.assign.table 2026-10-15T08:53:43Z
site_a CNSIM CNSIM1 read dsuser 2026-10-15T08:56:16Z
site_a CNSIM CNSIM1 read dsuser DSI::datashield.assign.table 2026-10-15T08:56:16Z
site_a CNSIM CNSIM1 read dsuser base::exists 2026-10-15T08:56:18Z
site_a CNSIM CNSIM1 read dsuser dsBase::classDS 2026-10-15T08:56:18Z
site_a CNSIM CNSIM1 read dsuser dsBase::isValidDS 2026-10-15T08:56:18Z
site_a CNSIM CNSIM1 read dsuser dsBase::dimDS 2026-10-15T08:56:18Z
site_a CNSIM CNSIM1 read dsuser dsBase::colnamesDS 2026-10-15T08:56:18Z
site_a CNSIM CNSIM1 read dsuser 2026-10-15T09:32:39Z
site_a CNSIM CNSIM1 read dsuser DSI::datashield.assign.table 2026-10-15T09:32:40Z
site_a CNSIM CNSIM1 read dsuser base::exists 2026-10-15T09:32:41Z
site_a CNSIM CNSIM1 read dsuser dsBase::classDS 2026-10-15T09:32:41Z
site_a CNSIM CNSIM1 read dsuser dsBase::isValidDS 2026-10-15T09:32:41Z
site_a CNSIM CNSIM1 read dsuser dsBase::dimDS 2026-10-15T09:32:42Z
site_a CNSIM CNSIM1 read dsuser dsBase::colnamesDS 2026-10-15T09:32:42Z
site_a CNSIM CNSIM1 read dsuser 2026-10-15T09:34:37Z
site_a CNSIM CNSIM1 read dsuser DSI::datashield.assign.table 2026-10-15T09:34:38Z
site_a CNSIM CNSIM1 read dsuser 2026-10-15T09:36:43Z
site_a CNSIM CNSIM1 read dsuser DSI::datashield.assign.table 2026-10-15T09:36:44Z
site_a CNSIM CNSIM1 read dsuser base::exists 2026-10-15T09:36:45Z
site_a CNSIM CNSIM1 read dsuser dsBase::classDS 2026-10-15T09:36:45Z
site_a CNSIM CNSIM1 read dsuser dsBase::isValidDS 2026-10-15T09:36:45Z
site_a CNSIM CNSIM1 read dsuser dsBase::dimDS 2026-10-15T09:36:45Z
site_a CNSIM CNSIM1 read dsuser dsBase::colnamesDS 2026-10-15T09:36:46Z
site_a CNSIM CNSIM1 read dsuser 2026-10-15T09:39:33Z
site_a CNSIM CNSIM1 read dsuser DSI::datashield.assign.table 2026-10-15T09:39:34Z
site_a CNSIM CNSIM1 read dsuser base::exists 2026-10-15T09:39:35Z
site_a CNSIM CNSIM1 read dsuser dsBase::classDS 2026-10-15T09:39:35Z
site_a CNSIM CNSIM1 read dsuser dsBase::isValidDS 2026-10-15T09:39:35Z
site_a CNSIM CNSIM1 read dsuser dsBase::dimDS 2026-10-15T09:39:36Z
site_a CNSIM CNSIM1 read dsuser dsBase::colnamesDS 2026-10-15T09:39:36Z
site_a CNSIM CNSIM1 read dsuser 2026-10-15T09:43:10Z
site_a CNSIM CNSIM1 read dsuser DSI::datashield.assign.table 2026-10-15T09:43:11Z
site_a CNSIM CNSIM1 read dsuser base::exists 2026-10-15T09:43:12Z
site_a CNSIM CNSIM1 read dsuser dsBase::classDS 2026-10-15T09:43:13Z
site_a CNSIM CNSIM1 read dsuser dsBase::isValidDS 2026-10-15T09:43:13Z
site_a CNSIM CNSIM1 read dsuser dsBase::dimDS 2026-10-15T09:43:13Z
site_a CNSIM CNSIM1 read dsuser dsBase::colnamesDS 2026-10-15T09:43:13Z
site_a CNSIM CNSIM1 read dsuser 2026-10-15T09:45:36Z
site_a CNSIM CNSIM1 read dsuser DSI::datashield.assign.table 2026-10-15T09:45:36Z
site_a CNSIM CNSIM1 read dsuser 2026-10-15T09:47:38Z
site_a CNSIM CNSIM1 read dsuser DSI::datashield.assign.table 2026-10-15T09:47:38Z
site_a CNSIM CNSIM1 read dsuser base::exists 2026-10-15T09:47:39Z
site_a CNSIM CNSIM1 read dsuser dsBase::classDS 2026-10-15T09:47:39Z
site_a CNSIM CNSIM1 read dsuser dsBase::isValidDS 2026-10-15T09:47:39Z
site_a CNSIM CNSIM1 read dsuser dsBase::dimDS 2026-10-15T09:47:40Z
site_a CNSIM CNSIM1 read dsuser dsBase::colnamesDS 2026-10-15T09:47:40Z
site_a CNSIM CNSIM1 read dsuser 2026-10-15T09:49:05Z
site_a CNSIM CNSIM1 read dsuser DSI::datashield.assign.table 2026-10-15T09:49:05Z
site_a CNSIM CNSIM1 read dsuser base::exists 2026-10-15T09:49:07Z
site_a CNSIM CNSIM1 read dsuser dsBase::classDS 2026-10-15T09:49:07Z
site_a CNSIM CNSIM1 read dsuser dsBase::isValidDS 2026-10-15T09:49:07Z
site_a CNSIM CNSIM1 read dsuser dsBase::dimDS 2026-10-15T09:49:07Z
site_a CNSIM CNSIM1 read dsuser dsBase::colnamesDS 2026-10-15T09:49:07Z
site_b CNSIM CNSIM1 read dsuser 2026-10-15T08:51:51Z
site_b CNSIM CNSIM1 read dsuser DSI::datashield.assign.table 2026-10-15T08:51:52Z
site_b CNSIM CNSIM1 read dsuser base::exists 2026-10-15T08:51:54Z
site_b CNSIM CNSIM1 read dsuser dsBase::classDS 2026-10-15T08:51:54Z
site_b CNSIM CNSIM1 read dsuser dsBase::isValidDS 2026-10-15T08:51:54Z
site_b CNSIM CNSIM1 read dsuser dsBase::dimDS 2026-10-15T08:51:55Z
site_b CNSIM CNSIM1 read dsuser dsBase::colnamesDS 2026-10-15T08:51:55Z
site_b CNSIM CNSIM1 read dsuser 2026-10-15T08:53:43Z
site_b CNSIM CNSIM1 read dsuser DSI::datashield.assign.table 2026-10-15T08:53:43Z
site_b CNSIM CNSIM1 read dsuser 2026-10-15T08:56:16Z
site_b CNSIM CNSIM1 read dsuser DSI::datashield.assign.table 2026-10-15T08:56:16Z
site_b CNSIM CNSIM1 read dsuser base::exists 2026-10-15T08:56:18Z
site_b CNSIM CNSIM1 read dsuser dsBase::classDS 2026-10-15T08:56:18Z
site_b CNSIM CNSIM1 read dsuser dsBase::isValidDS 2026-10-15T08:56:18Z
site_b CNSIM CNSIM1 read dsuser dsBase::dimDS 2026-10-15T08:56:18Z
site_b CNSIM CNSIM1 read dsuser dsBase::colnamesDS 2026-10-15T08:56:18Z
site_b CNSIM CNSIM1 read dsuser 2026-10-15T09:32:39Z
site_b CNSIM CNSIM1 read dsuser DSI::datashield.assign.table 2026-10-15T09:32:40Z
site_b CNSIM CNSIM1 read dsuser base::exists 2026-10-15T09:32:41Z
site_b CNSIM CNSIM1 read dsuser dsBase::classDS 2026-10-15T09:32:41Z
site_b CNSIM CNSIM1 read dsuser dsBase::isValidDS 2026-10-15T09:32:41Z
site_b CNSIM CNSIM1 read dsuser dsBase::dimDS 2026-10-15T09:32:42Z
site_b CNSIM CNSIM1 read dsuser dsBase::colnamesDS 2026-10-15T09:32:42Z
site_b CNSIM CNSIM1 read dsuser 2026-10-15T09:34:37Z
site_b CNSIM CNSIM1 read dsuser DSI::datashield.assign.table 2026-10-15T09:34:38Z
site_b CNSIM CNSIM1 read dsuser 2026-10-15T09:36:43Z
site_b CNSIM CNSIM1 read dsuser DSI::datashield.assign.table 2026-10-15T09:36:44Z
site_b CNSIM CNSIM1 read dsuser base::exists 2026-10-15T09:36:45Z
site_b CNSIM CNSIM1 read dsuser dsBase::classDS 2026-10-15T09:36:45Z
site_b CNSIM CNSIM1 read dsuser dsBase::isValidDS 2026-10-15T09:36:45Z
site_b CNSIM CNSIM1 read dsuser dsBase::dimDS 2026-10-15T09:36:45Z
site_b CNSIM CNSIM1 read dsuser dsBase::colnamesDS 2026-10-15T09:36:46Z
site_b CNSIM CNSIM1 read dsuser 2026-10-15T09:39:33Z
site_b CNSIM CNSIM1 read dsuser DSI::datashield.assign.table 2026-10-15T09:39:34Z
site_b CNSIM CNSIM1 read dsuser base::exists 2026-10-15T09:39:35Z
site_b CNSIM CNSIM1 read dsuser dsBase::classDS 2026-10-15T09:39:35Z
site_b CNSIM CNSIM1 read dsuser dsBase::isValidDS 2026-10-15T09:39:35Z
site_b CNSIM CNSIM1 read dsuser dsBase::dimDS 2026-10-15T09:39:36Z
site_b CNSIM CNSIM1 read dsuser dsBase::colnamesDS 2026-10-15T09:39:36Z
site_b CNSIM CNSIM1 read dsuser 2026-10-15T09:43:10Z
site_b CNSIM CNSIM1 read dsuser DSI::datashield.assign.table 2026-10-15T09:43:11Z
site_b CNSIM CNSIM1 read dsuser base::exists 2026-10-15T09:43:12Z
site_b CNSIM CNSIM1 read dsuser dsBase::classDS 2026-10-15T09:43:13Z
site_b CNSIM CNSIM1 read dsuser dsBase::isValidDS 2026-10-15T09:43:13Z
site_b CNSIM CNSIM1 read dsuser dsBase::dimDS 2026-10-15T09:43:13Z
site_b CNSIM CNSIM1 read dsuser dsBase::colnamesDS 2026-10-15T09:43:13Z
site_b CNSIM CNSIM1 read dsuser 2026-10-15T09:45:36Z
site_b CNSIM CNSIM1 read dsuser DSI::datashield.assign.table 2026-10-15T09:45:36Z
site_b CNSIM CNSIM1 read dsuser 2026-10-15T09:47:38Z
site_b CNSIM CNSIM1 read dsuser DSI::datashield.assign.table 2026-10-15T09:47:38Z
site_b CNSIM CNSIM1 read dsuser base::exists 2026-10-15T09:47:39Z
site_b CNSIM CNSIM1 read dsuser dsBase::classDS 2026-10-15T09:47:39Z
site_b CNSIM CNSIM1 read dsuser dsBase::isValidDS 2026-10-15T09:47:39Z
site_b CNSIM CNSIM1 read dsuser dsBase::dimDS 2026-10-15T09:47:40Z
site_b CNSIM CNSIM1 read dsuser dsBase::colnamesDS 2026-10-15T09:47:40Z
site_b CNSIM CNSIM1 read dsuser 2026-10-15T09:49:05Z
site_b CNSIM CNSIM1 read dsuser DSI::datashield.assign.table 2026-10-15T09:49:05Z
site_b CNSIM CNSIM1 read dsuser base::exists 2026-10-15T09:49:07Z
site_b CNSIM CNSIM1 read dsuser dsBase::classDS 2026-10-15T09:49:07Z
site_b CNSIM CNSIM1 read dsuser dsBase::isValidDS 2026-10-15T09:49:07Z
site_b CNSIM CNSIM1 read dsuser dsBase::dimDS 2026-10-15T09:49:07Z
site_b CNSIM CNSIM1 read dsuser dsBase::colnamesDS 2026-10-15T09:49:07Z

and render the full report (HTML) with:

study_audit |>
  report(
    filepath = report_file,
    title = "DataSHIELD study audit",
    render = TRUE,
    overwrite = TRUE
  )

4. Close the connections

invisible(lapply(cons, opalr::opal.logout))