-
Notifications
You must be signed in to change notification settings - Fork 16
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
Update to API v4 #57
Update to API v4 #57
Conversation
Hi, Thanks again for all your work on this! I manually tested some of the functions and all the tests passed on my computer (note that I deleted I was wondering if it would be possible to implement a function to query species' assesments using their identifiers (i.e., a function for the I'm happy to prepare a PR if that would be useful?
|
Thanks for playing around with the new version of the package @jeffreyhanson, I really appreciate it! Not sure how I missed the |
Thanks for the quick response! Yeah, I just tested it and the new I think that provides all the functionality I'd need, but there might be some opportunities to add some quality of features if you wanted to? For example, I think most people will only want/need the latest asssesment for a particular species. So if you wanted to help make the package easier to work with, you could have (i) a function that accepts a species name and genus, finds the latest assesment for it, and then returns the assesment info, and (ii) a function that accepts a species id, find the latest assesment for it, and then returns the assesment info? Just an idea. I know I'll need to implement a function like this in my own work, so it'd be handy if there was a function in the package did this for me? I suppose it would be nice if there were some wrapper functions that could provide backwards compatibility with the current (or soon to be previous version) of the package? However, my impression is that would be a lot of work, so probably not worth it? Especially since many of the functions in the current version have a |
Thanks @jeffreyhanson, that's all super helpful! I've put together some quick wrappers to return the full version of the latest assessment for a given SIS ID or species name ( |
Sorry for my slow response. I just tried out the new functions for getting the latest assesments for a given species, and they work perfectly. Thanks so much for implementing them! Also, great work supporting those scopes well! I'm not sure if this is unnecessary, but is it worth adding some logic to handle situations where none of the assesments are listed as latest? This is because it seems that the "latest" information might contain mistakes, since it seems that multiple assesments may be listed as latest (based on your recent commit)? For example, instead of this:
You could do something like this:
Also, I noticed that the "year_published" column has years stored in a character format. I'm not super knowledgeable about character encoding, but is it possible that sorting the table based on this column without converting it to a numeric might result in an unexpected ordering? Also, if users are using older versions of R (where
Hope that helps? But maybe I'm just being overly paranoid about issues that might never occur? |
Thanks @jeffreyhanson, I've implemented both of those great suggestions! |
Hi @willgearty, Thank you for updating the rredlist package to the latest IUCN API. I tried playing around with the new functionality, but it seems the function I am hoping to use (rl_synonyms) is no longer available? I downloaded the latest version of the package from GitHub and used the new API token I got with the following function call: However, I get the following error message: Had the usage of this function been intentionally removed? Cheers, |
Thanks for reaching out @ThomasLuypaert, and thanks for giving the new version of the package a go! This function is indeed no longer included in the function. You should be able to get the same synonym information using However, this brings up a good point, that I could use the |
Thanks for getting back to me on this so quickly! Thanks for providing me with a workaround - and yes, the error with the workaround solution would be very helpful :). I just tried the workaround and it works great. |
Just thought I'd chime in, in case it's helpful, I think throwing deprecation warnings/errors for the old functions might be worthwhile. I suspect that rredlist has a fairly large user base, and so putting warnings/errors in the package that explain the deprecated functions could help with reducing the number of issues being posted on GitHub or email queries you get about the package. |
And...done! Thanks to both of you for the feedback! |
This is a work-in-progress PR to update the package to the new version (v4) of the Red List API.
Note that this new version of the API is a HUGE rework and the entire API is now designed around assessments rather than the last version which was mostly designed around species. I think this should still be fine for most people because you can still get all of the species for a given habitat, for example, but you'll just get multiple assessments/species which you'll then need to clean up (alternatively, there could be a
latest
argument for any assessment summary function which only returns the latest assessments and I believe should return only one assessment/species).I've implemented about half-or-so of the endpoints so far and anticipate implementing the rest within the week.UPDATE: All endpoints are now implemented.Here's the full TO-DO:
Fixes #43, Fixes #48, Fixes #52, Fixes #55, Fixes #58