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

including sourcing info in taxon responses #59

Open
kueda opened this issue Feb 15, 2017 · 0 comments
Open

including sourcing info in taxon responses #59

kueda opened this issue Feb 15, 2017 · 0 comments

Comments

@kueda
Copy link
Member

kueda commented Feb 15, 2017

E.g. responses to /v1/taxa/12345 should include

  • user who added it
  • user who last updated it
  • datetime it was added
  • datetime it was updated
  • name of the provider / source
  • link to provider / source

so we can display this on the taxon page. Note that provider stuff are present as columns in the taxa table, while Sources are in another table.

Patrick recommends stuffing these things in the ES index since it doesn't change much and configure ES not to index those attributes, just return them.

Some more notes from Patrick:

what I've tended to do for some user stuff is add a simple representation of the user to the index (just ID and login, usually for search), then use methods like ESModel.fetchBelongsTo to fetch full users from the ES index using the IDs at query time (edited)

it's all a little hacky right now, but generally I try to lookup models once. For example in https://github.com/inaturalist/iNaturalistAPI/blob/master/lib/models/observation.js#L82 it's loading users for many different instances so it all happens in a single query. We're making those User calls anyway for most requests (not sure about taxon show though)

@kueda kueda self-assigned this Feb 15, 2017
@kueda kueda added the ready label Jul 17, 2020
@kueda kueda removed their assignment Jul 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant