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

galah_select for other atlases #181

Open
fontikar opened this issue Feb 17, 2023 · 2 comments
Open

galah_select for other atlases #181

fontikar opened this issue Feb 17, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@fontikar
Copy link

Hey folks, I’ve been loving my tinkering with GBIF with {galah}, its soooo good that you don’t have to learn different syntax just to get data out from a non-ALA altas.
This is a super minor suggestion and happy to help with this if you need.

I created the following query and had assumed that group = options would be transferrable to different atlases, but then get the error:

galah_config(email = Sys.getenv("ALA_EMAIL"),
             username = Sys.getenv("GBIF_USER"),
             password = Sys.getenv("GBIF_PWD"),
             atlas = "Global")

african_ele_projfields <- galah_call() %>% 
  galah_identify("Loxodonta africana") %>% 
  galah_select(group = "basic", project_fields) %>% 
  atlas_occurrences()

Error in `all_of()`:
! Can't subset columns that don't exist.
✖ Columns `taxonConceptID`, `recordID`, and `dataResourceName` don't exist.
Run `rlang::last_error()` to see where the error occurred.

It makes sense that not all fields are consistent across atlases. Perhaps this needs to be reflected in the galah_select help file/error message and other documentation, or in the future, we can create the same group = options for other atlases but this might be tricky really fast!

@fontikar fontikar added the bug Something isn't working label Feb 17, 2023
@mjwestgate
Copy link
Collaborator

OK this is an interesting one. Basically, when galah_select() is called with a group argument, it is passed to preset_cols (here), which behaves differently depending on which group is chosen:

  • group = "basic": passed to default_columns() (here), which does vary depending on atlas
  • group = "assertions" passes to show_all_assertions()$id, which calls an API. So that changes depending on atlas as well
  • group = "media" and group = "event" are hard-coded, probably because we didn't get to them yet

So an obvious action is to update galah_select() to give better results for different atlases when group is either media or event. This might require some care, as not every atlas appears to have an image service.

More important for this specific query is how to use galah_select() for GBIF. My reading of the GBIF API docs is that selecting columns isn't possible from GBIF, in which case we need to:

  • add a warning when this function is called, and
  • prevent it erroring

mjwestgate added a commit that referenced this issue Mar 10, 2023
…n atlas = GBIF (#181)

Both `galah_select` and `select` now can be piped for GBIF without breaking, but do not modify the `galah_call()` object. They also give a message. Tests added for this behaviour
@mjwestgate
Copy link
Collaborator

As of version 2.1.0, group = basic and media both work for all available atlases; events does not yet

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