AtlasOfLivingAustralia / galah-R

Query living atlases from R
https://galah.ala.org.au
39 stars 3 forks source link

`search_taxa` with multiple ranks does not return best-fit taxonomic result #115

Closed daxkellie closed 2 years ago

daxkellie commented 2 years ago

search_taxa is expected to use additional ranks to find the best-fit result to a taxonomic search query. However, when multiple ranks are entered, separated queries are returned:

# Current results
search_taxa(list(genus = "Acacia", kingdom = "Plantae"))
#>   search_term scientific_name scientific_name_authorship
#> 1      Acacia          Acacia                      Mill.
#> 2     Plantae         Plantae                    Haeckel
#>                                     taxon_concept_id    rank match_type kingdom
#> 1 https://id.biodiversity.org.au/taxon/apni/51311124   genus exactMatch Plantae
#> 2 https://id.biodiversity.org.au/taxon/apni/51337710 kingdom exactMatch Plantae
#>       phylum         class   order   family  genus  issues
#> 1 Charophyta Equisetopsida Fabales Fabaceae Acacia noIssue
#> 2       <NA>          <NA>    <NA>     <NA>   <NA> noIssue

Created on 2021-12-17 by the reprex package (v2.0.1)

A more useful output would be 1 row with a best-fit result

daxkellie commented 2 years ago

This now works but with a data.frame or tibble rather than with list:

search_taxa(data.frame(genus = "Acacia", kingdom = "Plantae"))
#> # A tibble: 1 x 13
#>   search_term scientific_name scientific_name~ taxon_concept_id rank  match_type
#>   <chr>       <chr>           <chr>            <chr>            <chr> <chr>     
#> 1 Acacia_Pla~ Acacia          Mill.            https://id.biod~ genus exactMatch
#> # ... with 7 more variables: kingdom <chr>, phylum <chr>, class <chr>,
#> #   order <chr>, family <chr>, genus <chr>, issues <chr>

Created on 2022-01-11 by the reprex package (v2.0.1)