diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000..f40fbd8 --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1,5 @@ +_site +.sass-cache +.jekyll-cache +.jekyll-metadata +vendor diff --git a/docs/404.html b/docs/404.html new file mode 100644 index 0000000..086a5c9 --- /dev/null +++ b/docs/404.html @@ -0,0 +1,25 @@ +--- +permalink: /404.html +layout: default +--- + + + +
+

404

+ +

Page not found :(

+

The requested page could not be found.

+
diff --git a/docs/Gemfile b/docs/Gemfile new file mode 100644 index 0000000..7c9beb1 --- /dev/null +++ b/docs/Gemfile @@ -0,0 +1,34 @@ +source "https://rubygems.org" +# Hello! This is where you manage which Jekyll version is used to run. +# When you want to use a different version, change it below, save the +# file and run `bundle install`. Run Jekyll with `bundle exec`, like so: +# +# bundle exec jekyll serve +# +# This will help ensure the proper Jekyll version is running. +# Happy Jekylling! +gem "jekyll", "~> 4.3.2" +# This is the default theme for new Jekyll sites. You may change this to anything you like. +gem "minima", "~> 2.5" +# If you want to use GitHub Pages, remove the "gem "jekyll"" above and +# uncomment the line below. To upgrade, run `bundle update github-pages`. +gem "github-pages", "~> 228", group: :jekyll_plugins + +# If you have any plugins, put them here! +group :jekyll_plugins do + gem "jekyll-feed", "~> 0.12" +end + +# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem +# and associated library. +platforms :mingw, :x64_mingw, :mswin, :jruby do + gem "tzinfo", ">= 1", "< 3" + gem "tzinfo-data" +end + +# Performance-booster for watching directories on Windows +gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin] + +# Lock `http_parser.rb` gem to `v0.6.x` on JRuby builds since newer versions of the gem +# do not have a Java counterpart. +gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby] diff --git a/docs/_config.yml b/docs/_config.yml new file mode 100644 index 0000000..ef7ba7c --- /dev/null +++ b/docs/_config.yml @@ -0,0 +1,55 @@ +# Welcome to Jekyll! +# +# This config file is meant for settings that affect your whole blog, values +# which you are expected to set up once and rarely edit after that. If you find +# yourself editing this file very often, consider using Jekyll's data files +# feature for the data you need to update frequently. +# +# For technical reasons, this file is *NOT* reloaded automatically when you use +# 'bundle exec jekyll serve'. If you change this file, please restart the server process. +# +# If you need help with YAML syntax, here are some quick references for you: +# https://learn-the-web.algonquindesign.ca/topics/markdown-yaml-cheat-sheet/#yaml +# https://learnxinyminutes.com/docs/yaml/ +# +# Site settings +# These are used to personalize your new site. If you look in the HTML files, +# you will see them accessed via {{ site.title }}, {{ site.email }}, and so on. +# You can create any custom variable you would like, and they will be accessible +# in the templates via {{ site.myvariable }}. + +title: Your awesome title +email: your-email@example.com +description: >- # this means to ignore newlines until "baseurl:" + Write an awesome description for your new site here. You can edit this + line in _config.yml. It will appear in your document head meta (for + Google search results) and in your feed.xml site description. +baseurl: "" # the subpath of your site, e.g. /blog +url: "" # the base hostname & protocol for your site, e.g. http://example.com +twitter_username: jekyllrb +github_username: jekyll + +# Build settings +theme: minima +plugins: + - jekyll-feed + +# Exclude from processing. +# The following items will not be processed, by default. +# Any item listed under the `exclude:` key here will be automatically added to +# the internal "default list". +# +# Excluded items can be processed by explicitly listing the directories or +# their entries' file path in the `include:` list. +# +# exclude: +# - .sass-cache/ +# - .jekyll-cache/ +# - gemfiles/ +# - Gemfile +# - Gemfile.lock +# - node_modules/ +# - vendor/bundle/ +# - vendor/cache/ +# - vendor/gems/ +# - vendor/ruby/ diff --git a/docs/index.markdown b/docs/index.markdown new file mode 100644 index 0000000..f6960b2 --- /dev/null +++ b/docs/index.markdown @@ -0,0 +1,366 @@ +--- +# Feel free to add content and custom Front Matter to this file. +# To modify the layout, see https://jekyllrb.com/docs/themes/#overriding-theme-defaults + +layout: home +--- + + +# How to Use Our Stats Service API + +Our stats service API allows our volunteers, project owners and project contributors to view their efforts and contributions to project/s. + +Our Stats API uses HTTP GET requests with JSON arguments and JSON responses. You can view here ([https://github.com/zooniverse/eras/wiki/API-Callout-Examples](https://github.com/zooniverse/eras/wiki/API-Callout-Examples)) for full documentation and more callout examples. + +In this page, we provide common examples project owners or user group admins might use in order to query specific volunteer classification/comment counts. + + +### Differences Between eras.zooniverse.org vs Defunct stats.zooniverse.org + +If you are familiar with our older stats service ([https://github.com/zooniverse/zoo-event-stats](https://github.com/zooniverse/zoo-event-stats); [https://stats.zooniverse.org/](https://stats.zooniverse.org/)), there are some key differences between the new service [https://eras.zooniverse.org](https://eras.zooniverse.org) and the old service [https://stats.zooniverse.org/](https://stats.zooniverse.org/). + + + +* Differences in the Requests + * URL changes + * No need to include `/counts` in URL for eras.zooniverse.org + * Period is now a parameter (`?period`) vs a fixed part of URL + * Period is not a required parameter in eras.zooniverse.org + * Eras.zooniverse.org uses pluralized version of `classifications` and `comments` + * Eg. [https://eras.zooniverse.org/classifications?period=week](https://eras.zooniverse.org/classifications?period=week) vs [https://stats.zooniverse.org/counts/classification/week](https://eras.zooniverse.org/classification/week) + * Valid `period`s are now only: + * Day + * Week + * Month + * Year + * Some requests in eras.zooniverse.org will require an Authorization Header +* Differences in Responses + * Responses of [https://eras.zooniverse.org](https://eras.zooniverse.org) will only return the total counts unless you specify a `period` you want to bucket your data by. + * Response keys are different + * [https://eras.zooniverse.org](https://eras.zooniverse.org) Response Example: + * [https://stats.zooniverse.org](https://stats.zooniverse.org) Response Example: + + + + +## Querying Classification Counts (Unauthenticated) + +We allow querying classification counts without Authentication (i.e. No Authorization Header within your request) if you are querying by the following: + + + +* project_id/s + * can search by multiple project_ids when entering a `,` separated string of ids + * eg. `?project_id=1,2,3,4` +* workflow_id/s + * can search by multiple workflow_ids when entering a `,` separated string of ids + * eg. `?workflow_id=1,2,3,4` +* Start_date + * Date Format must be in `YYYY-MM-DD` +* End_date + * Date Format must be in `YYYY-MM-DD` +* Period + * If this is a parameter, the response will include a `data` key which shows the breakdown of classification counts bucketed by your entered period. + * Allowable buckets are either: + * `day` + * `week` + * `month` + * `year` + +**One caveat is that we do not allow you to query by BOTH project_id AND workflow_id (either one or the other). ** + + +### Example: Querying Classification Counts in total for Zooniverse + +If one was curious on how many total classifications we currently have on the Zooniverse, you could query the following: + +This will return the total count of classifications of the entire Zooniverse. + +Response will look like: + + +### Example: Querying Classifications for a Specific Project + +If interested in querying classification count for a specific project, we can do the following: + +Response will look like: + + +### Example: Querying Classifications for a Specific Project With Count Breakdown + +If interested in querying for classification count for a specific project (for eg. project with id `1234`) and also interested in the monthly counts that make up the total count of the response, we can query the following: + +Here, we utilize the `?period` parameter to bucket by month. Allowable `period`s are `day`, `week`, `month`, `year`. + +Response will look like: + + +### Example: Querying Classification Counts for a Specific Project With Count Breakdown Within A Certain Date Range + +If interested in querying for classification count for a specific project (for eg. project with id `1234`) between the days of September 18, 2023 and September 22, 2023, and also interested in the daily counts that make up the total count of the response, we can query the following: + +**It is important to note that when entering a date range (a `start_date` or an `end_date` or both), dates entered MUST be in the format YYYY-MM-DD ** + +Response: + +**The API uses UTC and are strings in the ISO 8601 “combined date and time representation” format (https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations) :** + +**`2015-05-15T15:50:38Z` + + +### Example: Querying Classification Counts of Multiple Projects With Count Breakdowns Within A Certain Date Range + +If interested in querying the classification counts of multiple projects (for eg. if one was the owner of projects with ID `1234` and `4321`) and were interested in total classification for both projects altogether between the days of May 05, 2015 and June 05, 2015, and also interested in the daily counts that make up the total count of the response, we can query the following: + +**Note that the two project ids are separated by a `,`. ** + +**We expect the response to give the TOTAL classification count of both projects** + + + +* **i.e. classification counts of project with id 1234 + classification counts of project with id 4321** + +Response: + + +## Querying Comment Counts + +We also allow querying comment counts without Authentication (i.e. No Authorization Header within your request). + +With comment counts you can also filter your count query by the following parameters: + + + +* project_id/s + * can search by multiple project_ids when entering a `,` separated string of ids + * eg. `?project_id=1,2,3,4` +* user_id/s + * can search by multiple user_ids when entering a `,` separated string of ids + * eg. `?user_id=1,2,3,4` +* Start_date + * Date Format must be in `YYYY-MM-DD` +* End_date + * Date Format must be in `YYYY-MM-DD` +* Period + * If this is a parameter, the response will include a `data` key which shows the breakdown of comment counts bucketed by your entered period. + * Allowable buckets are either: + * `day` + * `week` + * `month` + * `year` + + +### Example: Querying Comment Counts + +If one was curious on how many total comments we currently have on the Zooniverse, you could query with the following: + +Response will look something like this: + + +### Example: Querying Comment Counts By Project With Count Breakdown + +Similar to querying classification counts, our stats API allows querying comment counts by project. The following example shows how one would query for comment counts for a specific project (eg. project with id `1234`) broken down by month. + +Similar to `/classifications` endpoint, valid `period` buckets are either by `day`, `week`, `month`, `year`. + +Response: + + +## Querying Classification Counts By User (Authenticated) + +Our stats API allows querying for a volunteer’s personal classification stats as long as the person querying has proper authorizations._ In other words, querying classification counts by user requires an authentication token to be supplied. _ + +This authentication token is known as a bearer token and is usually supplied as a HTTP `Authorization` header with the value prefixed by `Bearer` and then the token data. + +For example: + +These tokens are generated by our main backend Panoptes. For more information on retrieving a Bearer token from Panoptes, please refer to our Panoptes documentation, specifically [https://zooniverse.github.io/panoptes/#example-using-postman](https://zooniverse.github.io/panoptes/#example-using-postman). + + +### Example: Retrieving Bearer Token From Panoptes + +The easiest way to get started is to use client credentials OAuth flow. + +You will need to create an OAuth application within our system via : [https://signin.zooniverse.org/oauth/applications/new](https://signin.zooniverse.org/oauth/applications/new) + +**Note that it is imperative that you do NOT share the OAuth application secret **as it can gain access to your Zooniverse account as if you were using the system. + +Once you have your OAuth application set up, you can do the following: + + +--- + +When calling out to Stats API’s `/classifications/users/?` route, you will not have access to another person’s classification stats through this route; you will only have access to view your own classification counts. More information can be found in our full documentation: [https://github.com/zooniverse/eras/wiki/API-Callout-Examples#classificationsusersid](https://github.com/zooniverse/eras/wiki/API-Callout-Examples#classificationsusersid) + +You can query personal classification counts filtering by any of the following: + + + +* project_id/s + * can search by multiple project_ids when entering a `,` separated string of ids + * eg. `?project_id=1,2,3,4` +* workflow_id/s + * can search by multiple workflow_ids when entering a `,` separated string of ids + * eg. `?workflow_id=1,2,3,4` +* Start_date + * Date Format must be in `YYYY-MM-DD` +* End_date + * Date Format must be in `YYYY-MM-DD` +* Period + * If this is a parameter, the response will include a `data` key which shows the breakdown of classification counts bucketed by your entered period. + * Allowable buckets are either: + * `day` + * `week` + * `month` + * `year` +* Time_spent (true/false) + * Boolean that dictates whether your response will calculate the approximate time spent **in seconds** on your classifications. + * Note that this calculation does not include any time you have spent on Talk +* Project_contributions (true/false) + * Boolean that dictates whether your response will display all your project contributions broken down. + * This list is ordered by top contributing projects, by classification count + * This list does not include any time and efforts you may have spent on Talk + +**CAVEATS** + + + +* **We do not allow you to query by BOTH project_id AND workflow_id (either one or the other)** +* **We do not allow you to query by both `project_id`/`workflow_id` AND `?project_contributions=true`. ** + +For the following examples, we use the user_id `1234` + + +### Example: Query Personal Classification Counts + +If you were interested in your own personal classification counts of all time. You will need your user_id and run the following: + +Response: + + +### Example: Query Personal Classification Counts and Approximate Time Spent + +If you were interested in both your own personal classification counts of all time and approximate time spent on those classifications, you would query the following: + +Response will look something like this: + +**Noting that `time_spent` calculation is time in _seconds_** + + +### Example: Query Personal Classification Counts, Time Spent, and Breakdown of Classification Counts + +If interested in querying for your own personal classification counts of all time, approximate time spent on those classifications, also interested in the yearly counts that make up the total count of the response, we can query the following: + +Response: + + +### Example: Query Personal Classification Counts, Time Spent, And All Project Contributions + +If interested in querying for your own personal classification counts of all time, approximate time spent on those classifications, and also interested in your project contributions in terms of classification count, we can query the following: + +Response will look something like this: + +Note that the list of `project_contributions` is in order by `count`; which is your classification count per project. + + +### Example: Query Personal Classification Counts For A Specific Project/s + +If interested in querying for your own personal classification counts during a date range for a specific project, along approximate time spent on those classifications, we can query the following: + + + +In this example, we use the user with id `1234`’s project classification counts for project with id `1972` in between the date range of `2022-03-10` (March 10, 2022) through `2023-03-10` (March 10, 2023) + +Response: + + +## Querying Classification Counts By User Group + + +### What Are User Groups? + +As a new feature of our stats service, we introduce the idea of user groups so that a group of volunteers can set shared goals and celebrate milestones. Whether it’s a classroom, after school club, a group of friends, or corporate volunteering program, this new group feature provides new avenues for fostering community and collaboration for our volunteers and contributors. + +For more documentation on user groups within our stats service, you can view our documentation: here (https://github.com/zooniverse/eras/wiki/API-Callout-Examples#classificationsuser_groupsid) + +Our stats API allows querying for a user group’s classification stats as long as the person querying has proper authorizations to access the group statistics. _In other words, querying classification counts by user group requires an authentication token to be supplied. _ + +This authentication token is known as a bearer token and is usually supplied as a HTTP `Authorization` header with the value prefixed by `Bearer` and then the token data. + + +--- + +You can query user group classification counts filtering by any of the following: + + + +* project_id/s + * can search by multiple project_ids when entering a `,` separated string of ids + * eg. `?project_id=1,2,3,4` +* workflow_id/s + * can search by multiple workflow_ids when entering a `,` separated string of ids + * eg. `?workflow_id=1,2,3,4` +* Start_date + * Date Format must be in `YYYY-MM-DD` +* End_date + * Date Format must be in `YYYY-MM-DD` +* Period + * If this is a parameter, the response will include a `data` key which shows the breakdown of classification counts bucketed by your entered period. + * Allowable buckets are either: + * `day` + * `week` + * `month` + * `year` +* top_contributors (integer) + * Limit that dictates whether your response will show top contributors of the user group +* individual_stats_breakdown (true/false) + * Boolean that dictates whether your response will shows show a roster stats report per each individual member for the user group + + +### Example: Query User Group Classification Counts + +If you were interested in the user group with user_group id=1234’s classification counts of all time. You will need your user_group_id and run the following: + +Response: + +The response for querying user group classification counts will look a bit different than the other queries from the previous examples. By default, querying user group classification counts will return the following: + + + +* Total_count + * Integer + * The total count of classifications of queried user group +* Time_spent + * Float + * Total session time IN SECONDS of total classifications of user group +* Active_users + * Integer + * Total active users of the user group + * Active users being users who have made a classification given request parameters +* Project_contributions + * List + * List of all project contributions (project_id and count) of user group given request parameters + * NOTE: if `project_id` or `workflow_id` is a parameter in your request, the response will NOT include this list +* data + * Only returned when `period` is a request parameter + * This shows the total breakdown of classifications of the user group bucketed by `period` that make up the response’s `total_count` + + +### Example: Query User Group’s Group Member Stats Breakdown + +If you were interested in the user group with user_group id=1234’s group member stats breakdown of all time, we can utilize the `?individual_stats_breakdown=true` parameter and request the following: + +Response: + +Note that in this particular response, it returns a list of each group member’s project contributions, session time and classification count, ordered by top total classification count of members in the group. + + +## Examples in Other Languages + + +### Python + + +### Javascript + +The following example is an authenticated callout to `/users` where `user_id=1234`