H30 Publish a correction
Use your current course session. Preparation and course runner · R script ↓
H30 Publish a correction
Goal: Name the expected previous release.
Prerequisites: H29.
previous protects a correction against an unexpectedly changed starting release.
training_step(
"H30",
{
lake_correction_data <- lake_second_data
lake_correction_data$premium[1] <- 105
lake_corrected <- dr_publish(
lake_product,
data = lake_correction_data,
previous = lake_second,
business_date = "2026-08-31"
)
print(dataraft.lake::dr_compare(
lake_second,
lake_corrected,
key = "policy_id"
))
stopifnot(
sum(dr_collect(lake_first)$premium) == 740,
sum(dr_collect(lake_corrected)$premium) == 745
)
},
needs = c("H29"),
enabled = training_options$lake,
optional = TRUE
)Expected result: The correction totals 745; the first version remains 740.
Task: Does a correction overwrite a historical release?
Show solution
No. It creates another traceable version.