Skip to contents

Deduplicates (OwnerID, EventID, StationID) so the CSV carries one row per station folder (= one record). The JSON sidecar captures audit metadata: name, timestamp, total hits, hits per owner.

Usage

writeSelection(DT, name, path)

Arguments

DT

subset of the master data.table (output of buildMaster() after the user's filters).

name

identifier for the selection, used as filename stem.

path

Absolute path to the directory where <name>.csv and <name>.json will be written. Required – no default.

Value

Invisibly, the deduplicated selection data.table.

Details

The CSV is the canonical input contract for any downstream orchestrator that iterates over a selection: each row identifies one (OwnerID, EventID, StationID) station folder under whichever records root the orchestrator was given.

Examples

x <- data.table::data.table(
  OwnerID = c("AAA", "AAA"),
  EventID = c("E1", "E1"),
  StationID = c("S1", "S1"),
  DIR = c("H1", "H2")
)
path <- file.path(tempdir(), "gmsp-selection-example")
unlink(path, recursive = TRUE)
suppressMessages(writeSelection(x, name = "demo", path = path))
list.files(path)
#> [1] "demo.csv"  "demo.json"