Fill gaps in the taxon table from the WoRMS REST API
Source: R/taxon_gapfill.R
obis_taxon_fill_gaps.RdSupplements the bulk WoRMS taxon.txt download with per-id lookups for every
AphiaID that occ_h3 carries but taxon lacks, then keeps going until the
tree is closed: each round also fetches any ancestor newly referenced by the
rows just inserted. Without that closure an orphan species stays disconnected
from its seed and remains unreachable by obis_taxon_children().
Usage
obis_taxon_fill_gaps(
con,
fetch = wm_aphia_records,
max_rounds = 40L,
min_records = 0L,
verbose = TRUE
)Arguments
- con
a
DBIconnection to a writable store withocc_h3+taxon.- fetch
function taking an integer vector of AphiaIDs and returning a data frame shaped like
wm_aphia_records()'s output; the seam that lets tests run without network.- max_rounds
runaway guard on closure rounds. Each round climbs exactly one generation, and a full WoRMS chain (every intermediate rank from species to Biota) runs ~15-20 deep, so this needs headroom well past the depth of the named ranks. If the guard is hit while ancestors are still missing the fill warns and reports
closed = FALSErather than leaving you to believe the tree is whole.- min_records
only chase orphans with at least this many records.
- verbose
message per-round progress.