AtlasOfLivingAustralia / galah-R

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

Unable to view values for some fields using `show_values()` #246

Closed daxkellie closed 3 days ago

daxkellie commented 3 months ago

When searching through metadata, show_values() allows users to see what categories are inside a given field. However, an error occurs when trying to use show_values() on some specific fields. For example, 2023 LGAs hit an error when trying to see values.

library(galah)

search_all(fields, "Local Government Areas")
#> # A tibble: 4 × 3
#>   id       description                                      type  
#>   <chr>    <chr>                                            <chr> 
#> 1 cl10923  PSMA Local Government Areas (2018)               fields
#> 2 cl110923 PSMA Local Government Areas - Abbreviated (2018) fields
#> 3 cl11170  Local Government Areas 2023                      fields
#> 4 cl959    Local Government Areas                           fields

# Doesn't work
search_all(fields, "cl11170") |>
  show_values()
#> • Showing values for 'cl11170'.
#> Warning: There was 1 warning in `mutate()`.
#> ℹ In argument: `field_value = stringr::str_extract(result$i18nCode,
#>   "(?<=\\.).*")`.
#> Caused by warning:
#> ! Unknown or uninitialised column: `i18nCode`.
#> # A tibble: 0 × 1
#> # ℹ 1 variable: cl11170 <chr>

Other LGA fields work correctly

# Works
search_all(fields, "cl10923") |>
  show_values()
#> • Showing values for 'cl10923'.
#> # A tibble: 560 × 1
#>    cl10923                     
#>    <chr>                       
#>  1 BRISBANE CITY               
#>  2 GREATER GEELONG CITY        
#>  3 EAST GIPPSLAND SHIRE        
#>  4 MORETON BAY REGIONAL        
#>  5 PASTORAL UNINCORPORATED AREA
#>  6 COOK SHIRE                  
#>  7 CAIRNS REGIONAL             
#>  8 TOWNSVILLE CITY             
#>  9 SUNSHINE COAST REGIONAL     
#> 10 CENTRAL COAST COUNCIL       
#> # ℹ 550 more rows

Created on 2024-08-20 with reprex v2.0.2

It's unclear whether this is an issue with the field or galah's ability to read and parse values within that field.

mjwestgate commented 1 week ago

This specific example works correctly in version 2.1.0, though it's unclear whether that's because of changes we made to galah, or something server-side. Will leave this open in case other similar examples emerge.

daxkellie commented 3 days ago

This was an issue with the specific LGA2023 layer, which was fixed server-side