Skip to contents

Extracts failure information from an operative (or agent) that has been configured with validation steps. This is a memory-efficient alternative to full interrogation that focuses only on identifying and reporting validation failures.

Usage

debrief(
  operative,
  row_id_col,
  parquet_path = NULL,
  con = NULL,
  output_tbl = NULL,
  chunk_size = 1000
)

Arguments

operative

A pointblank agent or operative object with validation steps

row_id_col

Character vector of column names to use as row identifiers. These columns will be included in the output to identify failing rows.

parquet_path

Optional path to save failures as a parquet file. If provided, failures will be written to this file instead of returned as a tibble. Requires the 'arrow' package to be installed.

con

Optional database connection to save failures. If provided, failures will be inserted into a database table. Requires the 'DBI' package to be installed.

output_tbl

Optional table name for database output. If not provided and con is specified, the table name will be inferred as {source_table}_failures.

chunk_size

Number of rows to process at once for memory efficiency. Default is 1000.

Value

If no output path is specified, returns a tibble containing failure records with ID columns, test metadata, and failure details. If parquet_path or con is provided, returns NULL invisibly after writing the failures.

Examples

if (FALSE) { # \dontrun{
# Basic usage - return failures as tibble
operative <- create_operative(mtcars) |>
  col_vals_not_null(columns = vars(mpg)) |>
  col_vals_between(columns = vars(cyl), left = 4, right = 8)

failures <- debrief(operative, row_id_col = c("gear", "carb"))

# Save to parquet file (requires arrow package)
# install.packages("arrow")
debrief(operative, row_id_col = "gear", parquet_path = "failures.parquet")

# Save to database (requires DBI package)
# install.packages("DBI")
con <- DBI::dbConnect(duckdb::duckdb(), ":memory:")
debrief(operative, row_id_col = "gear", con = con, output_tbl = "car_failures")
} # }