zooniverse / panoptes

Zooniverse API to support user defined volunteer research projects
Apache License 2.0
103 stars 41 forks source link

Why do we include classifications in the serialized user response? #471

Closed camallen closed 9 years ago

camallen commented 9 years ago

Firstly why do we include the classification sets of a user on their index route?

Also it seems Restpack is querying the includes even when not actually using them. This will be pretty slow for basic index routes on users (especially as classifications come in).

https://github.com/zooniverse/Panoptes/blob/671ba191fb30193de8104b442a009714990f7a61/app/serializers/user_serializer.rb#L4

Index route (no include params) result set: screen shot 2015-01-30 at 22 37 01

Test Log DB queries: screen shot 2015-01-30 at 22 36 24

edpaget commented 9 years ago

In order to include include the top_level link to the classifications in restpack you have to include them as a whole. We should override this behaviour or replace restpack.

camallen commented 9 years ago

What's the use case for having the top level classification links on the serialised user response?

edpaget commented 9 years ago

Because the responses need to have thr url link to all their related models. That's how clients figure out how to navigate the api. Overriding restpack to just have the url link and not the list of ids is pretty easy. I think I do it in another one of the serializers. On Jan 30, 2015 5:30 PM, "Campbell Allen" notifications@github.com wrote:

What's the use case for having the top level classification links on the serialised user response?

— Reply to this email directly or view it on GitHub https://github.com/zooniverse/Panoptes/issues/471#issuecomment-72289048.

camallen commented 9 years ago

Right so it's just ensuring a valid hypermedia API. I'll look into why RP is querying the associations even when not serialising them via the optional include param.