Wikipedia:Bots/Requests for approval/William Avery 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 Wikipedia:Bots/Noticeboard. The result of the discussion was Approved.
Operator: William Avery (talk · contribs · SUL · edit count · logs · page moves · block log · rights log · ANI search)
Time filed: 19:27, Saturday, June 12, 2021 (UTC)
Function overview: Sorts tables of draft picks in articles under Category:Lists of National Football League draftees by college football team that have been tagged with {{Chronological}} into chronological order, and optionally remove the {{Chronological}} tag.
Automatic, Supervised, or Manual: Automatic
Programming language(s): Python (pywikibot and mwparserfromhell)
Source code available: Yes draftPickSortBot.py draftPickSortBot.sh
Links to relevant discussions (where appropriate): WP:BOTR#Cleanup of chronological data in NFL Draft tables
Edit period(s): one time run
Estimated number of pages affected: 121 (of 298 in the targetted category)
Namespace(s): Mainspace/Articles
Exclusion compliant (Yes/No): Yes
Function details:
- The bot will process pages that are in category Category:Lists of National Football League draftees by college football team and have been tagged with {{Chronological}}. See query in draftPickSortBot.sh.
- Each section is scanned for {{Chronological}} templates, and the bot attempts to process the first table it finds after the tag.
- If the table does not have a header row, or the first column is not headed "Year", processing of the table is abandoned.
- Each row in the table is assigned a sort key based on the applicable Year value and its original sequence in the table. This has to account for rowspan attributes on the Year table cells, and sanity checks are made; e.g. that the value of year is within the expected range, and only the year cells have rowspans. If any of these checks fail, processing of the table is abandoned. Empty table rows, which are seemingly ignored by MediaWiki, are dropped.
- The rows are sorted on a key of their assigned year value and their original position in the table, to give the desired new sequence, and reinserted into the table
- Depending on a run parameter, the associated {{Chronological}} tag may also be removed.
Testing:
The bot can also output the sorted tables to a report page. Example at User:William Avery Bot/tablesortsample
Userspace test without removing tag: https://en.wikipedia.org/w/index.php?title=User:William_Avery_Bot/draftPickSortBotTest&diff=prev&oldid=1028221379
Userspace test removing tag: https://en.wikipedia.org/w/index.php?title=User:William_Avery_Bot/draftPickSortBotTest&diff=next&oldid=1028221507
Discussion
[edit]Approved for trial (25 edits). Please provide a link to the relevant contributions and/or diffs when the trial is complete. Primefac (talk) 23:10, 29 June 2021 (UTC)[reply]
@UW Dawgs: Could you take a look at the 10 edits the bot has done today, and check that they are OK? You can use this link.
I set the bot to remove the {{Chronological}} tag. Is that satisfactory? William Avery (talk) 20:52, 1 July 2021 (UTC)[reply]
- @William Avery: Nice job! I reviewed all ten edits and found no issues. Removal of the {{Chronological}} tag is helpful and works as expected. This is safe to run on the remaining (full category) in my view. UW Dawgs (talk) 22:48, 1 July 2021 (UTC)[reply]
- @UW Dawgs: Good. Absent any apparent problems I have run the bot over another 15 articles. If you can't see any problems I'll mark the trial as complete and we will wait for approval to proceed. William Avery (talk) 19:08, 2 July 2021 (UTC)[reply]
- @William Avery: The second run also looks good. UW Dawgs (talk) 21:58, 2 July 2021 (UTC)[reply]
- @UW Dawgs: Good. Absent any apparent problems I have run the bot over another 15 articles. If you can't see any problems I'll mark the trial as complete and we will wait for approval to proceed. William Avery (talk) 19:08, 2 July 2021 (UTC)[reply]
Trial complete. And seems to have gone smoothly. Edits here. William Avery (talk) 17:24, 3 July 2021 (UTC) Approved. Primefac (talk) 18:52, 20 July 2021 (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.