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 Bots/Noticeboard. The result of the discussion was

William Avery Bot 4
Operator:

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

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:


 * 1) 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.
 * 2) Each section is scanned for Chronological templates, and the bot attempts to process the first table it finds after the tag.
 * 3) If the table does not have a header row, or the first column is not headed "Year", processing of the table is abandoned.
 * 4) 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.
 * 5) 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
 * 6) 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
Primefac (talk) 23:10, 29 June 2021 (UTC)

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)
 * 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)
 * 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)
 * The second run also looks good. UW Dawgs (talk) 21:58, 2 July 2021 (UTC)

And seems to have gone smoothly. Edits here. William Avery (talk) 17:24, 3 July 2021 (UTC) Primefac (talk) 18:52, 20 July 2021 (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 Bots/Noticeboard.