This tutorial gets you from a DataSHIELD server to an audit report in four steps: connect, check permissions, audit and report.
It uses OBiBa’s public Opal demo server (https://opal-demo.obiba.org), so you need an internet
connection. To try a local server instead, see
vignette("deploy-local-datashield-server-with-opal", package = "dsROCrate").
Where to go next
vignette("building-crates", package = "dsROCrate"):
build the RO-Crate one Safe at a time.vignette("auditing-studies", package = "dsROCrate"):
audit several servers as one study.vignette("audit-permissions", package = "dsROCrate"):
set up an auditor account.
USERNAME <- "administrator"
USERPASS <- "password"
con <- opalr::opal.login(
username = USERNAME,
password = USERPASS,
url = SERVER
)
print(con)
#> url: https://opal-demo.obiba.org
#> name: opal-demo.obiba.org
#> version: 6.0.2
#> username: administratorNote: auditing reads server-wide information (users,
permissions, DataSHIELD settings and logs), so it needs an administrator
or a user with the Audit system permission. The demo server
only provides the administrator account, so we use it here. For real
servers, create a dedicated auditor account, see
vignette("audit-permissions", package = "dsROCrate").
check_permissions(con, verbose = TRUE)
#> You are ready to audit this system!If the account is not suitable, the function stops with instructions on how to fix it.
audit() collects all the Five Safes (people, project,
data, setting and output) for a project in a single call. Here we audit
the CNSIM project, for the user dsuser and the
table CNSIM1:
PROJECT <- "CNSIM"
TABLES <- "CNSIM1"
USER <- "dsuser"
crate <- audit(con, project = PROJECT, tables = TABLES, user = USER)
#> Found 359 records... Imported 359 records. Simplifying...
print(crate)
#> {
#> "@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-19",
#> "license": {
#> "@id": "http://spdx.org/licenses/CC-BY-4.0"
#> },
#> "conformsTo": {
#> "@id": "https://w3id.org/5s-crate/0.4"
#> },
#> "hasPart": [
#> {
#> "@id": "20261019T120036-dslogs-dsuser.log"
#> },
#> {
#> "@id": "20261019T120038-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-19T04:30:05.449Z",
#> "dateModified": "2026-10-19T04:30:10.534Z",
#> "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-19T00:00:00Z",
#> "dateModified": "2026-10-19T00: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>
#> ]
#> }Useful arguments:
user: leave it out to include every non-administrator,
non-auditor account.tables and resources: restrict the assets
included; by default, all the assets in the project are used.logs_from and logs_to: restrict the period
covered by the outputs (default: all the activity available).path: a directory where the log files are stored;
otherwise they are included in the crate itself.report() summarises the crate. First, we generate only
the contents of the report and display the overview:
report_file <- tempfile(fileext = ".Rmd")
report_parts <- crate |>
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!
# overview diagram
report_parts$overview_diagram
# overview table (Safe People, Safe Project and Safe Data)
knitr::kable(report_parts$overview_data)| Project | Data | Access Level | People | Function | Timestamp |
|---|---|---|---|---|---|
| CNSIM | CNSIM1 | read | dsuser | 2026-10-19T11:10:26Z | |
| CNSIM | CNSIM1 | read | dsuser | DSI::datashield.assign.table | 2026-10-19T11:10:28Z |
| CNSIM | CNSIM1 | read | dsuser | base::exists | 2026-10-19T11:10:30Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::classDS | 2026-10-19T11:10:30Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::isValidDS | 2026-10-19T11:10:31Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::dimDS | 2026-10-19T11:10:31Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::colnamesDS | 2026-10-19T11:10:32Z |
| CNSIM | CNSIM1 | read | dsuser | 2026-10-19T11:10:34Z | |
| CNSIM | CNSIM1 | read | dsuser | DSI::datashield.assign.table | 2026-10-19T11:10:34Z |
| CNSIM | CNSIM1 | read | dsuser | base::exists | 2026-10-19T11:10:36Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::classDS | 2026-10-19T11:10:37Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::isValidDS | 2026-10-19T11:10:37Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::dimDS | 2026-10-19T11:10:38Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::colnamesDS | 2026-10-19T11:10:38Z |
| CNSIM | CNSIM1 | read | dsuser | 2026-10-19T11:10:49Z | |
| CNSIM | CNSIM1 | read | dsuser | DSI::datashield.assign.table | 2026-10-19T11:10:50Z |
| CNSIM | CNSIM1 | read | dsuser | base::exists | 2026-10-19T11:10:52Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::classDS | 2026-10-19T11:10:52Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::isValidDS | 2026-10-19T11:10:52Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::dimDS | 2026-10-19T11:10:53Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::colnamesDS | 2026-10-19T11:10:53Z |
| CNSIM | CNSIM1 | read | dsuser | 2026-10-19T11:11:00Z | |
| CNSIM | CNSIM1 | read | dsuser | DSI::datashield.assign.table | 2026-10-19T11:11:01Z |
| CNSIM | CNSIM1 | read | dsuser | base::exists | 2026-10-19T11:11:03Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::classDS | 2026-10-19T11:11:03Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::isValidDS | 2026-10-19T11:11:03Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::dimDS | 2026-10-19T11:11:04Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::colnamesDS | 2026-10-19T11:11:04Z |
| CNSIM | CNSIM1 | read | dsuser | 2026-10-19T11:11:35Z | |
| CNSIM | CNSIM1 | read | dsuser | DSI::datashield.assign.table | 2026-10-19T11:11:36Z |
| CNSIM | CNSIM1 | read | dsuser | 2026-10-19T11:11:43Z | |
| CNSIM | CNSIM1 | read | dsuser | DSI::datashield.assign.table | 2026-10-19T11:11:44Z |
| CNSIM | CNSIM1 | read | dsuser | base::exists | 2026-10-19T11:11:46Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::classDS | 2026-10-19T11:11:46Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::isValidDS | 2026-10-19T11:11:46Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::dimDS | 2026-10-19T11:11:46Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::colnamesDS | 2026-10-19T11:11:47Z |
| CNSIM | CNSIM1 | read | dsuser | 2026-10-19T11:12:21Z | |
| CNSIM | CNSIM1 | read | dsuser | DSI::datashield.assign.table | 2026-10-19T11:12:22Z |
| CNSIM | CNSIM1 | read | dsuser | 2026-10-19T11:12:34Z | |
| CNSIM | CNSIM1 | read | dsuser | DSI::datashield.assign.table | 2026-10-19T11:12:35Z |
| CNSIM | CNSIM1 | read | dsuser | 2026-10-19T11:12:39Z | |
| CNSIM | CNSIM1 | read | dsuser | DSI::datashield.assign.table | 2026-10-19T11:12:39Z |
| CNSIM | CNSIM1 | read | dsuser | 2026-10-19T11:13:36Z | |
| CNSIM | CNSIM1 | read | dsuser | DSI::datashield.assign.table | 2026-10-19T11:13:36Z |
| CNSIM | CNSIM1 | read | dsuser | 2026-10-19T11:16:58Z | |
| CNSIM | CNSIM1 | read | dsuser | DSI::datashield.assign.table | 2026-10-19T11:16:59Z |
| CNSIM | CNSIM1 | read | dsuser | base::exists | 2026-10-19T11:17:01Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::classDS | 2026-10-19T11:17:01Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::isValidDS | 2026-10-19T11:17:01Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::dimDS | 2026-10-19T11:17:02Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::colnamesDS | 2026-10-19T11:17:02Z |
| CNSIM | CNSIM1 | read | dsuser | 2026-10-19T11:17:42Z | |
| CNSIM | CNSIM1 | read | dsuser | DSI::datashield.assign.table | 2026-10-19T11:17:42Z |
| CNSIM | CNSIM1 | read | dsuser | base::exists | 2026-10-19T11:17:44Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::classDS | 2026-10-19T11:17:44Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::isValidDS | 2026-10-19T11:17:45Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::dimDS | 2026-10-19T11:17:45Z |
| CNSIM | CNSIM1 | read | dsuser | 2026-10-19T11:17:45Z | |
| CNSIM | CNSIM1 | read | dsuser | dsBase::colnamesDS | 2026-10-19T11:17:45Z |
| CNSIM | CNSIM1 | read | dsuser | DSI::datashield.assign.table | 2026-10-19T11:17:46Z |
| CNSIM | CNSIM1 | read | dsuser | base::exists | 2026-10-19T11:17:48Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::classDS | 2026-10-19T11:17:48Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::isValidDS | 2026-10-19T11:17:48Z |
| CNSIM | CNSIM1 | read | dsuser | 2026-10-19T11:17:48Z | |
| CNSIM | CNSIM1 | read | dsuser | dsBase::dimDS | 2026-10-19T11:17:48Z |
| CNSIM | CNSIM1 | read | dsuser | DSI::datashield.assign.table | 2026-10-19T11:17:49Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::colnamesDS | 2026-10-19T11:17:49Z |
| CNSIM | CNSIM1 | read | dsuser | base::exists | 2026-10-19T11:17:51Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::classDS | 2026-10-19T11:17:51Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::isValidDS | 2026-10-19T11:17:51Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::dimDS | 2026-10-19T11:17:52Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::colnamesDS | 2026-10-19T11:17:52Z |
| CNSIM | CNSIM1 | read | dsuser | 2026-10-19T11:39:26Z | |
| CNSIM | CNSIM1 | read | dsuser | DSI::datashield.assign.table | 2026-10-19T11:39:27Z |
| CNSIM | CNSIM1 | read | dsuser | base::exists | 2026-10-19T11:39:29Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::classDS | 2026-10-19T11:39:30Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::isValidDS | 2026-10-19T11:39:30Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::dimDS | 2026-10-19T11:39:31Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::colnamesDS | 2026-10-19T11:39:31Z |
| CNSIM | CNSIM1 | read | dsuser | 2026-10-19T11:42:12Z | |
| CNSIM | CNSIM1 | read | dsuser | DSI::datashield.assign.table | 2026-10-19T11:42:13Z |
| CNSIM | CNSIM1 | read | dsuser | 2026-10-19T11:49:01Z | |
| CNSIM | CNSIM1 | read | dsuser | DSI::datashield.assign.table | 2026-10-19T11:49:02Z |
| CNSIM | CNSIM1 | read | dsuser | base::exists | 2026-10-19T11:49:04Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::classDS | 2026-10-19T11:49:04Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::isValidDS | 2026-10-19T11:49:05Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::dimDS | 2026-10-19T11:49:05Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::colnamesDS | 2026-10-19T11:49:06Z |
| CNSIM | CNSIM1 | read | dsuser | 2026-10-19T11:56:21Z | |
| CNSIM | CNSIM1 | read | dsuser | DSI::datashield.assign.table | 2026-10-19T11:56:21Z |
| CNSIM | CNSIM1 | read | dsuser | base::exists | 2026-10-19T11:56:23Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::classDS | 2026-10-19T11:56:24Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::isValidDS | 2026-10-19T11:56:24Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::dimDS | 2026-10-19T11:56:24Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::colnamesDS | 2026-10-19T11:56:25Z |
| CNSIM | CNSIM1 | read | dsuser | 2026-10-19T11:57:24Z | |
| CNSIM | CNSIM1 | read | dsuser | DSI::datashield.assign.table | 2026-10-19T11:57:24Z |
| CNSIM | CNSIM1 | read | dsuser | base::exists | 2026-10-19T11:57:27Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::classDS | 2026-10-19T11:57:27Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::isValidDS | 2026-10-19T11:57:27Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::dimDS | 2026-10-19T11:57:28Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::colnamesDS | 2026-10-19T11:57:29Z |
| CNSIM | CNSIM1 | read | dsuser | 2026-10-19T11:57:30Z | |
| CNSIM | CNSIM1 | read | dsuser | DSI::datashield.assign.table | 2026-10-19T11:57:31Z |
| CNSIM | CNSIM1 | read | dsuser | base::exists | 2026-10-19T11:57:33Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::classDS | 2026-10-19T11:57:33Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::isValidDS | 2026-10-19T11:57:33Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::dimDS | 2026-10-19T11:57:33Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::colnamesDS | 2026-10-19T11:57:34Z |
| CNSIM | CNSIM1 | read | dsuser | 2026-10-19T11:57:41Z | |
| CNSIM | CNSIM1 | read | dsuser | DSI::datashield.assign.table | 2026-10-19T11:57:41Z |
| CNSIM | CNSIM1 | read | dsuser | base::exists | 2026-10-19T11:57:43Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::classDS | 2026-10-19T11:57:43Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::isValidDS | 2026-10-19T11:57:44Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::dimDS | 2026-10-19T11:57:44Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::colnamesDS | 2026-10-19T11:57:45Z |
| CNSIM | CNSIM1 | read | dsuser | 2026-10-19T11:58:00Z | |
| CNSIM | CNSIM1 | read | dsuser | DSI::datashield.assign.table | 2026-10-19T11:58:00Z |
| CNSIM | CNSIM1 | read | dsuser | base::exists | 2026-10-19T11:58:02Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::classDS | 2026-10-19T11:58:03Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::isValidDS | 2026-10-19T11:58:03Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::dimDS | 2026-10-19T11:58:04Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::colnamesDS | 2026-10-19T11:58:05Z |
| CNSIM | CNSIM1 | read | dsuser | 2026-10-19T11:58:16Z | |
| CNSIM | CNSIM1 | read | dsuser | DSI::datashield.assign.table | 2026-10-19T11:58:17Z |
| CNSIM | CNSIM1 | read | dsuser | 2026-10-19T11:58:41Z | |
| CNSIM | CNSIM1 | read | dsuser | DSI::datashield.assign.table | 2026-10-19T11:58:42Z |
| CNSIM | CNSIM1 | read | dsuser | 2026-10-19T11:59:54Z | |
| CNSIM | CNSIM1 | read | dsuser | DSI::datashield.assign.table | 2026-10-19T11:59:54Z |
| CNSIM | CNSIM1 | read | dsuser | 2026-10-19T12:00:06Z | |
| CNSIM | CNSIM1 | read | dsuser | DSI::datashield.assign.table | 2026-10-19T12:00:06Z |
| CNSIM | CNSIM1 | read | dsuser | base::exists | 2026-10-19T12:00:08Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::classDS | 2026-10-19T12:00:09Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::isValidDS | 2026-10-19T12:00:09Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::dimDS | 2026-10-19T12:00:09Z |
| CNSIM | CNSIM1 | read | dsuser | dsBase::colnamesDS | 2026-10-19T12:00:10Z |
| CNSIM | CNSIM1 | read | dsuser | 2026-10-19T12:00:11Z | |
| CNSIM | CNSIM1 | read | dsuser | DSI::datashield.assign.table | 2026-10-19T12:00:11Z |
To render the full report as an HTML document, run:
crate |>
report(
filepath = report_file,
title = "DataSHIELD Five Safes report",
render = TRUE,
overwrite = TRUE
)
opalr::opal.logout(con)