Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
550e684
Create index.md for Acro-R
JessUWE Oct 23, 2025
4edb58a
Revise installation guide for ACRO and SACRO tools
JessUWE Oct 23, 2025
b0625a6
Add comprehensive overview of ACRO's capabilities
JessUWE Oct 23, 2025
49e520a
Add welcome documentation for ACRO-R package
JessUWE Oct 23, 2025
eac3dd3
Create examples.md with usage and tutorials for ACRO
JessUWE Oct 23, 2025
a04eb1f
Add files via upload
JessUWE Oct 23, 2025
819001f
Added the SACRO_Logo to the figures folder
JessUWE Oct 23, 2025
07296a3
Enhance pkgdown configuration with light-switch
JessUWE Oct 23, 2025
c68b52f
CSS and JS for custom styling
JessUWE Oct 23, 2025
891c44a
Simplify pkgdown workflow configuration
JessUWE Oct 23, 2025
ff135eb
Fix link for SACRO-Viewer documentation
JessUWE Nov 7, 2025
96afd0d
Update links for ACRO and SACRO-ML tools
JessUWE Nov 7, 2025
12fc94c
Update output formats in supports.md
JessUWE Nov 11, 2025
065c287
Enable building vignettes in R package check
JessUWE Nov 11, 2025
aa88e54
Merge remote-tracking branch 'upstream/main'
JessUWE Nov 13, 2025
4347add
Fix merging issues
JessUWE Nov 13, 2025
0c923fe
Update .gitignore and DESCRIPTION for improved documentation and outp…
JessUWE Nov 13, 2025
e0b5e5c
Refactor R-CMD-check workflow configuration
JessUWE Nov 13, 2025
41cc0d6
Update pre-commit configuration, fix links in documentation, and upda…
JessUWE Nov 13, 2025
99fed1f
Remove unnecessary trailing whitespace from various HTML and JavaScri…
JessUWE Nov 13, 2025
2c779dc
Remove unnecessary trailing whitespace from various HTML and JavaScri…
JessUWE Nov 13, 2025
8d33617
Change Python requirement to version 3.10 or higher
JessUWE Nov 13, 2025
ebcd747
Delete .vscode directory
JessUWE Nov 14, 2025
739bd21
Delete docs directory
JessUWE Nov 14, 2025
e2def9c
Delete .RData
JessUWE Nov 14, 2025
f9ce72a
Add additional entries to .Rbuildignore
JessUWE Nov 14, 2025
4804ef7
Update WORDLIST with additional terms
JessUWE Nov 14, 2025
05cf208
Change Python version for old R versions in CI
JessUWE Nov 14, 2025
69e2bb7
Fix YAML formatting in R-CMD-check workflow
JessUWE Nov 14, 2025
3347588
Comment out the R Package check step in the CI workflow
JessUWE Nov 14, 2025
aed2993
Remove deprecated documentation files and update installation require…
JessUWE Nov 14, 2025
5b8938a
Remove unnecessary blank line in R-CMD-check workflow
JessUWE Nov 14, 2025
355793c
Build vignettes and documentation
JessUWE Nov 14, 2025
d11dd3c
Uncomment R Package check step in workflow
JessUWE Nov 14, 2025
ea851f8
Build vignettes and documentation
JessUWE Nov 14, 2025
2fdf7bd
Add skip_on_ci() to tests and fix workflow
JessUWE Nov 14, 2025
b34f2ee
Merge branch 'main' of https://github.com/JessUWE/ACRO-R
JessUWE Nov 14, 2025
651b7fe
Replace skip_on_cran() with skip_on_ci() in tests for acro_crosstab a…
JessUWE Nov 14, 2025
0d8ddcb
Fix formatting issues in test-acro_crosstab.R
JessUWE Nov 14, 2025
998b7a6
Update tests for acro_glm with skip_on_ci
JessUWE Nov 14, 2025
0a895bb
Fixed errors in the files as well as warnings. fix vignette issues an…
JessUWE Nov 14, 2025
6b2197d
Merge branch 'main' of https://github.com/JessUWE/ACRO-R
JessUWE Nov 14, 2025
98a479f
fixed r-cmd-check and warnings from the test files
JessUWE Nov 14, 2025
5239c5f
Update R-CMD-check.yaml
JessUWE Nov 14, 2025
8ff9a92
Update R-CMD-check.yaml
JessUWE Nov 14, 2025
f816ed7
Update create_virtualenv.R
JessUWE Nov 14, 2025
665d492
fix errors and warnings, hopefully it works this time, made adjustmen…
JessUWE Nov 14, 2025
e6b1256
Update create_virtualenv.R
JessUWE Nov 14, 2025
3d4a236
Updated virtualenv
JessUWE Nov 14, 2025
2bf66b0
Merge branch 'main' of https://github.com/JessUWE/ACRO-R
JessUWE Nov 14, 2025
a2d0599
cleaned code to meet codecav
JessUWE Nov 14, 2025
6d5f04f
fixed The roxygen comments in your R code are being converted to an i…
JessUWE Nov 14, 2025
aea2bd3
added a new test file
JessUWE Nov 14, 2025
4405b92
fixed pre commit issues
JessUWE Nov 14, 2025
4dda03a
.
JessUWE Nov 14, 2025
a3b5843
Update create_virtualenv.R
JessUWE Nov 14, 2025
a7391fc
Merge branch 'main' of https://github.com/JessUWE/ACRO-R
JessUWE Nov 14, 2025
437d224
Update test-create_virtualenv.R
JessUWE Nov 14, 2025
8e1b6d2
.
JessUWE Nov 14, 2025
64a52f0
Merge branch 'main' of https://github.com/JessUWE/ACRO-R
JessUWE Nov 14, 2025
2314796
.
JessUWE Nov 14, 2025
7d77251
Delete vignettes/.example-notebook.Rmd.swp
JessUWE Nov 15, 2025
cd934da
Update index.md
JessUWE Nov 26, 2025
5a0b421
Replace skip_on_ci() with skip_on_cran() in tests for acro_crosstab…
JessUWE Nov 26, 2025
ac5b9bf
Moved the NEWS.md file to the right position
JessUWE Nov 26, 2025
34e7a0a
Update test-acro_glm.R
JessUWE Nov 27, 2025
e67f891
Update R-CMD-check.yaml
JessUWE Nov 27, 2025
1ae1d12
Update R-CMD-check.yaml
JessUWE Nov 27, 2025
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
11 changes: 11 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,14 @@
^data/nursery\.arff$
^data/charity\.dta$
^prepare_to_submit_to_CRAN\.R$
^pkgdown$
^index\.md$
^examples\.md$
^installation\.md$
^supports\.md$
^welcome\.md$
^\.vscode$
^.*\.swp$
^\.Rdata$
^doc$
^Meta$
36 changes: 8 additions & 28 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,65 +1,45 @@
# 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:
branches: [main, master]

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ${{ matrix.os }}

