Skip to contents

Saves a (case_number, field, verified_value) tuple to an overrides CSV, canonical_overrides.csv, in the user data directory (tools::R_user_dir("morie", "data"), sub-directory siu), so it outlives the R session. Every later morie_fetch_siu() overlays these corrections onto the regex-parsed output. The shipped inst/extdata/siu_canonical_overrides.csv.gz carries maintainer-confirmed corrections; this function lets users add their own without touching the package source.

Usage

morie_siu_record_correction(
  case_number,
  field,
  verified_value,
  note = "",
  cache_dir = .siu_corrections_dir()
)

Arguments

case_number

SIU case number, e.g. "17-OVI-201".

field

Name of the column in the SIU schema (e.g. "location_of_call").

verified_value

The correct value, verified against the cached HTML (see morie_siu_audit_case()).

note

Optional one-line note describing the basis for the correction (HTML excerpt, LLM verdict, etc.).

cache_dir

Directory for the overrides CSV (default: the user data directory, which persists between sessions).

Value

Invisibly, the path to the updated overrides CSV.

Details

This is the "memory" of the parser: every wrong cell you find and fix becomes permanent for that cache_dir. Maintainers can submit corrections upstream by sharing the resulting CSV file.

Examples

# \donttest{
# Writes the correction to a temp cache so the example never
# touches the per-user cache directory.
tmp <- tempfile("morie_siu_"); dir.create(tmp, recursive = TRUE)
morie_siu_record_correction(
  case_number = "17-OVI-201",
  field = "location_of_call",
  verified_value = "Clair Road East, City of Guelph",
  note = "HTML excerpt: 'on Clair Road East in the City of Guelph'",
  cache_dir = tmp
)
unlink(tmp, recursive = TRUE)
# }