td_validate: Check a taxadb table against the taxadb Darwin Core rules

View source: R/td_validate.R

td_validateR Documentation

Check a taxadb table against the taxadb Darwin Core rules

Description

Check a taxadb table against the taxadb Darwin Core rules

Usage

td_validate(
  provider = getOption("taxadb_default_provider", "itis"),
  schema = c("dwc", "common"),
  version = latest_version(),
  db = td_connect()
)

Arguments

provider

from which provider should the hierarchy be returned? Default is 'itis', which can also be configured using ⁠options(default_taxadb_provider=...")⁠. See ⁠[td_create]⁠ for a list of recognized providers.

schema

One of "dwc" (for Darwin Core data) or "common" (for the Common names table.)

version

Which version of the taxadb provider database should we use? defaults to latest. See available_versions() for details.

db

a connection to the taxadb database. See details.

Details

The rules checked are:

  • columns – the required Darwin Core terms are present, spelled in Darwin Core camelCase.

  • types – identifier and name columns are character. A column that is entirely NA will often be typed as integer or logical by mistake, which this catches.

  • scientificName – never NA. Every row names something, at every rank: Animalia is a scientificName just as ⁠Homo sapiens⁠ is.

  • taxonRank, taxonomicStatus – never NA.

  • acceptedNameUsageID – never NA, on synonyms and on accepted names. This is where taxadb is stricter than Darwin Core.

  • accepted_has_id – a row labelled accepted is its own accepted name: taxonID is present and equals acceptedNameUsageID. (taxonID may be NA on a synonym, where the provider mints no identifier for it – OTT and NCBI, for instance, do not.)

  • accepted_resolves – every acceptedNameUsageID matches the taxonID of a self-referencing row. No dangling references.

  • synonym_not_self – a row labelled a synonym points somewhere else, never at itself.

  • taxonID_one_name – a taxonID always names the same scientificName. An identifier may appear on more than one row: ITIS records 255 synonyms that are ambiguous between two accepted taxa, and a row for each is the honest representation. What must not happen is one identifier naming two different names, which is what results from a provider numbering its accepted names and its synonyms in separate sequences and both being given the same prefix.

  • accepted_unique – no duplicate taxonID among accepted names.

  • id_prefix – identifiers are the provider's identifier prefixed by the provider abbreviation in capitals, e.g. ITIS:180092.

taxonomicStatus is deliberately not checked against a controlled vocabulary: providers draw real distinctions (⁠homotypic synonym⁠, ⁠provisionally accepted⁠, doubtful, misapplied) that are worth preserving. The rules are therefore phrased structurally. A name the provider does not redirect to another name is its own accepted name whatever confidence it expresses about it, so doubtful and ⁠provisionally accepted⁠ rows self-reference exactly as accepted ones do; only the two terms whose meaning taxadb actually relies on, accepted and synonym, are given a required shape.

Value

a data.frame with one row per rule, giving whether the table passes, how many rows violations were found, and a note.

Examples


td_validate("itis_test")


taxadb documentation built on Aug. 31, 2026, 5:07 p.m.