name: ${{ matrix.os }} (${{ matrix.r }})

strategy:
fail-fast: false
matrix:
include:

# default everything
- {os: 'ubuntu-latest', python: '3.13', r: 'release'}
- {os: 'windows-latest', python: '3.13', r: 'release'}
- {os: 'macOS-latest', python: '3.13', r: 'release'}

# older R versions
- {os: 'ubuntu-latest', python: '3.9', r: 'oldrel-1'}
- {os: 'ubuntu-latest', python: '3.9', r: 'oldrel-2'}
- {os: 'ubuntu-latest', python: '3.9', r: 'oldrel-3'}

- { os: "ubuntu-latest", python: "3.13", r: "release" }
- { os: "windows-latest", python: "3.13", r: "release" }
- { os: "macOS-latest", python: "3.13", r: "release" }
- { os: "ubuntu-latest", python: "3.10", r: "oldrel-1" }
- { os: "ubuntu-latest", python: "3.10", r: "oldrel-2" }
- { os: "ubuntu-latest", python: "3.10", r: "oldrel-3" }
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
# set matplotlib backend because Windows CI errors with:
# "This probably means that Tcl wasn't installed properly."
MPLBACKEND: Agg # https://github.com/orgs/community/discussions/26434

MPLBACKEND: Agg
steps:
- name: Checkout ACRO
uses: actions/checkout@v5

uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python }}

