Wikipedia:Bots/Requests for approval/WegweiserBot
- The following discussion is an archived debate. Please do not modify it. To request review of this BRFA, please start a new section at Wikipedia:Bots/Noticeboard. The result of the discussion was Approved.
Operator: JPxG (talk · contribs · SUL · edit count · logs · page moves · block log · rights log · ANI search)
Time filed: 01:22, Sunday, January 8, 2023 (UTC)
Automatic, Supervised, or Manual: automatic
Programming language(s): Python
Source code available: https://github.com/jp-x-g/wegweiser
Function overview: This bot's purpose is to carry out some basic tasks for the Signpost, of which I am the editor-in-chief and publication manager. Right now, I am engaged in updating the historical indices at Module:Signpost: this includes things like adding articles that were previously not indexed, and adding tags for untagged articles. I'm doing this by using my Wegweiser scripts to compose data and manually pasting the output into the module's index pages, which is extremely tedious (i.e. I have to navigate to the 2005 index to paste in output for tagging the arbitration reports, then the 2006, then the 2007, then the 2008, etc up to 2015, then navigate back to the 2005 index to paste in output for tagging the discussion reports, etc, etc). Currently, my edits to the modules look like this. I also intend to update the indices with pageview counts for intervals like "30 days after publication", etc, which can be used to tabulate information that Template:Graph:Pageviews cannot handle (it can only generate graphs, it can't output single numbers!).
Another issue is that, currently, the indices are built using User:Mr. Stradivarius's SignpostTagger script: this means that every time we publish a new issue, the articles don't show up in the index until someone individually goes to each of them and runs the SignpostTagger userscript. This is extremely sub-optimal (single-issue comment pages, for example, won't render properly until each article is in the index) and error-prone (some inevitably get missed when individually clicking on 24 articles, opening the tagger for each of them, running it and checking for completion).
Links to relevant discussions (where appropriate): Module_talk:Signpost#Adding_authorship
Edit period(s): Manually, whenever large maintenance tasks are carried out, and at time of publication, to update indices.
Estimated number of pages affected: Unknown (there are only 19 module indices, but some work may need to be done on Signpost articles as well)
Exclusion compliant (Yes/No): Yes
Already has a bot flag (Yes/No): No
Function details: As described above: one function of the bot would be to integrate information into the Module:Signpost indices from the obsolete Signpost article category system (e.g. Category:Wikipedia Signpost Special report archives 2005, Category:Wikipedia Signpost Special report archives 2006, Category:Wikipedia Signpost Special report archives 2007, Category:Wikipedia Signpost Special report archives 2008, Category:Wikipedia Signpost Special report archives 2009, Category:Wikipedia Signpost Special report archives 2010, Category:Wikipedia Signpost Special report archives 2011, Category:Wikipedia Signpost Special report archives 2012, Category:Wikipedia Signpost Special report archives 2013, Category:Wikipedia Signpost Special report archives 2014, Category:Wikipedia Signpost Special report archives 2015, Category:Wikipedia Signpost Technology reports archives, Category:Wikipedia Signpost Technology reports archives 2005, Category:Wikipedia Signpost Technology reports archives 2006, Category:Wikipedia Signpost Technology reports archives 2007, Category:Wikipedia Signpost Technology reports archives 2008, Category:Wikipedia Signpost Technology reports archives 2009, Category:Wikipedia Signpost Technology reports archives 2010, Category:Wikipedia Signpost Technology reports archives 2011, Category:Wikipedia Signpost Technology reports archives 2012, Category:Wikipedia Signpost Technology reports archives 2013, Category:Wikipedia Signpost Technology reports archives 2014, Category:Wikipedia Signpost Technology reports archives 2015, ad nauseam).
The way it does this is by hitting the API to retrieve the categories' contents, formatting it into an array, then hitting the API to retrieve the contents of the Lua tables, and formatting that into JSON. Next, it compares the category contents to the Lua table's contents, checks to see if the Lua module has the appropriate tag for that category (e.g. Category:Wikipedia Signpost Arbitration report archives 2005 would be "arbitrationreport"), and if not, adds them. Then it converts this JSON back to the proper format for a Lua table, and submits this to the server as an edit.
For pageview tracking, it does the same as the above, except instead of getting page names from categories, it gets them from the action=query&list=allpages
API endpoint, and instead of adding tags, it adds "views" key-value pairs to the dict.
For fleshing out indices, it does much the same, with respect to the Lua tables; the difference is that, rather than comparing those entries' tags to membership in a category, it compares them to a list of all pages from that year obtained through the action=query&list=allpages
API endpoint (and adds new entries to the Lua table if they are not already present).
I have tested this set of scripts at the following diff: [1] (this output is valid and works fine with the module).
Discussion
[edit]- Trusted user. Approved for trial. Please provide a link to the relevant contributions and/or diffs when the trial is complete. Trial length is whatever you feel is appropriate. Enterprisey (talk!) 04:34, 8 January 2023 (UTC)[reply]
- @Enterprisey: Despite WegweiserBot's valiant effort, he remains unable to edit the module pages due to not being autoconfirmed. Can he get AC (or bot) flags? jp×g 05:13, 8 January 2023 (UTC)[reply]
- This appears to have been sorted. Primefac (talk) 07:24, 8 January 2023 (UTC)[reply]
- @Enterprisey: Despite WegweiserBot's valiant effort, he remains unable to edit the module pages due to not being autoconfirmed. Can he get AC (or bot) flags? jp×g 05:13, 8 January 2023 (UTC)[reply]
- Trial complete. @Enterprisey and Primefac: Homeboy has been running happily without issue. See: 1, 2, 3, 4, 5 (there are a lot more if you want but these are a little sample. Here are the diffs from when it cleaned out the cats. I think he is ready for his trial by ordeal, or thesis defense, or whatever. jp×g 05:06, 1 September 2023 (UTC)[reply]
- Approved.. Neat. Haven't checked all the code & edits but the scope of edits is quite limited (backroom Signpost pages and some Signpost articles) so that'll be fine. Thanks for working on this. Enterprisey (talk!) 16:42, 3 September 2023 (UTC)[reply]
- Trial complete. @Enterprisey and Primefac: Homeboy has been running happily without issue. See: 1, 2, 3, 4, 5 (there are a lot more if you want but these are a little sample. Here are the diffs from when it cleaned out the cats. I think he is ready for his trial by ordeal, or thesis defense, or whatever. jp×g 05:06, 1 September 2023 (UTC)[reply]
- The above discussion is preserved as an archive of the debate. Please do not modify it. To request review of this BRFA, please start a new section at Wikipedia:Bots/Noticeboard.