Returns a structured snapshot of every input that influences a habitat-classification run: config-bundle provenance with current checksums, software versions and git SHAs, optional database snapshot counts, plus AOI and timestamps. The stamp is the artifact that makes pipeline drift attributable — diff two stamps to localize "what changed" between two runs.
Usage
lnk_stamp(
cfg,
conn = NULL,
aoi = NULL,
db_snapshot = TRUE,
start_time = Sys.time()
)Arguments
- cfg
An
lnk_configobject fromlnk_config().- conn
Optional DBI::DBIConnection for local fwapg. When non-
NULLanddb_snapshot = TRUE, populates thedbslot with row counts frombcfishobs.observationsandwhse_basemapping.fwa_stream_networks_sp. WhenNULL,dbisNULL.- aoi
Optional character. Watershed group code or arbitrary AOI identifier. Recorded verbatim in
stamp$run$aoi.- db_snapshot
Logical. When
FALSE, skips DB row-count queries even ifconnis provided. DefaultTRUE.- start_time
A
base::Sys.time()value. DefaultSys.time()captured at the call. Override only when reconstructing a stamp from a known start.
Value
An lnk_stamp S3 list with these slots:
config_name—cfg$nameconfig_dir—cfg$dirprovenance— output oflnk_config_verify()called oncfgat stamp time (carries observed checksums + drift status)software— list of versions + git SHAs forlink,fresh, plusR.version.stringdb— list of DB snapshot counts, orNULLrun— list withaoi,start_time,end_time(initiallyNULL— set bylnk_stamp_finish())result— the result tibble orNULL(set bylnk_stamp_finish())
Details
Workflow:
stamp <- lnk_stamp(cfg, conn, aoi = "ADMS")
# ... run pipeline ...
stamp <- lnk_stamp_finish(stamp, result = comparison_tibble)
message(format(stamp, "markdown"))The markdown rendering is one of multiple output formats; covers the report-appendix scope of issue #24.
See also
Other stamp:
lnk_stamp_finish()
Examples
cfg <- lnk_config("bcfishpass")
stamp <- lnk_stamp(cfg, aoi = "ADMS")
stamp
#> <lnk_stamp> bcfishpass
#> aoi: ADMS
#> started: 2026-05-23 23:44:54 UTC
#> link: 0.40.4
#> fresh: 0.31.0
#> provenance: 12 files (0 byte, 0 shape drifted)
format(stamp, "markdown")
#> [1] "## Run stamp — bcfishpass\n\n- AOI: `ADMS`\n- Started: 2026-05-23 23:44:54 UTC\n\n### Software\n- link: 0.40.4 (sha NA)\n- fresh: 0.31.0 (sha NA)\n- R: R version 4.6.0 (2026-04-24)\n\n### Config provenance (12 files, 0 byte / 0 shape drifted)\n\n| file | byte drift | shape drift |\n|---|---|---|\n| `rules.yaml` | no | no |\n| `dimensions.csv` | no | no |\n| `parameters_fresh.csv` | no | no |\n| `overrides/user_habitat_classification.csv` | no | no |\n| `overrides/observation_exclusions.csv` | no | no |\n| `overrides/wsg_species_presence.csv` | no | no |\n| `overrides/user_modelled_crossing_fixes.csv` | no | no |\n| `overrides/user_pscis_barrier_status.csv` | no | no |\n| `overrides/pscis_modelledcrossings_streams_xref.csv` | no | no |\n| `overrides/user_barriers_definite.csv` | no | no |\n| `overrides/user_barriers_definite_control.csv` | no | no |\n| `overrides/user_crossings_misc.csv` | no | no |"
if (FALSE) { # \dontrun{
# Full workflow with DB and a result
conn <- lnk_db_conn()
stamp <- lnk_stamp(cfg, conn, aoi = "ADMS")
result <- compare_bcfishpass_wsg(wsg = "ADMS", config = cfg)
stamp <- lnk_stamp_finish(stamp, result = result)
writeLines(format(stamp, "markdown"), "stamp.md")
} # }