- name: Setup pandoc
uses: r-lib/actions/setup-pandoc@v2

- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.r }}

- name: Install R dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- name: Check R Package
uses: r-lib/actions/check-r-package@v2
with:
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ jobs:
pkgdown:
runs-on: ubuntu-latest

concurrency: # restrict concurrency for non-PR jobs
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Checkout
uses: actions/checkout@v5
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,6 @@ stata/various_stata_development__files
# test output
/outputs/
/test.xlsx
inst/doc
/doc/
/Meta/
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ repos:
(?x)^(
.*\.txt|
.*\.ipynb|
.*\.html
.*\.html|
docs/deps/.*
)$

# Format R files
Expand Down
5 changes: 4 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Description: A Tool for Semi-Automating the Statistical Disclosure Control of Re
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
RoxygenNote: 7.3.3
SystemRequirements: Python (>= 3.10)
Imports:
reticulate,
Expand All @@ -23,9 +23,12 @@ Depends:
R (>= 2.10)
LazyData: true
Suggests:
knitr,
rmarkdown,
spelling,
testthat (>= 3.0.0)
Config/testthat/edition: 3
Language: en-US
URL: https://github.com/AI-SDC/ACRO-R
BugReports: https://github.com/AI-SDC/ACRO-R/issues
VignetteBuilder: knitr
26 changes: 20 additions & 6 deletions R/create_virtualenv.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,29 @@ acro_venv <- "r-acro"
acro_package <- "acro==0.4.11"
python_version <- ">=3.10"


