Wikipedia:Bots/Requests for approval/JJMC89 bot 7
- 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 Approved.
Operator: JJMC89 (talk · contribs · SUL · edit count · logs · page moves · block log · rights log · ANI search)
Time filed: 22:40, Monday, September 5, 2016 (UTC)
Automatic, Supervised, or Manual: Automatic
Programming language(s): C# (Custom AWB module) Python
Source code available: Partial: AWB infobox-coords-migrator.py on GitHub
Function overview: Migrate infobox coordinates parameters to {{Coord}}
Links to relevant discussions (where appropriate):
- RfC
- Help:Coordinates in infoboxes (edit | talk | history | links | watch | logs)
- BOTREQ for Infobox park (permalink)
Edit period(s): One run per infobox
Estimated number of pages affected: Up to the number of articles transcluding each infobox (6–10 edits/min)
Exclusion compliant (Yes/No): Yes
Already has a bot flag (Yes/No): Yes
Function details: Migrate infobox coordinates parameters to {{Coord}} using a template wrapper substitution.
Discussion
edit{{Infobox park}} will be used for the bot trial with {{subst:Infobox coord/sandbox}} as the wrapper to convert the coordinates parameters to |coords={{Coord}}
.
{{Infobox park}} configuration #1 |
---|
private static readonly string targetTemplate = "Infobox park";
private static readonly Regex regexTargetTemplate = Tools.NestedTemplateRegex(new List<string>("Infobox park,Infobox Park,Infobox Nature reserve,Infobox garden,Infobox desert".Split(',')));
private static readonly Dictionary<string, string> parametersDict = new Dictionary<string, string>
{
{ "lat_d", "lat_d" },
{ "lat_m", "lat_m" },
{ "lat_s", "lat_s" },
{ "lat_NS", "lat_NS" },
{ "long_d", "long_d" },
{ "long_m", "long_m" },
{ "long_s", "long_s" },
{ "long_EW", "long_EW" },
{ "coords_type", "type" },
{ "region", "region" },
{ "dim", "dim" },
{ "scale", "scale" },
{ "source", "source" },
{ "display", "display" },
{ "format", "format" }
};
private static readonly string replacementParameter = "coords";
private static readonly string initialReplacementTemplate = "subst:Infobox coord/sandbox";
private static readonly string editSummary = "Migrate {{" + targetTemplate + "}} coordinates parameters to " + replacementParameter + "={{Coord}}, see [[Help:Coordinates in infoboxes]]";
|
- — JJMC89 (T·C) 22:40, 5 September 2016 (UTC)[reply]
- Minor comment: Should {{Coord}} in the edit summary be escaped or written as {{tl|Coord}}? Have you tested this script manually to see if the edit summary parses correctly? I trust that you'll make it work. – Jonesey95 (talk) 03:51, 6 September 2016 (UTC)[reply]
- @Jonesey95: The edit summary will appear as
Migrate {{Infobox park}} coordinates parameters to coords={{Coord}}, see Help:Coordinates in infoboxes
. — JJMC89 (T·C) 04:23, 6 September 2016 (UTC)[reply]
- @Jonesey95: The edit summary will appear as
- Minor comment: Should {{Coord}} in the edit summary be escaped or written as {{tl|Coord}}? Have you tested this script manually to see if the edit summary parses correctly? I trust that you'll make it work. – Jonesey95 (talk) 03:51, 6 September 2016 (UTC)[reply]
|
Jc86035 (talk • contribs) Use {{re|Jc86035}} to reply to me 16:19, 6 September 2016 (UTC)[reply]
- @Jc86035: Currently it will handle aliases where only one has a value. To handle cases where multiple have a value, I will need to update the code. — JJMC89 (T·C) 17:31, 6 September 2016 (UTC)[reply]
- @Jc86035: The code has been revised to fully handle parameter aliases. Aliases must be in order:
{{{latitude|{{{latd|}}}}}}
→"latitude,latd"
.
- @Jc86035: The code has been revised to fully handle parameter aliases. Aliases must be in order:
{{Infobox park}} configuration #2 |
---|
private static readonly string targetTemplate = "Infobox park";
private static readonly Regex regexTargetTemplate = Tools.NestedTemplateRegex("Infobox park,Infobox Park,Infobox Nature reserve,Infobox garden,Infobox desert".Split(',').ToList());
private static readonly Dictionary<string, List<string>> parametersDict = new Dictionary<string, List<string>>
{
{ "lat_d", "lat_d".Split(',').ToList() },
{ "lat_m", "lat_m".Split(',').ToList() },
{ "lat_s", "lat_s".Split(',').ToList() },
{ "lat_NS", "lat_NS".Split(',').ToList() },
{ "long_d", "long_d".Split(',').ToList() },
{ "long_m", "long_m".Split(',').ToList() },
{ "long_s", "long_s".Split(',').ToList() },
{ "long_EW", "long_EW".Split(',').ToList() },
{ "coords_type", "type".Split(',').ToList() },
{ "region", "region".Split(',').ToList() },
{ "dim", "dim".Split(',').ToList() },
{ "scale", "scale".Split(',').ToList() },
{ "source", "source".Split(',').ToList() },
{ "display", "display".Split(',').ToList() },
{ "format", "format".Split(',').ToList() }
};
private static readonly string replacementParameter = "coords";
private static readonly string initialReplacementTemplate = "subst:Infobox coord/sandbox";
private static readonly string editSummary = "Migrate {{" + targetTemplate + "}} coordinates parameters to " + replacementParameter + "={{Coord}}, see [[Help:Coordinates in infoboxes]]";
|
{{Infobox school}} configuration |
---|
private static readonly string targetTemplate = "Infobox school";
private static readonly Regex regexTargetTemplate = Tools.NestedTemplateRegex("Infobox school,School,Infobox HighSchool,Infobox OtherEducation,Infobox Private School,Infobox School2,Infobox high school,Infobox middle school,Infobox education in Canada,Infobox private school,School infobox,Infobox New Zealand school,Infobox Public School,Infobox secondary school,Infobox School3,Infobox US school,Infobox School UK,Infobox Education in the United States,Infobox boarding school,Infobox Malaysia School,Infobox Malaysia school,Infobox Secondary School,Infobox K-12 School,Infobox scottish primary, secondary and nursery school,Infobox scottish primary school,Infobox High School,High school,Infobox School IN,Infobox Education in Canada,Infobox Secondary school,Infobox School,Infobox education in the United States,Infobox NZ school,Infobox Hochschule,Infobox cadet college,Infobox yeshiva,Infobox education in canada".Split(',').ToList());
private static readonly Dictionary<string, List<string>> parametersDict = new Dictionary<string, List<string>>
{
{ "1", "latitude,latd".Split(',').ToList() },
{ "2", "latm".Split(',').ToList() },
{ "3", "lats".Split(',').ToList() },
{ "4", "latNS".Split(',').ToList() },
{ "5", "longitude,longd".Split(',').ToList() },
{ "6", "longm".Split(',').ToList() },
{ "7", "longs".Split(',').ToList() },
{ "8", "longEW".Split(',').ToList() },
{ "title", "coordinates_display".Split(',').ToList() },
{ "dms", "dms".Split(',').ToList() }, // Geobox coor: format
{ "region", "iso_region".Split(',').ToList() }
};
private static readonly string replacementParameter = "coordinates";
private static readonly string initialReplacementTemplate = "subst:Geobox coor/sandbox";
private static readonly string editSummary = "Migrate {{" + targetTemplate + "}} coordinates parameters to " + replacementParameter + "={{Coord}}, see [[Help:Coordinates in infoboxes]]";
|
- — JJMC89 (T·C) 05:34, 7 September 2016 (UTC)[reply]
@JJMC89: Tried making one for {{Infobox station}}. Does the process normally go this long without any input from approvals group members?
- — JJMC89 (T·C) 05:34, 7 September 2016 (UTC)[reply]
{{Infobox station}} configuration |
---|
private static readonly string targetTemplate = "Infobox station";
private static readonly Regex regexTargetTemplate = Tools.NestedTemplateRegex("Infobox station,Infobox Austria station,Infobox China station,Infobox English bus stations,Infobox GB bus station,Infobox HK Bus Station,Infobox HK Bus station,Infobox Ireland disused station,Infobox Ireland station,Infobox Italy station,Infobox Japan station,Infobox MTR,Infobox MTR station,Infobox NI station,Infobox NS-station,Infobox Oslo Tramway station,Infobox Railway Station,Infobox Slovakia station,Infobox Slovenia station,Infobox Station,Infobox Switzerland station,Infobox Taiwan station,Infobox bus station,Infobox china station,Infobox japan station,London Tram stations,MTR Infobox,MTR infobox,TP Train Station".Split(',').ToList());
private static readonly Dictionary<string, List<string>> parametersDict = new Dictionary<string, List<string>>
{
{ "1", "latitude,latd".Split(',').ToList() },
{ "2", "latm".Split(',').ToList() },
{ "3", "lats".Split(',').ToList() },
{ "4", "latNS".Split(',').ToList() },
{ "5", "longitude,longd".Split(',').ToList() },
{ "6", "longm".Split(',').ToList() },
{ "7", "longs".Split(',').ToList() },
{ "8", "longEW".Split(',').ToList() },
{ "title", "coordinates_display".Split(',').ToList() },
{ "format", "coordinates_format".Split(',').ToList() },
{ "region", "iso_region".Split(',').ToList() }
};
private static readonly string replacementParameter = "coordinates";
private static readonly string initialReplacementTemplate = "subst:Geobox coor/sandbox";
private static readonly string editSummary = "Migrate {{" + targetTemplate + "}} coordinates parameters to " + replacementParameter + "={{Coord}}, see [[Help:Coordinates in infoboxes]]";
|
—Jc86035 (talk) Use {{re|Jc86035}}
to reply to me 13:03, 8 September 2016 (UTC)[reply]- @Jc86035: Thanks. I think we're good on configurations until the bot task gets approval. There aren't many active BAG members, so it is common for it to take some time before getting any input. — JJMC89 (T·C) 22:24, 8 September 2016 (UTC)[reply]
- Pinging everyone in the active section of the BAG members list, because why not. Jc86035 (talk) Use {{re|Jc86035}}
to reply to me 15:42, 9 September 2016 (UTC)[reply]
- Pinging everyone in the active section of the BAG members list, because why not. Jc86035 (talk) Use {{re|Jc86035}}
- @Jc86035: Thanks. I think we're good on configurations until the bot task gets approval. There aren't many active BAG members, so it is common for it to take some time before getting any input. — JJMC89 (T·C) 22:24, 8 September 2016 (UTC)[reply]
{{BAG assistance needed}} Any questions or comments? — JJMC89 (T·C) 02:22, 13 September 2016 (UTC)[reply]
- Do you have any ballpark estimation to the number of edits this task will make? — xaosflux Talk 01:27, 19 September 2016 (UTC)[reply]
- @Xaosflux: I'd say around 100,000 to a million pages. Possibly before this task ends, the Geohack parameter syntax might be changed due to the introduction of Kartographer's
<maplink/>
(which Yurik might want {{Coord}} to be based on), so that would involve some more pages. Jc86035 (talk) Use {{re|Jc86035}}
to reply to me 03:47, 19 September 2016 (UTC)[reply] - @Xaosflux: That depends on the scope of the approval. If the task is approved to remove all the deprecated parameters, then significantly more edits will be needed. There are roughly 830k transclusions of the infoboxes currently listed at Help:Coordinates in infoboxes. Three of them have been setup to test for needing the change. If those three are representative, then about 90k of the 830k would need to be edited to convert to use {{coord}}. I don't think those three are representative, so that is probably on the low end. — JJMC89 (T·C) 04:28, 19 September 2016 (UTC)[reply]
- {{BAG assistance needed}} — JJMC89 (T·C) 03:03, 27 September 2016 (UTC)[reply]
- @Xaosflux: I'd say around 100,000 to a million pages. Possibly before this task ends, the Geohack parameter syntax might be changed due to the introduction of Kartographer's
- Approved for trial (60 edits or 10 days). Please provide a link to the relevant contributions and/or diffs when the trial is complete. — xaosflux Talk 16:45, 23 October 2016 (UTC)[reply]
- Trial complete. The bot edited as intended: 60 edits. — JJMC89 (T·C) 22:32, 23 October 2016 (UTC)[reply]
- @JJMC89: Just a few minor things: why does the bot move the parameter to the end; and could it take into account the parameter spacing (
| parameter_name = value
) of the other infobox parameters so that the|coords=
parameter matches them? Thanks, Jc86035 (talk) Use {{re|Jc86035}}
to reply to me 02:44, 24 October 2016 (UTC)[reply]- @Jc86035: It is using
Tools.SetTemplateParameterValue("{{Infobox park|...}}", replacementParameter, "{{subst:Infobox coord/sandbox|...}}", true)
to set the parameter value. If thereplacementParameter
is already in the template, it will update the value in place (example). In this case, any spacing is maintained. Otherwise, thereplacementParameter
is appended to the end. In that case, it attempts to match the spacing around the|
but not the=
. If either of those is important, it would be easier for me to rewrite this in Python than to implement them in the module. — JJMC89 (T·C) 05:40, 24 October 2016 (UTC)[reply]
- @Jc86035: It is using
- @JJMC89: Just a few minor things: why does the bot move the parameter to the end; and could it take into account the parameter spacing (
- Trial complete. The bot edited as intended: 60 edits. — JJMC89 (T·C) 22:32, 23 October 2016 (UTC)[reply]
Template:Infobox park/config
) or a single page can be recycled for all templates (e.g. User:JJMC89 bot/config/InfoboxCoordinatesParametersMigrator
).
Example JSON configurations
|
---|
{
"template": "Infobox park",
"replacementParameter": "coords",
"initialReplacementTemplate": "subst:Infobox coord/sandbox",
"editSummary": null,
"parametersMap": {
"lat_d": "lat_d",
"lat_m": "lat_m",
"lat_s": "lat_s",
"lat_NS": "lat_NS",
"long_d": "long_d",
"long_m": "long_m",
"long_s": "long_s",
"long_EW": "long_EW",
"type": "coords_type",
"region": "region",
"dim": "dim",
"scale": "scale",
"source": "source",
"display": "display",
"format": "format"
}
}
{
"template": "Infobox school",
"replacementParameter": "coordinates",
"initialReplacementTemplate": "subst:Geobox coor/sandbox",
"parametersMap": {
"1": ["latitude", "latd"],
"2": "latm",
"3": "lats",
"4": "latNS",
"5": ["longitude", "longd"],
"6": "longm",
"7": "longs",
"8": "longEW",
"title": "coordinates_display",
"dms": "dms",
"region": "iso_region"
}
}
|
- — JJMC89 (T·C) 05:17, 31 October 2016 (UTC)[reply]
- Approved for extended trial (50 edits). Please provide a link to the relevant contributions and/or diffs when the trial is complete. Trial restart for new codebase. — xaosflux Talk 11:41, 31 October 2016 (UTC)[reply]
- Trial complete. 50 edits. There were two edits with non-ideal positioning for
|coords=
due to one of the deprecated parameters being separated from the others and one with extra spacing due to the spacing in the embedded{{Infobox zoo}}
. Configurations can be found here. — JJMC89 (T·C) 03:52, 1 November 2016 (UTC)[reply]- @JJMC89: Looks pretty good. Jc86035 (talk) Use {{re|Jc86035}}
to reply to me 11:42, 2 November 2016 (UTC)[reply]- I patched the spacing issue last night. — JJMC89 (T·C) 16:37, 2 November 2016 (UTC)[reply]
- The position for inserting
|replacementParameter=
is now before the first parameter in the orderedparametersMap
that is found intemplate
. (parametersMap
was previously unordered.) — JJMC89 (T·C) 05:02, 6 November 2016 (UTC)[reply]- @JJMC89: Would the bot automatically use new template configurations added to the list (with the list being extended-confirmed protected)? —Jc86035 (talk) Use {{re|Jc86035}}
to reply to me 05:30, 6 November 2016 (UTC)[reply]- @Jc86035: The bot does not start automatically. I must run the script, specifying a configuration. — JJMC89 (T·C) 20:58, 6 November 2016 (UTC)[reply]
- @JJMC89: (pinging Xaosflux, Mandruss and Jonesey95) Okay then. I guess we're good to go for the first two or three then? Jc86035 (talk) Use {{re|Jc86035}}
to reply to me 13:54, 7 November 2016 (UTC)[reply]- I checked some of these edits to {{infobox park}}, and they looked good to me. – Jonesey95 (talk) 16:02, 7 November 2016 (UTC)[reply]
- @JJMC89: (pinging Xaosflux, Mandruss and Jonesey95) Okay then. I guess we're good to go for the first two or three then? Jc86035 (talk) Use {{re|Jc86035}}
- @Jc86035: The bot does not start automatically. I must run the script, specifying a configuration. — JJMC89 (T·C) 20:58, 6 November 2016 (UTC)[reply]
- @JJMC89: Would the bot automatically use new template configurations added to the list (with the list being extended-confirmed protected)? —Jc86035 (talk) Use {{re|Jc86035}}
- @JJMC89: Looks pretty good. Jc86035 (talk) Use {{re|Jc86035}}
- Trial complete. 50 edits. There were two edits with non-ideal positioning for
to reply to me 11:12, 11 November 2016 (UTC)[reply]
- Approved. Task approved. — xaosflux Talk 14:22, 11 November 2016 (UTC)[reply]
- Due to the huge size of your potential edit pool, a ramp-up schedule is to be used to allow unexpected issues to be brought to your attention should they present:
- 1500 edits, 24 hour hold
- 2500 edits, 24 hour hold
- 5000 edits, 24 hour hold
- 5000 edits, 24 hour hold
- open editing
- Due to the huge size of your potential edit pool, a ramp-up schedule is to be used to allow unexpected issues to be brought to your attention should they present:
- Should minor issues be brought up that are causing page problem - address and restart the ramp up schedule above. — xaosflux Talk 14:22, 11 November 2016 (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 WT:BRFA.