WP:Bots/Requests for approval/William Avery Bot 4

William Avery Bot 4

[[User:William Avery Bot|William Avery Bot 4]]

{{Newbot|William Avery Bot|4}}

Operator: {{botop|William Avery}}

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 {{tl|Chronological}} into chronological order, and optionally remove the {{tl|Chronological}} tag.

Automatic, Supervised, or Manual: Automatic

Programming language(s): Python (pywikibot and mwparserfromhell)

Source code available: Yes

[https://bitbucket.org/WilliamAvery/wikipythonics/src/master/draftPickSortBot.py draftPickSortBot.py]

[https://bitbucket.org/WilliamAvery/wikipythonics/src/master/draftPickSortBot.sh 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:

  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 {{tl|Chronological}}. See query in draftPickSortBot.sh.
  2. Each section is scanned for {{tl|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 {{tl|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=

{{BotTrial|edits=25}} Primefac (talk) 23:10, 29 June 2021 (UTC)

{{Ping|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 [https://sigma.toolforge.org/summary.py?name=William+Avery+Bot&search=Table+of+draft+selections+sorted&server=enwiki&max=500&ns=%2C%2C this link].

I set the bot to remove the {{tl|Chronological}} tag. Is that satisfactory? William Avery (talk) 20:52, 1 July 2021 (UTC)

: {{Ping|William Avery}} Nice job! I reviewed all ten edits and found no issues. Removal of the {{tl|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)

::{{Ping|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)

::: {{Ping|William Avery}} The second run also looks good. UW Dawgs (talk) 21:58, 2 July 2021 (UTC)

{{BotTrialComplete}} And seems to have gone smoothly. Edits [https://en.wikipedia.org/w/index.php?target=William+Avery+Bot&namespace=all&tagfilter=&start=2021-07-01&end=2021-07-02&limit=50&title=Special%3AContributions here]. William Avery (talk) 17:24, 3 July 2021 (UTC)

{{BotApproved}} 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 Wikipedia:Bots/Noticeboard.