inaturalist / iNaturalistAPI

Node.js API for iNaturalist.org
https://api.inaturalist.org/
102 stars 31 forks source link

Support observations_count param in /v2/projects/:id/members #464

Open albullington opened 4 days ago

albullington commented 4 days ago

It looks like observations_count is returning 0 for all members when making a request to fetch project members.

See example: https://api.inaturalist.org/v2/projects/62485/members?order_by=observations_count

(fwiw, observations_count and taxa_count also appear to return 0 for all users in v1 for the same project.)

In iNat Next, we're trying to show a "Project Members" page that shows the user photo and login details next to the number of observations they have in a given project.

pleary commented 3 days ago

For what it's worth, this was an intentional, albeit opaque and undocumented, decision for collection and umbrella projects because there is no value stored somewhere that represents observations by a project member the same way there is for traditional projects, that is easy to sort on. For example on the web there is a members page for projects - on the traditional projects member pages we show the obs count, e.g. https://www.inaturalist.org/projects/801/members, but on collection and umbrella project member pages we do no show the obs count, e.g. https://www.inaturalist.org/projects/city-nature-challenge-2020-san-francisco-bay-area/members.

It would be possible to generate these, but it would require extra queries. We'd essentially need to run a variant of the observers endpoint and the species count endpoint for the project, filtered by project members, then sort that result. It's doable, it just requires that extra bit of computing. So I just want to make sure this is what we want before I dig into this, as it would be a feature of iNatNext for collection and umbrella projects that isn't currently supported anywhere else and would need some additional development.