diff --git a/DESCRIPTION b/DESCRIPTION index dae5bc7..1290a52 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: acro Title: A Tool for Semi-Automating the Statistical Disclosure Control of Research Outputs -Version: 0.1.6 +Version: 0.1.7 Authors@R: c( person("Jim", "Smith", role = c("cre","ctb"), email = "James.Smith@uwe.ac.uk", comment = c(ORCID = "0000-0001-7908-1859")), diff --git a/NAMESPACE b/NAMESPACE index ddeb349..4d2998a 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -4,6 +4,8 @@ export(acro_add_comments) export(acro_add_exception) export(acro_crosstab) export(acro_custom_output) +export(acro_disable_suppression) +export(acro_enable_suppression) export(acro_finalise) export(acro_glm) export(acro_hist) diff --git a/NEWS.md b/NEWS.md index 53f8d56..00dd141 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,16 @@ + +# acro 0.1.7 +* Added support for installation via conda +* Added support for specifying config files when acro session is started +* Added support for specifying whether suppression is on or off when acro session is started +* Added support for toggling suppression dynamically during session via `acro_enable_supression()` + and `acro_disable_suppression()` +* Improved documentation in package and at [sacro-tools.org](sacro-tools.org) +* Added Support for variable names with spaces when calling crosstab +* Set status of disclosive outputs to 'review' (previously 'fail') when suppression has been applied +* Automatically add exception message when applying suppression to an output +* Make `acro_finalise()` non-interactive by default (interactive is now option at call time) + # acro 0.1.6 * Upgrade ACRO Python backend to v0.4.11, supporting Python 3.14. diff --git a/R/acro_init.R b/R/acro_init.R index 327255e..465ddbd 100644 --- a/R/acro_init.R +++ b/R/acro_init.R @@ -1,6 +1,6 @@ # Globals ----------------------------------------------------------------- acro_venv <- "r-acro" -acro_pkg <- "acro==0.4.11" +acro_pkg <- "acro==0.4.12" ch <- "conda-forge" diff --git a/R/output_commands.R b/R/output_commands.R index 4fcb4c6..ad91e39 100644 --- a/R/output_commands.R +++ b/R/output_commands.R @@ -98,3 +98,28 @@ acro_finalise <- function(path, ext) { } acroEnv$ac$finalise(path, ext) } + + +#' Turns suppression on during a session +#' +#' @return No return value, called for side effects +#' @export + +acro_enable_suppression <- function() { + if (is.null(acroEnv$ac)) { + stop("ACRO has not been initialised. Please first call acro_init().") + } + acroEnv$ac$enable_suppression() +} + +#' Turns suppression off during a session +#' +#' @return No return value, called for side effects +#' @export + +acro_disable_suppression <- function() { + if (is.null(acroEnv$ac)) { + stop("ACRO has not been initialised. Please first call acro_init().") + } + acroEnv$ac$disable_suppression() +} diff --git a/inst/WORDLIST b/inst/WORDLIST index 93cbbdf..8382203 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -1,41 +1,38 @@ ADR Acknowledgement Analytics +Conda EPSRC -GPLv GRAIMATTER HDR Initialise Karnofsky MRC MyBinder -NK -PyPI RStudio SACRO SDC -Scalable -TRE +TREs +TREvolution +Transformative Xplore +YAML +analytics auditable -btn codecov +conda +config crosstab disclosive -finalise github https initialised json -mitigations numpy openml -organisation pre programme -sacro scipy -sm -statsmodels www xlsx +yaml diff --git a/man/acro_disable_suppression.Rd b/man/acro_disable_suppression.Rd new file mode 100644 index 0000000..2f77a76 --- /dev/null +++ b/man/acro_disable_suppression.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/output_commands.R +\name{acro_disable_suppression} +\alias{acro_disable_suppression} +\title{Turns suppression off during a session} +\usage{ +acro_disable_suppression() +} +\value{ +No return value, called for side effects +} +\description{ +Turns suppression off during a session +} diff --git a/man/acro_enable_suppression.Rd b/man/acro_enable_suppression.Rd new file mode 100644 index 0000000..2ca6dbe --- /dev/null +++ b/man/acro_enable_suppression.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/output_commands.R +\name{acro_enable_suppression} +\alias{acro_enable_suppression} +\title{Turns suppression on during a session} +\usage{ +acro_enable_suppression() +} +\value{ +No return value, called for side effects +} +\description{ +Turns suppression on during a session +} diff --git a/tests/testthat/test-acro_disable_suppression.R b/tests/testthat/test-acro_disable_suppression.R new file mode 100644 index 0000000..365c733 --- /dev/null +++ b/tests/testthat/test-acro_disable_suppression.R @@ -0,0 +1,14 @@ +test_that("acro_enable_suppression without initialising ACRO object first", { + acroEnv$ac <- NULL + expect_error(acro_disable_suppression(), "ACRO has not been initialised. Please first call acro_init()") +}) + +test_that("acro_disable_suppression works", { + testthat::skip_on_cran() + acro_init() + foo <- acro_disable_suppression() + table <- acro_crosstab(index = nursery_data[, c("recommend")], columns = nursery_data[, c("parents")]) + output <- acro_print_outputs() + status <- "fail" + expect_true(any(grepl(status, output))) +}) diff --git a/tests/testthat/test-acro_enable_suppression.R b/tests/testthat/test-acro_enable_suppression.R new file mode 100644 index 0000000..08536fa --- /dev/null +++ b/tests/testthat/test-acro_enable_suppression.R @@ -0,0 +1,14 @@ +test_that("acro_enable_suppression without initialising ACRO object first", { + acroEnv$ac <- NULL + expect_error(acro_enable_suppression()(), "ACRO has not been initialised. Please first call acro_init()") +}) + +test_that("acro_enable_suppression works", { + testthat::skip_on_cran() + acro_init() + acro_enable_suppression() + table <- acro_crosstab(index = nursery_data[, c("recommend")], columns = nursery_data[, c("parents")]) + output <- acro_print_outputs() + status <- "review" + expect_true(any(grepl(status, output))) +}) diff --git a/tests/testthat/test-acro_pivot_table.R b/tests/testthat/test-acro_pivot_table.R index 4331bde..ea43e11 100644 --- a/tests/testthat/test-acro_pivot_table.R +++ b/tests/testthat/test-acro_pivot_table.R @@ -17,6 +17,5 @@ test_that("acro_pivot_table works", { acro_init() table <- acro_pivot_table(data = nursery_data, index = "parents", values = "children", aggfunc = list("mean", "std")) - print(expected_table) expect_equal(table[, -1, drop = FALSE], expected_table[, -1, drop = FALSE]) }) diff --git a/vignettes/supports.Rmd b/vignettes/supports.Rmd index 5a2e0fb..25de22c 100644 --- a/vignettes/supports.Rmd +++ b/vignettes/supports.Rmd @@ -4,7 +4,7 @@ title: "What ACRO-R Supports" # What ACRO-R Supports -This page provides a comprehensive overview of ACRO’s capabilities. ACRO supports a wide range of statistical analysis functions with automated disclosure control. +This page provides a comprehensive overview of the capabilities ACRO supports. ACRO supports a wide range of statistical analysis functions with automated disclosure control. ## Supported Data Analysis Functions