Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
a58d21b
Update function's documentation
villegar Mar 16, 2026
45df281
Refactor extract_safe_data.opal and flatten_safe_data.rocrate to simp…
villegar Mar 16, 2026
75c40b2
Update tests to account for changes in extract_safe_data.rocrate
villegar Mar 16, 2026
3d155ab
Update safe_project.opal S3 generic to automatically link users to pr…
villegar Mar 16, 2026
646bdcf
Add new function append_entity_ref to attach new references/links to …
villegar Mar 16, 2026
8858c2a
Update internal documentation
villegar Mar 16, 2026
85fa12a
New build
villegar Mar 16, 2026
3a93840
Minor change to simplify adding the hasPart property
villegar Mar 17, 2026
a0c63b4
Minor changes to streamline extraction of 5 safe components
villegar Mar 17, 2026
6d43958
Streamline audit safe project to provide same functionality without o…
villegar Mar 18, 2026
807a300
Update add_asset_permissions_to_crate and get_asset_permissions
villegar Mar 18, 2026
2b895cd
Update error messages for project_exists.* S3 generics
villegar Mar 18, 2026
0a885e8
Standardise column names, Safe Projects: project_id and project; Safe…
villegar Mar 18, 2026
8957c0d
Standardise audit functions
villegar Mar 18, 2026
0369e31
New build
villegar Mar 18, 2026
e943713
Update tests to capture changes done to the code
villegar Mar 18, 2026
0bad595
Add new internal generic, audit_engine, to power the auditing functions
villegar Mar 19, 2026
733d778
Update audit_cr8tor from a single function to an S3 generic, so the i…
villegar Mar 19, 2026
5dfb6d0
Phase out the internal load_rocrate in favour of rocrateR::load_rocrate
villegar Mar 19, 2026
f79e6e1
Phase out internal load_rocrate in favour of rocrateR::load_rocrate
villegar Mar 19, 2026
263af05
Update internal functions to use asset, instead of table, table_id >>…
villegar Mar 19, 2026
80ebdfb
Add initial draft of print generic for cr8tor/cr8tor_bundle objects
villegar Mar 19, 2026
a747f60
New build
villegar Mar 19, 2026
d93ef82
Minor changes to tests
villegar Mar 19, 2026
8c02fed
Update audit_engine to require project and check if the given values …
villegar Mar 20, 2026
3fd36d5
Update safe_people.opal generic to include givenName and familyName a…
villegar Mar 20, 2026
ee0ffbb
Update audit_cr8tor and supporting utilitarian functions to make no a…
villegar Mar 20, 2026
3265d07
Update tests to capture new changes in requiring a project for audits
villegar Mar 20, 2026
694df41
New build
villegar Mar 20, 2026
d0f170a
Add new function audit_governance to audit intent vs deployment
villegar Mar 23, 2026
68cd8c6
New build
villegar Mar 23, 2026
c31ca16
Add new internal function .extract_srvr_comp to simplify combination …
villegar Mar 24, 2026
f85b29d
Update logo's URL
villegar Mar 24, 2026
14b7468
Update Collate section
villegar Mar 25, 2026
8781395
Add new global function `audit` to handle all types of audits, includ…
villegar Mar 25, 2026
ce9d394
New build
villegar Mar 25, 2026
360ef98
Update tests to capture changes in the audit module
villegar Mar 25, 2026
6dd3cad
Update calls to audit_safe_* with the new audit() global function
villegar Mar 26, 2026
13c0927
Add internal function audit_intent, that handles if the intent arg is…
villegar Mar 26, 2026
4d42f53
Combine the audit_governance into the main audit function, to replica…
villegar Mar 26, 2026
fda356a
New build
villegar Mar 26, 2026
e2252ca
Set load_cr8tor_bundle as an internal function
villegar Mar 26, 2026
7aa2b95
Rename rocrate_report to report
villegar Mar 26, 2026
385e9e4
New build
villegar Mar 26, 2026
365335c
Update tutorial to reflect changes in the package. including calls to…
villegar Mar 27, 2026
dc4a331
Update title
villegar Mar 27, 2026
1485677
New build
villegar Mar 27, 2026
40ae48c
Move DSMolgenisArmadillo from Suggests to Imports
villegar Mar 31, 2026
703a5ab
Update tests to suppress warning messages generate when no logs are f…
villegar Mar 31, 2026
1c8a5ff
Update minimum version of rocrateR to 0.0.2 and temporarily include R…
villegar Mar 31, 2026
dfc167b
Downgrade dependency with rocrateR
villegar Apr 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: dsROCrate
Title: 'DataSHIELD' RO-Crate Wrapper Functions
Title: 'DataSHIELD' RO-Crate Governance Functions
Version: 0.0.1
Authors@R: c(
person(given = "Roberto",
Expand All @@ -26,7 +26,6 @@ License: MIT + file LICENSE
Suggests:
dsBaseClient,
DSI,
DSMolgenisArmadillo,
DSOpal,
knitr,
MolgenisArmadillo,
Expand All @@ -41,6 +40,7 @@ RoxygenNote: 7.3.3
Imports:
digest,
dplyr,
DSMolgenisArmadillo,
jsonlite,
methods,
purrr,
Expand All @@ -53,22 +53,24 @@ Imports:
yaml
Depends:
R (>= 4.1.0)
Remotes:
ResearchObject/ro-crate-r
VignetteBuilder: knitr
Collate:
'ArmadilloCredentials-class.R'
'audit_cr8tor.R'
'audit_safe_people.R'
'audit_safe_project.R'
'audit_study.R'
'audit.R'
'audit_engine.R'
'dsROCrate-package.R'
'dsROCrate.R'
'rocrate_report.R'
'print.R'
'report.R'
'safe_data.R'
'safe_output.R'
'safe_people.R'
'safe_project.R'
'safe_setting.R'
'utils-armadillo.R'
'utils-audit.R'
'utils-connection.R'
'utils-cr8tor.R'
'utils-date.R'
Expand Down
32 changes: 15 additions & 17 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Generated by roxygen2: do not edit by hand

S3method(audit_safe_people,default)
S3method(audit_safe_people,opal)
S3method(audit_safe_project,default)
S3method(audit_safe_project,opal)
S3method(audit_study,default)
S3method(audit_study,list)
S3method(audit_study,opal)
S3method(audit,armadillo)
S3method(audit,character)
S3method(audit,cr8tor)
S3method(audit,list)
S3method(audit,opal)
S3method(audit,rocrate)
S3method(audit_engine,cr8tor)
S3method(audit_engine,opal)
S3method(extract_safe_data,opal)
S3method(extract_safe_data,rocrate)
S3method(extract_safe_output,opal)
Expand All @@ -29,10 +30,11 @@ S3method(flatten_safe_setting,default)
S3method(flatten_safe_setting,rocrate)
S3method(init,opal)
S3method(init,rocrate)
S3method(rocrate_report,character)
S3method(rocrate_report,default)
S3method(rocrate_report,list)
S3method(rocrate_report,rocrate)
S3method(print,cr8tor_bundle)
S3method(report,character)
S3method(report,default)
S3method(report,list)
S3method(report,rocrate)
S3method(safe_data,character)
S3method(safe_data,default)
S3method(safe_data,opal)
Expand All @@ -55,13 +57,9 @@ S3method(safe_setting,default)
S3method(safe_setting,opal)
S3method(safe_setting,rocrate)
export(armadillo_login)
export(audit_cr8tor)
export(audit_safe_people)
export(audit_safe_project)
export(audit_study)
export(audit)
export(init)
export(load_cr8tor_bundle)
export(rocrate_report)
export(report)
export(safe_data)
export(safe_output)
export(safe_people)
Expand Down
148 changes: 148 additions & 0 deletions R/audit.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
#' Create an audit RO-Crate
#'
#' Create an audit RO-Crate following the 5 Safes Principles.
#'
#' This function handles various audit types, which will be dispatched based on
#' the input object. If the input object is
#'
#' \itemize{
#' \item a _connection_ to a DataSHIELD server (e.g., OBiBa's Opal):
#'. generates an RO-Crate object with deployment details, including outputs.
#' \item a _path_ pointing to
#' \itemize{
#' \item **a `cr8tor` archive / governance bundle**: generates an
#' RO-Crate object with pre-deployment governance details.
#' \item **an RO-Crate object**: generates an RO-Crate object with
#' clearly defined 5 Safes elements.
#' }
#' \item an _RO-Crate_ object: generates an RO-Crate object with clearly
#' defined 5 Safes elements.
#' }
#' @param x Object to be audited. This can be
#' \itemize{
#' \item a _connection_ to a DataSHIELD server (e.g., OBiBa's Opal).
#' \item a _path_ pointing to an RO-Crate OR a `cr8tor` archive /
#'. governance bundle.
#' \item an _RO-Crate_ object.
#' }
#' Alternatively, a list of any of the above.
#' @param ... Additional arguments.
#' @param intent Additional object with governance bundle/specification of the
#' intent of a project. It takes the same types as `x`.
#' @inheritParams audit_engine
#'
#' @returns RO-Crate with audit details.
#' @export
audit <- function(x, ...) {
UseMethod("audit")
}

#' @rdname audit
#' @export
audit.armadillo <- function(x, ..., intent = NULL) {
# <PLACEHOLDER>
}

#' @rdname audit
#' @export
audit.character <- function(x, ..., intent = NULL) {
# verify if the given path exists, if not, return an error message
if (!file.exists(x)) {
stop("The given file does not exist!", call. = FALSE)
}

# attempt loading a `cr8tor` bundle
x_obj <- tryCatch(
load_cr8tor_bundle(x, ...),
error = function(e) NULL
)
# alternatively, attempt loading an RO-Crate
if (is.null(x_obj)) {
x_obj <- tryCatch(
rocrateR::load_rocrate(x, ...),
error = function(e) NULL
)
}

if (is.null(x_obj)) {
stop(
"The given path does not point to a valid `cr8tor` archive nor an `rocrate",
call. = FALSE
)
}

# attempt auditing intent
intent_lst <- audit_intent(intent, ...)

# call next method
main_audit <- audit(x_obj, intent_lst$main_audit_args)

# return list
if (is.null(intent_lst$intent_audit)) {
return(main_audit)
}
list(intent = intent_lst$intent_audit, deployment = main_audit)
}

#' @rdname audit
#' @export
audit.cr8tor <- function(x, ..., intent = NULL) {
# attempt auditing intent
intent_lst <- audit_intent(intent, ..., excluded_args = "path")

# audit_engine(x, exclude_args(..., "path"), intent = intent)

# call next method
main_audit <- audit_engine(x, intent_lst$main_audit_args)

# return list
if (is.null(intent_lst$intent_audit)) {
return(main_audit)
}
list(intent = intent_lst$intent_audit, deployment = main_audit)
}

#' @rdname audit
#' @export
audit.list <- function(x, ..., intent = NULL) {
purrr::map(x, audit, ..., intent = intent)
}

#' @rdname audit
#' @export
audit.opal <- function(
x,
...,
intent = NULL,
project = NULL,
user = NULL,
logs_from = -Inf,
logs_to = Inf,
path = NULL
) {
# attempt auditing intent
intent_lst <- audit_intent(intent, ...)

# call next method
main_audit <- audit_engine(
x,
project = c(intent_lst$main_audit_args$project, project),
user = c(intent_lst$main_audit_args$user, user),
logs_from = logs_from,
logs_to = logs_to,
path = path,
intent_lst$main_audit_args
)

# return list
if (is.null(intent_lst$intent_audit)) {
return(main_audit)
}
list(intent = intent_lst$intent_audit, deployment = main_audit)
}

#' @rdname audit
#' @export
audit.rocrate <- function(x, ..., intent = NULL) {
# <PLACEHOLDER>
}
97 changes: 0 additions & 97 deletions R/audit_cr8tor.R

This file was deleted.

Loading
Loading