AtlasOfLivingAustralia / galah-R

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

`atlas_media` returns error when filtering by license with `galah_filter` #151

Closed daxkellie closed 1 year ago

daxkellie commented 2 years ago

atlas_media returns a confusing error when trying to filter by license type

media <- galah_call() |>
  galah_identify("perameles") |>
  galah_filter(license == "CC-BY 4.0 (Int)") |>
  atlas_media(download_dir = tempdir())
#> Downloading records with media...
#> This query will return 606 records
#>   |                                                                              |                                                                      |   0%  |                                                                              |======================================================================| 100%
#> Warning: Unknown or uninitialised column: `name`.
#> Error: attempt to select less than one element in get1index

Created on 2022-07-14 by the reprex package (v2.0.1)

However, filtering by other fields work correctly

media <- galah_call() |>
  galah_identify("eolophus") |>
  galah_filter(multimedia == "Sound") |>
  atlas_media(download_dir = tempdir())
#> Downloading records with media...
#> This query will return 41 records
#>   |                                                                              |                                                                      |   0%  |                                                                              |======================================================================| 100%
#> 
#> Downloading 53 media files...
#>   |                                                                              |                                                                      |   0%  |                                                                              |======================================================================| 100%
#> 
#> 
#> 53 files were downloaded to [temp directory path]

Created on 2022-07-14 by the reprex package (v2.0.1)

daxkellie commented 2 years ago

In addition, atlas_media uses the multimediaLicense field rather than the license field in the summary output tibble. This means that people who use atlas_counts to get record count by license will get different results to what is returned by altas_media.

It would be good to make sure the names of the column name and the field name are consistent.

mjwestgate commented 1 year ago

galah_filter no longer tries to filter media columns