NeotomaDB / Neotoma-API

A Placeholder for the Neotoma API
3 stars 1 forks source link

Add down-taxonomy searching #1

Open scottsfarley93 opened 7 years ago

scottsfarley93 commented 7 years ago

I think it would be really helpful if we could aggregate API responses to higher level taxa. For example, if I search for picea records, I would get everything identified to the genus picea, but also everything everything that was identified to a more specific level (picea abies, Picea abies subsp. abies, Picea cf. P. glauca, etc).

I see this being helpful for both visualization and modeling. Obviously, it could result in some very large responses, like if someone searched for all of Plantae, and I'm not sure how we would deal with that. Ideally it could just be a flag in the query string on all the endpoints that include a taxonname/taxonid field to turn on or off the aggregation.

SimonGoring commented 7 years ago

This is implemented for the occurrences method:

http://apidev.neotomadb.org/v1/data/occurrences?taxonname=Microtus

-vs-

http://apidev.neotomadb.org/v1/data/occurrences?taxonname=Microtus&nametype=base

This is not implemented in the datasets methods, but we've added it to the feature list.

Note that this does not assign cf or type taxa if this is appended at the level equivalent to the call itself, only at levels below.

SimonGoring commented 7 years ago

Also not there's no Microtus all on its own in the DB.

scottsfarley93 commented 7 years ago

Yeah this looks exactly like what I was thinking of!

scottsfarley93 commented 7 years ago

Searching for too large of a group makes it die in an application error. Can we add a rule along the lines of "if you're search for a taxon with more than X children then success of API call = false"?

SimonGoring commented 7 years ago

Thanks @scottsfarley93 , more generally we're discussing issues of how we return very large responses (as noted elsewhere). It might be worth having a two-part system:

  1. A summary query - how many sites/occurrences exist, how many taxa are pulled
  2. The full query

This doesn't really answer what happens if people want to make a very big call though.

SimonGoring commented 7 years ago

Tagging @spatialit so he's in the loop as well.

spatialit commented 7 years ago

Are there resources other than the datasets resource this should be added to?

SimonGoring commented 7 years ago

Right now datasets and occurrences are the only resources that provide searching by taxon, as far as I know. If you're talking about the summary API service, then we should start a new issue.