User:MusikBot/CategoryCounter

CategoryCounter

Populates the size of categories into a dataset for use in on-wiki charts.

How to add a new category

  1. Create the chart template using {{category chart}}. See {{articles lacking sources chart}} as an example.
  2. Create the /data subpage with the content [] (an empty array), for example at Template:Articles lacking sources chart/data.
  3. Ask an admin or template editor to change the content type of the /data page to JSON, for instance at Special:ChangeContentModel/Template:Articles lacking sources chart/data.
  4. Ask an admin to configure the category on the bot's configuration page. See below for documentation.
  5. Add any historical data to the dataset page as desired.
  6. The bot should start adding data to the /data page within the amount of time configured (i.e. within a week if you chose "weekly" granularity).


 
 N Disabled

To enable, set /Run to true (link)

Errors are logged at /Error log

Configuration

Functionality can be tweaked at /config. Configuration data is in the form of JSON.

IMPORTANT:

  • Do not modify the config files unless you have a basic understanding of JSON
  • Read the documentation first.
  • Do not change the key values.
  • Keys should always be strings, e.g. use "option": true instead of option: true.
  • Strings should be wrapped in double-quotes, e.g. "option" instead of 'option'.
  • Boolean values must be either true or false with no quotations around it.
  • Numerical values must be integers with no quotations around it.
  • The last key/value pair within a hash or the value value in an array must not have a comma at the end of it
  • Essentially if the JSON editor interface says there are any syntax errors or warnings, you have done something wrong
Available parameters
Parameter Description
category Which category to track, with or without the Category: namespace prefix.
granularity Either "daily", "weekly" or "monthly". If you choose daily granularity, you may wish to also use the cutoff option to ensure the dataset page doesn't become too big over time.
dataset Where to store the data. This is usually a subpage of the chart template.
cutoff Represents the number of days after which the bot should remove entries from the chart. This is to prevent datasets from becoming too large, or if you just wanted your dataset to only include the latest 30 days, for example.

Example

edit

{{articles lacking sources chart}} is an example chart: