Wikipedia:Bots/Requests for approval/Pi bot 4


 * The following discussion is an archived debate. Please do not modify it. To request review of this BRFA, please start a new section at WT:BRFA. The result of the discussion was

Pi bot 4
Operator:

Time filed: 20:21, Tuesday, January 1, 2019 (UTC)

Function overview: Fix or remove commons category links that are missing, or are to category redirects or disambiguation categories

Automatic, Supervised, or Manual: Automatic

Programming language(s): python (pywikibot)

Source code available: on bitbucket

Links to relevant discussions (where appropriate): Template_talk:Commons_category (and threads below that)

Edit period(s): Daily

Estimated number of pages affected: Of order 10,000 to start with, maybe around 10 per day afterwards

Namespace(s): Articles and categories

Exclusion compliant (Yes/No): No

Function details: The bot looks through the contents of the maintenance categories at Category:Commons category link is locally defined and Category:Commons category link is defined as the pagename (which track differences between local commons sitelinks and those on wikidata) to find cases where the locally defined category links are to non-existent categories (then either removing the commons category completely, e.g., or removing the local definition to use the commons sitelink from Wikidata, e.g. ), or are to category redirects or disambiguation categories (then removing the local link if the redirect/disambig page points to the commons sitelinked category).

Discussion
BAG assistance needed
 * This is a spin-off from the work I've been doing with commons category sitelinks on Wikidata, and is somewhat connected to the RfC about switching to use Wikidata for commons links - in particular the changes I've been making at Commons category and Commons category-inline and the new tracking categories at Category:Commons category Wikidata tracking categories. This proposal only tackles differences between enwp and Wikidata links, and mirrors some of the maintenance tasks that my bot is already doing to commons sitelinks on Wikidata. A future RfC (and bot request) will tackle the case where enwp and Wikidata have matching links (since there was not consensus either way at the RfC). Thanks. Mike Peel (talk) 20:21, 1 January 2019 (UTC)
 * Just to make sure I understand, this is:
 * removing the template entirely if the target Commons category is non-existent and no Commons category is available through Wikidata
 * removing the local parameter but leaving the template if the target Commons category is non-existent and a Commons category is available through Wikidata
 * What exactly happens for redirects and disambiguation pages? ~ Rob 13 Talk 17:20, 14 January 2019 (UTC)
 * Thanks for the comment! Your understanding of (1) and (2) is correct. (2) would also apply for redirects and disambiguation pages. Thanks. Mike Peel (talk) 17:31, 14 January 2019 (UTC)
 * Isn't it more desirable to replace the local parameter with the redirect target for redirects and leave it for human review for the disambiguation page? ~ Rob 13 Talk 17:59, 14 January 2019 (UTC)
 * We currently have a mix of links with local parameters and those without (see tracking at Category:Commons category Wikidata tracking categories), I'm hoping that can be standardised at some point soon but that needs an RfC first. It's easier to simply remove them for now (and that also means that they'll automatically update if needed in the future, rather than the bot having to do so here), but I can modify the code to write the local link if needed. It's easy to disable the code that handles disambiguation pages if you'd prefer, that can be revisited later if needed. Thanks. Mike Peel (talk) 18:23, 14 January 2019 (UTC)
 * The basic problem is that we don't want to preempt the RfC by removing local parameters that are currently useful. I personally agree with standardizing this one way or the other, but that's a decision for the community. If one is sent to a redirect category on Commons, they can click through to the actual category, so I would regard that as useful. Same with disambiguation categories, since they could feasibly be replaced with the appropriate category that they should be disambiguated to. Removing non-existent categories, on the other hand, is a simple maintenance task that is certainly useful. Let's turn off the disambiguation for now, at least until there's a consensus to do something else with them somewhere. For the redirects, that can either be turned off or the categories can be replaced with the redirect's target category. Once those edits to the code are done, let me know and I'll approve for trial. ~ Rob 13 Talk 18:28, 14 January 2019 (UTC)
 * I've modified the code to disable the disambiguation code, and to substitute the new commons link into the wikitext - see the latest version on bitbucket. Please let me know if you want any other changes/tweaks making before trial. Thanks. Mike Peel (talk) 18:54, 14 January 2019 (UTC)


 * ~ Rob 13 Talk 19:27, 14 January 2019 (UTC)
 * Trial done, results at . I tried to mix the types of edits it was making, but probably should have done fewer in category space and more in main space. It worked as expected for all edits. Removing the "2019 in ..." category links that don't exist may be the most controversial of the edits made, but they're easy enough to add back if they're created on commons. Thanks. Mike Peel (talk) 19:53, 14 January 2019 (UTC)
 * Could you do another 10 edits in mainspace before I review this to provide a better sample outside of categories? I expect those to be most controversial. ~ Rob 13 Talk 19:55, 14 January 2019 (UTC)
 * Done. Thanks. Mike Peel (talk) 20:03, 14 January 2019 (UTC)
 * Any chance you could review this over this weekend, please? I'd like to get started with this task next week if possible. Thanks. Mike Peel (talk) 22:57, 17 January 2019 (UTC)
 * Currently quite sick, unfortunately. I'll try to get to it this weekend if I get over whatever virus I have. ~ Rob 13 Talk 00:37, 18 January 2019 (UTC)
 * To update you, it appears I'm getting over my illness fairly quickly, thankfully. I will be able to get to this by Sunday evening. ~ Rob 13 Talk 19:59, 18 January 2019 (UTC)
 * Glad to hear that you're getting better! I'm traveling over most of the weekend, but will be back to normal and able to run the bot next week. Thanks. Mike Peel (talk) 20:55, 18 January 2019 (UTC)
 * This strikes me as a possible edge case. The category doesn't exist at Commons, but it has items in it. Would it be possible to skip such categories, since they may need to be created on Commons rather than removed as a link on enwiki? ~ Rob 13 Talk 04:09, 20 January 2019 (UTC)
 * I've modified the code in to call a new function 'check_if_category_has_contents' from, so the bot will now skip cases like that one and we can sort them out manually. Thanks. Mike Peel (talk) 11:14, 20 January 2019 (UTC)
 * ~ Rob 13 Talk 07:02, 21 January 2019 (UTC)
 * 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 WT:BRFA.