palaeoverse / rphylopic

Get Silhouettes of Organisms from PhyloPic
https://rphylopic.palaeoverse.org
GNU General Public License v3.0
91 stars 9 forks source link

get_uuid still doesn't replicate phylopic.org search #66

Closed willgearty closed 8 months ago

willgearty commented 1 year ago

The goal for get_uuid is to make it behave just like the search bar on phylopic.org. However, it appears that we are still missing something, because some search terms give errors with get_uuid whereas they give reasonable results on phylopic.org. It looks like this might be related to phylopic's use of external databases, which maybe we could emulate using some of the phylopic API endpoints? Or maybe we should reach out to Mike and see if the search endpoint could better emulate the frontend search functionality?

Here's an example that works on phylopic.org but not with get_uuid: Myotis lucifugus

keesey commented 1 year ago

PhyloPic makes parallel calls to a number of external databases (EoL, GBIF, OTOL, PBDB) -- it's fairly complex and asynchronous. The details are in here: https://github.com/keesey/phylopic/tree/main/packages/ui/src/search

This is done client-side rather than server-side to keep PhyloPic's operating costs down.

keesey commented 1 year ago

I forgot, I did document the general approach here: https://www.phylopic.org/articles/api-recipes#searching-name

keesey commented 1 year ago

Note that there's some kind of bug on that page right now where it's inserting build=NaN into the queries. I need to fix that for the "play" buttons to work. But the documentation should still be useful.

willgearty commented 1 year ago

I believe there are R packages that interface with all of those databases, although it might just be easier for us to query their APIs ourselves instead of depending on those extra packages.

keesey commented 1 year ago

Either way you'll still have to use the "Resolve Node" examples in the link above to translate results into the closest PhyloPic nodes.

willgearty commented 9 months ago

Plan:

resolve_phylopic(name, api = "paleobiodb.org", hierarchy = FALSE, n = 1)

Some notes:

willgearty commented 8 months ago

I've started this on the resolve_phylopic branch