Commons:Bots/Requests/Pi bot 2
Pi bot (talk · contribs) 2
Operator: Mike Peel (talk · contributions · Statistics · Recent activity · block log · User rights log · uploads · Global account information)
Bot's tasks for which permission is being sought: Trim duplicate external ID information from categories where those IDs are shown in {{Wikidata Infobox}}
Automatic or manually assisted: Automatic
Edit type (e.g. Continuous, daily, one time run): Weekly
Maximum edit rate (e.g. edits per minute): 10 edits per minute
Bot flag requested: (Y/N): Y (Pi bot already has this)
Programming language(s): pywkibot. source code
This bot looks for categories that use both {{Wikidata infobox}} and specified external ID templates where both are displaying the same link (and/or templates like {{Mainw}} without parameters or only links to Wikipedia articles that are shown in the infobox). When it finds such a case, then it removes the external ID template (and the other templates where possible), as well as extra whitespace, before saving the page. It is currently coded to look at National Heritage List for England number (P1216) and Category:Listed buildings in England with known IDs, but this will be expanded for other IDs in the future. The motivation is that we don't need to have duplicate links, and it's better to use the ones from Wikidata via the infobox to avoid cluttering the category with multiple templates. It links in with a proposed Wikidata bot that will use the IDs to find new category sitelinks from Wikidata, and probably a future Wikidata bot that will copy the IDs from Commons to Wikidata.
Example edits: [1], [2], [3], [4].
Thanks. Mike Peel (talk) 23:24, 14 May 2018 (UTC)
Discussion
- Looks OK for me. I also could suggest to think about removal of description and/or image, like in Category:Queen's House. --EugeneZelenko (talk) 03:37, 15 May 2018 (UTC)
- @EugeneZelenko: That was this edit, which I did manually. It would be possible to look for images and descriptions in the category wikitext and remove them, but it's much more tricky to check that the information in the description is already in the infobox, so I think that's better done by hand to make sure we don't lose information. I'm generally trying to be very conservative with the bot edits, so complex cases with multiple IDs are also skipped. Thanks. Mike Peel (talk) 11:35, 15 May 2018 (UTC)
- Does bot keep a track of such elements for further automatic or manual clean-up? --EugeneZelenko (talk) 17:37, 15 May 2018 (UTC)
- @EugeneZelenko: No, my plan is to continue using categories to select targets for auto-cleanup, and possibly migrate to using SQL queries in the future. Thanks. Mike Peel (talk) 21:40, 15 May 2018 (UTC)
- Does bot keep a track of such elements for further automatic or manual clean-up? --EugeneZelenko (talk) 17:37, 15 May 2018 (UTC)
- @EugeneZelenko: That was this edit, which I did manually. It would be possible to look for images and descriptions in the category wikitext and remove them, but it's much more tricky to check that the information in the description is already in the infobox, so I think that's better done by hand to make sure we don't lose information. I'm generally trying to be very conservative with the bot edits, so complex cases with multiple IDs are also skipped. Thanks. Mike Peel (talk) 11:35, 15 May 2018 (UTC)
- Basic edits look good. It is however standard on commons to have a new line before categories and another before interwikis. I would not remove them. --Schlurcher (talk) 05:46, 15 May 2018 (UTC)
- @Schlurcher: OK, I've removed the line that looks for double \n's. That may leave extra whitespace at the top, but we can see how it goes. I'm hoping the manual interwikis won't be there much longer! New example edits: [5], [6]. Thanks. Mike Peel (talk) 11:35, 15 May 2018 (UTC)
If there are no objections, I think task should be approved. --EugeneZelenko (talk) 14:16, 24 May 2018 (UTC)