Extension:MobileFrontend/WikiGrok

WikiGrok is an experimental feature in the MobileFrontend Extension that prompts a user to confirm metadata information that will be eventually stored in Wikidata (https://www.wikidata.org).

Prototype user testing results
See Design/Research/Guerilla testing Wikigrok.

WikiGrok version A
WikiGrok version A is a simplified interface that only asks a single binary question (randomly selected from all claim possibilities for that item), for example, "Was Anne Dallas Dudley an insurance broker?" It offers three possible answers: 'Yes', 'No', and 'Not sure'. After the user answers the question, they are thanked for participating and can then dismiss the interface.

WikiGrok version B
Version B is a more complicated tagging interface. In this version the user is presented a random set of several possible metadata tags. The user is asked to select the correct tags and then submit them. After the user submits the tags, they are thanked for participating and can then dismiss the interface. The tags only have two possible states: selected and not selected. 'Not selected' is an ambiguous state, i.e. it can either mean that the user rejected the tag or that the user isn't sure the tags is correct.

Vocabulary
Wikidata:Glossary is required reading to understand the rest of this documentation. Especially the entries on item, property, claim, label, and values.

Claim recording
Right now (during prototype testing) claims are recorded on Tool Labs via the WikiGrok API. The API code itself is at https://github.com/kaldari/WikiGrokAPI (with some limited documentation). The table where the claim data is stored is s52293__wikigrok.claim_log. The client-side code that interacts with that API is in the WikiGrokApi class in MobileFrontend. During the A/B testing phase, we will be switching to use EventLogging for claim recording. (See Trello card). Once we have selected a model to productize (A or B), we will probably switch to using dedicated database tables.

Claim suggestions
Currently: WikiGrok relies on claim suggestions generated by scripts written by Magnus and stored in database tables on Tool Labs. Most of the scripts can be seen in Magnus's bitbucket repo. The tables are: These tables are directly accessible by maintainers of the wikidata_game project on Tool Labs, or can be accessed via the WikiGrok API on Tool Labs (https://github.com/kaldari/WikiGrokAPI).
 * s51999__merge_candidates.genderless_people (items that are people and don't have their gender set)
 * s51999__merge_candidates.people_no_date (items that are people and are missing birth/death dates; does not include suggestions)
 * s51999__merge_candidates.potential_disambig (items that may be disambiguation pages)
 * s51999__merge_candidates.potential_nationality (potential nationality for specific items)
 * s51999__merge_candidates.potential_new_pages (?)
 * s51999__merge_candidates.potential_occupation (potential occupations for specific items)
 * s51999__merge_candidates.potential_people (items that may be humans)

Coming soon: WikiGrok will do its own analysis of existing Wikipedia and Wikidata content related to an item to generate cached lists of claim suggestions for each item. How these claim suggestions are generated depends on the type of claim, but typically it will involve looking at links or template parameters in an article and seeing if they could be potential claims. Some of these may follow logic similar to Magnus's scripts and some may not.

Occupations
Item selection: Item is an instance of person and not an instance of disambiguation page

Claim selection: Find any links in the item's article that correspond to a Wikidata item that is an instance of a profession (Q28640) or subclass thereof. Note this does not include items that are instances of an occupation (Q13516667), which is a subclass of profession. This is because the occupation property and occupation item do not have the same definition currently.

Nationality
Item selection: Item is an instance of person, has a birth place, and was born after 1750.

Claim selection: Take the item’s birthplace (which is usually already set). Get the tree of the ‘is in’ or ‘country’ properties of the birthplace. Find any that are instances of a country.

Local testing
Since your local articles are not connected to actual Wikidata items (i.e. they don't have valid Wikidata item IDs), WikiGrok will not work locally unless you use a testing override. To force WikiGrok to load on any page, you can manually assign the page a Wikidata item ID via the query string. Just make sure the item ID corresponds to a Wikidata item that would normally trigger the WikiGrok interface (for example, an item that needs an occupation claim). Examples include:
 * Q3784220 - Anne Dallas Dudley (one potential occupation claim)
 * Q14042 - Willy Moon (multiple potential occupation claims)
 * Q16917029 - Magnus Burton (one potential nationality claim)

If your local wiki has an article called MegaMan, you should be able to load WikiGrok with the following URL: http://localhost/index.php/MegaMan?wikidataid=Q3784220 (or something similar depending on how your local wiki is configured).

Note: WikiGrok will only load if you are logged in, in Alpha or Beta mode, and your screen size is very small (both vertical and horizontal), but see (https://gerrit.wikimedia.org/r/#/c/166885/) Also make sure that $wgMFEnableWikiGrok = true; in MobileFrontend.php.

Note that the WikiGrok API will accept data from any host, so there is no need to create a local instance of it for testing (unless you are writing new claim recording code and need to make sure it works). The API records the host that the data is submitted from so we can filter out submissions from testers and developers.