Template talk:PTV route

Update request
Could someone please change Route 627 to reflect its split into Route 625 Elsternwick-Chadstone and Route 626 Middle Brighton - Chadstone? — Preceding unsigned comment added by Lironl (talk • contribs) 06:03, 14 April 2012‎ (UTC)

Data changes
I've just been poking around the https://www.ptv.vic.gov.au website, and it looks like all the page values in Module:PTVBus/data will need updating. Luckily, the new pages are all listed in the source of https://www.ptv.vic.gov.au/timetables, so we should be able to get the new values with some simple screen-scraping. I'll have a go at doing that later on if no-one beats me to it. — Mr. Stradivarius  ♪ talk ♪ 05:50, 14 December 2015 (UTC)
 * Pinging The Earwig in case he hasn't seen this already. — Mr. Stradivarius  ♪ talk ♪ 05:52, 14 December 2015 (UTC)
 * Oh, this is funny... I was simply helping a user over IRC who asked me to move the templates. (Hope I did it all correctly.) BrillOBuffalo is the editor in question; I imagine they would like to help out. —  Earwig   talk 06:05, 14 December 2015 (UTC)

Yes, thank you both and especially Earwig for the help! I'll start linking the routes to the right pages on ptv.vig.gov.au - BrillOBuffalo (talk) 06:16, 14 December 2015 (UTC)
 * I've just done them all automatically for you. I left out the telebuses and the airport bus as they don't seem to have proper route numbers, but all other buses should be working now. — Mr. Stradivarius  ♪ talk ♪ 11:01, 14 December 2015 (UTC)
 * Thank you a lot for updating those websites...i'll just add the remaining that don't have links and manage the different changes among company names etc. Much appreciated :) Great team work! Thanks! - BrillOBuffalo (talk) 12:07, 14 December 2015 (UTC)
 * The recent new PTV website https://www.ptv.vic.gov.au introduced during the past week or so, has resulted in many links not working. Prior to this I was not aware of this template, but the research into the impact of t6he new website did lead me to it. I have now updated many items in the data module with most routes now correct although I do know there is more work to be done which I will address over the next month or so with at least 200 stations still to be fixed. In addition I have started to use this template PTVBus to create timetable references for bus routes in railway station articles eg Merinda Park railway station. It is a simple matter of defining the reference as just changing the route number in two places. While I have done a few stations, the first priority is fixing the links broken by the new website and changing the references will be a slower process which will take some further time and may not be completed before I go away for some time in April. I will advise periodic updates to this.Fleet Lists (talk) 04:09, 29 January 2019 (UTC)
 * I have replaced the route data with a list taken directly from https://www.ptv.vic.gov.au/, which I converted into a Lua table using a script I wrote. Please have a look over it to see if there are any strangely formatted entries, and let me know if you notice anything that is broken. If something is wrong, feel free to revert. Best — Mr. Stradivarius  ♪ talk ♪ 14:40, 31 January 2019 (UTC)
 * Thank you for taking an interest in this. The fact that it more than doubled in size intrigued me. I have not reverted at this stage as everything seems to be working. But I found that route "1" has a number of entries pointing to different pages such as 1318, 1344, 1350, 1355, 1374, 1439, 1524, 1611, and 1658 and possibly more, while route "2" points to pages 1319, 1341, and 1373 and others while other single digit route numbers also have multiple entries. This does not seem right. Also at least page 1449 and probably others, have an alpha description in the route number field, which is the same as the alpha description. Probably correct for PTV but do we need to clutter this module up with this information? Cheers. Fleet Lists (talk) 21:44, 31 January 2019 (UTC)
 * If we can remove the duplicate entries, that would be best. You can see why it's happening if you go to https://www.ptv.vic.gov.au/timetables, select "Bus" as your mode of transport and then take a look at the routes that appear in the "Select your line or route" dropdown menu. There are 22 separate entries for route 1, all with different places. I have no idea if there's a canonical page that we can choose for each of the routes, but if there is one and you know how to choose it, let me know and I will build it into the script. — Mr. Stradivarius  ♪ talk ♪ 14:53, 1 February 2019 (UTC)
 * The route with page 1449 doesn't seem to have a route number at all, which is why I think they didn't use a number in the data. Same for the other ones with descriptions where the route number should be. In the original data, the field I got the descriptions from is called "label" and the field I got the route numbers from is called "short label", so they don't seem to think there has to be a route number. I considered removing all the entries where the "short label" wasn't a number, but I wasn't sure if that would be helpful. — Mr. Stradivarius  ♪ talk ♪ 15:05, 1 February 2019 (UTC)
 * Very helpful - so far I have deleted some rail line entries for which I could not see any use. I will progressively delete other entries as I have a look at them. I have changed the URL after being pointed in the right direction by Frietjes below. For references I suggested above that be used. I would like to shorten that to to make it easier for editors. The template should be able to insert the constant "Route" and the route number into the output at the beginning as well as the constant "Public Transport Victoria" at the end of the output - see route 246 in Elsternwick railway station. I have tried to do that without any luck. Could you do that or would I need to refer that to Frietjes as well?Fleet Lists (talk) 03:04, 2 February 2019 (UTC)
 * Since my last contact I have gone through all 300 or so Victorian stations and made sure they have all been updated to point to the station page in the new PTV website. Next I need to go through the bus routes where most links still work but the occasional one does not. However at the same time I would like to update all bus references using the new format PTVBus template as suggested above for easier future maintenance. I will be away next week. Is it possible to make this change or should I go elsewhere to have this change made? Regards - Fleet Lists (talk) 02:25, 19 February 2019 (UTC)
 * I have found a situation where the requested change will cause some problems so I have decided not to go ahead with it. Thanks for your help.Fleet Lists (talk) 04:05, 21 February 2019 (UTC)
 * Sorry for the late response. What was the situation that would cause problems? Maybe there's a way we can work around it. — Mr. Stradivarius  ♪ talk ♪ 04:07, 23 February 2019 (UTC)
 * Thanks for your reply. I found that this template was also very helpful with tram routes and not just bus routes so possibly we may need to rename it to reflect that. Your thoughts on that please. With the trams the route numbers in many cases duplicate bus routes. So in the data I have prefixed the tram routes with the letter T. As a result of this using say route number 16, the route numbers for the trams need to be different in the two occasions ie 16 in the first place and T16 in the second case. And I am also looking at doing something similar for train lines in the future. We could possibly get around this by the template inserting the information after the only if it has not input ie it would be input for trams but not buses. And the same only insert the "Public Transport Victoria" if it has not been input. This would give some flexibility if we ever wanted to show something different ie the name of a different operator. Also see Template:PTVBus/doc which I have updated to reflect the tram situation. If we do make this change then we would only need to input information after the for trams and not buses.But I had not wanted you to go to this trouble, but it would be nice if it could be done. I will be away for a week after this coming Monday. Another editor has raised another issue with the template but it does not effect this matter but I may raise that with you at a later stage.Fleet Lists (talk) 04:38, 23 February 2019 (UTC)
 * Another thought has just struck me. Perhaps we should create this as a separate template which would not need the "deftext=yes" to be included in the request. The other options are objected to by the other editor in that they create external links internally which he objects to. See the hat note on List of bus routes in Melbourne which is caused by the use of this template. The template has also been removed from at least one other article for this reason.Fleet Lists (talk) 04:52, 23 February 2019 (UTC)
 * I just found the article from which it was removed Sunshine Marketplace - I was planning to change it to deftext=yes where it is used with the other options which could result in PTVBus becoming obsolete if we create a new template with just the standard option which would not need to be named.Fleet Lists (talk) 05:09, 23 February 2019 (UTC)
 * If we go for a new template perhaps something like this where the initial parameter is the route number  - prefixed by T for Trams, and the other two parameters optional. If Route is not present, use the word Route followed by the input route number and if Author is not present, insert "Public Transport Victoria. It would use the PTV Bus data module for the data information like the current module. For buses that would just leave  and for trams  as input. Feel free to change the parameter names - just thought of those off the top of the head. Fleet Lists (talk) 07:11, 23 February 2019 (UTC)

