Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dataResourceName's with ampersands ("&") in their string cause a parsing error #203

Closed
cjwaite23 opened this issue Jul 14, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@cjwaite23
Copy link
Contributor

Describe the bug
Parsing error when using atlas_counts() or atlas_occurrences() with piping from galah_filter() or galah_group_by() for the dataResourceName field when resources involve ampersands.

galah version 1.5.3 (but also present in 1.5.1-1.5.2)

To Reproduce
We note that there are a handful of values in the dataResourceName field that include ampersands (&). These can be found by

> search_fields("dataResourceName") |> show_values() |> filter(str_detect(category, "&"))
! Search returned 2 matched fields.
• Showing values for 'dataResourceName'.
# A tibble: 5 × 2
  field            category                                       
  <chr>            <chr>                                          
1 dataResourceName Port Adelaide Enfield Flora & Fauna Monitoring 
2 dataResourceName NSW South Coast & ACT plants                   
3 dataResourceName Manning & Great Lakes - NSW Waterwatch         
4 dataResourceName Pinao'ula: Dragonflies & damselflies of Hawai'i
5 dataResourceName Wetlands & Wildlife Creations Group

When trying to filter or group_by these records, a parsing error occurs which does not present itself for any other data records.

> galah_call() |>
+     galah_filter(dataResourceName == "SA Fauna") |>
+     atlas_counts()
# A tibble: 1 × 1
    count
    <int>
1 1727992
> galah_call() |>
+     galah_filter(dataResourceName == "NSW South Coast & ACT plants") |>
+     atlas_counts()
Error in parse(text = x, keep.source = FALSE) : 
  <text>:1:1: unexpected INCOMPLETE_STRING
1: "NSW South Coast
    ^
> galah_call() |>
+     galah_filter(dataResourceName == "Pinao'ula: Dragonflies & damselflies of Hawai'i") |>
+     atlas_counts()
Error in parse(text = x, keep.source = FALSE) : 
  <text>:1:1: unexpected INCOMPLETE_STRING
1: "Pinao'ula: Dragonflies
    ^

This behaviour also presents itself when using galah_group_by():

> galah_call() |>
+     galah_filter(genus == "Platycercus", year == 2023) |>
+     galah_group_by(scientificName, dataResourceName) |>
+     atlas_counts()
Error in parse(text = x, keep.source = FALSE) : 
  <text>:1:1: unexpected INCOMPLETE_STRING
1: 'Port Adelaide Enfield Flora
    ^

Expected behaviour
We would expect the functions to behave as shown above when filtering for dataResourceName == "SA Fauna"

We suspect this may be due to how the queries are being translated.

@cjwaite23 cjwaite23 added the bug Something isn't working label Jul 14, 2023
@daxkellie
Copy link
Contributor

Thanks for flagging this issue. Just tested these queries in the dev version for galah 2.0 and they run correctly, so this issue should be fixed in the next release 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants