AtlasOfLivingAustralia / galah-R

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

`OR` statement not working in `galah_filter()` #169

Closed daxkellie closed 1 year ago

daxkellie commented 1 year ago

galah_filter() does not return the second half of an OR statement in a query

library(galah)

galah_call() |>
  galah_filter(phylum == "Chordata") |>
  atlas_counts()
#> # A tibble: 1 × 1
#>      count
#>      <int>
#> 1 77396036

galah_call() |>
  galah_filter(kingdom == "Plantae") |>
  atlas_counts()
#> # A tibble: 1 × 1
#>      count
#>      <int>
#> 1 23384918

galah_call() |>
  galah_filter(phylum == "Chordata" | kingdom == "Plantae") |>
  atlas_counts()
#> # A tibble: 1 × 1
#>      count
#>      <int>
#> 1 77396036

galah_call() |>
  galah_filter(kingdom == "Plantae" | phylum == "Chordata") |>
  atlas_counts()
#> # A tibble: 1 × 1
#>      count
#>      <int>
#> 1 23384918

Created on 2022-11-03 with reprex v2.0.2

/cc @mjwestgate

mjwestgate commented 1 year ago

Looking in detail here, it appears that galah_filter is ignoring the second field name:

galah_filter(phylum == "Chordata" | kingdom == "Plantae")
# A tibble: 1 × 4
  variable logical value                                  query                                        
  <chr>    <chr>   <chr>                                  <chr>                                        
1 phylum   ==      "c(\\\"Chordata\\\", \\\"Plantae\\\")" "(phylum:\"Chordata\" OR phylum:\"Plantae\")"

I'll look at the parsing logic now

daxkellie commented 1 year ago

Fixed piping issue in new galah_filter parsing logic in commit a0b2a3c4da0fac2d56d95d06f66b483235f66a33 (#154, #169)