Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
4bd52fd
Increment version number to 0.2.4.9000
villegar Oct 19, 2026
136900a
Introduce new module with internal base R functions, %||%
villegar Oct 22, 2026
f6e09fc
Replace spected return size for vapply from "" to character(1)
villegar Oct 22, 2026
0ab8171
Add test for OR helper and updated version of safe_desc
villegar Oct 22, 2026
fda782a
Standardise the format for dates used across the package
villegar Oct 23, 2026
7bfc4ff
Inspect the length of the input for safe_time and return empty if con…
villegar Oct 23, 2026
05586af
Add tests to check multiple scenarios with different input timestamps
villegar Oct 23, 2026
acec187
Update website building with pkgdown, including a custom articules index
villegar Oct 23, 2026
a044203
Replace is_admin_con and is_audit_con with backend_can_audit, this ge…
villegar Oct 27, 2026
f61a648
Add new internal function set_crate_context to reduce code duplicatio…
villegar Oct 27, 2026
2774f36
Update calls to set_crate_context and add tests
villegar Oct 28, 2026
b5cabe7
Add new internal helpers: s3_method_not_available and s3_method_not_i…
villegar Oct 28, 2026
66bc9ad
Introduce helper to generalise backend's name, instead of a hardcoded…
villegar Oct 28, 2026
8254d03
Update tests for report when called for non-existent class and update…
villegar Oct 28, 2026
acd92bc
Add internal S3 generic method, backend_validated, to verify if a bac…
villegar Oct 28, 2026
b2402bb
Add tests to ensure functionality of validate_backend works as expected
villegar Oct 28, 2026
7b263a5
Update s3_method_not_available to include a hint arg and drop out bac…
villegar Oct 29, 2026
0f284fc
Add new helper get_crate_context to extract context of an RO-Crate an…
villegar Oct 29, 2026
366cc4a
Add new helper get_crate_context to extract context of an RO-Crate an…
villegar Oct 29, 2026
cd40a39
Revert changes in date formatting, keep formatting only for later sta…
villegar Oct 29, 2026
54056c9
New build
villegar Oct 29, 2026
4c72809
Update extraction of path from RO-Crate when creating the report
villegar Oct 30, 2026
35f9b07
Add missing attribute, backend_validated to list of accepted attributes
villegar Oct 30, 2026
06c7836
Update calls_to_tbl to filter out elements in the arguments that don'…
villegar Nov 2, 2026
bdf6061
Minor changes, including new version of roxygen2 and replace quotes
villegar Nov 3, 2026
70c2211
Add workflow to checkout for dependencies/updates on GHA workflows
villegar Nov 10, 2026
f2452dd
Integrate lintr in the code base and deploy GHA workflow for PRs
villegar Nov 10, 2026
fd19ace
Run rsonar::sonar_analysis and apply fixes, create internal function …
villegar Nov 10, 2026
492c147
Adjust name of variable in vignette to comply with lintr rules
villegar Nov 10, 2026
8ca4a09
Add new helper module to introduce a project context to reduce number…
villegar Nov 11, 2026
acd9c6f
Remove unused S3 generic methods for extract_safe_*.opal()
villegar Nov 11, 2026
a050bf0
Update DESCRIPTION to move DSMolgenisArmadillo as a suggested package…
villegar Nov 11, 2026
e74bc4a
Minor styling changes
villegar Nov 11, 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
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@
^CRAN-SUBMISSION$
^\.positai$
^\.claude$
^sonar-fixes\.json$
^quality\.html$
^\.lintr$
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
31 changes: 31 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:

name: lint.yaml

permissions: read-all

jobs:
lint:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v6

- uses: r-lib/actions/setup-r@v2

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::lintr, local::.
needs: lint

