Skip to content

Data flows how student contributions count to a classroom

Campbell Allen edited this page Dec 6, 2022 · 1 revision

How does classification data flow to the education api so we can count contributions?

The education api has a kinesis stream listener that forwards all classifications to the education api for a known set of projects, https://github.com/zooniverse/education-api/blob/e625741b13a91bd423d54edb8facb377903b5d88/kinesis-to-http/function.py#L14

Those classifications have special metadata values signalling they should contribute towards the education api counters like user_group_ids and selected_user_group_id https://github.com/zooniverse/education-api/blob/e625741b13a91bd423d54edb8facb377903b5d88/app/operations/kinesis/create.rb#L25

user_group_ids are added by the API on classification receipt https://github.com/zooniverse/panoptes/blob/84de373bf03296d75d62e4f80a6857439f82fce4/lib/classification_lifecycle.rb and selected_user_group_id is added by the PFE UI client via query params links via classrooms intro 2 astro to PFE url routing e.g. https://github.com/zooniverse/classroom/blob/f599725de391fdd1247208cd76b1272394585649/src/components/astro/AstroClassroomsTable.jsx#L116

These query params links signal to the www.zooniverse.org code which classroom (user group) the student is classifying under via a query param in the UI that in turn that is recorded in the classification metadata. e.g. https://github.com/zooniverse/Panoptes-Front-End/blob/54208982086c7a07ef81d81f6f516f6af61dec39/app/pages/project/classify.jsx **

Those user_group_ids and selected_user_group_id are then used in the counters in the education API - kicked off by a classification event via the kinesis stream data. These correlate to the classrooms that a student has joined so the counters know which classrooms the classifications should be attributed towards in the counters.

Here are the counters in the education api https://github.com/zooniverse/education-api/blob/e625741b13a91bd423d54edb8facb377903b5d88/app/operations/kinesis/count_classification.rb#L25-L47. Note how they change counting behaviour based on the presence of user_group_ids (count all classrooms) or selected_user_group_id (only count this classroom).

All this is event driven from the classification stream, at short intervals any classifications that match the listed education api's allowed project ids will be pushed into the education api for counting. It’s almost real time and no need for pulling / polling etc.

Once a classrooms classification is submitted there is a short delay till it’s received in the education api for contribution counting etc.

** Note we could even improve on this and include the assignment id as well! I’ve noted this setup in the following issue https://github.com/zooniverse/education-api/issues/338