AtlasOfLivingAustralia / galah-R

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

No way to select `fields` outside of `atlas_occurrences()` #185

Open daxkellie opened 1 year ago

daxkellie commented 1 year ago

At the moment, the only way to add or subtract columns from a query is by using galah_select(), which only works with atlas_occurrences(). This means that to get additional information from other fields, you must download the records first.

Not all fields provide information only useful to each individual record. There are fields that provide taxonomic information, for example, for higher taxonomic clades. However, because atlas_occurrences() is the only function that lets you select additional columns, it's impossible to get this information for many higher taxonomic ranks (e.g., kingdom, phylum) because you cannot send a query for any level that will return too many records (greater than 50 million records).

Should there be a way to add additional columns to a query? And if so does this require a new atlas_ function that works with piping? Or should this functionality be added to search_taxa(), which already returns pretty much exactly the output that a user would want - one row per search result + additional taxonomic information? i.e.:

search_taxa(tibble(phylum = "ACANTHOCEPHALA"))
# A tibble: 1 × 10
  search_term    scientific_name scientific_name_authorship taxon_concept_id                             rank  match…¹ kingdom phylum verna…² issues
  <chr>          <chr>           <chr>                      <chr>                                        <chr> <chr>   <chr>   <chr>  <chr>   <chr> 
1 ACANTHOCEPHALA ACANTHOCEPHALA  Koelreuther, 1771          https://biodiversity.org.au/afd/taxa/3cbb53… phyl… exactM… Animal… Acant… Thorny… noIss…
# … with abbreviated variable names ¹​match_type, ²​vernacular_name