I’ve just come across this template as well and think there might be an opportunity here to make things a little more user-friendly. I am a little out of my technical depth here but think everything I propose is fairly straightforward. First, for a more readable and consistent template name, I’d suggest PTV route. Second, instead of a funky prefix denoting tram routes, I’d suggest that the module data be split into separate tram and bus lists and a template parameter such as mode= added with values t or b. That should make maintenance easier. Third, I think the "text" parameter should be used with keyword values like "desc" or "num", instead of having these in separate parameters to custom text. The old parameters could be retained but deprecated, or removed using a bot or AWB. Fourth, I think there’s a need for this template to mesh well with CS1 and CS2 given its frequent appearance in red tags; I’m currently of the view that a wrapper template (say, Cite PTV route) is the best way to do this but it could also be implemented as "cs1" or "cs2" keywords in the text= parameter here. Triptothecottage (talk) 04:26, 24 February 2019 (UTC)
 * After writing the above, I had also thought of the mode type which certainly has merit and I would be happy to go along with that. But a third mode for trains should be provided from the outset so that it can be used at a later stage and mode should default to bus so that I would not need to be included for buses. And expanding on buses, provision also needs to be made for such routes as Telebuses as I added to Lilydale railway station and Mooroolbark railway station today where the route number is much larger that just a number eg "Lilydale - Chirnside Park (Telebus Area 1)" where I have just displayed "Telebus 1" without using the word Route. I wont be adding anymore PTVBus templates after today as I will be going away for a week and hopefully when I get back I may be able to start converting them to the new template.Fleet Lists (talk) 05:05, 24 February 2019 (UTC)
 * Any further news on this? I had hoped to have started using the new template on my return this week but that is not to be. I will still be doing some work on Melbourne/Victorian stations but only add the PTVBus template where existing links do not work and PTVBus is the easiest way to fix it as I did with Hallam railway station‎ today. I hope to hear soon.Fleet Lists (talk) 08:19, 4 March 2019 (UTC)
 * I've just finished making changes to the data sandbox module, but the changes to the main module will have to wait as it is getting late here. Best — Mr. Stradivarius  ♪ talk ♪ 14:54, 6 March 2019 (UTC)
 * I've just finished implementing your suggestions. I've moved this template to Template:PTV route and added a mode parameter to it. There is also now a cite PTV route template for citations. This uses cite web under the hood, so the wording is the default wording instead of Fleet Lists' suggested format. Have a look at the updated documentation for both templates and let me know what you think. Best — Mr. Stradivarius  ♪ talk ♪ 15:52, 9 March 2019 (UTC)
 * Thank you for a fantastic amount of work done. However I seem to have a few little problems. See the PTV section of User:Fleet Lists/sandbox where I have taken a copy of the definitions for Elsternwick railway station defined both as current and using the new template for a couple of routes where some information appears to be missing from the new ones. I have updated Hawthorn railway station, Melbourne to use the new template which also shows the missing information. Thanks again for all the work done.Fleet Lists (talk) 23:53, 9 March 2019 (UTC)
 * I had misinterpreted your comment about the cite template which I had assumed would be linked to from the PTV route template but I have found that linking to the cite template direct solves the problem. I need to go out now but will try some more after I get back. Thanks again.Fleet Lists (talk) 00:03, 10 March 2019 (UTC)
 * Yes that has solved my problems. I have identified 10 stations which had links to tram routes prefixed with a T which no longer worked under the new setup, so I have given them priority in updating to the new template see I am still on the lookout for more. Thanks again for a great job well done.Fleet Lists (talk) 03:28, 10 March 2019 (UTC)
 * I've added two tracking categories to the module, so that you can easily see which pages have PTV route templates that need fixing. The first is Category:PTV route templates with invalid routes, which is added to a page if a user specifies a route that doesn't exist in the data module. (This would catch tram routes prefixed with a "T".) The second is Category:PTV route templates with deprecated parameters, which is added to a page if either of the numtext or deftext parameters are used. — Mr. Stradivarius  ♪ talk ♪ 13:33, 10 March 2019 (UTC)
 * Fantastic work . I was actually about to leave a comment suggesting tracking cats when you added them. Great work. Triptothecottage (talk) 03:40, 11 March 2019 (UTC)
 * And so say all of us Fleet Lists (talk) 04:06, 11 March 2019 (UTC)
 * Thank you. :) I noticed some user sandboxes had made their way into the tracking categories, so I've changed the module to only add the category links to pages in mainspace. — Mr. Stradivarius  ♪ talk ♪ 09:51, 11 March 2019 (UTC)

