The gate for every ingest phase. These are properties the database is checked
against on its own terms - key uniqueness, EIN wellformedness, referential
integrity, provenance completeness, and agreement between the stored derived
columns and a live npnormalize::np_normalize() call.
Arguments
- x
A
data.frame/data.tableto check.- key
Column(s) forming the primary key. Checked for uniqueness and completeness.
- ein
Name of the EIN column, or
NULLto skip the EIN checks.- parent
Optional vector of valid EINs (typically
entity$ein) for a referential-integrity check.- enums
Named list of allowed values, e.g.
list(variant_class = c("legal", "dba")).- required
Columns that must be present and wholly non-missing. Provenance columns belong here.
- sample
Rows to draw for the derived-column agreement check.
0skips it.- v
Output of
md_validate().- stop_on_fail
Error rather than return when any check fails. Phase gates use
TRUE; interactive inspection usesFALSE.
Details
It is deliberately not a comparison against a previously built artifact. matchdb is built from the freshest available sources, so "matches the file we had before" is not a property worth having: it would pin the database to an older vintage and to a build nobody can reproduce. Attribution against the existing pfmatch reference belongs at cutover, where it is a question about two references rather than a constraint on this one.