DRDataRaft/ docs
GitHub ↗

H15 Process a second delivery

H15Persistence and relationships1 step

Use your current course session. Preparation and course runner · R script ↓

H15 Process a second delivery

Goal: Distinguish old and new versions.

Prerequisites: H14.

Change one value and reuse the same product definition.

training_step(
  "H15",
  {
    second_policies <- policies
    second_policies$premium[1] <- 110
    rds_second <- dr_run(rds_product, data = second_policies)
    old_rows <- dr_collect(dr_run(reloaded_product, write = FALSE))
    latest_source <- dataraft.adapters::dr_source_rds(rds_path)
    latest_rows <- dr_collect(dr_run(
      dr_product("latest", latest_source),
      write = FALSE
    ))
    stopifnot(sum(old_rows$premium) == 740, sum(latest_rows$premium) == 750)
    print(c(old = sum(old_rows$premium), latest = sum(latest_rows$premium)))
  },
  needs = c("H14")
)

Expected result: The old total is 740; the current total is 750.

Task: Is a version the same thing as a business month?

Show solution

No. Multiple technical versions can correct the same business period.

Search documentation

Search functions, packages and guides.