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

Adds bcdc_list_organizations() & bcdc_list_organization_records() (#322) #323

Merged
merged 12 commits into from
Mar 16, 2023

Conversation

stephhazlitt
Copy link
Member

@stephhazlitt stephhazlitt commented Mar 14, 2023

  • adds bcdc_list_organizations()
  • adds bcdc_list_organization_records()
  • adds unit tests for the above new fxns
  • updates NEWS.md

Closes #322.

@stephhazlitt stephhazlitt requested review from boshek and ateucher March 14, 2023 16:14
@ateucher
Copy link
Collaborator

This looks awesome, thanks! The one thing we're not doing here (and in bcdc_list_group_records() is checking for a valid group. If you do bcdc_list_organization_records("foo") it just returns 404.

I played around with checking via:

if (!organization %in% bcdc_list_organizations()) {
  stop("'", organization, "' is not a valid organization", call. = FALSE)
}

but it's sloooowwww, especially with groups. I'm not sure it's worth it. Thoughts?

@stephhazlitt
Copy link
Member Author

I am not surprised it is slooooow, given how slow all of the bcdc_list_* functions are in general. Is there a technique to catch the 404 and add a more informative error?

Copy link
Collaborator

@boshek boshek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. I regret not thinking of this at the time but the bcdc_list_* naming convention for something that returns a data.frame is a bit confusing. But we are sorted of locked now which is probably fine.

@ateucher
Copy link
Collaborator

Is there a technique to catch the 404 and add a more informative error?

We could, but the error message that comes back basically just says the url is not found, so we'd be throwing all 404s into one message (i.e., if it 404'd because the catalogue was down people would still get an error telling them that their organization/group doesn't exist)

@stephhazlitt
Copy link
Member Author

the bcdc_list_* naming convention for something that returns a data.frame is a bit confusing

I agree. However, I also think that a user mental model where they are primarily thinking about the class of the object returned is probably less frequent than where they are thinking about what content is in the object returned. 🤷‍♀️

@stephhazlitt
Copy link
Member Author

We could add a note to the documentation for those fxns "if you supply an invalid group | organization you will get a 404"? I have often thought of adding a general sentence somewhere re: 404s when the catalogue is down, given the frequency we see that in Issues.

@ateucher
Copy link
Collaborator

the bcdc_list_* naming convention for something that returns a data.frame is a bit confusing

I see list as a verb here rather than a noun, so it doesn't bother me that much 😄

Copy link
Collaborator

@ateucher ateucher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much! One small suggestion then go ahead and merge when you're happy :)

R/bcdc_search.R Outdated Show resolved Hide resolved
@ateucher
Copy link
Collaborator

Also sf installation is broken right now - don't worry about that failure on Linux

Co-authored-by: Andy Teucher <andy.teucher@gmail.com>
@stephhazlitt stephhazlitt merged commit 033a54e into main Mar 16, 2023
@stephhazlitt stephhazlitt deleted the issue-322 branch March 16, 2023 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add bcdc_list_organizations() & bcdc_list_organization_records()
3 participants