Skip to content

Gbif translation

gbif_translation

gbif_translation(
    taxonomy: CleanedTaxonomy,
    translation_report: TranslationReport | None,
) -> TranslationReport | None

Get translations using GBIF API

Parameters:

Name Type Description Default
taxonomy CleanedTaxonomy

cleaned taxonomy from a cleaned taxon

required
translation_report TranslationReport | None

The translation report to update

required

Returns:

Type Description
TranslationReport | None

TranslationReport | None: The translation report for the specific taxon

get_gbif_key

get_gbif_key(taxonomy: CleanedTaxonomy) -> str | None

Get GBIF key for a given taxonomy

Parameters:

Name Type Description Default
taxonomy CleanedTaxonomy

Cleaned taxonomy from a cleaned taxon

required

Returns:

Type Description
str | None

str | None: The GBIF key for the specific taxon

translation_report_from_vernaculars

translation_report_from_vernaculars(
    vernaculars: list[dict],
    translation_report: TranslationReport | None,
) -> TranslationReport

Convert raw vernaculars to translation report

Parameters:

Name Type Description Default
vernaculars list[dict]

List of vernaculars

required
translation_report TranslationReport | None

The translation report to update

required

Returns:

Name Type Description
TranslationReport TranslationReport

The translation report for the specific taxon

is_valid_candidate

is_valid_candidate(
    r: dict,
    *,
    rank: TaxonRank,
    family: str,
    genus: str,
    species: str | None = None,
) -> bool

Check if a candidate from GBIF search is corresponding to the taxon.

Parameters:

Name Type Description Default
r dict

The candidate to check

required
rank TaxonRank

The rank of the taxon

required
family str

The family of the taxon

required
genus str

The genus of the taxon

required
species str | None

The species of the taxon

None

Returns:

Name Type Description
bool bool

True if the candidate is valid, False otherwise