Wikidata:Edit groups/Adding a tool
This page describes how to add a tool to EditGroups.
For tool developers
[edit]If you are the author of a tool that can be used to edit Wikidata programmatically, here are the steps to let EditGroups track your edits:
- Make sure your application attributes unique identifiers to your edit batches. This can be a randomly generated hash - it does not need to reflect anything from your own application. These identifiers should be included in the edit summaries of each edit.
- Notify Pintoch that you want your tool to be included in EditGroups, with the following information:
- the name of the tool;
- the URL of a page that describes the tool;
- a regular expression to capture the identifier from an edit summary;
- if the edits are performed via another account such as QuickStatementsBot, a regular expression to capture the actual author of the batch
- if the tool lets users write their own edit summaries, a regular expression to catch these
One way to do this without displaying uninformative strings to Wikidata editors is to add the identifier as a link to the EditGroups tool, like this: ([[:toolforge:editgroups/b/mytool/e892da3f|details]])
.
For custom bots
[edit]If you are writing a custom bot for a particular task and you want your edits to be tracked by editgroups, just use edit summaries like this, replacing the hash by a randomly generated hex hash (from 4 to 32 lowercase hex digits):
my very informative edit summary ([[:toolforge:editgroups/b/CB/89ead4fe|details]])
The "CB" identifier stands for "custom bot". The regular expression capturing the identifier relies on the link in the summary, which is required to be formatted exactly as above: the text in the link must be "details" and the URL must be formatted exactly as above (brackets around the link are optional though).
Code snippets to generate such a hex hash:
- JavaScript
Math.floor(Math.random() * Math.pow(2, 48)).toString(16)
- Node.js
crypto.randomBytes(6).toString("hex")
- Java
import java.util.Random;
,Long.toString((new Random()).nextLong(), 16).replace("-", "")
- Python
import random
,"{:x}".format(random.randrange(0, 2**48))
- C#
var rng = System.Security.CryptographyRandomNumberGenerator.Create(); var bytes = new byte[6]; rng.GetBytes(bytes); return System.BitConverter.ToString(bytes).Replace("-", "").ToLowerInvariant();
- Ruby
require 'securerandom'; SecureRandom.hex(16)