Output format of URL in this template
This template outputs the URL for the required bus route as http://ptv.vic.gov.au/route/view/8074 as for bus route 246. There has been a new PTV website which now uses the format https://www.ptv.vic.gov.au/route/8074 How can this template be changed to output the new format? The input data for this template is in Module:PTVBus/data. I have another nice to have change but I will leave that until the first item is resolved. Route 246 is the only route in Elsternwick railway station which uses this template at this point in time. It is planned to convert other routes later as was done when we created a common template for Sydney bus routes in stations some time ago. This template was written some three years ago but has not had much use because the data was not maintained I am in the process of cleaning that up.Fleet Lists (talk) 08:13, 30 January 2019 (UTC)
 * Fleet Lists, do you just want to change the  to   and not change the numbers?  if so, you just need to edit Module:PTVBus and change   to   in the code. Frietjes (talk) 13:40, 30 January 2019 (UTC)

mode=train
It is good to see that this mode is now available for Metro train routes and today I have updated some train routes using this mode for example with which duplicates the name of the train route. Can this duplication be suppressed as is done for the Telebus bus routes? Fleet Lists (talk) 02:40, 12 March 2019 (UTC)
 * I'll have to think about how best to do this. It's not as easy as the fix for the buses, where I just checked whether the route number was the same as the description. We will probably need to change the data format somehow. — Mr. Stradivarius  ♪ talk ♪ 12:15, 12 March 2019 (UTC)
 * I fully understand. I dont understand the language used here but I have been involved in writing software for over 50 years. Perhaps the simplest way is to tie it to the train mode as it applies to all train lines.Fleet Lists (talk) 08:05, 14 March 2019 (UTC)
 * No hurry. I just went through and added the trains on a whim and didn't have time to properly test it. Suggest it not be implemented anywhere else until we've got a lasting fix (we could just change the description text in each instance to "Line", it's not exactly a dynamic list :)) Triptothecottage (talk) 11:25, 14 March 2019 (UTC)
 * Thank you for that. I have done a number of train lines but wont do any more. I would like to get as much of this done - at least the bus/tram references - before I go away for about 5 weeks in just over three weeks time. I would be happy to change the description to just "line" which is OK for Metro lines but not be so if we also do it for V/Line ones but that is an issue we can address at a later date.Fleet Lists (talk) 04:25, 15 March 2019 (UTC)

List_of_bus_routes_in_Melbourne
This is now the only article left with deprecated parameters and also the only one with invalid route numbers. I have raised these issues in Talk:List_of_bus_routes_in_Melbourne Your comments would be appreciated there.Fleet Lists (talk) 02:41, 16 March 2019 (UTC)
 * Thank you for your positive response on this issue. As a result I started to make some changes to achieve that. But since then I have received a not unexpected response which takes the totally opposite approach ie just one link for the lot. I think we need some consensus on this before I can finalise this. What would be the best approach for this?Fleet Lists (talk) 07:13, 18 March 2019 (UTC)

Deprecated Parms?
it looks like the deprecated params have all been resolved (see ). As such, can we remove the support for those deprecated parms?  Zack mann  (Talk to me/What I been doing) 20:39, 20 January 2023 (UTC)
 * Done in Special:Diff/1135053548. — Mr. Stradivarius  ♪ talk ♪ 10:08, 22 January 2023 (UTC)
 * awesome sauce! Thanks!  Zack mann  (Talk to me/What I been doing) 19:52, 22 January 2023 (UTC)