
Match bcfishobs records to the FDIS site visits they came from
Source:R/bcfishobs_match.R
knw_bcfishobs_match.RdAbout half of the province's fish observation records carry
FDIS Database: fshclctn_id <n> in source: the collection id the FDIS
export keys on (issue #23). A record is matched to a visit when the visit's
collection (the first field of site_visit), species and date agree. One
collection holds several sites and dates, so a record can match several visits
of one collection on the same date: those are kept, one row per pair, and
flagged many. A record whose collection is in the export but whose species
and date match no visit is collection_only; one whose collection is not in
the export is unmatched; a record with no FDIS key is not_fdis.
Usage
knw_bcfishobs_match(conn, visits, species, species_codes = knw_species())Arguments
- conn
a
DBIconnection to a database holdingbcfishobs.observations.- visits
data.framewithsite_visitanddate(Date), one row per visit, and the per-visit species tablespeciesbelow.- species
data.framewithsite_visitandspecies_code, one row per visit and species caught (any code), as0230'scatch.rdshas them.- species_codes
characterthe bcfishobs species to read.
Value
A list: matched, a tibble with one row per bcfishobs record and
matched visit (observation_key, fish_observation_point_id,
species_code, observation_date, fshclctn_id, site_visit,
match); summary, counts per species and match class.