V07 Use a pointblank agent
Use your current course session. Preparation and course runner · R script ↓
Optional deep dive. Enable only the options named in each block, after preparing its packages or services.
V07a Switch the quality engine
Goal: Run the same formula with pointblank.
Prerequisites: H06; pointblank; extras.
dr_set_engine selects the implementation of a rule, not the storage backend.
training_step(
"V07a",
{
pointblank_rule <- dr_quality_rule("nonnegative", ~ premium >= 0) |>
dr_set_engine("pointblank")
pointblank_product <- dr_product(
"policies.pointblank",
bad_policies,
contract = policy_contract
) |>
dr_add_quality(pointblank_rule)
pointblank_run <- dr_run(
pointblank_product,
write = FALSE,
stop_on_failure = FALSE
)
print(dr_quality_report(pointblank_run))
},
needs = c("H06"),
packages = c("pointblank"),
enabled = training_options$extras,
optional = TRUE
)Expected result: The negative premium is still detected.
Task: Has the lake switched to pointblank?
Show solution
No. Quality and storage are independent components.
V07 Use a pointblank agent
Goal: Reuse existing pointblank checks.
Prerequisites: V07a.
An agent builder is supplied through a rule adapter. The action remains explicitly blocking.
training_step(
"V07",
{
agent_rule <- dr_pointblank_checks(
"premium_agent",
function(data) {
pointblank::create_agent(data) |>
pointblank::col_vals_gte(columns = "premium", value = 0)
},
action = "block",
threshold = 0
)
agent_product <- dr_product(
"policies.agent",
bad_policies,
contract = policy_contract
) |>
dr_add_quality(agent_rule)
agent_run <- dr_run(agent_product, write = FALSE, stop_on_failure = FALSE)
print(dr_quality_report(agent_run))
agent_contract <- dr_contract(
"agent.report",
c(policy_id = "integer", premium = "numeric", cancelled = "logical"),
rules = list(agent_rule)
)
agent_quality <- dr_validate(
bad_policies,
agent_contract,
keep_agents = TRUE
)
dr_pointblank_report(
agent_quality,
"premium_agent",
file.path(training_root, "pointblank.html"),
overwrite = TRUE
)
},
needs = c("V07a"),
enabled = training_options$extras,
optional = TRUE
)Expected result: A pointblank report about the invalid premium.
Task: Must all native rules be replaced?
Show solution
No. The optional integration complements native quality checks.