- name: Lint
run: lintr::lint_package()
shell: Rscript {0}
env:
LINTR_ERROR_ON_LINT: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ inst/R.ignore
cran-comments.md
CRAN-SUBMISSION
.positai
docs
sonar-fixes.json
quality.html
7 changes: 7 additions & 0 deletions .lintr
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
linters: linters_with_defaults(
object_name_linter = lintr::object_name_linter(
styles = c("snake_case", "camelCase", "dotted.case"),
regexes = c("^[A-Z][[:alnum:]_]*$", "^@timestamp$", "%||%")
))
encoding: "UTF-8"
exclusions: list("inst/R.ignore")
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: dsROCrate
Title: 'DataSHIELD' RO-Crate Governance Functions
Version: 0.2.4
Version: 0.2.4.9000
Authors@R: c(
person(given = "Roberto",
family = "Villegas-Diaz",
Expand Down Expand Up @@ -30,6 +30,7 @@ Suggests:
dsBaseClient,
DSI,
DSOpal,
DSMolgenisArmadillo,
fs,
knitr,
MolgenisArmadillo,
Expand All @@ -42,7 +43,6 @@ Roxygen: list(markdown = TRUE)
Imports:
digest,
dplyr,
DSMolgenisArmadillo,
jsonlite,
opalr (>= 3.6.1),
purrr,
Expand All @@ -57,6 +57,6 @@ Imports:
Depends:
R (>= 4.1.0)
VignetteBuilder: knitr
URL: https://github.com/FederatedMethods/dsROCrate
URL: https://github.com/FederatedMethods/dsROCrate, https://federatedmethods.github.io/dsROCrate
BugReports: https://github.com/FederatedMethods/dsROCrate/issues
Config/roxygen2/version: 8.1.0
Config/roxygen2/version: 8.1.1
12 changes: 5 additions & 7 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

S3method(as.data.frame,safe_call)
S3method(as.data.frame,symbol_registry)
S3method(as_tibble,safe_symbol)
S3method(audit,ArmadilloCredentials)
S3method(audit,character)
S3method(audit,cr8tor)
Expand All @@ -12,7 +13,9 @@ S3method(audit,rocrate)
S3method(audit_engine,cr8tor)
S3method(audit_engine,default)
S3method(audit_engine,opal)
S3method(backend_can_audit,opal)
S3method(backend_logs,opal)
S3method(backend_name,opal)
S3method(backend_options,opal)
S3method(backend_packages,opal)
S3method(backend_profile_exists,opal)
Expand All @@ -27,18 +30,14 @@ S3method(backend_table_perms,opal)
S3method(backend_tables,opal)
S3method(backend_user_exists,opal)
S3method(backend_users,opal)
S3method(backend_validated,opal)
S3method(check_permissions,ArmadilloCredentials)
S3method(check_permissions,default)
S3method(check_permissions,opal)
S3method(extract_safe_data,opal)
S3method(extract_safe_data,rocrate)
S3method(extract_safe_output,opal)
S3method(extract_safe_output,rocrate)
S3method(extract_safe_people,opal)
S3method(extract_safe_people,rocrate)
S3method(extract_safe_project,opal)
S3method(extract_safe_project,rocrate)
S3method(extract_safe_setting,opal)
S3method(extract_safe_setting,rocrate)
S3method(filter_safe_people,opal)
S3method(flatten_safe_data,default)
Expand All @@ -54,8 +53,6 @@ S3method(flatten_safe_setting,rocrate)
S3method(init,ArmadilloCredentials)
S3method(init,opal)
S3method(init,rocrate)
S3method(is_admin_con,opal)
S3method(is_audit_con,opal)
S3method(parse_user_profiles,ArmadilloCredentials)
S3method(parse_user_profiles,opal)
S3method(print,cr8tor_bundle)
Expand Down Expand Up @@ -111,4 +108,5 @@ export(safe_people)
export(safe_project)
export(safe_setting)
importFrom(rocrateR,get_entity)
importFrom(tibble,as_tibble)
importFrom(utils,write.csv)
34 changes: 34 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
# dsROCrate (development version)

## Bug fixes

* Restored the internal `%||%` helper, removed in 0.2.4. Base R only provides
`%||%` from 4.4.0, so the Opal workflow failed on R 4.1 to 4.3. Tables and
resources without a description get the fallback description again (it had
become an empty string).
* Fixed `dateCreated`/`dateModified` of tables and resources being shifted by
the local UTC offset.
* `dateModified` of the `safe_output()` entities is now a UTC string, and the
time stamps in the log file names use UTC.

## Changes

* Errors for unsupported classes and not yet implemented backends are now
consistent across `audit()`, `check_permissions()`, `init()`, `report()` and
the `safe_*()` functions.
* `report()`: the date in the report header is now in UTC.

## Internal Changes

* The requests about a project (if it exists, and its tables and resources) are
made once and shared by `safe_project()` and `safe_data()` through the
RO-Crate, instead of once per function. For `init() |> safe_project() |>
safe_data()` this means 1 request to check the project (was 5) and 1 to list
its tables and resources (was 2 each). The shared requests last as long as the
RO-Crate: run `init()` again to refresh them.
* Added `backend_can_audit()`, replacing `is_admin_con()` and `is_audit_con()`:
checking that a connection can audit now takes 1 request instead of 4.
* `validate_backend()` skips the checks when the RO-Crate was already validated
for the same connection, so `audit()` and `init() |> safe_*()` validate once.
* Added `backend_name()`, `set_crate_context()` and shared error helpers.

# dsROCrate 0.2.4

## Bug fixes
Expand Down
15 changes: 5 additions & 10 deletions R/audit.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,17 @@ audit <- function(x, ...) {

#' @export
audit.default <- function(x, ...) {
stop(
sprintf(
"No `audit()` method exists for objects of class: %s.",
paste(class(x), collapse = ", ")
),
call. = FALSE
s3_method_not_available(
"audit",
class = class(x),
hint = "Please provide a supported backend connection object."
)
}

#' @rdname audit
#' @export
audit.ArmadilloCredentials <- function(x, ..., intent = NULL) {
stop(
"The `audit()` for the Armadillo backend is not currently implemented!",
call. = FALSE
)
s3_method_not_implemented("audit", backend = "Armadillo")
}

#' @rdname audit
Expand Down
10 changes: 4 additions & 6 deletions R/audit_engine.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@ audit_engine <- function(x, ...) {

#' @export
audit_engine.default <- function(x, ...) {
stop(
sprintf(
"No `audit_engine()` method exists for objects of class: %s.",
paste(class(x), collapse = ", ")
),
call. = FALSE
s3_method_not_available(
"audit_engine",
class = class(x),
hint = "Please provide a supported backend connection object."
)
}

Expand Down
36 changes: 10 additions & 26 deletions R/backend-generic.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
backend_can_audit <- function(x, ...) {
UseMethod("backend_can_audit")
}

backend_logs <- function(x, ...) {
UseMethod("backend_logs")
}

backend_name <- function(x, ...) {
UseMethod("backend_name")
}

backend_options <- function(x, ...) {
UseMethod("backend_options")
}
Expand Down Expand Up @@ -58,32 +66,8 @@ backend_users <- function(x, ...) {
UseMethod("backend_users")
}

#' Verify if connection was created by an administrator user
#'
#' @inheritParams validate_con
#' @param ... Unused, extra arguments.
#'
#' @returns Boolean flag to indicate whether the given connection was created
#' by an administrator user.
#' @keywords internal
#'
#' @noRd
is_admin_con <- function(x, ...) {
UseMethod("is_admin_con")
}

#' Verify if connection was created by an auditor user
#'
#' @inheritParams validate_con
#' @param ... Unused, extra arguments.
#'
#' @returns Boolean flag to indicate whether the given connection was created
#' by an auditor user.
#' @keywords internal
#'
#' @noRd
is_audit_con <- function(x, ...) {
UseMethod("is_audit_con")
backend_validated <- function(x, ...) {
UseMethod("backend_validated")
}

#' Validate backend version
Expand Down
58 changes: 26 additions & 32 deletions R/backend-opal.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,32 @@
#' @export
backend_can_audit.opal <- function(x, ..., role = FALSE) {
res <- .try_load(backend_profile_exists(x, "default"))
out <- list(ok = !is.null(res$value), role = NA_character_, error = res$error)
# the extra probe is only needed to report the role
if (role && out$ok) {
out$role <- if (
is.null(.try_load(backend_user_exists(x, x$username))$error)
) {
"administrator"
} else {
"auditor"
}
}
out
}

#' @export
backend_logs.opal <- function(x, ...) {
logs <- suppressMessages(opalr::dsadmin.log(x, ...))
logs[["@timestamp"]] <- parse_utc(logs[["@timestamp"]])
logs
}

#' @export
backend_name.opal <- function(x, ...) {
"OBiBa's Opal"
}

#' @export
backend_options.opal <- function(x, ...) {
opalr::dsadmin.get_options(x, ...)
Expand Down Expand Up @@ -76,38 +98,10 @@ backend_users.opal <- function(x, ...) {
}

#' @export
is_admin_con.opal <- function(x, ...) {
# condition 1: admin users have access to `backend_user_exists`
cond1 <- .try_load(backend_user_exists(x, x$username))
# condition 2: admin users have access to `backend_profile_exists`
cond2 <- .try_load(backend_profile_exists(x, "default"))

# check all the conditions are met
result <- all(!is.null(cond1$value), !is.null(cond2$value))
attr(result, "error") <- list(
user_exists = cond1$error,
profile_exists = cond2$error
)
result
}

#' @export
is_audit_con.opal <- function(x, ...) {
# condition 1: admin users have access to `backend_user_exists`
cond1 <- .try_load(backend_user_exists(x, x$username))
# condition 2: admin users have access to `backend_profile_exists`
cond2 <- .try_load(backend_profile_exists(x, "default"))

# check all the conditions are met
# cond1 is met when the call *errored* (no admin access, as expected of
# a pure auditor); cond2 is met when the call *succeeded* - the returned
# values don't matter either way
result <- all(!is.null(cond1$error), !is.null(cond2$value))
attr(result, "error") <- list(
user_exists = NULL, # an error here is expected/correct for an auditor,
profile_exists = cond2$error
)
result
backend_validated.opal <- function(x, ..., rocrate = NULL) {
# validate both the `backend_validated` flag and the connection object
isTRUE(attr(rocrate, "backend_validated")) &&
identical(x, attr(rocrate, "connection"))
}

#' @export
Expand Down
Loading
Loading