dr_quality_rule()
Define a quality rule
Usage
dr_quality_rule(
name = NULL,
check = NULL,
description = "",
engine = c("native", "pointblank"),
action = NULL,
threshold = NULL,
dimension = NULL,
volatile = FALSE
)
dr_quality_counts(n_failed, n_total)
dr_pointblank_checks(
name,
build,
policy = c("rule", "agent"),
action = NULL,
threshold = NULL,
volatile = FALSE
)Arguments
- name
- Rule name, or a one-sided formula as a shortcut. When omitted, formula rules use their expression as a label. Explicit names stay unchanged.
- check
- Function taking a table and returning a logical vector or
dr_quality_counts(), or a one-sided row predicate such as
~ amount >= 0. A scalar function result is one aggregate test; a longer vector must have one value per row. Formula results are evaluated per row, including scalar predicates repeated for each row. Missing logical values count as failures. Lazy formulas run on the backend; arbitrary functions remain responsible for their own collection. - description
- Rule description.
- engine
- Formula evaluation engine:
"native"(default) or optional"pointblank". Both require logical row predicates and count missing values as failures. Pointblank interrogates a real agent against the normalized predicate, retaining its reports and check evidence. Ordinary functions use the native engine; usedr_pointblank_checks()for custom agents. - action
- Optional publication policy: block, warn or quarantine. Quarantine removes every failing row before writing and retains it locally on the result. It supports native row formulas only. Standalone validation still blocks rejected rows until an execution path actually removes them.
- threshold
- Permitted fraction of failed test units, from zero to one. For quarantine, every rejected row is removed regardless of threshold.
- dimension
- Optional ODCS quality dimension.
- volatile
- Explicitly allow time-dependent or random checks. Such checks are labelled volatile, cannot authorize attestations and cannot use release caching.
- n_failed, n_total
- Failed and total test units.
- build
- Function creating a pointblank agent from a lazy table.
- policy
"rule"preserves the explicitaction/thresholdgate."agent"uses pointblank's per-step action levels: warnings permit publication, stop/error and critical states block. Native pointblank threshold rounding applies. An unconfigured, inactive or errored agent step always blocks. Old notify-only levels do not authorize publication.
Value
A rule specification or counts object.
Examples
rule <- dr_quality_rule("positive", function(data) {
counts <- dplyr::summarise(data, failed = sum(amount <= 0), total = dplyr::n())
if (inherits(counts, "tbl_sql")) counts <- dplyr::collect(counts)
dr_quality_counts(counts$failed, counts$total)
})
rule$nameDocumentation source snapshot · View source at d9cb454 ↗
Code examples are documented source examples; they are not executed in this website build.
Code examples are documented source examples; they are not executed in this website build.