#' Install acro
#'
#' @param envname the name of the Python virtual environment
#' @param python the path to Python executable
#' @param ... Any other parameters.
#'
#' @return No return value, called for side effects
install_acro <- function(envname = "r-acro", python = NULL, ...) {
# Get Python executable if not provided
if (is.null(python)) {
python <- Sys.which("python3")
if (python == "") {
python <- Sys.which("python") # nocov
if (python == "") { # nocov
stop("Python not found in PATH. Please ensure Python is installed and accessible.") # nocov
} # nocov
}
}


install_acro <- function(envname = "r-acro", ...) {
# create Python virtual environment
reticulate::virtualenv_create(
envname = envname,
version = python_version,
python = python,
force = TRUE,
packages = NULL
)
Expand All @@ -29,11 +38,16 @@ install_acro <- function(envname = "r-acro", ...) {
#' @param ... Any other parameters.
#'
#' @return No return value, called for side effects

create_virtualenv <- function(...) {
# Get Python executable path
python_path <- Sys.which("python3")
if (python_path == "") {
python_path <- Sys.which("python") # nocov
}

# ensure a virtual environment exists
if (!reticulate::virtualenv_exists(acro_venv)) {
install_acro(envname = acro_venv)
install_acro(envname = acro_venv, python = python_path)
}

# activate virtual environment
Expand Down
28 changes: 25 additions & 3 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
---
url: https://AI-SDC.github.io/ACRO-R/
template:
light-switch: true
bootstrap: 5
...
bslib:
primary: "#0051a5"

navbar:
structure:
left: [home, reference, welcome, supports, installation, examples]
right: [search, github, lightswitch]
left:
- text: "Home"
href: index.html
- text: "Reference"
href: reference/index.html
- text: "Welcome to ACRO-R"
href: welcome.html
- text: "What ACRO-R Supports"
href: supports.html
- text: "Installation"
href: installation.html
- text: "Examples"
href: examples.html
right:
- icon: fab-github
href: https://github.com/AI-SDC/ACRO-R
aria-label: GitHub
13 changes: 13 additions & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,40 @@ ADR
Acknowledgement
Analytics
EPSRC
GPLv
GRAIMATTER
HDR
Initialise
Karnofsky
MRC
MyBinder
NK
PyPI
RStudio
SACRO
SDC
Scalable
TRE
Xplore
auditable
btn
codecov
crosstab
disclosive
finalise
github
https
initialised
json
mitigations
numpy
openml
organisation
pre
programme
sacro
scipy
sm
statsmodels
www
xlsx
40 changes: 40 additions & 0 deletions inst/examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Examples

## Interactive Notebook

For comprehensive examples and tutorials, see our interactive R notebook:

[Example Notebook](articles/example-notebook.html)

## Quick Start Examples

### Basic Usage

```r
library("acro")

# Initialize ACRO
acro_init(suppress = TRUE)

# Your analysis code here
# ACRO will automatically check outputs for disclosure risks
```

### Creating Safe Tables

```r
# Example of creating a cross-tabulation with ACRO
result <- acro_crosstab(data$variable1, data$variable2)

# ACRO automatically applies disclosure control
print(result)
```

### Finalizing Your Session

```r
# When you're done with your analysis
acro_finalise()
```

For more detailed examples and use cases, please refer to the [Example Notebook](articles/example-notebook.html).
49 changes: 49 additions & 0 deletions inst/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<img src="man/figures/SACRO_Logo_final.png" alt="Alt Text" width="20%">

## AI-SDC Family Tools

| **ACRO (Python)** | **SACRO-ML** |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Statistical Disclosure Control for Python** <br />Tools for the Semi-Automatic Checking of Research Outputs. Drop-in replacements for common analysis commands with built-in privacy protection.<br />[Statistical Analysis](https://sacro-tools.org/introduction.html){.btn .btn-acro .btn-sm} | **Machine Learning Privacy Tools** <br />Collection of tools and resources for managing the statistical disclosure control of trained machine learning models.<br />[Learn More](https://SACRO-ML.sacro-tools.org/introduction.html){.btn .btn-sacro-ml .btn-sm} |
| **ACRO-R** | **SACRO-Viewer** |
| **R Package Integration** <br />R-language interface for the Python ACRO library, providing familiar R syntax for statistical disclosure control.<br />[R Integration](reference/index.html){.btn .btn-acro-r .btn-sm} | **Graphical User Interface** <br />A graphical user interface for fast, secure and effective output checking, which can work in any TRE (Trusted Research Environment).<br />[View Docs](https://SACRO-Viewer.sacro-tools.org/introduction.html){.btn .btn-sacro-viewer .btn-sm} |

## ACRO-R: Statistical Disclosure Control

ACRO is a free and open source tool that supports the semi-automated checking of research outputs (SACRO) for privacy disclosure within secure data environments. SACRO is a framework that applies best-practice principles-based statistical disclosure control (SDC) techniques on-the-fly as researchers conduct their analysis. SACRO is designed to assist human checkers rather than seeking to replace them as with current automated rules-based approaches.

## What is ACRO-R?

ACRO implements a principles-based statistical disclosure control (SDC) methodology that:

* Automatically identifies potentially disclosive outputs
* Applies optional disclosure mitigation strategies
* Reports reasons for applying SDC
* Produces summary documents for output checkers

## Core Features

### Semi-Automated Disclosure Checking

* **Drop-in replacements** for common Python analysis commands (pandas, statsmodels, etc.) with configurable disclosure checks
* **Automated sensitivity tests** : frequency thresholds, dominance (p%, NK rules, etc.), residual degrees-of-freedom checks
* **Optional mitigations** : suppression, rounding, and more to come
* **Session management** : track, rename, comment, remove, add exceptions, and finalise reports
* **Configurable risk parameters** via YAML files
* **Generates auditable reports** in JSON or Excel

### Design Principles

* **Free and open source** under MIT (ACRO) / GPLv3 (SACRO Viewer)
* **Easy to install** via PyPI, CRAN, or GitHub; cross-platform (Linux, macOS, Windows)
* **Familiar APIs** - same function signatures as native commands: acro.crosstab mirrors pandas.crosstab, etc.
* **Comprehensive coverage** - tables, regressions, histograms, survival plots, etc.
* **Transparent & auditable** - clear reports, stored queries, designed for human-checkers
* **Configurable & extensible** - organisation-defined disclosure rules, multi-language support
* **Scalable** - lightweight, session-based, local execution

## Getting Started

| **Install** | **Learn** | **Reference** |
| ------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| Get ACRO-R installed and configured in your environment<br />[Install Guide](articles/installation.html){.btn .btn-primary} | Explore tutorials and examples for common use cases<br />[Examples](articles/index.html){.btn .btn-primary} | Complete API documentation and function reference<br />[API Docs](reference/index.html){.btn .btn-primary} |
Loading