Template:Dataset category selection/doc

From Wikidata
Jump to navigation Jump to search

This template is used on Wikidata:Dataset Imports, and uses conditional statements (i.e. the #ifeq parser function) to assign categories to a newly created page based on user input. User input is collected through FormWizard.

Usage[edit]

Full parameters
{{Data import header|float=left}}

{{Dataset category selection
|format_type =
|dataset_topic =
|update_type =
|progress_status = 
|timestamp =
|creator =
}}

The template is automatically generated through FormWizard whenever a user creates a new dataset summary on using Wikidata:Dataset Imports. Currently, it has four parameters to categorize a dataset summary based on:

  • the format the data appears in (format_type),
  • the primary topic of the dataset (dataset_topic),
  • how the dataset is updated (update_type), and
  • the state of importing the dataset into Wikidata (progress_status)

FormWizard also tacks on a date and time (timestamp) and the username (creator) automatically to the template.

User input is collected in the form of strings based on selections they make when creating a new dataset summary. The strings are defined in the configuration file. This template then evaluates whether the user selections match any of a number of strings. If there is a match, categories are assigned to the page. For instance, if someone selects "Art" for the dataset topic in FormWizard, the resulting page will be assigned a category based on the following conditional statement in this template:

{{#ifeq:{{{dataset_topic}}}|art|<includeonly>[[Category:Art datasets]]</includeonly>|}}

Basically, this code evaluates whether the string the user submitted for the parameter {{{dataset_topic}}} matches the string "art". If it matches, it assigns the appropriate category (Category:Art datasets). If it does not match, it does nothing. Once the page is created, this template can be updated manually (e.g. if categories need to be updated).

How to add additional categories[edit]

Additional categories can be assigned by this template. For example, if a category for datasets about trout were desired:

  1. Create a new category page. [[Category:Trout datasets]]
  2. Edit the configuration file under the appropriate dropdown prompt to include a new string ("trout") corresponding to the category under the "values" parameter:
    "values": ["...", "archives", "art", "trout"]
  3. Add a new conditional statement to this template with the following syntax:
    {{#ifeq:{{{dataset_topic}}}|trout|<includeonly>[[Category:Trout datasets]]</includeonly>|}}

See also[edit]