Module talk:Cycling race/archive5

Active discussions

Tour Down Under 2017 and its national team called UniSA-Australia

Hi Molarus, I wait a little before presenting you a new specific case. UniSA-Australia 2017 (Q28370724) participate at the 2017 Tour Down Under (Q22338002) but is a national cycling team with sponsor name (Q28492441), just a elite national cycling team (Q23726798) sponsored by a brand. Is it possible to put UniSA-Australia as a national team in the table ? Jérémy-Günther-Heinz Jähnick (talk) 14:48, 4 February 2017 (UTC)

That is no quick fix, it is a new feature. As a national team, it would not have a name, therefore we would need national teams with "official names". I have to think how that could be done. Maybe this could be done be a rewrite of the table. We have not done much effort into national teams so far, the example with "Australie" was something similar. Maybe after I have finished the classification table. --Molarus 00:37, 6 February 2017 (UTC)

That was a quick fix, it seems I had forgotten how that function works. See fr:Tour Down Under 2017. Now it is enough to add a <P31> <Q28492441> (équipe cycliste nationale de marque) into the team. Code is at frWiki and WDwiki. --Molarus 08:32, 17 March 2017 (UTC)

teamroster, notes and references

I have added to the documentation of table teamroster some additional information at de:Vorlage:Cycling race/teamroster/Doku. The part with the notes works on all Wikipedias, while the references only at enWiki, frWiki and deWiki (references are available for infoboxes too). I have looked into the code and the properties for the notes are P1642 (acquisition transaction) and P1534 (end cause). As a value for P1534 I have found Q23498248 (died during competition), but I remember that we have used more items. For the references the properties are: P854 (URL), P1476 (Titel) and P577 (time). I have seen that this feature is not mentioned at the documentation of this module, but I think it is an important feature. Someday we should improve that feature and add more Wikis for the references, imho. --Molarus 07:08, 8 February 2017 (UTC)

listofwinners, "above row 1"

I think the command "above row 1" has a problem. It should be "above 2016". When I´m adding an older race into WD, the text row has to move one line down. I don´t think this is happening. Maybe I should write a python code to look for articles that use an additional command in the articles. --Molarus 07:11, 10 February 2017 (UTC)

Good idea, it is true it can become difficult to count in the future when we will use more generally this function (for races that exists since 50 years for example). Tomorrow, I am at the press conference of the Grand Prix de Denain. Jérémy-Günther-Heinz Jähnick (talk) 19:23, 10 February 2017 (UTC)
Cool! --Molarus 10:10, 11 February 2017 (UTC)

event distance (P3157) instead of length (P2043)

I saw that this module and all the cycling race events use length (P2043) for the race distance. There is a specific property event distance (P3157) for such cases, since distances and dimensions are different concepts. Do you think it is possible to migrate cycling races and this module to event distance (P3157)? —MisterSynergy (talk) 17:10, 13 February 2017 (UTC)

The problem is not changing the code, but changing what is in the heads of the editors and in the database. A first step is to add P3157 as alternative into the code. I have changed the code, the documentation and the item of the infobox "Rund um Köln 2015" (on this page). --Molarus 20:01, 13 February 2017 (UTC)
Thanks, looks good at first glance! The module needs to support both versions for a longer time anyway, since editors do indeed need to adopt these changes first. Do you think it is a good idea to migrate existing claims from P2043 to P3157 with a bot? Cycle sport is the only type of sport that uses P2043 for events at the moment (~2650 claims as far as I see)… —MisterSynergy (talk) 21:05, 13 February 2017 (UTC)
That is the second step. Maybe Wikidata:Bot requests is a way to do that? It is no difficult bot job, therefore it is OK to ask for it. --Molarus 07:14, 14 February 2017 (UTC)
Yes, Wikidata:Bot requests would be the right place to ask. I’d suggest to also remove all bounds which are currently still in use:
SELECT ?item ?itemLabel ?length ?upperBound ?lowerBound {
  ?item p:P2043 [ psv:P2043 ?value ] . # items that use P2043 (length)
  ?value wikibase:quantityAmount ?length .
    ?value wikibase:quantityUpperBound ?upperBound; wikibase:quantityLowerBound ?lowerBound .
  ?item wdt:P31/wdt:P279* wd:Q13406554 . # and have P31 with subclass of sport competition (Q13406554)
#  MINUS { # activate this to filter away items that are related to cycle sport
#    VALUES ?cyclingClasses { wd:Q15091377 wd:Q18131152 }
#    ?item wdt:P31/wdt:P279* ?cyclingClasses . # but not P31 with subclass of cycling race (Q15091377) or stage (Q18131152)
#  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' }
Try it! Is there any scenario in which they were added on purpose? Most (if not all) of the bounds are probably legacy stuff from the time when they were added automatically and you had to remove them after adding the value (which barely anyone did). —MisterSynergy (talk) 09:18, 14 February 2017 (UTC)
OK. --Molarus 18:38, 14 February 2017 (UTC)
I also found n:fr:Modèle:Article Tour de France 2016 which relies on P2043. Which other templates/modules do we have which use this property? If we transfer P2043 to P3157, the former one will be directly unavailable and we have to move all templates ASAP as well. —MisterSynergy (talk) 22:07, 14 February 2017 (UTC)
I remember, that frWiki has a second cycling module from user Zolo, which would get problems too without changing the code. Maybe, the solution is not transferring the data, but copying the data? This way I don´t have to hurry to give the module with the code that can read P3157 to all wikis as soon as possible. And we would need a third step: Changing all the code that exist and a fourth step: Deleting P2043 data. PS: I have never heard before, that frWikinews is using our module. It seems that they have created a special module (how many?) just to print our classification table and some news (á la newsticker) about the Tour de France 2016 (n:fr:Tour de France 2016 : Christopher Froome s'empare du maillot jaune). I like the newsticker! Good idea! --Molarus 06:28, 15 February 2017 (UTC)
Copy instead of move sounds reasonable, we probably do not break that much. I looked at Property talk:P2043 to find more uses of P2043 in the field of (cycle) sports, but this French Wikinews template was the only one I found. As far as I see all the other P2043 users do not deal with sports. —MisterSynergy (talk) 06:50, 15 February 2017 (UTC)
Just here for few minutes, I see this new property few days ago, and I think the best solution would be a bot do the job. We can imagine a constraint : if the item contain sport (P641) = road bicycle racing (Q3609), it will not be possible to use length (P2043) and a message will say to use event distance (P3157). For what is in the head of our users, I can let an explanation when I will give them the new functions. Around 2650 claims, it is fantastic, we go very fast. Jérémy-Günther-Heinz Jähnick (talk) 17:31, 14 February 2017 (UTC)
I don´t know how it is done: sometimes a software proposes properties while editing items. It would be nice if that software is going to propose the new property. --Molarus 18:59, 14 February 2017 (UTC)
It will get proposed when it'll be popular enough. See WD:Devs (one of last sections). --Edgars2007 (talk) 09:36, 15 February 2017 (UTC)

Can´t see a bot request. --Molarus 20:16, 17 February 2017 (UTC)

I will apply for a bot run on the weekend. —MisterSynergy (talk) 22:30, 17 February 2017 (UTC)
The bot request to move the data is at "Wikidata:Bot_requests". By the way, frWikinews has an older (juillet 2016) copy of our module and itWP has a cycling module on their own. --Molarus 13:06, 20 February 2017 (UTC)
Is it possible to make an adaptation for listofstages ? I see the new property is not taken in consideration on fr:Tour du Loir-et-Cher 2017.
@MisterSynergy: what about the transfert of former property to new property ?
@Edgars2007: I think in few weeks we will have this new property proposed when we fill statements. Jérémy-Günther-Heinz Jähnick (talk) 12:37, 6 March 2017 (UTC)
Frankly, I don’t really know what’s the problem. I filed a bot request some two weeks ago, but no bot owner has volunteered until now to do the job. Since I was on vacation for some time meanwhile, I did not find the time to develop a suitable bot by myself (to be executed using PAWS, which is quite comfortable to set up). Therefore, this task is still on my worklist and if no bot operator wants to help, I’m going to do this by myself. Regards, —MisterSynergy (talk) 13:16, 6 March 2017 (UTC)
Actually it (move one property data to another) is a trivial bot task. Maybe the thing about 'remove unneded bounds' isn't let's say attracting :) --Edgars2007 (talk) 15:58, 6 March 2017 (UTC)
Do you have pywikibot sample code for the property move available? I saw several bots doing such tasks in one edit including qualifiers and references (thus it is indeed easy), but I have only very little experience with pywikibot and would have to study the docs a lot before I could claim that task by myself… Bounds removal does not scare me any longer, I’ve done that already. Thanks! —MisterSynergy (talk) 16:26, 6 March 2017 (UTC)
action_moveP. Of course, we can set this task (moving property) as a regular job (once in 2 hours) for DeltaBot. --Edgars2007 (talk) 17:12, 6 March 2017 (UTC)
Great, very useful and works like a charme (with some modifications). I would now principally be able to do this job by myself, although I’d like to test this code a little more before the actual run can start. If no other bot operator steps in, I’ll continue in the next days… —MisterSynergy (talk) 21:00, 6 March 2017 (UTC)
As far as I know, only few wikis have the module version of Cycling_race that is able to print both properties. At least the two other cycling modules in itwiki and frwiki are not able to print the new property. I think the module in frnews is not showing length data. --Molarus 01:08, 7 March 2017 (UTC)

June 2018 update

@Molarus, Edgars2007, Jérémy-Günther-Heinz Jähnick, Cs-wolves, Hejsa, Repf72, @Douglasfugazi, Bergenga: Quite some time has passed since I proposed this change, now I found it again on my worklist. Fortunately, the main cycling module with support for event distance (P3157) and length (P2043) (as fallback) has meanwhile been deployed to most wikis, so that only a few places to fix remain:

I still think we should harmonize this, as currently there is a mixed use of length (P2043) and event distance (P3157) which is clearly a very undesirable situation. How can we deploy the most recent version of this module to fawiki and frwikinews? The other two modules can be updated manually.

Apart from that I am perfectly ready to move all remaining length (P2043) claims of cycling events to event distance (P3157) including all (optional) qualifiers and references. It would take around one hour to perform this move. The issue regarding bounds, mentioned above by me, has meanwhile been solved. —MisterSynergy (talk) 18:22, 7 June 2018 (UTC)

Hi everybody. In fact, some months ago I read about this issue (event distance (P3157) and length (P2043)) and could verify that event distance (P3157) is the better property to set distances for cyclism, but I found some bugs for event distance (P3157) in the implemented code (when I used event distance (P3157) no distance data was present when I used some functions as listofstages) and I proceded to fix them in the code as you could see. Now, all my datafill on Wikidata uses event distance (P3157) and I think it is important as you say fix all now. Repf72 (talk) 01:22, 8 June 2018 (UTC)


  • This morning, I have moved all cases where length (P2043) was used but event distance (P3157) wasn’t (4280 items affected). I have collected excessive information about use of these two properties in all connected Wikipedia articles (more than 36k uses) before and after the move. I am now going to look where information in articles was lost in spite of the long preparation time.
  • Besides this I have updated it:Modulo:Ciclismo and n:fr:Modèle:Article Tour de France 2016 to use the new property, and requested updates of fa:پودمان:Cycling race and n:fr:Module:Cycling race on their local talk pages.
  • Feel free to report other important issues if you’ve observed anything of relevance.
  • I also plan to remove duplicated information (items that contain both properties) in future from ~50 items.

MisterSynergy (talk) 12:06, 9 June 2018 (UTC)

Final update:

  • fawiki meanwhile got a new version of this module; frwikinews not yet, but the module does not seem to use length/distance data from Wikidata there.
  • After thorough checks, I am 99% sure that there was no transcluded data in articles lost. We gained 29 instances of data use just due to the move and lost 5 (all Wikidata covi pages, i.e. no problem); in 20 cases, the API is not able to report correctly/consistently which data is used, but by manual checking it is clear that all required data is still in place.
  • I also removed duplicated length (P2043) data when identical event distance (P3157) data was already in place (50 items) and checked whether we lost any transclusions due to that removal (we didn’t).

All of that in summary means that all instances of cycling races and stages use event distance (P3157) right now. I will occasionally look whether new length (P2043) emerged, and move them without further notice to event distance (P3157). As far as I can see, documentation is already updated to reflect this. If you happen to spot any inconsistencies, please let me know. —MisterSynergy (talk) 18:46, 9 June 2018 (UTC)

Excellent job @MisterSynergy:. Repf72 (talk) 20:08, 9 June 2018 (UTC)

sorting teamroster

Wilier Triestina-Selle Italia 2017 (Q28045646) is the first season item where a rider (Alberto Cecchin) is added in a non alphabetical order. I did this to test the sort parameter for this table. It did not work, but I found the error and fixed it at deWiki and WDwiki. {{Cycling race/teamroster|Q28045646|sort}}) tells the table to sort the riders. The result is that Alberto Cecchin is sorted at the right place at de:Wilier Triestina (Radsportteam). By the way, lvWiki, ruWiki and mkWiki are using this sorting function without adding the "sort" parameter in the article. --Molarus 00:45, 8 March 2017 (UTC)

How it works ? I remember by the past we where obliged to use family name (P734), given name (P735) to always sort cyclists, but we never start because we are currently add family name (P734) to cyclists (The fact is it is easy to add given name (P735) because the major part of items are created, it is not again the case for family names). Jérémy-Günther-Heinz Jähnick (talk) 14:57, 8 March 2017 (UTC)
There is no problem if the name consists of two parts (In Japanese names the family name is written first, but this is not in the code). It gets difficult if the name consists of three or four parts. P734 and P735 is used in the code, but also this list {'da', 'de', 'di', 'De', 'la', 'Le', 'ten', 'van', 'Van'} (plus the translations for lvwiki, mkwiki and ruwiki) and sometimes I´m just guessing. As far as I remember, the solution was that the sorting algorithm should not sort always right and editors could just add P734 or P735 in the case it is sorted wrong. And most of the time the riders are already sorted by entering their names in alphabetical order into Wikidata. Only in non-latin Wikipedias this is not the case, but I know only from mkWiki that the algorithm works there quite good. This is the first time that I have seen sorting in a latin script wiki too. There was another problem with non-latin Wikis: Most of the time they have translated and untranslated rider names in the same table. The solution is to sort each group on its own and show first all translated riders and then all untranslated riders.
About P734 or P735. I´m just counting the number of name parts for each property and it seems that I do not use P735 for anything. But it does not make a difference if I use this property or that property or both properties, only it is not in the code. That is done at line 2484-2486 in the code "if not done and familyname==2". "2" means that the family name has two name parts out of three name parts. If the name has more then 3 name pars, I´m looking into the list or I´m guessing. I would say, there is room to improve the sorting code. --Molarus 02:58, 9 March 2017 (UTC)


Can we create Module:Cycling race/L10n and move all translations to it.!? The module is to long and I it's take a long time to be saved when I tried to edit it, the network some time disconnect before it's done. And Regardless from that, I think it would be better for translation. I created w:ar:Module:Cycling_race/L10n at arwiki --Mr. Ibrahem (talk) 19:23, 8 March 2017 (UTC)

I could write special code for arWiki, but I would prefer that the lang Module is used for that. And I think the solution would be that each Wiki should have only their own translations (maybe plus another translation?) in their lang module, as an option. At the moment, we say that if there in no translation for a wiki use language x as fall back. That could be changed by looking into the lang module before going to the fall back translation. If there is no data in the lang module or no lang module, the fall back translation should be taken. It should not be difficult to code that. We would need a standard code which could be copied into most functions that deal with translations. I would develop the code at Module:Version 2 for Module:Cycling race-WD in this Wiki and if you and Jérémy like the solution the code could be moved to the cycling module.
I had this problem already in my mind when developing the first use case for the lang module, because wiki x do not need to have the translations for twenty or more other wikis. The size of the code would get smaller by this. But at the moment not many wikis have a lang module and maybe some wikis will nether have one. Maybe this is a solution for that problem? By the way, we already have the code to deal with no lang module and different lang modules, because only few wikis will have the code for translating team names in their lang module. For example, frWiki does not need that, while mkwiki does. That means, we will get lots of different lang modules, depending on what the editors want for their wiki. If that is OK, I could start with coding soon. I guess, that could be done in one or two days. --Molarus 03:47, 9 March 2017 (UTC)
Another solution for this user is to directly give us translations on this page. Or to prepare a line on AR Wiki and notify one of us. It is not a problem, and it is a process we already widely use not for questions of network but because it is more easy to users to have a few lines of code to translate instead having to do this on a page of 4000 lines, this also permits to discuss of adaptations (dates, time...). Another idea is I can update Wikidata:WikiProject Cycling/Translations of Module:Cycling race. Note that the algorithm will evolve. One day it will become possible to use directly modules hosted on Meta, instead of using a local copy, and in this idea we will surely use subpages. For the moment, it is more practical to centralize the code on one page because we have evolutions every weeks and around one new function each month. Jérémy-Günther-Heinz Jähnick (talk) 17:36, 13 March 2017 (UTC)

501 expensive calls on lvwiki Paris-Nice 2017

We exceeded 500 expensive calls on lvwiki Paris-Nice 2017, so general classification is not showing. Optimizations are needed. What do you think of having cache table (not sure how it works in Lua) for rider information (flag, team name). --Papuass (talk) 09:50, 13 March 2017 (UTC)

The problem is not the expensive calls, but the fact this limit always exist from years. I already say at different places that this limit should disappear, but I am never listened. I make now another try. I hope now I will be helped. Jérémy-Günther-Heinz Jähnick (talk) 11:11, 13 March 2017 (UTC) PS : note that an optimization is not the solution (for the long term). A day, we will be able to enter lists of participating riders, and the table will be bigger.
I don´t think this will help. Our module is the only one with so many expensive function calls, because most of the time the Wikidata module is used.
Caching works only per lua table. That means only a team that is used more then once per table could reduce the number of expensive function calls. This way, maybe, the numbers would go down by 10. I´m sure rewriting old code would help a bit too. Maybe this way we could show another classification table (I think a classification table has around 20 expensive function calls). But that will not help with this race. Have you thought about using a template for the team list? Maybe this way you could reduce the number enough to get all classification tables to work? --Molarus 11:20, 13 March 2017 (UTC)
Can we check if there are any other expensive calls outside of those for Wikidata? --Papuass (talk) 11:24, 13 March 2017 (UTC)
The number is 0 after deleting all cycling race functions (in preview mode). You can see that at the bottom of the article in edit mode at "Parsētāja profilēšanas dati:". By the way, without listofteams, it is only 447 expensive calls. 50 is a lot. It seems as each team needs two expensive calls. Strange. --Molarus 11:54, 13 March 2017 (UTC) I have found a way to reduce the number of expensive calls for a listofteams table from 67 to 46 and I will try to do this for the classification tables too. --Molarus 13:50, 13 March 2017 (UTC) No, there is no reduction of expensive function calls in the code. I was wrong. --Molarus 15:11, 13 March 2017 (UTC)
>>So, what will be solutions, and what we as users of this module, can make it, as we notice same problem on Macedonian Wikipedia? --Ehrlich91 (talk) 18:28, 13 March 2017 (UTC)
Without table listofteams, it is no problem to show the other ~20 tables. --Molarus 19:07, 13 March 2017 (UTC)
Thanks, I done this on my home mkwiki, but it will be nicer if it is possible to find proper solutions for this in the future. --Ehrlich91 (talk) 20:14, 13 March 2017 (UTC)
It seems all wikis using this module have the same problem with this race. Maybe we have to give all Wikis the same advice? I have changed listofteams for the template solution at deWiki and written a text at de:Portal Diskussion:Radsport. Templates needs a lot of work, different then Wikidata. --Molarus 03:37, 14 March 2017 (UTC)

Maybe there is a way. I have tried again what I did yesterday and it seems it works now. I will do that for frwiki now and see if the code has an error. I´m not sure if the classification tables would gain by this too, because a table with 10 riders has at least ten rider items and maybe 8 different team items, plus items for the jerseys. An option would be to show just 5 riders per table, because this way we would need only half of the expensive function calls per table. What I have seen so far, listofteams tables with lots of season articles would reduce the number of expensive function calls from 70 to 50, while tables with no season articles would not gain that much, maybe by 10. Maybe it would be enough to print all classification tables for Paris-Nice 2017, which has only 8 stages. We will never be able to print a list of all participating riders on the same article. Maybe there is a way to scroll through such a list and show this way maybe only 5 riders of ~200 riders each time, but I see no way to code such a scrolling function in lua.

There is another way to reduce the number of expensive function calls: We have already reduces the expensive function calls by using the lang module for the country names (calling an item is the expensive function call). We could do something like that for the jersey and calling one jersey less means one expensive function calls less. For Paris-Nice 2017 that would be ~30 less. --Molarus 09:55, 15 March 2017 (UTC)

Code is at frWiki, but that doesn´t help with Paris-Nice 2017 at frWiki, because this article is not using listofteams. I will look for lua errors in frWiki and try to code the jersey solution. At least that should help frWiki. When I´m sure the new code has no errors, I will move the code to WDWiki too. --Molarus 10:21, 15 March 2017 (UTC)
I do not understand why each jersey need 2 expensive function calls, but this way frWiki is down to 460 by just adding three jerseys into the code (yellow, green and white). It seems the code is correct, therefore I´m moving the code to WDwiki.
By the way, the change in listofteams should be applied to all the other functions too or we have some functions more or less twice in the code. This will be a lot of work for the future, I will not do that now.
We should give that update to all those wikis that show this race. --Molarus 11:48, 15 March 2017 (UTC)

Mountains classification

I use this great temple in russian wiki. But why I don't see mountains classification? --MegaRaptor (talk) 10:50, 17 May 2017 (UTC)

Hi MegaRaptor (talkcontribslogs). I propose the creation of such properties seven monthes ago. Unfortunately, nobody accepts to create them even if we can say we have a consensus between users of cycling to develop associated functions. Jérémy-Günther-Heinz Jähnick (talk) 08:57, 24 June 2017 (UTC)

Mountains and youth classifications

Would it be very difficult to add the templates for the youth and mountain classifications? I think that there is already the point and teams classifications, these others one could also be added. 12:04, 22 May 2017 (UTC)

I believe it should be relatively easy to add those two, because the programming logic should be very similar for the mountains classification compared to points classification and for the young riders classification compared to the general classification. Without knowing the code myself, I think it should be only to "copy-paste" the code itself and then point to other labels and WD-properties. And I think that would be the place to start; to add Wikidata properties for them. Last week I added results for Tour of Norway 2017, and this week I will add for Tour des Fjords 2017, but obviously I was not able to add the results for mountains and young riders, as there is currently nowhere to add them. Also I want to add results for older editions of these and other Norwegian races, but I don't want to do that until these properties are in place, so I don't have to go back and go through them again later. Right now I have to consider if I want to add such results manually as standard wikitables in the Norwegian articles, and then remove it and waste a lot of work when the function is implementet later, or if I'll just leave it open with no data until the feature is there. I don't want either, and I believe that other people too are in the same situation as me.
I love these templates that have been made in this project, and they are probably the sole reason why I started editing bicycle-related articles! But right now the features that I think are the most missed ones are these. First adding the properies, then implement the presentation of them. I understand that there may be little time these days as there are a lot of races going on now, but I believe that these features are the ones that should have the highest priority in the project right now, both because they seem to be quite important, but most of all because how I understand it they will require very little work. (If I were to try and do it I would probably waste several days just to understand how it works, while this should only take a matter of hours I belive, maybe less.) Bergenga (talk) 16:00, 22 May 2017 (UTC)
I found out tonight that these properties were proposed several months ago, but they weren't created due to lack of support. I therefore encourage others to go to the Wikidata:Property_proposal/Event page and give them support, then maybe something will happen. Bergenga (talk) 23:12, 22 May 2017 (UTC)
Hi Bergenga (talkcontribslogs). I think it will be very easy to create new functions when we will have these new properties. I hope a creator will help us because I can't do nothing for this point. The functions will be identical to pointsclassification, we will just change one or two things. Jérémy-Günther-Heinz Jähnick (talk) 09:05, 24 June 2017 (UTC)


--Zebulon84 (talk) 07:03, 23 May 2017 (UTC)

For information, the first problem was because someone found more adequate to use P1532 (sport nationality) which is not used from cycling race than P17 (nationality) for Hong Kong. I corrected back and it works fine. Psemdel (talk) 21:29, 6 June 2017 (UTC)
  fixed --Zebulon84 (talk) 13:28, 13 July 2017 (UTC)


Hi Molarus (talkcontribslogs). After weeks far from my computer, I am now able to spend time on Wikidata (but not to illustrate cycling races). Jérémy-Günther-Heinz Jähnick (talk) 08:53, 24 June 2017 (UTC)

Error at enwiki

en:2017 Vuelta a Colombia is currently showing an error due to its use of {{Cycling race/infobox|Q30129895}}. The error is "Lua error in Module:Cycling_race at line 2026: attempt to concatenate a nil value."

I see that en:Module:Cycling race is listed as an "adaptation", but I'm wondering if it is just a copy of an old version. Pasting the current Wikidata module into the enwiki module and previewing the page with the error makes the problem go away so I am tempted to just copy this module. However, it would be better if someone familiar with the module would do that because I do not know if the enwiki module has been adapted in some way. Thanks. Johnuniq (talk) 10:19, 16 August 2017 (UTC)

Hi @Johnuniq: (and @Repf72:). en:Module:Cycling race is just a local copy of the Module:Cycling race hosted here on Wikidata. Sometimes, you can go on it and for example add translations in English. For the programmation, it depends of Molarus, unfortunately, we have no news about him since the 9th May (and I am worry about this). Developments have been stopped on EN Wiki due to the opposition of a hand of users about the use of Wikidata, we have had similar problems on IT Wiki and NL Wiki, so the efforts have been deployed where users were interested by the algorithm.
I make an update. Normally, all should works. If it is not the case, it can be a problem when Wikidata is filled, it arrives sometimes.
If you want, you can also express your opinion about the creation of properties about classifications on Wikidata:Property proposal/Event. Jérémy-Günther-Heinz Jähnick (talk) 21:05, 17 August 2017 (UTC)
Thanks. I have seen some enwiki discussions about the use of automatically retrieved Wikidata and understand the problems. I will examine the event proposal later although I am not a cycling editor—I mainly fix modules. Johnuniq (talk) 22:52, 17 August 2017 (UTC)
I saw also the bugs sometimes. Most of the time in the evening or on Saturday. So I suppose that it is linked with the load on the server. Psemdel (talk) 07:15, 19 August 2017 (UTC)

Ranking, error

Hello, I report a bug on [Women's Tour], stage 4 and 5. Normally most of us start the ranking with the first. Here a bot made some changes and the first is in last position on wikidata. Everythings is filled correctly but it isn't displayed correctly. I think the case "first not in first" is not managed correctly from the code right away. Psemdel (talk) 07:15, 19 August 2017 (UTC)

This problem is still not solved... Psemdel (talk) 10:14, 2 September 2017 (UTC)


To make it easier to adapt this module for new projects and to get a cleaner code, I will move in the next weeks the translations and localisations to a submodule. --Pasleim (talk) 09:50, 24 August 2017 (UTC)

No, I prefer having all informations in this supermodule, I go faster to update the different copies of this module. I will be possible to do that when we will can directly from a Wikipedia use a module hosted on Wikidata or Meta Wiki. Jérémy-Günther-Heinz Jähnick (talk) 17:15, 25 August 2017 (UTC)
The main goal is to make the update process faster. Some projects started to make their own adaption to the module, e.g. on dawiki, dewiki, nowiki, plwiki, ruwiki. If a bug gets fixed in the version here on Wikidata, it's cumbersome to update the module in these projects since a simple copy&paste is not possible. If we can convince these projects to only use the module version from Wikidata and to do their localisations in a submodule, we can safe a lot of time. If the localisation submodule is changed, it doesn't have to be copied to all other projects. That means, if a new language is added or in one language translations are improved, nothing has to be copied to the other projects. Another advantage would be that redundancies can be reduced. The word "country" does appear in six translation lists. Translators have to be aware that they have to store the translation six times. This has also consequences to the loading time of pages. --Pasleim (talk) 18:33, 25 August 2017 (UTC)
I agree with moving texts to submodule. It can be done so that there are default texts shown if there is no translation. See how ca:Mòdul:Wikidata, ca:Mòdul:Wikidata/i18n does it. --Papuass (talk) 23:49, 25 August 2017 (UTC)
that is good idea . --Mr. Ibrahem (talk) 12:30, 2 September 2017 (UTC)
If I understand well, we will have the classic module without translations, and another called l10n. It will have similarities with the principle of the page. Jérémy-Günther-Heinz Jähnick (talk) 12:10, 3 September 2017 (UTC)
Yes, the new submodule will look very similar to Wikidata:WikiProject Cycling/Translations of Module:Cycling race and will technically be an extension of the already existing submodule Module:Cycling race/lang. --Pasleim (talk) 11:47, 4 September 2017 (UTC)

Cycling race/victories

I got a bug on all the teams that use "Cycling race/victories" Today and Yesterday. Error message is "Erreur Lua dans Module:Cycling_race à la ligne 658 : attempt to concatenate a nil value.". Psemdel (talk) 10:15, 2 September 2017 (UTC)

corrected. --Pasleim (talk) 10:49, 2 September 2017 (UTC)
Thx. Psemdel (talk) 09:38, 3 September 2017 (UTC)

Some links in "Cycling race/victories" goes to FR wiki from DA wiki, see here. Can somebody help? Thanks --Hejsa (talk) 11:58, 17 December 2017 (UTC)

Fixed. --Repf72 (talk) 18:45, 13 January 2018 (UTC)


Hi, it seems that the Linter extension is detecting problems on pages using this module like fr:Discussion:21e étape du Tour de France 1989. I've looked at the code, and I've seen the following problems that may be the cause for the detection:

  • lines 1454 and 1455 : a tag is closed (</span>), but I don't see any opening tag before.
  • line 1464 : the opening tags (<tr> and <td>) are never closed
  • line 1486 : a tag is closed (</span>), but I don't see any opening tag before.
  • line 1651 : there's no <tr>...</tr> (table row tags) inside the table, but directly a <th>...</th> (table cell header)
  • line 2392 : the closing tags (</td> and </tr>) are only added depending on the condition while the opening tags are not (<td> line 2390 ; is there a <tr>?)
  • line 3127 : a tag is closed (</span>), but I don't see any opening tag before.

Can you fix this module ? --NicoV (talk) 09:34, 16 October 2017 (UTC)

I've done the modifications myself. --NicoV (talk) 12:35, 20 November 2017 (UTC)

Team roster

I noticed a small bug in the team roster function. If you look at Cervélo Bigla 2016, you will see that it is written that Carmen Small was in the team from the 29 june to the 30 june. Actually if you look on wikidata she was in the team from the 29 june 2015 to the 30 june 2016.

Moreover I recall the bug mentioned in #Ranking, error, which is still there. Psemdel (talk) 11:38, 1 November 2017 (UTC)

No race

In the winner list, if there was no race during one year there are two solutions right now:

  • Spring the year
  • Leave the year in write (so we don't know if the winner is not filled or if there was no race)

Maybe a winner "no race" would help to have the perfect clarity for such cases. Psemdel (talk) 21:26, 18 December 2017 (UTC)

Bonjour @Psemdel:, le problème avait déjà été solutionné par le passé : fr:Modèle:Cycling race/listofwinners. Cordialement, Jérémy-Günther-Heinz Jähnick (talk) 10:38, 12 January 2018 (UTC)
Thank you. Psemdel (talk) 17:06, 12 January 2018 (UTC)

Cycling race/listofwinners for teams

Open de Suède Vårgårda TTT - If the teams became winners, then their names are not displayed through this module.

2008  Cervélo Lifeforce P.C.T  Columbia Women  Nürnberger Versicherung
2009  Cervélo TestTeam Women  Columbia-HTC Women  Flexpoint
2010  Cervélo TestTeam Women  HTC-Columbia Women  Nederland Bloeit
2011  HTC-Highroad Women  AA  Garmin-Cervélo
2012  Specialized-Lululemon  Orica-AIS  Rabobank Women
2013  Specialized-Lululemon  Rabo Women  Orica-AIS
2014  Specialized-Lululemon  Rabo Liv Women  Boels Dolmans
2015  Rabo Liv Women  Velocio-SRAM  Boels Dolmans
2016  Boels Dolmans  Cervélo Bigla  Rabo Liv Women
2017  Boels Dolmans  Cervélo Bigla  Canyon-SRAM Racing
2018  Boels Dolmans  Sunweb  Cervélo Bigla
2019  Trek-Segafredo Women  Canyon-SRAM Racing  Sunweb

GAN (talk) 12:47, 1 January 2018 (UTC)

Yes @GAN:. The fact is by the past we don't have think at this possibility that will need the creation of a new function. On my side, I am not a programmer and unfortunately I am not able to solve this problem. Jérémy-Günther-Heinz Jähnick (talk) 09:33, 2 January 2018 (UTC)
Hi @GAN: I had tried but I still have to learn more about the code. See advances HERE. --Repf72 (talk) 22:23, 12 January 2018 (UTC)
Hi @Repf72: If there is no article about the season of the team for a given year, then you need to display a link to the main article about the team. And not a "red link" to the missing article on the team for a given year. How it's done in hereGAN (talk) 09:57, 13 January 2018 (UTC)
@GAN, Jérémy-Günther-Heinz Jähnick, Repf72: Hi all. I just saw this old talk. With the latest module vesion this problem solved as you can see in the table above. I fixed that teams was not listed correct as stage winners for team time trials in Cycling race/listofstages, and then listofwinners was also solved because they now share the code to find and link to winners. --Dipsacus fullonum (talk) 09:05, 31 July 2018 (UTC)


It is necessary have some place to data fill participants (riders list, not teams) in a cycling race. So what do you think if we use participant (P710) joined with member of sports team (P54) and sport number (P1618)? As an example see 2018 Colombia Oro y Paz (Q43480080) for an eventually rider with dorsal number 1. Repf72 (talk) 15:55, 11 January 2018 (UTC)

It is possible. Just a problem on stage races because we reach the limit of expensive functions, but it should go for single days races. By the past, the problem was we don't have qualifiers of qualifiers, the idea was to quote the team, use the property "with". Your solution is more adapted to Wikidata. The question is now : how to display that in Wikipedias. I am not competent for this point but I am interested. Jérémy-Günther-Heinz Jähnick (talk) 10:33, 12 January 2018 (UTC)
The technical solution from Repf72 is good I think. As said from Jérémy, now we have the problem with expensive functions, still the functionality can be prepared for the future. It should be prioretized though, because the typing of a full participant list in Wikidata is very long. I fear that it will really take some time before, this solution is applicable for real. Psemdel (talk) 17:03, 12 January 2018 (UTC)
I am going to do some test using the proposal and a function to display riders list for each team, so I'll tell you. Repf72 (talk) 21:55, 12 January 2018 (UTC)
Don't hesitate to communicate on your progress. I have an idea how to avoid the problem with the 500 operations. Psemdel (talk) 21:11, 25 February 2018 (UTC)

I started programming something. Right now I get the list of participants "raw" (here), I will try to format it the normal way. To avoid 500 operations problem, I plan to copy it "hard" in wikipédia when finished. Psemdel (talk) 10:47, 10 June 2018 (UTC)

I am in delay, because, as mentioned below, I noticed the need for the code to be reorganized/optimized, before adding new stuff. Psemdel (talk) 06:17, 14 July 2018 (UTC)

Miles and Miles/Hour for "en" Wiki

I implemented an update in order to show "kilometers + (miles)" and "kilometers/hour + (miles/hour)" just for "en" wiki. I hope to make the project more attractive for "en" wiki users. Please see en:2017 Colorado Classic (fields: "Distance", "Average speed" and "Distance - km (mi)") and if you see any mistake or have some suggest, please let me know. Repf72 (talk) 22:06, 12 January 2018 (UTC)

sorting teamroster (bis)

Because of the operations limit, the sorting algorithm are quite difficult to use for cycling races. As the order normally don't change all the time, I thought that the easiest way to solve the problem is to sort directly in the item the things we want to display. I bought an algorithm to sort following items:

  • (alphabetically)
    • Riders list in team item
    • Teams list in calendar
  • (chronologically)
    • Victories list in team item

I think in the future, it would be feasible to automatize completelly this task and let a bot update periodically the concerned items. In between, you can just post me the items you want to be sorted, so that I start my script (it takes 10 s for me). Advantages: you can type the list of teams directly from the starting list without to care about the alphabetical order. Of course, it doesn't work for russian, but is still a beginning.

I continue to develop new functions to help us to be faster. Psemdel (talk) 20:48, 14 January 2018 (UTC)

Can anyone do it?

1. Cycling race / teamroster --> make that when you click on the word "trainee / stagiaire" an article about the term was opened Q2328847

Is currently displayed
Adrien Costa (1 Aug–31 Dec, stagiaire)
I suggest an option
Adrien Costa (1 Aug–31 Dec, stagiaire)

2. Cycling race / listofwinners --> make the title "Composition (Roster)" similarly as the Cycling race / victories done "Victory."

3. Cycling race / infobox -> do in the "Winners" section, writing the command that the racer represents from the new line, the worm <br>. Most of the command names are long and they are written in two lines. And with <br> will be written on one line immediately under the surname of the rider

Is currently displayed
Name of the rider (The long
name of the team)
I suggest an option
Name of the rider
(The long name of the team)

4. Cycling race / infobox --> string "winners of the team classification" The current version of the module when placed in the Ru-wiki for the specified parameter displays a link to the article about the team for the given year. We have no such articles and links are displayed in red.

Therefore, we are using the old version of the module - ru:Модуль:Cycling race. She in such cases inserts a link to the main flock about the team. Can you do the same thing in the current version of the module?

GAN (talk) 21:13, 14 January 2018 (UTC)

Hi @GAN: For your issue #4, I made a little change for "ru", so please try again with current version of the module in Wikidata.
For #3, I agree with you, but we have some teams with really long names and your proposal could add a third line showing in that cases something like that:
Name of the rider
(The long really
long name of the team)
For #1, let me check and #2 it is not clear for me, so can you explain more about this issue and give some example. Regards --Repf72 (talk) 01:32, 19 January 2018 (UTC)

1. Cycling race/teamroster
Screenshot Now in all Wiki the word "stagiaire" is displayed as plain text, not a link. But in some Wiki (da / de / ru) there is an article about this value. You can make sure that in these Wiki the word "trainee" becomes a link. Q2328847 - stagiaire

2. Cycling race/listofwinners
Screenshot Showed the differences between the two tables in the screenshot. You can add the sorting of columns for "Cycling race/teamroster"

3. About very long command names is understandable. You can write in which line of the module what you need to replace and what to do to the cycling teams from a new line. I'll try myself to make changes in ru-wiki and see.

4 —  

GAN (talk) 17:48, 19 January 2018 (UTC)

Hi @GAN: Issue #2: Ok. I made some improvements for function "teamroster" so please adjust function "getSquadTableColumn(x)" for "ru". --Repf72 (talk) 14:16, 20 January 2018 (UTC)
Hi @Repf72:: Translation done. — GAN (talk) 14:25, 20 January 2018 (UTC)

How should we organize the Hammer Series in WD?

The Hammer Series (Hammer Series (Q30103254)) is a fairly new addition to the world of cycling, and I'm not completely sure how we should make the structure for these events. In 2017, the first season, there was only one single event, the Hammer Sportzone Limburg (2017 Hammer Sportzone Limburg (Q30108967)), while this season there will be (at least) three different events at different locations: Hammer Stavanger (2018 Hammer Stavanger (Q30108970)) 25–27 May, Hammer Sportzone Limburg (2018 Hammer Sportzone Limburg (Q47469096)) 1–3 June and Hammer Zagreb (2018 Hammer Zagreb (Q47469097)) 20–22 September (according to the UCI calendar), and the number of events per year will probably grow at least a bit. Some of these events had already an entity, but the single events were erronously labeled as just "Hammer Series 2017", and so on. I changed those yesterday to get it right.

But to get the numbering right, maybe we can't just add several events in one year? In that case, how should we make the structure? I have an idea that we treat the main Hammer Series entity as we treat for example the UCI Europe Tour enitity. Then there are one entity per season, like "Hammer Series 2017" and "Hammer Series 2018". Then the separate events around in different countries have one entity for a recurring sporting event, so there will be at least "Hammer Sportzone Limburg", "Hammer Stavanger" and "Hammer Zagreb". Then all those single events should be instance of either of these, and then they are part of both the season of UCI Europe Tour and the season of Hammer Series. Is this the best way to do it, or will it simply be a bit too much overkill? (The amount of work to add these extra entities is irrelevant, as it is just fun anyway.)

Also, will the fact that the Hammer Series only award prizes to whole teams and not single riders have any impact on the templates? I haven't tried to add anything yet, so this is just an open question if anybody can think of something that might cause a failure related to this. Bergenga (talk) 15:32, 21 January 2018 (UTC)

  • I suggest then do likewise the Vuelta a Mallorca (Q1804506). It also consists of separate races. The difference is only in the duration of the race. In Mallorca these are one-day races, and on Hammer it's a multi-day race. — GAN (talk) 16:16, 21 January 2018 (UTC)
I looked at your suggestion and it was very similar to the idea that I was trying to explain, so I just went ahead and did it. The following entities were added: 2017 Hammer Series (Q47479341), 2018 Hammer Series (Q47479344), Hammer Sportzone Limburg (Q47479346), Hammer Stavanger (Q47479348), Hammer Zagreb (Q47479350), and connections between existing entities were changed. Bergenga (talk) 21:48, 21 January 2018 (UTC)

Thanks for the suggestion. I'm going to start adding these Hammer Series to Wikipedia in Spanish, Anyone more? Regards. Douglasfugazi (talk) 14:58, 5 February 2018 (UTC)

Good question, for me, Hammer Series are like the Belgian Topcompétition 2014. (Sorry for not responding in this moment, I am well occupied IRL) Jérémy-Günther-Heinz Jähnick (talk) 10:06, 6 February 2018 (UTC)

Sorry for not answering in ages. Cycling is only a part-time hobby to me and outside of the season (of UCI-ranked races in Norway) I don't really spend much time around it. I had intended to write an article about Hammer Series in general, including a translation of the rules and stuff, and then maybe about the separate races, on Norwegian Wikipedia, but it never happened. It'll happen some day, but I have no idea when, but hopefully before next Hammer Stavanger. So I won't spend any time on adding data for templates until I have an article in the making.
It also seems that Hammer Series this season didn't turn out as planned. According to this PDF there was supposed to be four races this year, with Stavanger, Limburg and Zagreb as mentioned before, and then Suzhou in China on 12–14 October. But since there is no information to be found about Zagreb, it has most likely been cancelled. Suzhou is also most likely not going to happen, because now we know that on 14 October there will be a one-day Hammer Series race in Hong Kong as part of the Hong Kong Cyclothon (Q24907680). I would guess that they will try to make the Zagreb event happen next year, so I don't see any reason to do anything drastic with Hammer Zagreb (Q47479350) entity, but perhaps 2018 Hammer Zagreb (Q47469097) could be reused for the Hong Kong event this year, or we just leave it there as a cancelled event. I don't know what would be best to do with it yet. Bergenga (talk) 18:24, 2 June 2018 (UTC)

Suggestions, code structure, UCI calendar


Hello, I have already contributed often on this page, but I never tried to code in LUA. Now it is done. So I come with some questions and suggestions.


  •   For the display of the victories, it is already possible for the championship to customize the name (to make it shorter). This function is introduced at line 193 and 194 of the code. Now, the continental championships don't have this option (which make their names long). Is it ok, if we introduce also this possibility for the continental championships? It means concretely add a "or Q22231118" at these lines.
  •   On line 559, for the determination of the class of the race. It seems to me that the case where the class is defined first is missing. It is written:
if "Q"..d == class[i] then class_text = mw.wikibase.label('Q'..d) sortkey_class = class_sort['Q'..d] break end

I think the case with "b" instead of "d" should be also present.


As I will mention afterwards, I tried to programmate an UCI calendar. Basically I reused almost unmodified a lots of functions from the function victories. These functions are local. So I have to redifine them a second time. I thought to make them global. However, I noticed that it doesn't work so well, because them I have to pass all the arguments (strangely to me, it seems that inside of a "parent" functions the local variables are transmitted to the "child" functions have direct access to all local variables). However many local functions make the code very long and difficult to maintain. In the same way, the function winner and the function fn_rider are very similar. What do you think? Can someone explain me more clearly the local/global concept in Module:Cycling race?

Ok I understand now that it is too complicated. The code is long, it's so

UCI calendar

I made it possible to display the women UCI calendar from wikidata. You can see it on the French WP (for beta testing): Calendar. I put also the code on my user page. It is my first code with LUA, so it is clearly possible to improve it. I am waiting for your comments before to include the code in the module. Right now, I still see two issues:

  • Some of the classes appears in bold (why?)
  • If I try with the year 2015, I have a bug. Some exception management is surely missing.
  • I have to add the end date for stage races.

Psemdel (talk) 12:17, 28 January 2018 (UTC)

Ready :) Psemdel (talk) 18:22, 4 February 2018 (UTC)

New functions:

  • calendar with a Q element, which can be adapted according to the needs.
  • WWTcalendar with a year
  • womenucicalendar with a year

{{#invoke:Bac à sable|calendar |Q22920532 }} The ID "" is unknown to the system. Please use a valid entity ID. It works at my place, I suppose some debugging is however still needed. For instance here in the example the sortkey of the race in April is obviously not correct. Psemdel (talk) 18:22, 4 February 2018 (UTC)

There are several proposals.

The idea is wonderful.

In the currently displayed calendar, if there is no article about the race for a given year, then its name is simply printed without a link. In the "Victory" template, in this case, a link to the main article about the race is displayed. For Vicki in which there are only basic articles about races it is essential.

Do for the tables that output the final classification, the ability to change its title in the article. For example, instead of "Classification by points" you could display "Individual classification". This would also be useful for the Tour de France and the Giro d'Italia when the winner was determined by the amount of points, not by time.

GAN (talk) 13:24, 28 January 2018 (UTC)

Yes I suppose, we can make the thing more flexible. Step by step. Normally the link should be displayed exactly as for "victory" as I reused the functions. Let me know what you think about the Module structure. As it is a big code realized from different users, it can become quickly chaotic and impossible to maintain for others. That I don't want. For this reason, I prefer to discuss first before exporting my work. A bit of order in the code could be useful in my opinion. I would like to discuss about it. Psemdel (talk) 18:09, 28 January 2018 (UTC)┘


In the two templates "Cycling race/teamroster" and "Cycling race/victories" for versions that do not use the "country" column (there is no Module:Cycling race/lang), and the flag is displayed before the racer, the sorting of the racers does not work correctly.

Racers sorted in two stages. First, inside the country (by the flag), and then already inside the country in alphabetical order. For example pt:Predefinição:Cycling race/teamroster and pt:Plantilla:Ficha de victorias por equipo de ciclismo. Can you fix it? — GAN (talk) 20:01, 4 February 2018 (UTC)

It should be solved. The problem is that it will be then sorted with the first name. And it is difficult to know what is the name. My solution is to sort directly in the item the list of rider to avoid this issue (with a bot). So when you load, it is already in the correct order. Psemdel (talk) 18:53, 6 February 2018 (UTC)
Now sorting the racers inside the country is done correctly. As in the Ru-version, where the surname is first (we have the articles named in the format Surname, Name). So in other language versions where the name first stands. You just need to disable the primary sorting by country for this case. Sort in the element (that is, here in the Wikidata). Will there be any problems when switching the display of the text from Latin to Cyrillic? After all, one and the same letter can be in different parts in these alphabets. — GAN (talk) 19:40, 6 February 2018 (UTC)
Hi everybody, it is possible to sort riders by using properties family name (P734) and given name (P735). It is the only one solution because we have riders that have three or four names and they can arrive from Spain, Asia or Scandinavia so very different cases. More over, items about family names and given names are translated (or will be) in different alphabet, so it is practical when we will have more different languages. Jérémy-Günther-Heinz Jähnick (talk) 08:56, 8 February 2018 (UTC)
Gan, yes I see your point, but for latin writing, the name is second and therefore, it makes the sorting difficult. If the sorting, works well in cyrillic, I would say to sort manually in latin (with bot), and automatically (in the function) in cyrillic. family name (P734) and given name (P735) don't help really, because there are a lot of riders with several surname (you want to create all surname combination as elements) and several family names (same problem). In my opinion, it can be only realized with a property which doesn't call an element, like name (P2561), so more flexible. Psemdel (talk) 17:38, 11 February 2018 (UTC)
@Psemdel: I looked again at what principle is the sorting if the country is indicated only by the flag. Initially, the riders in the table are located in the order they are entered in the Wikidata.
When you click on the up and down arrows next to the heading of the column, the country is sorted alphabetically from the beginning, and then the riders are sorted, regardless of how they are written. That is, there is no difference that first comes the Name or Surname, everything is considered as a single word and only the order of the letters relative to the used alphabet (Latin or Cyrillic) is taken into account. Accordingly, the question. You can disable sorting of countries for this case. So that when you click on the up and down arrows, you immediately sorted the riders? For this case, it was a good option. — GAN (talk) 17:11, 20 February 2018 (UTC)
Sorry, my mistake. I also noticed that I misunderstood the problem. The sorting of the rider is quite complex in the code, I can't correct as I understand nothing. Psemdel (talk) 17:59, 20 February 2018 (UTC)


Hi everybody. We already list jerseys on Wikidata:WikiProject Cycling/Kit to translate/Jerseys. A similar way to fill items permits us to display informations about them in articles. I had a little idea today when I use used by (P1535) to list races where we use them. There is no display in articles, it is just for us to have examples of their use. I give a basic example with dark blue jersey, points classification (Q47945989) and another with more details on red jersey, points classification (Q26919974). I prefer making a statement instead adding examples in descriptions, this permits users to have translations in their languages. Jérémy-Günther-Heinz Jähnick (talk) 12:38, 7 February 2018 (UTC)

Classification reference

I added an option for Cycling race/stageclassification, Cycling race/generalclassification, Cycling race/teamtimetrialclassification. If you set the second argument to 1, the references (Procyclingstats...) appears at the bottom right of the classification. I still have two open points:

  • Maybe I should write "Reference: " before the links. Then this word has to be translated
  • Maybe a <ref> would be better.

What do you prefer? Psemdel (talk) 20:28, 11 February 2018 (UTC)

It is now:
Tour de France 2016

Lua error in Module:Cycling_race at line 4049: attempt to concatenate field 'header_1_text' (a nil value).

The variant at the bottom of each table in the form of "References: Site 1, Site 2, Site 3" seems more visual and convenient. I would suggest the following:

- Make it automatically displayed by default. This will not waste time editing existing articles using these templates. And keep the essence of this module - posted it in the article in advance and forgot. He will fill himself up through WD.
- Change the appearance of the display. Reduce the font size slightly and separate with a horizontal line. Like here.
- To add too most for "Cycling race/listofwinners" or it is not necessary

The variant of mapping through <ref> at chelation can be made through one additional argument.

And such a moment. In some multi-day races, the final results are posted on the page of the last stage. Accordingly, on one page of the WD, you need to specify two links for one site. At the moment, the module takes into account only the first one. For the above example, I just entered two different IDs for the cqranking - 21 stage and the final classification.

GAN (talk) 00:01, 12 February 2018 (UTC)

Thank you, yes I also understood how to put a <ref>. I am waiting for the reaction on the French WP. For the by default, it seems that some members prefer sometimes to have direct access to official site than those database. So I think, I won't make it by default in the beginning. Moreover, it takes some operations. I can imagine that by long stage races, I comes to the 500 limits just because of that... Psemdel (talk) 17:37, 12 February 2018 (UTC)
Ok, not many feedbacks from WP:fr. In the end, I agree with all your points Gan (see above). I made some tests and it doesn't cost more "operations" with than without references. I would set them by default. However, first the translation for the word "Source" has to be completed. Psemdel (talk) 08:57, 17 February 2018 (UTC)
EDIT: It seems that all new function from this kind is too expensive. I leave it deactivated by default. Reliability (that something is displayed) is more important than the rest. Psemdel (talk) 18:38, 23 February 2018 (UTC)
OK. Note for one point you mentioned above that the best is to use classifications from official websites, but the problem is they often finish by disappear. The best solution will be to upload these classifications in PDF on Wikimedia Commons, but I fear they finish to be deleted due to a problem with licence. Jérémy-Günther-Heinz Jähnick (talk) 18:51, 23 February 2018 (UTC)

Bonjour Psemdel (talkcontribslogs). Juste un détail de détail, est-ce que tu pourrais mettre en jaune la ligne qui est au-dessus de « Sources » au lieu du bleu ? On aurait quelquechose comme le tableau qui liste les équipes. Jérémy-Günther-Heinz Jähnick (talk) 17:12, 26 February 2018 (UTC)

  yes it is possible. Psemdel (talk) 18:47, 26 February 2018 (UTC)

Official name rider

I work further on other topics. For the women, there is always a problem in the palmares (list of winners) because their name change when they mary (so anachronogical name everywhere). To solve the problem, I introduced a test on "official name" for the palmares. I made it on WP:fr, waiting to see if we have bugs when the list of winners is too long. If it works I would introduce this change also for the other functions. Psemdel (talk) 20:18, 12 February 2018 (UTC)

  I introduced the modification for listofwinner and the classification. I have to find out the same for infobox. Psemdel (talk) 12:44, 17 February 2018 (UTC)
I revert, because it seems to be too expensive. Psemdel (talk) 18:37, 23 February 2018 (UTC)
It can be for such cases to create a new element (Q) and call it the initial name-surname of the rider? Specify (bind) for this element the link-redirection existing in the Wiki. And this is the element to indicate in the required tables. And different "athletes" will be displayed in the table and the resources of the module will not be used. — GAN (talk) 21:20, 27 February 2018 (UTC)
I am not sure to understand the idea. I reintroce the function but separately. I am also exploring another way to solve the problem. Psemdel (talk) 21:26, 5 March 2018 (UTC)
For the command there is a separate page (element) about the whole team. And there are pages (elements) about each of its season. And we use the element we need when drawing up a list of participating teams in the race. Also for riders who changed their name during the career. — GAN (talk) 21:40, 5 March 2018 (UTC)

function WTcalendar

Just like WWTcalendar but we can use it for UCI World Tour (Q635366), UCI World Tour (Q635366), UCI Europe Tour (Q1194340), UCI Asia Tour (Q1063423), UCI Africa Tour (Q268357), UCI Oceania Tour (Q1039648) !

{{#invoke:Cycling race/sandbox|WTcalendar|Q42317185}}

--Mr. Ibrahem (talk) 13:29, 14 February 2018 (UTC)

Basically, with the calendar function you can already do it. WWTcalendar is just with fixed options and with the link between year and Q element. Let me just know how you want to display the different calendar. I can then do a sub-function. Psemdel (talk) 18:55, 14 February 2018 (UTC)
I created table for world, europe, asia, america, africa, oceania tours:
	UCI["world"] = { -- Q635366
		['2018'] = 'Q42317185',['2017'] = 'Q21857932',['2016'] = 'Q20970765', 
		['2015'] = 'Q18192726',['2014'] = 'Q14979277',['2013'] = 'Q1031504', 
		['2012'] = 'Q849059', ['2011'] = 'Q849092'
	UCI["europe"] = { -- Q1194340	
		['2018'] = 'Q44497477',['2017'] = 'Q27915850',['2016'] = 'Q21029681',
		['2015'] = 'Q18342122',['2014'] = 'Q15041668',['2013'] = 'Q1280387',
		['2012'] = 'Q961709',['2010–11'] = 'Q751208',['2009–10'] = 'Q212197',
		['2008–09'] = 'Q1811548',['2007–08'] = 'Q1788011',['2006–07'] = 'Q1780660',
		['2005–06'] = 'Q1455600',['2005'] = 'Q1431816'

and the table keys will be used as args like: {{#invoke:Cycling race/sandbox|WTcalendar|america=2016}} " Script error: The function "WTcalendar" does not exist." . --Mr. Ibrahem (talk) 20:42, 14 February 2018 (UTC)

I have a look tomorrow, but it seems already a very nice improvement! Psemdel (talk) 19:55, 16 February 2018 (UTC)
I confirm, that it is much better shapped as in my case. I just wonder, if it is usefull to display the "leader column" for all these calendars. Psemdel (talk) 07:31, 17 February 2018 (UTC)
Mr. Ibrahem So I thought over. I don't want to display the world tour competition the same way as for instance europa calendar for diverse reasons. So I would introduce (at least) 2 display settings. They could be adapted depending on the wiki.. tastes always differ! With 2 display settings, I don't need the other functions. So I would rename WTcalendar in calendar and delete the old one (and WWTcalendar and womencalendar). I also added the women calendar to your code. Last point, I would rename "world" in "WT", because before 2004 there was also a men UCI calendar... just in case. My proposition is in the sandbox with name WTcalendar2. Psemdel (talk) 08:22, 17 February 2018 (UTC)
For information, I realized a similar function for the list of national champions. See Championnats nationaux de cyclisme sur route en 2017 Psemdel (talk) 15:51, 17 February 2018 (UTC)
@Psemdel: that will be good. --Mr. Ibrahem (talk) 19:33, 18 February 2018 (UTC)
Ok I made the change. Inbetween I remembered that I had some extra competitions, where I need the customized mode. SO your function WTcalendar is now calendar. Calendar became calendarcustom. Psemdel (talk) 18:47, 19 February 2018 (UTC)

──────────────────────────────────────────────────────────────────────────────────────────────────── What is the point in two almost identical templates calendarcustom and calendar. The second (calendarcustom) due to the use of Q and the possibility of selecting the outgoing columns looks more preferable.

Therefore, there are a number of questions:

1. Can I make a calendarcustom entry in yellow on a yellow background like a calendar? To display simply the word "Calendar" or "Calendar + title of the page in Wikidata". And it is better to write the name of the "Calendar" directly in the article directly in the "listofwinners". After all, through Q, it seems to me to add faster and more conveniently

2. Digital parameters for displaying those or other columns in the "calendarcustom". How to include them. Can you give an example? I was only able to display only the column "No." through the number "1", although the figure indicates the number "2". But due to the fact that the races are arranged in the order of their addition to the Wikidata page, the sense in this column is lost.

GAN (talk) 16:53, 20 February 2018 (UTC)

You can notice that first I wanted to delete this "custom" function, but afterwards remembered that I use it for some small competitions (Lotto cycling cup, but why not cyclo-cross for instance). However, I agree with you that the main function will be 90% of the cases. That's why I renamed it in "calendar", to make it easy. By adding other calendars, this rate could be 99%...


  • 1.   Yes we can add the label of the item as title of the calendar. It is no problem. I do it next week-end. (edit: let's say this week ;) ) , note that the solution I found is maybe not ultra elegant. I hope we don't have problem with TableA...
  • 2. Here it is Wikidata:WikiProject Cycling/Documentation/Calendarcustom. I didn't know that we can name the parameters, that's why it is one, two, three... We could sort by date, but would cost some operations, you can implement it if you want (it is almost there actually). I prefer to sort by date with my bot in the item. Psemdel (talk) 18:37, 20 February 2018 (UTC)

A link to a DAB page

There is a discussion relevant to this module at en:Template talk:Infobox cycling race#A link to a DAB page. Certes (talk) 16:52, 16 February 2018 (UTC)

Classification : when a cyclist loss his place

Hi @Repf72: (because you create functions about classifications) and all others. On the French Wikipedia, two users, Damonking and Toïlev speak about the case of cyclists that lost their place when for example they were guilty of doping. These particular cases are interesting and I just ask them few minutes ago they give me different examples (because the question can be complex, we can have different cases...). So I think we should discuss a little of these different cases, to see what is the best solution to enter the datas on Wikidata and make a good display on the different Wikipedias.

For my part, we have qualifiers like cyclist declassed due to results cancelled due to doping (Q22039296) and a property reason for deprecation (P2241), and we can make a statement obsolescent. We are also able to add references and for this type of cases it is a good thing. So we are perfectly able to enter such datas (another solution consists in writing a new classification). I am interested by your opinion, and also if you have different cases in your head. I am not able to code, only to give ideas, so for this, it will be interested to strike the line of the doped cyclist or giving it a grey color, display at the bottom of the table the cyclist loose its places for the reason XXX, and display the reference at the bottom of the articles, as we do for Drôme Classic 2018. The first idea is to be able to display this type of cases, the second idea is to be able to display sources about that. But I also need your opinions. I add that if we are agree about the way to enter the datas for this, I will can update the documentation. Jérémy-Günther-Heinz Jähnick (talk) 18:27, 27 February 2018 (UTC)

  • I also wanted to discuss this situation.
I would suggest in such cases to specify a shorter word, for example, "not available", so as not to stretch the table along the width, and in the mark rk to indicate the true reason for the absence of the prize.
GP Triberg-Schwarzwald 2003 (Q49390664) Here I was trying to specify this for 3rd place. As a result, only the Wikidata icon without text is displayed in the table. Table -> ru:Гран-при Триберг-им-Шварцвальда
Also, in addition to the disqualification, the winner may be absent from the multi-day race at the canceled stage. Now, in this case, the TABLE "Cycling race/listofstages" simply displays an empty space. Accordingly, it is impossible to understand why the winner is absent.
The ref-link shown above as an example of fr:Drôme Classic 2018 is displayed only in the "Cycling race/infobox". And in the fr:Drôme Classic "Cycling race/listofwinners", the ref-link does not exist, although the data for both these tables are taken from the same place.

GAN (talk) 20:04, 27 February 2018 (UTC)

Hi everybody. For the case that the position must be void, I tried to make some trick with a fictitious rider to put instead of it a legend like "Declared desert", but other users that check integrity and consistency of Wikidata deleted it and the solution was to use 2 properties, for example see winner of: 2005 Tour de France (Q655118), and I implemented that in the code of the module Cycling race some weeks ago to be used in functions p.listofwinners and p.infobox and currently you can see datafill at 1974 Vuelta a Colombia (Q20803359) and displayed using p.listofwinners at es:Vuelta a Colombia (see year 1974).
For other cases (no void position) with cyclist displacement to disqualified positions, I prefer to allow references to can be shown in some other functions that at this moment can not display that (like p.listofwinners). Repf72 (talk) 04:37, 28 February 2018 (UTC)
This is the current view for Tour of California (Q607463). Repf72 (talk) 04:22, 26 March 2018 (UTC)
Lua error in Module:Cycling_race at line 118: attempt to index local 'black_list' (a nil value).

{{Wikidata Infobox}} for Wikimedia Commons categories

Hi everybody. I discover yesterday c:Template:Wikidata Infobox on Wikimedia Commons. It permits to add an infobox on different domains on Wikimedia Commons categories. To give an example, I add in on c:Category:Jordi Warlop. I see different advantages :

  • we had just to display {{Wikidata Infobox}} instead of {{fr|[[:fr:Jordi Warlop|Jordi Warlop]].}} that only works for FR Wiki,
  • if in your language you have an article, it is written Wikipedia and there is a link to your Wiki, this link exists when you put it to Wikidata, so it doesn't need additional work,
  • for the moment, it displays the photo, the description, the birth and death and autorities, in the future, we can imagine first the country (we already have it, so it will not need additional work),
  • this infobox is translated in your language, it is very practical,
  • because we already have entered datas on Wikidata, easy categories are added, even if we can do better with family name (P734).

So I propose we add this template when we found a category. The weather is bad this week, so I start since yesterday to add it. Jérémy-Günther-Heinz Jähnick (talk) 08:53, 28 March 2018 (UTC)

A link in Wikipedia to a DAB page

In w:List of Mitsubishi–Jartazi rosters, this template calls Q24117328. That in turn calls w:Johan Svensson, which is a DAB page with no relevant entry (there is no entry in Swedish Wiki either). The Wiki article should redlink to w:Johan Svensson (cyclist), but there seems no obvious way to do this.

w:User:DPL bot is complaining about a w:WP:INTDAB error (and of course the link is worse than useless to readers). Can this problem be fixed? Narky Blert (talk) 17:29, 4 April 2018 (UTC)

  • If I'm not mistaken, it happens because the page is "disambiguation page". You can fix this only by creating an appropriate article, then graft it to the desired page of the Wikidata. — GAN (talk) 20:13, 4 April 2018 (UTC)
  • I do not know whether or not the cyclist passes w:WP:GNG. I am not going to research and write an article which might get w:WP:A7ed because of a problem created solely by some WikiData thing or other.
This is not the first example I've seen of such a problem. I raised a similar issue earlier on a w:WikiProject Talk Page, and a very experienced editor indeed decided that the best answer was to remove the WikData link altogether, because doing so was less harmful to Wikipedia than keeping a link to a DAB page (even though there was, in that case, a plausible redirect in Wikipedia). Over half a million edits between us, and we couldn't work out how to solve a problem caused by WikiData. This sort of problem cannot be swept under the carpet. It is a very serious one. Narky Blert (talk) 02:19, 5 April 2018 (UTC)
If my memory is good, EN Wiki don't accept datas from Module:Cycling race. Si for my part I will not lost time on this point. Jérémy-Günther-Heinz Jähnick (talk) 09:08, 5 April 2018 (UTC)
I have removed the link due to lack of evidence that a notable person by this name exists. Including a non-notable person is, of course, a privacy violation. BD2412 (talk) 12:18, 5 April 2018 (UTC)
Note: my removal of the link was reverted with reference to the website where this name appears. BD2412 (talk) 13:45, 5 April 2018 (UTC)
@BD2412: I will answer here. This template is designed to compile a team list for a certain season, rather than a list of "ready-made" links for quickly creating articles. The presence of a red link also does not guarantee the availability of an article about this racer in any Wiki. Q24114234, Q24114145 and Q24116556 Why did not you delete them then? Like the names of the commands from the "previous team" column, which are also not links (black). In ru-wiki a link to this rider is red. — GAN (talk) 14:01, 5 April 2018 (UTC)
Nothing else has been raised as creating a problem on Wikipedia. It would be a life's work to remove every non-notable person whose name is not causing a problem elsewhere. However, the problem remains. Are you able to fix it? BD2412 (talk) 14:03, 5 April 2018 (UTC)
On the contrary, these modules create a lot of good conveniences for the Vicki language sections in which there are few authors who love cycling, allowing them to jointly create articles together with different lists and tables for articles about races and teams in different languages. — GAN (talk) 14:19, 5 April 2018 (UTC)
Can you fix it so that it does not cause the wrong name to be called for the subject without an article? BD2412 (talk) 14:49, 5 April 2018 (UTC)
Here's another example. w:2016 Vuelta a Costa Rica calls DAB page w:José Varela.
I repeat: links like these are worse than useless to readers. Further, they mislead editors into thinking that an article exists. Narky Blert (talk) 15:56, 5 April 2018 (UTC)
Yet another. w:2016 Vuelta a Costa Rica also calls w:José Vega. Narky Blert (talk) 15:59, 5 April 2018 (UTC)

──────────────────────────────────────────────────────────────────────────────────────────────────── Although I had other things to do, I wrote w:Johan Svensson (cyclist). When Q23843288 appeared, an hour or so later, I edited Q24117328 to refer to it. (I had hoped that the bot might do so, but it didn't.)

As a result, the link in w:List of Mitsubishi–Jartazi rosters turned black, but it is still being reported as a WP:INTDAB error.

Get your collective act together. I have wasted over an hour on this total non-problem, created by you. In Wikipedia, we call this sort of thing w:WP:DISRUPTIVE editing. Editors can get blocked for doing it. Narky Blert (talk) 23:47, 5 April 2018 (UTC)

I would suggest that the simplest way to resolve this issue would be to return text only (no article link) if the linked article is not present in the target wiki. The only other solution I can think of is to change the main name of the data item to show the disambiguation handle (e.g. "(cyclist)") where article is not available on the given language and the main name is already occupied by a disambiguation or different person. Sillyfolkboy (talk) 13:36, 7 April 2018 (UTC)
I don't really get it. Red links are part of Wikipedia. They are there to make people start with Wikipedia. That the DPL bot is idiot is not our fault. We can put the link in black for WP:en (which, as Jeremy already mentioned, will never ever use this module) it will cost us a "if" which will make the performance worse for all other WP. Change the name of the item is not good idea, otherwise the name in the ranking will be "John Smith (cyclist)". And can we please avoid using bold and upper case...wikilove. Psemdel (talk) 19:01, 11 April 2018 (UTC)


Hi all. We're discussing how to build data items at the Olympics project with Cycling at the 2016 Summer Olympics – Men's individual road race (Q24760634) as our start point. One question has arisen about how to handle participants who end the competition without a ranking, so that would cover values such as disqualification (Q1229261), did not finish (Q1210380), did not start (Q1210382), etc. How have you approached this concept in this module? We're looking at using significant event (P793) to show this alongside participant data. Any comments on that before we start using it? Sillyfolkboy (talk) 13:10, 7 April 2018 (UTC)

  • @Sillyfolkboy: You have entered the results in the wrong "values", so that the module could process them you need to use: general classification of race participants (P2321) instead of participant (P710) and winner (P1346) instead of trophy awarded (P4622). See for example (talk) 13:28, 7 April 2018 (UTC)
    • @GAN, MisterSynergy: Ah, I see. We will have to match the Olympic data model to the cycling one to get this to work. This is a very important point to consider. My main aim is to create a general sports ontology that works across sports so Olympics-oriented data extraction is as easy as possible. My approach of using participant (P710) to keep general results is because it is a high level property that can apply to any sports competition. A cycling GC is pretty much the opposite of that. Presumably, the more sports-specific properties we use, the more complex the data model will become for anyone looking to extract data on multiple sports (for example, building a list of Olympic results by country). I will use general classification of race participants (P2321) on the cycling data items for consistency, but I'll try to consider the best generalised models for the other sports to keep things simple. Do you know of sports other than cycling which already have developed data models? Olympics models may have to link in with those too. Also, I'm still interested in the answer to my original question :) Sillyfolkboy (talk) 14:17, 7 April 2018 (UTC)
      • @Sillyfolkboy: As for other species that also use modules, I do not know. But formally this bicycle module can be used to display results in other cyclic types where the winner is determined by time or points. And also for compiling a list of winners by year. — GAN (talk) 14:37, 7 April 2018 (UTC)
        • I have an interest in moving athletics data to Wikidata so I will probably use this module as a basis for an athletics version. I have some python code to convert results in non-English wikis to English, but ultimately storing results at Wikidata are the best solution because we can leverage the efforts of all users and avoid situations where an error in the data means having to fix dozens of pages in other languages. Especially with all the doping disqualifications... Sillyfolkboy (talk) 15:01, 7 April 2018 (UTC)

I added over time limit (Q54881674). Psemdel (talk) 10:48, 10 June 2018 (UTC)

One cycling team - two elements

There is a cycling team Lotto-Soudal (Q841014) which has part (P527) since 1985. And there is a cycling team Omega Pharma-Lotto (Q12731637) that existed from 2005 to 2011 and which does not have a list of has part (P527), but it is not referenced by the seasons that are on the list of Q841014

Similarly, several other French cycling teams met.

As a result, we have one element about the whole team as a whole. And the second element is about several years (not individual seasons) of this team, included in the first.

As a result, in the module-based templates, references to this cycling team for this period of time stop working - they turn black. I "artificially" with the help of articles-redirects in the Wiki will make the links displayed.

I now see this moment a little strange. I rely solely on the functionality of the module, because I do not know very well such subtleties of the history of cycling teams.

The situation when the team ceased to exist, and not its base appeared a new slightly different. (Example T-Mobile -> HTC) In this case, in Wiki or there is one article that includes all seasons. Or several articles about different periods of the team that do not overlap.

GAN (talk) 01:21, 12 April 2018 (UTC)

Hi, in fact it was different teams along the time, the question was solved on FR Wiki few monthes ago, and written in articles if my memory is good. The solution is to dispatch items about seasons in items about teams.
For these particulary cases, it is possible to write the questions on FR Wiki, we have users able to respond, add sources and modify articles.
There are serveral cases and they are not all solved. The most of time, I avoid to work on specific years ans concentrate my work on seasons as 1974, 1980... CA Wiki has also good datas about old teams. Jérémy-Günther-Heinz Jähnick (talk) 08:30, 12 April 2018 (UTC)
It is a difficult issue. The concept of Team is not well defined in cycling. For example in football, you have a city, a stadium. In cycling, there are three elements : riders, staff and sponsors. How much must stay same to consider it is the same team between two seasons depends on the interpretation. All WP won't always agree. For instance, I consider that T-Mobile women, HTC, Velocio-SRAM and Canyon-SRAM is one unit. WP:en consider that there is a split between HTC and Velocio-SRAM. To sum up, I think your solution is as good as another. Every seasons must be perfectly clear, the way to sort them between "Team" has to be argumented (with words) in the articles. Psemdel (talk) 21:01, 15 April 2018 (UTC)

Module Bug

1. Cyclists are in the right order, how they finished. And their time and allocation bold is not right. Can I fix this without editing the data in the Wikidata? Lua error in Module:Cycling_race at line 4049: attempt to concatenate field 'header_1_text' (a nil value). Lua error in Module:Cycling_race at line 4049: attempt to concatenate field 'header_1_text' (a nil value).

I mentioned the problem several times above. In fact, the module as programmed now needs the cyclists to be in the correct order in wikidata to work. When I mentioned the problem I thought: solve it! Now that I also program, I see that it is more complex. With the time limitation for the script executation, I always fear that a new "if, sort" loop makes other problems. I would just sort the elements in Wikidata (should be quickly fixed). Psemdel (talk) 21:09, 15 April 2018 (UTC)

2. 31 Mart. Three Days of Bruges–De Panne. Stage 3b. In fact, the victory was won by Maciej Bodnar, but Lieuwe Westra is displayed. In Ru-wiki, the letter of the stage - A or B.

Lieuwe Westra had the wrong qualifier. It is the problem. I changed it.
> At the same time. Can I swap the display of the race and stage? To start with the name, and then the stage number for the ru-wiki. This order is seen more logical.
Why not. You can make this change for Fussian version. In French with start with the number.
> And such a proposal. If the name of the race has an explanation in parentheses, can I make it not displayed? This would allow to write in the brackets of men or women, and in the tables to display the name without specifying. Now, for example, in the list of the victories of the men's cycling team there may be a line "world champion among men", and there will be a "world champion".
Now this option is present with P2561 but only for CN. You can extend it for all races (I see no reason). I would be also happy to have this change.
Cycling race - victories

Lua error in Module:Cycling_race at line 1995: attempt to concatenate a nil value.

GAN (talk) 20:31, 12 April 2018 (UTC)

279== Infobox for races == Now we have an infobox for each edition of the races, I programmed in the "old" format (in French it is infobox v3), an infobox for the races, so all editions. It displays automatically the last winner, the link to the last edition of the race, an so on. It re-uses functions from Cycling race, so it is easy to port it in another language I think. Still I have an open point, on WP:fr nobody gives its opinion, so I give it a try here.

  • I would like to enter the category (class) of the race in wikidata. I was thinking of using P279, but sometimes it is used for "stage race" or "one day race", which I personnaly give in P31. Have someone an idea of a property where we could list the class of the races? Psemdel (talk) 18:29, 23 April 2018 (UTC)
    • May be class (P2308) for 1WT, 1.1, 1.HC? Wikidata adds data to the article card. In Ru-wiki there is a Gadget for adding data from the article card to the Wikidata if the card contains Q values. In other Wikis there is a similar one that could transfer data from the cycling charts to the Wikidata? — GAN (talk) 19:20, 23 April 2018 (UTC)
      • I read it only now (sorry). I made it with P279. If it makes an issue, we could use P2308. Psemdel (talk) 19:26, 15 May 2018 (UTC)


This module is completely ridiculous.

  1. There is way too much code duplication (example: the customization for enwiki to use miles requires changes in nine different sections of code
  2. It makes no sense to me to store the customizations for every wiki in every other wiki, rather than having every language fork the module slightly or have a language-specific config page containing general things like "WDlinkon = true"
  3. etc.

It's almost certainly not a good idea to solve whatever task this is trying to solve with a 300KB mammoth module. Pppery (talk) 20:56, 14 May 2018 (UTC)

Please provide more constructive feedback on how to fix some of problems. While I agree that this module is hard to maintain, has duplications and should be split in logical units, developing this centrally has made it possible to deploy current version of module on every Wikipedia that uses it. --Papuass (talk) 09:48, 15 May 2018 (UTC)
I suggested last year (#l10n) to move all translations and wiki customizations to an prject specific submodules. This would remove the duplications, and customizations of one wiki would not be stored on all other wikis. However, the feedback to this proposal was different from what I expected, so I did not spend more time on it. --Pasleim (talk) 09:58, 15 May 2018 (UTC)
When I started to code with this module, I add the same reaction. I wanted to centralize everything. Then I programmed the part for the display of the calendar which is similar to the display of victories. I wanted to use exactly the same functions (which would have been global). However, I noticed that it required "small" changes. Of course, we can add an "if" to consider those changes. The issue is that when there are too many "if" we get some error messages in wikipedia. I experienced it quickly. So it is a good idea, the realization is however more difficult than expected. Of course, if you can structure the code, we have nothing against it. Psemdel (talk) 19:24, 15 May 2018 (UTC)

season of club or team (P5138)

A new property was created : season of club or team (P5138). Jérémy-Günther-Heinz Jähnick (talk) 09:56, 15 May 2018 (UTC)

Ok, the code will have to be adapted for it. First adapt the code, then migrate all items to this new property, otherwise the display is incorrect :/. Psemdel (talk) 19:17, 15 May 2018 (UTC)
I will also adapt Wikidata Infobox for Commons. Jérémy-Günther-Heinz Jähnick (talk) 06:30, 16 May 2018 (UTC)
I have seen that part of (P361) has been replaced with P5138 in some places. Does this mean that the code has been adapted for it and is working? I'm holding back on changing until I know that it is okay.
Also I see that in cases where cycling team season (Q53534649) has been added to instance of (P31), the type of team like for example UCI Continental Team (Q1756006) is still there. Is this just until things are migrated, or is it supposed to be that way? In my sense of logic this is somehow not right. Having something like "season of UCI Continental Team" would make more sense, but to make such structure would probably be a lot of overkill? Or does the templates gather this information from the entity stated in P361/P5138 anyway? (I might just be over-reacting anyway ...) Bergenga (talk) 08:26, 10 June 2018 (UTC)

Teams in cards

Previously, we in the elements about the season of the team indicated the parameter part of (P361).

Recently for the season teams added a new parameter season of club or team (P5138). The module does not support it. And if there is no separate article about the team season, the module will display the name as plain text (black color).

Example (the first line above the map (Movistar))

GAN (talk) 22:08, 18 July 2018 (UTC)

I will implement to use season of club or team (P5138). --Dipsacus fullonum (talk)05:47, 19 July 2018 (UTC)
Functions listofteams and new_classification (for team lists and classification lists) now use P5138. It is not changed in other code yet (like in infoboxes). The other code will rewritten by me later to reduce run time, memory usage and expensive parser functions, and I will then add test of P5138. The change today also includes a fix for nowiki where the local language code ('nb') is not the same as the wiki name. --Dipsacus fullonum (talk) 10:28, 19 July 2018 (UTC)

Claims still to move

There are still a lot of claims part of (P361) which should be moved to season of club or team (P5138) as in all other types of sports, in items about cycling team seasons. A list to start with is this query result, containing ~1800 statements (the query needs some further refinement, but there we have already a good overview). I would be able to do the move so that we end in a consistent state over all items again. I would need to apply for a bot task, but that should be doable; the code would be ready for immediate use.

However, this module needs to be adopted first, and deployed to all Wikis. After the recent overhaul of the code for performance gains, how long do you all think it would take to implement use of P5138 instead of P361, and get this out to all Wikis? —MisterSynergy (talk) 19:53, 22 July 2018 (UTC)

Fuga Pinarello -> Fuga (Breakaway)

Hi Guys. I think that Fuga Pinarello (winner of the breakaway classification (Q27907715)) used in the "Giro" to have a classification of longest "Breakaway" should be renamed at Wikidata and in the "Cycling race" Code simply as "Fuga" without commercial sponsors because same concept for a "Breakaway classification" is used in others races and it is important to keep estandarizad classifications and estandarizad properties at infobox not linked to an some specific sponsor. Besides if we keep "Fuga Pinarello" then would be valid to have "Magia Rosa Enel", "Maglia Bianca Eurospin" and so on... What do you think? And if you are agree, maybe we should ask a property for "Breakaway classification" for the Giro and for other races that use points for a breakaway.

Hi Jérémy-Günther-Heinz Jähnick due you create winner of the breakaway classification (Q27907715), what do you think?

lb:Tour de Luxembourg 2018 et autres


Depuis la dernière mise à jour du module cyclingrace des nouvelles astuces ont été introduites de sorte que sur les pages lb l'affichage ne se fait plus correctement en fonction de langue, en l'occurrence le 1er devrait s'afficher comme 1. En plus les étappes s'affichent en bleu comme si un article existait.

Dois-je faire des traductions ou autre travaux pour que ça marche de nouveau correctement comme avant. Merci pour votre aide --Les Meloures (talk) 18:13, 31 May 2018 (UTC)

Bonjour, j'ai lu ta remarque, mais suis parti en week-end. Ca a l'air de nouveau correct. Est-ce le cas? Psemdel (talk) 16:23, 4 June 2018 (UTC)

Translation kit for national cycling teams

>> Wikidata:WikiProject Cycling/Kit to translate/National teams

In July last year I started a little project of my own to try to clean up the national teams, as there were many duplicates and many entities that were not properly linked. I found out that linking them from a translation kit page would probably be the best way to do it, and so that people can know where to find it too. So this doesn't directly affect the module and the templates, but I guess you will find it useful that I post this here. I had actually almost completed the list last year, but never really got around to finish it and publish it, but now I think it should be good enough. Obviously it may contain many errors, but that's why it better go public so that others can help fix it. It is created as language neutral as possible, and only the top description is written in English, with the possibility of translating to any language of choice.

I have added labels in both Norwegian Bokmål (my own language) and English (the default language of everything related to Wikimedia), but I don't know any other languages well enough to add labels. But you guys do the job for your own language. I have also been very specific about mentioning which gender the team is for. This is not because a little bit of gender equality couldn't hurt anybody, but because it removes a lot of ambiguity. Talking about a national team and talking about a men's national team may in some cases not be the same thing. That's why I would encourage everybody to supply the gender in the label, simply to increase the quality and integrity of the information. (I guess this may be a difference in culture between languages, as in Norwegian it is very obvious to mention the gender if there are teams of both genders.) In the list I have added the gender/age class WU (Women Under-23), which obviously isn't in use yet. But it was added to the UCI general regulations in 2017, which means that they probably plan to use the class in the future, and I don't see any reason not to include it here. (That's why I've specifically used men's U23, not just U23 in the English labels.)

I added the entity junior national cycling team (Q54555994) for juniors, since they participate in the World Championships, but I don't know if there is any need to add support for it in the templates. I also changed the labels on elite national cycling team (Q23726798) to include "elite", and made another entity, national cycling team (Q54660600), that all three age classes are a sublcass of. This needs to be translated in several languages. The reason why I added elite was to better follow how the UCI define the classes, and to make it more obvious that the other classes are not any kind of sublcass of it.

I have noticed that on some teams there is official name (P1448) defined, but only in French and sometimes in Spanish. Is there really any use at all with P1448 in national teams? When seen in Norwegian Wikipedia, all I see is the standard Norwegian name of the country anyway. Also stating an official name in a language that is quite inferior in the country seems a bit odd.

When making this list, I also did some edits on Commons, under Category:National cycling teams. There I found out that for some odd reason all national teams were written in French. I know that French is the "world language" of cycling (and I'm not opposing it), but the naming guidelines for categories on Commons clearly state that if possible, category names should be in English. Exceptions include if there are proper names, official names, if there is no way of describing it in English, or if it is commonly know in a different language, but that is obviously not the case here, except for probably the countries where French is an official language. I have found some really awkward category names like "Vehicles of Équipe du Royaume-Uni féminine de cyclisme sur route in 2016", a name that both starts and ends in English and have a midlle part in French. I have so far only renamed a few of the categories, and only on the top level, but await doing any more in case it would turn out that the naming scheme I have used isn't correct. (I'm really confused about the United Kingdom/Great Britain/Britain/British teams. I know the difference between UK and GB, but I have no idea how it is used in sports.)

The list was initially created by looking at the Special:WhatLinksHere page for the basic national cycling team entities (Special:WhatLinksHere/Q23726798, Special:WhatLinksHere/Q20738667 and Special:WhatLinksHere/Q54555994), and I will probably take a look there again from time to time (a couple times per year?), but it would be nice if you add items there as soon as you create them. Only then can we avoid the risk of several people creating duplicates of the same thing. At the bottom of the page in "hidden code" is kind of a copy-paste template for adding the different classes, where you only have to add the Wikidata-ID of the entity.

I made this list for my own benefit, but I hope that you also can enjoy it and find it useful, and together we can make it even more complete. Bergenga (talk) 20:37, 9 June 2018 (UTC)

For Commons, it is not me that made the name in French :). For Wikidata, as you probably noticed, I made a script to create and link all national team instances in a few seconds (normally without problem). I run it only for women team but it is clearly possible to do it for the other categories. For the label, I also face the problem that I don't speak all languages :). So I put only French and English right now. The use of official name is to avoid "People's Republic of China" and "Kingdom of the Netherlands", obviously in 99% of the case it is not needed. The list you did, I have it also (partially) for women team in Python here, it is the teamTable[kk][4] items Psemdel (talk) 10:29, 10 June 2018 (UTC)
Yes, I saw that you had added a lot by script. It had some minor errors and there were quite some duplicates (Some elements already existed, and there was almost a complete duplicate set of seasons of "British women's".), but I think I fixed all of that. When I started this last year there was quite a lot that were not linked at all, and since many people had added in their own language, there were other duplicates that had only other languages. I even fixed a few of those duplicates a couple of weeks ago, but obviously things are more controlled and they are actually linked together when using the script, so that problem will be smaller. Even so, people might still want to add labels and descriptions in their own language, so it will be useful for them to see it in one page like I have made. And now they will know what countries/teams exist, which was almost impossible earlier without good technical knowledge. We can't really expect every single contributor to have programming experience.
If you are going to run a similar script for adding more "men's" and "men's U23", here are some things that should be corrected:
  • Change Dane to Danish and Slovene to Slovenian (You have to use the demonym for adjective, not the demonym for people.)
  • Sweden does not end with d ("Swedend")
  • The UCI code for Japan is JPN, not JAP (In the script code I see that you say that they are IOC codes. It is anyway wrong to use IOC codes, because UCI codes are sometimes different. Or you could add IOC codes as IOC country code (P984), but that would only be useful in years with Summer Olympics.)
I believe that I fixed most of this on the elements created by your script, but I don't think that I changed JAP to JPN on seasons.
Thanks for the explanation about official names! Then it makes sense, and I even think that it might come in handy in Norwegian in a few special cases.
Also, I'm just curious: Why have the seasons been made back to 1990? Was there any special event or change in things back then, or is it just a random year to be sure to cover any "recent history"? Bergenga (talk) 20:11, 10 June 2018 (UTC)
That's an answer! Yes, there was a huge mistake by the brits. I hope there is no other like that, in fact it is just that I forgot a space, and when the script tested if it was already existing, it said "no" and so created "équipe deGrande-Bretagne...". I corrected right away of course. Yes, I have noticed your huge work on the topic, which is much appreciated. Of course, we don't expect all users to use Python. That's why I added the team with IOC code and an english name as I suppose most of the users will use english name to make the search. Thank you for the corrections, it will be considered (and you don't have to correct yourself, the s*** I make, I have to correct). Where do I find UCI codes (as you noticed I use IOC code)? Because of the possibility of such mistakes, I didn't want to add too many years at once. A script is good because, with it I can do automatically many things at once. It is bad, because I can do many things wrong at once. I started also in 1990, because many countries didn't exist before (ex-USSR). I will run the script for the men and U23 soon then. For years before 1990, it is also just one click. Just tell me what you need. The objective is to have soon all team we need, then we don't have to worry anymore. Psemdel (talk) 21:17, 10 June 2018 (UTC)
Since it was almost a year ago I don't remember exactly how I got the UCI codes, but I think my main source was actually to look through the drop-down list of countries when filtering by country (Advanced Search) at the road teams page. Yes, it's a really silly and probably not very effective way to do it, but I just couldn't find anything else on the UCI website. I also added a few from this page, and I beleive that there were one or two other sources, but they are no longer in my memory. I don't really recall how many UCI codes are different from IOC codes, but at some point I got to experience that expecting them to be the same was a bad idea.
Yes, 1990 seems like a obvious year for when some countries came into existense (formally, not literally). We also have countries that only existed for a shorter time, like Serbia and Montenegro (SCG), so with countries like that, one should find out what years they had a national team before multiple adding. I now see that your bot added female team for Serbia back to 1990. But did they actually have their own separate national team all the way back then? In 1990 there was still the old Yugoslavia (Socialist Federal Republic of Yugoslavia (Q83286)). I haven't found any UCI code for that or for the following Federal Republic of Yugoslavia (Q838261). (I really don't know much about those countries at all, I've just been looking a bit around to find information. I have no idea if the Yugoslavian member states had separate national teams at the time.) I also believe that even "stable" countries may not have had a working national team every year up through the years. It may have been because of financial reasons or because there were not enough good riders. Once again, this is not something I know, but I kind of expect things to be like that in some special cases. And the reason why I mention it is that I think it's not a good idea to add national team seasons that only theoretically may have existed. For me there is no point in mass adding seasons just for adding them. The most important thing is to have one item that represent the team regardless of season, and then the rest can be added later. How many seasons you add is all up to you. Bergenga (talk) 14:33, 11 June 2018 (UTC)
I get your point. Of course, there is a risk with mass-adding. However, I did it for many countries and many years in only a very short time. Last year, I spent a lot of time adding them one by one. It should be possible to delete item, if we notice they should not be there. Psemdel (talk) 20:14, 15 June 2018 (UTC)•

The module needs optimizations (July 2018 overhaul)

Hi all,

I am not particularly interested in cycling, but I can code in lua. We have some problems with this module at the Danish Wikipedia, because it uses so large amounts of CPU time and memory that pages often get script errors due to this. I have looked at the code. It seems to me that the primary problem is that it in many cases unnecessarily loads whole Wikidata entities. The function mw.wikibase.getEntity is very expensive and uses lots of time and memory. In most cases you can get the needed information without loading the entity by using functions like mw.wikibase.getLabelByLang and mw.wikibase.getBestStatements and similar.

I plan to optimize the code to avoid loading entities where possible in the next week or so. If anyone have objections or other ideas I will take that into consideration. Best regards, Dipsacus fullonum (talk) 20:10, 30 June 2018 (UTC)

You have all my support. Just save your edits often to avoid conflicts. Is there an {{inuse}} template here? --Papuass (talk) 12:32, 3 July 2018 (UTC)
My plan is to work with the code in my module sandbox at dawiki where I can test performance, and if it still works, using Special:TemplateSandbox with the Wikipedia articles which use the module. I will only copy new code it here when it is tested. There have not been many or large edits here in the last months, so I hope to avoid conflicts, or be able to solve them should there be any. --Dipsacus fullonum (talk) 13:35, 3 July 2018 (UTC)
I would suggest going trough all Wikipedias where this module is used, maybe there are some useful differences. --Edgars2007 (talk) 18:09, 3 July 2018 (UTC)

Hi, I will start working on this today. It may take 2-4 days. Please don't edit the module while I do this, thank you. --Dipsacus fullonum (talk) 04:38, 11 July 2018 (UTC)

I have now finished rewriting the p.listofteams function - except that my version not yet supports translations.lang_priority in the lang submodule. I have a test page on dawiki with just:
{{#invoke:Cycling race|listofteams|Q43337313}} {{#invoke:Cycling race|listofteams|Q28477949}}
  • With the current module, it uses 1.174 lua seconds, 18.32 MB lua memory, and 97 expensive parser functions to show
  • With the rewritten code, it uses 0.663 lua seconds, 10.37 MB lua memory, and 10 expensive parser functions to show
The module code used for the test is You are welcome to test it yourselves, but I will continue to work on the code for few days more. --Dipsacus fullonum (talk) 22:37, 12 July 2018 (UTC)
Excellent. I'd like to copy your version from your sandbox to mine when it is ready to test in spanish wikipedia. Repf72 (talk) 23:18, 12 July 2018 (UTC)
By the way, I just noticed that I forgot to rewrite the function flag(), and that function alone uses about 0.360 seconds in my test runs . I should be able to remove most of that time by putting more flag data into tables in the code, and avoid loading country entities (these are huge) for any table look-up misses. --Dipsacus fullonum (talk) 23:40, 12 July 2018 (UTC)
Would it be reasonable to split flag module from this cycling race module? I am thinking it will work much better without any lookups in Wikidata. --Papuass (talk) 07:41, 13 July 2018 (UTC)
I think it may be reasonable because a separate flag module can be used by other modules too. And yes, fewer or none Wikidata lookups is better because it is much faster and uses less memory. --Dipsacus fullonum (talk) 09:18, 13 July 2018 (UTC)

I have replaced the function flag now as it works indepedent of the other parts of the module, and have a big impact on the run time. The new function have a much bigger internal table of flag images and IOC country codes than the old function, and for any table misses it will lookup the flag on Wikidata without loading the usual very big country entities. The new flag function is already live on dawiki, and I think the loading time of articles using the module feels much improved. I don't have any exact measurements for this though. --Dipsacus fullonum (talk) 18:23, 13 July 2018 (UTC)

Thank you that you take time for the code. On my side, I was (1 month ago) trying to delete all "pcall", as suggested a programmer on French wikipedia. Goal is also to improve the speed. I but still load the entities, so your solution can be even better. As I was reading all code, I also started to rewrite some parts and reorganized the code (it is in draft, chaos here). I wanted to test before to post anything, and had unfortunately absolutely no time the last month (I want to do too many things at the same time), and will probably don't have much time until September. One question, how do get these performance information? Psemdel (talk) 06:11, 14 July 2018 (UTC)
@Psemdel: Hi. If you look at the HTML source code from the Wikipedia servers, you will at the bottom of the code find a summary of used resources, and also a timing profile listing the templates which used most time. When you preview a page you are editing you will get a table with used resources in the preview page. And finally when you preview pages or code using modules and templates in a sandbox with Special:TemplateSandbox you will also get a table with used resources in the preview page.
Status for my work: function p.listofteams is finished with support for translations.lang_priority as in the old code. function flag is finished. I am now working on the code for making classification tables (function new_classification), and hope to finish that in one day. --Dipsacus fullonum (talk) 08:27, 14 July 2018 (UTC)
I am very happy about that. We will have to implement that slowly and in a structurized way to avoid merging problem between the different changes. Your work gave me a lot of motivation, I will also try to make progress Today. Psemdel (talk) 07:39, 15 July 2018 (UTC)
Edit: Now my version "pcall" seems to work. I will start to merge with you modification. To avoid a "big crash", I propose to change very progressively in the next weeks the code of Module:Cycling race in order to have feedback from the users. Psemdel (talk) 10:05, 15 July 2018 (UTC)
Ok, I merged your work with my work. Actually, it is partially the same idea. You also deleted all pcall. You also rewrote the function WPlink('team'), exactly as I did. So I definitely think we are in line. In my code, it is however possible to avoid the pcall in a general way. In your code, I have the impression that you have to create a new function for all properties (getThis, getThat). In terms of benchmarks (same as yours) the gain is huge :
  • Cycling race original code: Lua time usage: 1.164, Lua memory usage: 20.19 MB
  • Your code: Lua time usage: 0.690, Lua memory usage: 10.63 MB
  • Your code and my code together: Lua time usage: 0.235, Lua memory usage: 2.38 MB!!!
I will make some proposition, how to reformulate the getThis/getThat in a general way this afternoon. Psemdel (talk) 10:46, 15 July 2018 (UTC)

As I thought it is not a problem to use a generic function. Zebulon wrote a function that test if the value exists:

function getCascadedValue( t, v, ... )
	if v and type(t) == 'table' then
		return getCascadedValue( t[v], ... )
	elseif v then
		return nil
		return t

Then the well-known fooA function becomes simply:

function fooBestA (mode,ID,property,var)
	local best, snak, temprank
	best=  mw.wikibase.getBestStatements(ID, property)
	if best then
		if mode=="value" then 
			snak = getCascadedValue(best, var, 'mainsnak', 'datavalue', 'value')
		elseif mode=="amount" then
			snak = getCascadedValue(best, var, 'mainsnak', 'datavalue', 'value','amount')
		elseif mode=="snaktype" then
			snak = getCascadedValue(best, var, 'mainsnak','snaktype')
		elseif mode=='numeric-id' then
			local temp = getCascadedValue(best, var, 'mainsnak', 'datavalue', 'value', 'numeric-id')
			if temp  then snak = 'Q'..tostring(temp) else snak=nil end
			snak = getCascadedValue(best, var, 'mainsnak', 'datavalue', 'value', mode)	
		temprank = getCascadedValue(best, var,'rank')
		return snak, temprank 	
		return nil

Then your function getParentID becomes:

fooBestA ('numeric-id',teamID,'P361',1)

The function getOfficialName is actually a new way to write timeStartEnd, so no need for new functions everywhere. We will just adapt the old one.

local function getOfficialName(teamID, timeOfRace)
	local a, official_name=timeStartEnd_Best(teamID, 'P1448', 'text', timeOfRace)
	if a ==true then
		return official_name
		return mw.wikibase.getLabel(teamID) -- No official name, try label	

And so on. I will reduce the need for entity in my code. Psemdel (talk) 12:11, 15 July 2018 (UTC) Edit: I changed the function p.listofwinners, without entity and without pcall and make a beta testing on WP:fr. Psemdel (talk) 13:33, 15 July 2018 (UTC)

@Psemdel: Hi Psemdel, It is a bad time to develop on my code as it is changing all time at the moment. Please wait until I am finished. I am now nearly finished with all the classification tables (the missing part is function race_reference). I also remove all use of pcall, and I move repeated code to new functions to avoid code duplication. I don't have functions for each property. I don't know why you got that impression. --Dipsacus fullonum (talk) 14:12, 15 July 2018 (UTC)
As I already developped one month ago, we developped in parallel :/. I really changed the whole code. We will try to get the best from what you do and what I do. The next week, I won't have time, so you can developp further your code. We will manage it. If I do anything, it will for the function p.calendar. Psemdel (talk) 14:18, 15 July 2018 (UTC)
Well, I gave warning a week before I began working on the code just to avoid working parallel with someone else. I have now finished rewriting the functions p.listofteams and new_classification. The last makes all classification tables. We are testing these changes now at dawiki, and if everything is OK I will copy the changes here tomorrow morning. Then I will pause to see your reactions before I convert more of the module to not load entities and to not use pcall. That will also give time for others to apply any pending changes. My current version of the code is at --Dipsacus fullonum (talk) 16:25, 15 July 2018 (UTC)
Bugfixed version: --Dipsacus fullonum (talk) 17:13, 15 July 2018 (UTC)

I took a look at the proposed functions getCascadedValue and fooBestA above. I assume that they work, but I don't think there is a reason to use such a complicated general approach to testing if a value exists. It seems more logical to me to utilise that a value is known to be present if snaktype is 'value'. Besides my goal is to improve run time. I don't think using a function call for each level of tables do that (even if lua uses tail calls). I created function getParentID to avoid code duplication as the same thing was done in more than one place. I admit that it isn't the best code. In other places I test the value of snaktype, and getParentID should also do that. I will correct that before uploading the code here tomorrow morning. --Dipsacus fullonum (talk) 18:34, 15 July 2018 (UTC)

Function getOfficialName is needed because it handles the configuration in translations.lang_priority. Again I created it to avoid code duplication as this was handled in more than one place before. It uses getStatementForTime which I wrote to replace timeStartEnd as we need both until the conversion is complete. When everything is converted, the replaced functions can be removed and the module will be smaller than now. --Dipsacus fullonum (talk) 18:47, 15 July 2018 (UTC)

Never said, it was your fault that we worked in parallel. I trust you and when you think it is ready, I will have a look again and try to help. Psemdel (talk) 20:26, 16 July 2018 (UTC)

New code uploaded

I have just uploaded a new module with rewritten functions p.listofteams and new_classification (making all of the classification lists) and all functions called by these. It is already running on dawiki with much reduced time and memory usage. Please contact me if this have caused any bugs. I will now stop to develop more on the module for at least a week (except for any necessary bug fixes). So if you have waited to edit the module, please apply your pending changes now. I will return later to make more optimizations, and maybe move all translations and local configuration to the lang submodule. --Dipsacus fullonum (talk) 05:48, 16 July 2018 (UTC)

@Dipsacus fullonum: Thank you very much for your improvements. I have already implemented your latest version in es.wikipedia and many of the eternal performance issues disappeared. For example listofteams with only U23 teams (like es:Tour del Porvenir 2017) was not working and today is fine. Today the only issue could be in listofwinners for long long races as Paris–Roubaix (Q33992). Kind regards. Repf72 (talk) 00:39, 17 July 2018 (UTC)
@Repf72: I am glad that it is running better now. You may want to update the module again already, as a few bugs in the new code was fixed today. I will make more functions, including the list of winners, faster in same way later. Best regards, Dipsacus fullonum (talk) 10:18, 17 July 2018 (UTC)

3 bugfixes

Hi, I just fixed 3 issues which were all found by User:Hejsa:

  1. The tooltips with name of jersey in classification lists wasn't always in the local language. Reason: For jerseys found in table jerseys in function jersey in function new_classification, no Wikidata lookup was made if no localized name was in the table. Solution: Add Wikidata lookup, and remove use of English as table fallback lookup as mw.wikibase.getLabel will fallback to English anyway (besides no English names are in the table.)
  2. Infoboxes can show both start and end dates, and single dates at the same time (se fr:Tour de France 2018 for an example until it is fixed on frwiki). Besides single dates with precision of year is shown as 30. November of the previous year. Reason: no test in function p.infobox if alle three of start time (P580), end time (P582) and point in time (P585) is used, and no test of the precision of the values so "2018-00-00" was interpreted as 1 month and 1 day before "2018-01-01". Solution: Don't write single dates, if start and end dates are present. I did not fix the missing check of precision (will do so when the infobox code is rewritten for optimizations anyway).
  3. In lists of victories of a team sometimes no date of race was in the table (se fr:Équipe cycliste Movistar#Victoires for an example untill it is fixed on frwiki). Reason: When function fn_date in function victory_main found a value of point in time (P585) with precision year it had no date to present in the table, but didn't then look for values of end time (P582). Solution: Check for end time (P582) first. Besides I droped check for start time (P580) as start time (P580) and end time (P582) are supposed to always be in pairs.

--Dipsacus fullonum ([[User talk:Dipsacus fullonum|

Corrected. [This line was move from inside my text after issue no. 1 Dipsacus fullonum (talk) 20:48, 16 July 2018 (UTC)]
User_talk:&beer&love adds errors everywhere in the pages... and we mentioned him several times already... Psemdel (talk) 20:43, 16 July 2018 (UTC)
User:&beer&love has been inserting point in time (P585) with precision year for a lot of stage races in the last few days. It is now removed from 2018 Tour de France (Q28859163), but it is still at a lot of other races. It is better to make the module code more robust to strange things in the entities. --Dipsacus fullonum (talk) 20:48, 16 July 2018 (UTC)
I also see no other choice (It is still incredible, Blackcat and I mentioned him on the Beginning of the month, and he changed nothing and deployed it on all items of the universe. The bots have to be released because of such mass destruction possibilities. It is not "do whatever you want" here. I call it vandalism). It was probably too easy for this world: P585--> one day race, no P585 --> stage race. Psemdel (talk) 20:55, 16 July 2018 (UTC)
Existe P585 y P2348 para diferenciar si intervalo de tiempo comprende un año o varios. Claro que lo podemos eliminar. ¿Pero lo hacemos solo en el deporte ciclismo? ¿sólo las ediciones recientes o las antiguas? ¿sólo si están los dos valores: fecha de inicio y fecha de fin? --&beer&love (talk) 20:56, 16 July 2018 (UTC)
I have done research and there are records with the three dates from minimum 2015. I think it gives problem with the cycling module. --&beer&love (talk) 21:03, 16 July 2018 (UTC)

3 more bug fixes

I have uploaded bug fixes again today:

  1. If end time (P582) was with precision month or year, dates in the end month or end year wasn't considered to be in the time period. This was a bug from my optimization rewrite and it caused the team not to be shown for riders in the classification lists the last year they rode for a team.
  2. In some cases only one of the jerseys was shown in classification lists if a rider had more than one. Also a bug from my rewrite.
  3. In calendar lists, I exchanged the test for point in time (P585) and start time (P580), so start time (P580) is tested first. That way point in time (P585) in stage races with precision year doesn't disrupt the calendar.

Thanks to User:Hejsa for finding issue 1 and 3. Regarding stage races with all of start time (P580), end time (P582), point in time (P585) I think the best approach is make the code so it can handle it, as all 3 of them are arguably true. --Dipsacus fullonum (talk) 10:02, 17 July 2018 (UTC)

I have also now fixed a bug for team timetrial classification lists. Thank you to User:Repf72 for informing me about it. --Dipsacus fullonum (talk) 10:00, 18 July 2018 (UTC)

Thank you friend Dipsacus fullonum. Once you could check listofwinners, could you check how integrate teams as winners? This is in order to can show some list of winners like Tour of the Alps (Q1401183) that include teams as winners like in 1986 or Open de Suède Vårgårda TTT (Q26266060) with only teams, but currently those can not be showed. See:{{Cycling race/listofwinners|Q1401183}} or see: {{Cycling race/listofwinners|Q26266060}}Kind regards. Repf72 (talk) 14:07, 18 July 2018 (UTC)
@Repf72: Hi, I will look at teams as winners later. But I have been working on the code for list of winners already. You asked earlier for a list of winners of Paris–Roubaix (Q33992), and you can see it at da:User:Dipsacus fullonum/sandkasse2. That page is made in less than 1 second, but as you can see not all of the winners is yet on Wikidata. --Dipsacus fullonum (talk) 16:10, 18 July 2018 (UTC)

List of winners rewritten

Hi, I just uploaded a new module with p.listofwinners rewritten. Now lists of winners for a race is always made in less than 1 second. It is much faster than before because it doesn't load any entities, and because it only does the same thing once. The old code loaded the Wikidata entity for each year of the race 4 times in total (once to get the year, and 3 times to get each of number 1, 2 and 3 in the race). That was very costly in running time and number of expensive parser functions. It also for instance sorted the list of races once for each race it accessed, instead of just once when all races were accessed. Beware that the new code may run into a limit of max 400 accessed entities, even you don't load them, for races which are more than 100 years old. --Dipsacus fullonum (talk) 07:53, 20 July 2018 (UTC)

My solution to avoid the limit, is to copy "in hard", the old listofwinners (it won't change :)) and just from 2017 with wikidata. The user see nothing. Psemdel (talk) 10:46, 21 July 2018 (UTC)

Code for formating of dates rewritten

Hi, I uploaded a new version of the module with function func_date rewritten. It is used to format dates in the local language, and had a big impact on the overall run time. I measured calendar lists (using {{Cycling race/calendar|WWT|2018}}) to be approx. 7% (150 ms) faster with that change alone. The problem with the old function was that it for each call loaded a language object for about 18 different languages and then formatted the date for each of these languages, before finally selecting one of the formatted dates. The new code will not load the language object on each call, and will only format the date for one language. I also removed the list of Polish month names in genitive from the code, as there is a format code to get them directly, and concatenated the calls if mw.language:formatDate was called more than once. --Dipsacus fullonum (talk) 09:58, 20 July 2018 (UTC)

Function p.listofstages rewritten

I have uploaded a new module today with p.listofstages rewritten. I have tested performance for a page showing the stages of Tour de France 2016 (exactly as in the unchanged usage example in the comment inside the code) twice. Before the test page used 198/500 expensive parser function, accessed 74/400 Wikidata entities, 2.1/10 seconds, and 16.1/50 MB. After the rewrite is uses 0/500 expensive parser function, accessed 36/400 Wikidata entities, 0.3/10 seconds, and 2.5/50 MB. --Dipsacus fullonum (talk) 06:49, 30 July 2018 (UTC)

I put it on WP:fr. I notice that for TTT, the team link is not retrived correctly. I got [[Sitelink|Sitelink]] instead of [[Sitelink|official name]]. For instance here. Psemdel (talk) 21:25, 30 July 2018 (UTC)
I checked the names for team number 1, 2, and 3 in stage 1 (TTT). In all cases it was presented as [[Sitelink|official name]]. For which team do you see [[Sitelink|Sitelink]]? --Dipsacus fullonum (talk) 22:04, 30 July 2018 (UTC)
@Psemdel: Sorry for the bug. I found and fixed it. Now the winner team of stages which are team time trials is shown correct in both listofwinners and listofstages with this bugfix edit: Special:Diff/718617509. --Dipsacus fullonum (talk) 07:39, 31 July 2018 (UTC)
You don't have to be sorry for that. Only those who do nothing don't do any mistake. Now it is better,...but it links to the team and not to the season of the team. The previous code was quite complex, sometimes without reason, sometimes with :D. Psemdel (talk) 09:55, 31 July 2018 (UTC)
@Psemdel: If you want a link to the season of the team, it can be done. Most Wikipedias don't have articles for individual seasons of a team, but it would be easy to return a link to the season if an article exists for it, and otherwise to the article for the team. Team links are now made by a new function called getTeamLinkCat which are used by all of the functions listofteams, new_classification (all classifications), listofwinners and listofstages. Infoboxes and other functions may come later. Do you prefer links to the season in all of these cases, or only in some of them? --Dipsacus fullonum (talk) 10:33, 31 July 2018 (UTC)
As I personnaly create the season articles, I prefer when the people know that they exist :D. For a TTT, it is obviously the season that should be displayed (it was the case before, of course, it leads to another if loop... ).For the list of teams, it makes also more sense to have the team of that year. For list of winner, I didn't know that we display the team, but here it is not sooo important. The same for the classification, I think it is better to have more detail, so the season but the general team article is also ok. Psemdel (talk) 18:42, 31 July 2018 (UTC)


In the tables where the citizenship of the rider is indicated only by the flag (without the name of the country). Now comes the sorting of the flag first (country), and then the rider.

Can someone break this column into two bars (if it is possible and not heavily loaded module)? In the first there will be only a flag, and in the second one is the driver himself. To be sorted by the rider. — GAN (talk) 23:01, 18 July 2018 (UTC)

I see that happens in the list of victories for a team. Is it also in other places? I will fix the sorting when I rewrite the code to list victories faster. It will maybe be in 1 or 2 weeks. --Dipsacus fullonum (talk)05:58, 19 July 2018 (UTC)
And "Cycling race/teamroster" and maybe even in "Cycling race/calendar" in which this opportunity has already been made for the column "Racing". — GAN (talk) 10:19, 19 July 2018 (UTC)
I was thinking about sorting the riders both by first name and by last name, like in the examples here. What do you think? --Dipsacus fullonum (talk) 16:53, 30 July 2018 (UTC)
Cycliste Date de naissance Nationalité
Enrico Battaglin 17 novembre 1989   Italie
George Bennett 7 avril 1990   Nouvelle-Zélande
Lars Boom 30 décembre 1985   Pays-Bas
Koen Bouwman 2 décembre 1993   Pays-Bas
Stef Clement 24 septembre 1982   Pays-Bas
Floris De Tier 20 janvier 1992   Belgique
Cycliste Date de naissance
  Enrico Battaglin 17 novembre 1989
  George Bennett 7 avril 1990
  Lars Boom 30 décembre 1985
  Koen Bouwman 2 décembre 1993
  Stef Clement 24 septembre 1982
  Floris De Tier 20 janvier 1992
Why not, but it is difficult to differentiate the Last name from the first name automatically in many cases (Spanish for instance). Psemdel (talk) 21:28, 30 July 2018 (UTC)
Yes, you can only know the family name for sure if it is stated with family name (P734). We have the same problem now when it only sorts on family name. --Dipsacus fullonum (talk) 21:46, 30 July 2018 (UTC)
The first column in the second table (where only the flags) is interested is how it's done for the races in and As for sorting the riders. In Ru-wiki, articles about people in most cases are named in the format "Surname, Name" (separated by commas. That is not "Enrico Battaglin", but "Battaglin, Enrico"). Accordingly, in the tables based on the module, they are displayed in the same form. Therefore sorting in ru-wiki at the moment by default is obtained by last name. — GAN (talk) 12:45, 31 July 2018 (UTC)

Proposal: Move all translations and local configuration to Module:Cycling race/lang

Hi, I propose that all translations and configuration is moved to the submodule Module:Cycling race/lang. This will make the main module smaller and faster to load saving both time and memory resources, give less updates on Wikidata with less risc of edit conflicts, and it will also make it possible to load and parse the translation tables only once per page instead of once per {{#invoke:}} call, which will also save time when you for instance have several classification tables or other lists in one article.

I am willing to make the change if it has your support. Best regards, --Dipsacus fullonum (talk) 05:23, 21 July 2018 (UTC)

There was already a short discussion in the section #l10n above on this page. I support this idea. —MisterSynergy (talk) 06:35, 21 July 2018 (UTC)
It seems there was mostly support in the previous discussion, but for some reason it was not done. I imagine a system where you have something like this in the lang submodule:
conf = {
   doSomething = true,
   doSomethingElse = false,
translations = {
   Stage = 'Etapa',
   Distance = 'Distancia',
   Winner = 'Ganador',
and something like this in the main module:
   if conf.doSomething then
       -- Do something here
   local tableCell = '<td>' .. (translations.Stage or 'Stage') .. '</td>'
That way you avoid doing any function calls, so I think it will be very fast. --Dipsacus fullonum (talk) 08:15, 21 July 2018 (UTC)
PS. We could even simplify the last line in the example to
   local tableCell = '<td>' .. translations.Stage .. '</td>'

with a little metatable magic to make translations[key] return key as the value if it isn't defined. --Dipsacus fullonum (talk) 09:17, 21 July 2018 (UTC)

I was once working on it but could never finish it. Especially the formatting of dates has caused me trouble. My playground was at Module:Version_2/l10n. Maybe you can reuse some of it. --Pasleim (talk) 09:33, 21 July 2018 (UTC)
What I did in my "draft", was to section the code in chapter I) Functions used for link II) functions used for time.. X) translation Y) listofwinners ... We can split, but we can also structure. Psemdel (talk) 10:41, 21 July 2018 (UTC)
I agree. I think the translations and configurations should be structured so the things used by each template is grouped together as much as possible, so the local maintainers can more easily find what to translate and configure. That will also make it easier to add new sections for new functionality later. The submodule should preferably contain only tables, strings, numbers and boolean values (no functions), so it can be loaded by mw.loadData. --Dipsacus fullonum (talk) 11:26, 21 July 2018 (UTC)
This module "Module: Cycling race / lang" in addition to the support of translation, adds in the tables (lists) with the composition of the team, the results of the stages and the classification of the column in which the country that the racer represents is represented. This stretches the table, especially with long names (In Ru-wiki, post-Soviet racers have a long spelling of the name). Without this module, citizenship is indicated only by the flag. Therefore, the question. Will it be possible to take into account the choice of how to display the citizenship of the rider? — GAN (talk) 23:00, 22 July 2018 (UTC)

Small bug

Hello, for listofteams, if no team is present in the item, it returns "Erreur Lua dans Module:Cycling_race à la ligne 2927 : attempt to concatenate local 'header' (a nil value)." Psemdel (talk) 07:49, 28 July 2018 (UTC)

Hi, I will fix it. Do you have an example (Q-id on Wikidata, page on any Wikipedia) I can use for testing?. --Dipsacus fullonum (talk) 14:04, 28 July 2018 (UTC)
By the way, I fixed another bug for classification lists: A crash if no rank is given on Wikidata. Exampel is es:Boucles de la Mayenne 2018#3.ª etapa. --Dipsacus fullonum (talk) 14:12, 28 July 2018 (UTC)
@Psemdel: With that error message occuring at line 2927, I think the problem was that no team category could be found for a team. I have uploaded a new module version to fix that, and also to fix other error messages if no country could be found for a team in listofteams, or if no country could be found for a rider or team in a classification. The problem with no team category for a team may be due to an attempt to merge Lotto Soudal Ladies/2015 (Q21011822) and 2015 Lotto-Soudal (Q18654923) at juli 21 leaving both items in a bad state. I have restored the two items. --Dipsacus fullonum (talk) 17:36, 28 July 2018 (UTC)
Yes, it is because there was no team therefore no category. So a second "if not header..." was needed. It seems to work now. Don't worry for that :). Psemdel (talk) 20:10, 28 July 2018 (UTC)

Function p.generalclassificationforttt

Hi friends. I have introduced function p.generalclassificationforttt as a function for "general classification for TTT races" like Open de Suède Vårgårda TTT (Q26266060), Hammer Sportzone Limburg (Q47479346), Hammer Stavanger (Q47479348). It is similar as "Cycling race/teamtimetrialclassification", but due it that was only for stages using stage classification (P2417), we need a function for CG using general classification of race participants (P2321). Repf72 (talk) 00:49, 3 August 2018 (UTC)

Example: 2017 Open de Suède Vårgårda TTT (Q27555311)

Lua error in Module:Cycling_race at line 4049: attempt to concatenate field 'header_1_text' (a nil value).

Nice. --Dipsacus fullonum (talk) 19:03, 3 August 2018 (UTC)

Race winners lists

I collected on my page User:GAN a list of races for which there is a full list of prize winners for all years so as not to search for them by separate wikis. And separately races for the UCI World Tour. Can it be worth placing them on a separate page so that everyone can add races to this list for which there are all the winners? — GAN (talk) 08:56, 3 August 2018 (UTC)

@GAN: Excellent. I am datafilling some listofwinners. As you could see, I had datafilled lots of races that include recently Tour de France (Q33881) and Vuelta a España (Q33937) and some months ago Giro d'Italia (Q33861) but it had the problem that did not show teams as winners up to User:Dipsacus fullonum fixed the problem. The most slow activity is it to collect exact start time (P580) and end time (P582) for stage race (Q1318941) or point in time (P585) for single-day road race (Q2912397) races, in order to not put a point in time (P585) only with the year. Repf72 (talk) 16:20, 3 August 2018 (UTC)
@GAN: All "UCI World Tour" per stages races in your list are done (one day races hope soon) so now it is possible to replace palmares with {{Cycling race/listofwwinners|Qxxx}} due they have all years and winners and datafilled cases as "declared desert" positions. For Presidential Cycling Tour of Turkey (Q930866) there is the challenge if someone want to help to find pending positions to fullfill this race, but current information available are also fulfilled. Repf72 (talk) 19:53, 5 August 2018 (UTC)
90% of the women races are done, thanks Repf72, no need for a list here, just look on WP:fr as I always use the wikidata listofwinners when available. Psemdel (talk) 20:44, 8 August 2018 (UTC)
I also look at such lists in fr-wiki. But it's convenient when creating a new page about the race and you can immediately place a list of winners with the help of the module. And there are cases that the page about the race has already been created, and the list for the module appears much later. For example, as they now appeared for all the grand tours. Here for such situations I decided to create a similar list of races so that I could add races that received all the prizes for the module. A kind of analog Wikidata:WikiProject Cycling/2018 racesGAN (talk) 12:33, 9 August 2018 (UTC)

@Psemdel, Jérémy-Günther-Heinz Jähnick, Hejsa, GAN: 100% of current UCI World Tour races has listofwinners completed, validated and also replaced the old tables at eswiki (including aboverow tags and footnotes). The only race with some data pending is Presidential Cycling Tour of Turkey (Q930866) and if someone can find entire list I can complete this race. Repf72 (talk) 13:50, 29 August 2018 (UTC)

@Repf72: Presidential Cycling Tour of Turkey (Q930866) - added another 4 years. Deutschland Tour (Q160696) - a complete list of winners, but you may need to remove Levi Leipheimer because of doping. Tour of China (Q1073205) is logical to leave for the races from 1995 to 2011, and since 2012 separately Tour of China I (Q56550809) and Tour of China II (Q56651671)GAN (talk) 21:38, 18 September 2018 (UTC) @Repf72:
@Repf72: + Eindhoven Team Time Trial (Q1311792) and Paris–Tours (Q499337). From the ProTour there was only the Züri-Metzgete (Q157475)GAN (talk) 23:59, 18 September 2018 (UTC)
@GAN: Deutschland Tour (Q160696) was "under construction", now is ok. About the second message is not clear what do you mean. Repf72 (talk) 01:21, 19 September 2018 (UTC)
@Repf72: "+" in the sense of plus. That is, he has fully contributed all the winners in two more races (Eindhoven and Paris-Tours). And almost completely Zurich. The missing positions are the riders absent in the Wikidata. And there will be lists of all races of ProTour and World Tour. — GAN (talk) 20:10, 19 September 2018 (UTC)

References in infoboxes

Hi all, I am working on rewriting the infobox code to be much faster. It have taken longer to find a good design for the code than I thought at first, but I think I finally have a good solution but it is not finished yet. Infoboxes can take local values for all fields from arguments in the template, and make references to all results to show Wikidata's source for the information. But I cannot find any testcases for this. Can anyone give examples of races where the results are sourced on Wikidata, and of existing infoboxes which show the sources from Wikidata in references? And I would also like to have any examples of infoboxes with local values from the template, so I can test if these things are working. Thank you, --Dipsacus fullonum (talk) 19:03, 3 August 2018 (UTC)

--> image locally–Roubaix_2016
--> pencil icon shows that the data from the wikidata
--> in ru-wiki in the winners' list, the wikidat icon is present opposite each entryШаблон:Cycling_race/listofwinners

??? — GAN (talk) 22:16, 3 August 2018 (UTC)

Thank you, GAN. The French infobox is not made by Module:Cycling race, but another French module to make infoboxes with data from Wikidata. So I am still looking for infoboxes (made by Module:Cycling race) with references (like the <ref>-tag in wiki text) --Dipsacus fullonum (talk) 22:50, 3 August 2018 (UTC)
I found the answer with a SPARQL query:
SELECT DISTINCT ?race ?raceLabel WHERE {
  ?race wdt:P31/wdt:P279* wd:Q15091377.
  ?race p:P1346 ?statement.
  ?statement prov:wasDerivedFrom ?ref .
   SERVICE wikibase:label
           { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }

Try it!

Examples of infoboxes with references are fr:Tour de Cologne 2015 and da:Paris-Roubaix 2018. --Dipsacus fullonum (talk) 17:27, 4 August 2018 (UTC)

p.infobox rewritten but take care

Hello, I have rewritten p.infoboxes which makes infoboxes for races, in order to make it faster. Before my test page with 6 infoboxes used 4.3 seconds and 28 MB memory. With the new code it uses 0.4 seconds and 2.5 MB memory for the same content.

However a lot of code is moved around or rewritten, so it may contain new bugs. The infoboxes looks exactly as before in dawiki, but they may have changed in other wikis as the code contains a lot of wiki-dependent code which is hard for me to test. So please be careful when you use this code and test if it works for you. I will try to fix any bugs you report here.

@Repf72: The bug for national teams winning the team classification not in the infobox is solved.

The infobox for stages (p.stageinfobox) is not changed yet. I will do that next. --Dipsacus fullonum (talk) 16:03, 10 August 2018 (UTC)

  • . probably does not support the two parameters in part of (P361) - the race enters simultaneously into two tournaments

If does not complicate. Heading Cyrilic "тест." There {{Cycling race/teamroster|Q45837766}} There the composition of the team is not displayed. In other cases where we use the analogous template there are no problems.

GAN (talk) 16:08, 10 August 2018 (UTC)

@Dipsacus fullonum: Awesome. Thank you very much, now I can see team winner at 2017 Tour de l'Avenir (Q36092437). New code is now active at eswiki and checking for bugs. Repf72 (talk) 16:10, 10 August 2018 (UTC)
bag (talk) 16:29, 10 August 2018 (UTC)
Fixed. --Dipsacus fullonum (talk) 17:18, 10 August 2018 (UTC)
@Dipsacus fullonum: I updated the module again. Error in ru-wiki with two tournaments remained. — GAN (talk) 18:04, 10 August 2018 (UTC)
@GAN: Sorry, I was not clear. Only the last thing (es:Vuelta a Castilla y León 2015) is fixed yet. The error in ru:Шаблон:Cycling race/infobox ({{Cycling race/infobox|Q20872499}}) is caused by a wrong variable name in line 4612. The line should be:
              if sitelink2 then return '[[' .. sitelink2 ..'|' .. mw.ustring.gsub(sitelink2, " %b()", "") .. ']]' end
I don't know about ru:Участник:GAN/Черновик#тест. I have not changed "teamroster". Is it a new error? --Dipsacus fullonum (talk) 18:31, 10 August 2018 (UTC)
@Dipsacus fullonum: This is an old mistake. But I do not know Lua. So I wanted to ask you to see what the problem of knowledgeable people is. — GAN (talk) 20:08, 10 August 2018 (UTC)
I will look at ru:Участник:GAN/Черновик#тест later when I rewrite the teamroster function. --Dipsacus fullonum (talk) 20:19, 10 August 2018 (UTC)

Listofstages - Conflict

@Psemdel, Jérémy-Günther-Heinz Jähnick, Hejsa, Douglasfugazi, GAN: This huge effort to standardize our module Wikidata and also Wikipedias, needs adequate and complete datafilling. For stage-races, in many cases the information is provided by race organizers, but few races give the "icon" for stage profile to fulfill if one stage is plain stage (Q20646667), hilly stage (Q20646670), medium mountain stage (Q20680270), mountain stage (Q20646668), but gives stage profile to set adequate profile and if someone have better information can set a profile that fits better, example changing medium mountain stage (Q20680270) for hilly stage (Q20646670). For example in 2018 Vuelta a Burgos (Q55577797) is clear that stages like 2018 Vuelta a Burgos, stage 3 (Q55577816) or 2018 Vuelta a Burgos, stage 5 (Q55577824) are famous mountain stage (Q20646668), but some users like User:Vlaam simply change all profiles to round (Q18131152) starting an "edit war" due was not possible direct dialog. The opinions about this issue were only treated in a local context at frwiki at frwiki here. Due many Wikipedias uses "module Cycling race" and it affects to all, I want to show this situation to all, inviting with respect User:Vlaam in order to try to have a consensus about this. Repf72 (talk) 16:35, 11 August 2018 (UTC)

Thank you to contact the project on the topic. I am not 100% sure, but I understand it this way:
  • If it is not clear if a stage is flat/hilly.. "stage" should be used.
  • If we know, then the correct item should be used.
Vlaam has nothing against the fact to specify the type of stage (even though right now it is not very easy to see it). But it has to be correct. For instance Q52540701 is clearly flat procyclingstats. He wonders why you want it to be a hilly stage oldid? Psemdel (talk) 16:52, 11 August 2018 (UTC)
@Psemdel: We have lot of races with edit war 2018 Vuelta a Burgos (Q55577797), 2018 Tour du Poitou-Charentes (Q56010988), 2017 Tour du Poitou-Charentes (Q37860935), 2018 Tour de Wallonie (Q55120023). The knowledge of the community should be add efforts so it implies to datafill adequate profile but Vlaam just eliminate profiles even in cases of races well known as all the stages of 2018 Vuelta a Burgos (Q55577797) with no explanation. If these changes only (no stage icon at listofstages) affect the frwiki and frwiki's collaborators accept it, there would be no problem, but these changes affect everyone.Repf72 (talk) 17:09, 11 August 2018 (UTC)
If someone claims that a stage is an instance of plain stage (Q20646667), hilly stage (Q20646670), medium mountain stage (Q20680270), mountain stage (Q20646668) or whatever, they have to give a source so the claim can be verified, if it is disputed. Without a source others may remove the claim. So prove your claims instead of edit war. Why don't you select or make an icon for an unspecified type of stage to display in listofstages? --Dipsacus fullonum (talk) 19:30, 11 August 2018 (UTC)
Even if sometimes I can't support Vlaam, I must recognize he has a knowledge about some points. I give the page Wikidata:WikiProject Cycling/Sourcing Wikidata. If for informations we can found them in databases, it can't be the case for other informations and we have an informations that are not trivial, in these cases the user must add a source. It is a good solution for everybody, by adding a source you can permit to other users to verify where your informations come. By experience, it is sometimes very difficult to determine the profile of a race, especially when it occurs years ago. In some time, we should prefer just to write it is a stage if we have no more informations. Even a start and a finist town can be mistaken because we don't know exactly when the cyclists race. Even if we know the parcours, it can be difficult to make a difference between types of stages. The message if not especially for Repf72, it is for everybody, sometimes all is not black or white, and we don't see the things on the same mannear. Jérémy-Günther-Heinz Jähnick (talk) 20:29, 11 August 2018 (UTC)

So to sum up:

I must add that I really find this discussion right here really surrealist. Psemdel (talk) 08:01, 12 August 2018 (UTC)

There is such another site There the profile stages are also indicated by icons. And in some cases it's better than on (talk) 20:52, 12 August 2018 (UTC)
The point is it is sometimes difficult to make a difference between type of stages. Repf72 comes from Colombia, and for him, it is possible he has different notions. To give and exemple, around me, all is flat, and correspond to plain stages. But when I rode at Boulogne-sur-Mer the last month, it was for me medium mountain stage (Q20680270) at least. The idea when we have a doubt is first to add a source. Then we can always consider it is possible to have a discussion. But I think there are no idiot questions. On Wikipedias, we also have a long tradition of wikidramas, dignified of The Young and The Restless, and we keep in French an expression called "pinailler pour une virgule". Finally, we should be positive with this discussion ==> it can be difficult to define the profile of a stage, and we can have different opinions about a stage. Having this discussion show our community is 1) alive (it is important) & 2) healthy. Jérémy-Günther-Heinz Jähnick (talk) 10:26, 13 August 2018 (UTC)
The stage races can have between 300 to 600 data and the best source will always be the official page of the race, but having to reference each data as a solution to the complaints of those who do not complete any data and only audit the result final, is an invitation to not collaborate more.
It would be much more constructive to respect the work of who went to the official website, extracted the contents, prepared and filled the data and respect starts with contributing to the efforts already made with investigating the non-conforming data so that the race could be very well documented with the correct profile in case of disagreeing with the already completed, instead of without any justification remove it.
One of the many advantages of the module, is not having to deal with the design of a page and these "contributions" that leave the listofstages as a puzzle with only the icon of "time trial" and the rest unbalanced, do not contribute much.
Clearly those who document European careers from a distance can make mistakes, it would be quite beneficial to know the correct answer and not a simple "I'll erase what you did" up to you can bring me some reference. Repf72 (talk) 03:51, 14 August 2018 (UTC)

@Psemdel, Jérémy-Günther-Heinz Jähnick, Hejsa, Douglasfugazi, GAN: We have a new conflict for 2018 Vuelta a España stage 19 (Q47295700) at 2018 Vuelta a España (Q47295669). As we know it was a "plain stage" with a "finish at the top" very hard and that was decisive and won by Thibaut Pinot (Q460872). So, what is the stage profile we should use to datafill with accuracy the instance of (P31) for that stage? Do we use plain stage (Q20646667)  , hilly stage (Q20646670)  , medium mountain stage (Q20680270)   or mountain stage (Q20646668)  ? According with someone it was a plain stage (Q20646667)   because here says "2 étapes de plaine avec une arrivée au sommet" but plain stage (Q20646667) only consider first part of the stage and not the hard climb so any wikipedia unprepared reader (our clients) could think that 2018 Vuelta a España stage 19 (Q47295700) was really plain and Thibaut Pinot (Q460872) won that stage because he could be a sprinter. Douglasfugazi and me changed the profile for medium mountain stage (Q20680270) and there were reversed. Instead of make an eternal discussion about what profile we should use, may be necessary review application of current icons, to see if they the best or if they are complete or see if it is necessary to define some new icon for "plain stage with a finish at the top" (some "plainstagefinishtop.svg", new wikidata element, include it the the code and so on). What do you think? Who can make a version of   if it is necessary create an icon for "plain stage with a finish at the top"? We should include more icons?. Repf72 (talk) 08:23, 19 September 2018 (UTC)

A new icon is a good idea, as this kind of stages is quite common. In all case, I agree with you it is not a "flat stage". Medium mountain seems a good compromise. Psemdel (talk) 16:54, 19 September 2018 (UTC)
Icon As an option, edited the icon "itt uphill." Accordingly, the stage can be called a "finish in the mountain." Color can be made in yellow tones. At the same time Q42148058GAN (talk) 17:43, 19 September 2018 (UTC)
The icon proposed by GAN could be perfect, but as he says should be made in yellow tones in order to be consistent with "medium difficult" shown by medium mountain stage (Q20680270)  . @Hejsa:, could you do a similar icon for "plain stage with a finish at the top" (something like: Plainstagetopfinish.svg) like the proposed by GAN but using same yellow as   instead of brown?. Regards. Repf72 (talk) 16:12, 20 September 2018 (UTC)
La présentation du parcours par les organisateurs est la suivante : six étapes de plaine et deux « étapes de plaine avec une arrivée au sommet », six étapes de moyenne-montagne, cinq étapes de montagne et deux contre-la-montre individuels. Pas de septième étape de moyenne-montagne. En outre, sur le site officiel, dans la tableau, l'étape est clairement référencée comme "plat"/"flat". Je ne vois pas de raison d'y déroger, et certainement pas parce que nous n'aurions pas la petite image qui correspond.Vlaam (talk) 14:09, 26 September 2018 (UTC)
(English after) Vlaam (talkcontribslogs), Repf72 ne contredit pas que l'étape ait été classée en plate, mais c'est tout de même quelque peu absurde cette classification. Nous ne sommes ni des concombres ni poissons rouges, on voit bien que cette étape n'est pas plate. La présenter comme telle sur wikipédia est quelque peu trompeur pour le lecteur. Il y a beaucoup d'étapes de ce type sur les GT, je vois pas où est le problème à créer cette catégorie. Elle est pour le coup facilement vérifiable.
Vlaam, Repf72 never said that the organiser doesn't classify it as "flat", but still it doesn't make much sense. As we are intelligent people, we are able to see that this stage is not flat. It would be deceiving for the wikipedia readers to present it as such. Moreover, there are a lots of stages from this kind in the GTs. I don't see why we could create it. It is in addition easy for everyone to verify the criterium if a stage is of this kind or not. Psemdel (talk) 20:58, 26 September 2018 (UTC)
Pour expliquer, il y a du texte. Expliquer que l'étape est classée « étapes de plaine avec une arrivée au sommet », ça se fait aisément. Expliquer que l'organisateur la classe « étapes de plaine avec une arrivée au sommet » mais que nous la classons moyenne-montagne parce que ça nous fait plaisir, ça va être plus difficile à expliquer en respectant l'exigence de source. Vlaam (talk) 06:27, 27 September 2018 (UTC)
Le principe de Wikidata, c'est justement qu'on peut s'en passer du texte. Si c'est pour avoir plus de boulot qu'avant ce n'est pas la peine. Quel est le problème avec cette nouvelle icône? Psemdel (talk) 21:03, 2 October 2018 (UTC)

Global variables

Psemdel made an edit with the summary "i remove the local, as I use it for infoboxes on WP:fr, maybe if someone can tell me how to access from outside to these lists (is there a "private" mode?)". Use of global variables is often considered bad practice for several reasons:

1. Pollution of global name space

Unexpexted global variables from other modules can give some very subtle and hard to find bugs. Examples:

1 -- Example 1
2 local module1 = require("Module:Module 1") -- Module 1 defines a global variable foo
3 local module2 = require("Module:Module 2") -- Module 2 also defines a global variable foo
5 local someValue = module1.someFunction() -- Can give unexpected results because becuase global variable foo was changed in line 3
 1 -- Example 2
 2 local module1 = require("Module:Module 1") -- Module 1 defines a global variable foo
 4 local function func()
 5     local foo = getFoo()
 6     if foo ~= nil then -- Test for success
 7         --[[ ERROR! You always execute this code even if getFoo() returned nil, because
 8              then foo will refer to the global variable foo coming from module1 ]]
 9         doSomething(foo)
10     end
11 end
2. You can more easily find typos if you avoid globals

It can be hard find misspelled variables like Foo or fo instead of foo when every unknown identifier in Lua is considered a global variable. If you have no globals, you can catch uses of misspelled identifiers by a metatable for the table that contains all globals. The very simple module Module:No globals does exactly that, and it is therefore often included in other modules.

3. Access to local variables is much faster

Local variables are stored in virtual registers, while global variables are stored in the table _G. Therefore access to local variables is much faster than access to global variables. This is not an issue for code which is executed only once or a few times, but it can of significance for instance in loops. (That is also why you see code like this):

bar = "Hello"
local funcion foo()
    local bar = bar -- For faster access to bar
    -- Do something
How best to access variables from other modules

Ideally included modules should not define or change any variables, so all access should happen via the modules' return value.

Example 1
1 -- This is module 1
2 local p = {}
3 p.hello = "Hello world"
4 return p
1 -- This is module 2
2 local module1 = require("Module:Module 1")
3 local hello = module1.hello
Example 2
1 -- This is module 1
2 local p = {}
3 local hello = "Hello world"
4 function p.getHello()
5     return hello
6 end
7 return p
1 -- This is module 2
2 local module1 = require("Module:Module 1")
3 local hello = module1.getHello()

That is why I have been changing global variables to local variables each time I have rewritten functions. I would like to complete this at some time and add require("Module:No globals"). --Dipsacus fullonum (talk) 09:43, 13 August 2018 (UTC)

Yes I know that global variables is bad practice, but as I said, I use class for another module. So we will have to return it or I have to copy it in my other module (edit: done). But understood. Psemdel (talk) 19:19, 13 August 2018 (UTC)

I come back here because I still don't understand how LUA manages the local/global function. Here I just reorder the function, without changing anything and I get "Erreur Lua dans Module:Cycling_race à la ligne 855 : attempt to call global 'getStatementForTime' (a nil value). " What is the rule (the functions have to be declared before being used?)? There is no kind of header in LUA? Psemdel (talk) 21:38, 16 September 2018 (UTC)

@Psemdel: No, you don't declare anything in lua. Functions are simply values in lua, and are neither global or local. Only variables are local or global. You can assign function values to variables, use them as arguments to other functions etc. You most likely assigned a function to a local variable, and then tried to access the local variable outside of its scope, which by lua is interpreted as accessing a global variable.
local v1 = plus(2,2) -- plus isn't defined here so it is interpreted as global variable with value nil, giving an error because a function value was expected
local plus = function(a, b) return a+b end -- assignment of a function value to a local variable
local v2 = plus(2,2) -- plus is a local variabel here with a function value
local function plus(a,b) return a+b end --[[This is another way of writing an assignment of a function to a variable (called using syntactic sugar), but the meaning is the same as above. ]]
Best regards, Dipsacus fullonum (talk) 07:41, 17 September 2018 (UTC)
Many thanks. In fact, my problem was not linked with local/global but with the order. I used a function before to declare it (which is possible in other languages with a header). I restructured the code, to make more easy to find functions. I hope it helps. Psemdel (talk) 19:57, 17 September 2018 (UTC)

The team does not display the cyclist

2014 2017
Lua error in Module:Cycling_race at line 4049: attempt to concatenate field 'header_1_text' (a nil value). Lua error in Module:Cycling_race at line 4049: attempt to concatenate field 'header_1_text' (a nil value).

The teams for which Sagan was performing are listed along with the years. In 2014 is not displayed, and in 2017 everything is fine. A similar bug came across several riders.

All one-day races of the World Tour since 2011 are now available. There are not enough Pro-Continental teams participating in some races.

GAN (talk) 13:39, 17 August 2018 (UTC)

@GAN: Thank you for finding the error. It is fixed now. --Dipsacus fullonum (talk) 18:43, 17 August 2018 (UTC)

The name of the bike race is not displayed

2016 Grand Prix Cycliste de Montréal (Q26253612) At least in the FR, ES and RU versions — GAN (talk) 14:04, 21 August 2018 (UTC)

It is because the infobox template uses 2016 Grand Prix Cycliste de Montréal (Q26837454) which is a redirection to 2016 Grand Prix Cycliste de Montréal (Q26253612). I could make a fix to follow redirects. --Dipsacus fullonum (talk) 14:23, 21 August 2018 (UTC)
It is a Wikibase Client bug, see mw:Extension talk:Wikibase Client/Lua#Redirects. I will think about a work around like using mw.wikibase.getEntity when I can get statements but unexpected no labels. --Dipsacus fullonum (talk) 18:34, 21 August 2018 (UTC)


  1. Name ----> Module_talk:Cycling_race#Official_name_rider
  1. General classification by points for 1909 Giro d'Italia (Q925176) and similar races, or the ability to change the heading of existing classifications to an arbitrary
We could do it, by using the 2nd or 3th argument of general classification. Is it really useful?
  1. We for many races in winner (P1346) indicate not only the top three of the winners, but also the owners of the test scores (points, mountains, teams). For them it is possible to make a similar template for listofwinners, the main thing is that you can specify which shirts to display as it was done for example in the Calendar and Calendarcustom,
  Done see for instance p.listofpointswinners, see Tour d'Italie féminin
  1. Templates for the results of different classifications. Two options. The first is to make it possible to locally add the results. For example, racers from a certain country. Or the second - folding from 11 lines. this will allow you to make more results and at the same time not to stretch the page.

GAN (talk) 14:04, 21 August 2018 (UTC)

I don't really get it. Psemdel (talk) 17:55, 7 October 2018 (UTC)

Error in victories function

See fr:Équipe_cycliste_Astana#Victoires, @Psemdel: --Papuass (talk) 19:21, 3 October 2018 (UTC)

Thank you for solving. --Papuass (talk) 21:24, 3 October 2018 (UTC)
If I create a new problem with my changes, I have to correct :D. Psemdel (talk) 21:40, 3 October 2018 (UTC)

Teamroster (partially) rewritten

Hello, I re-wrote Teamroster with the "principles" introduced from Dipsacus fullonum : no pcall, no entity. I haven't really changed the function in its functioning, only the syntax differs. The speed is not significantly improved to be honest, it is however easier to maintain the code now. On RU and MK wikipedia please benchmark the code first, the function seems to work differently on your WP.

I also reintroduced the use of "official name" (p1448) for the name of the riders. We can introduce it also for the classification in 1 second. I made a test, it doesn't influence the ressources. But first, I need to know if it works correctly for RU and MK (as usually :D).

Dipsacus fullonum, two questions/issues:

  • If I use "datavalue" like that, I need first a test, and then it doesn't really work (seems to be always false)
				for _, q in qualifiers(p527, v) do
					if q.snaktype == 'value' then 

If I write, it works:

			for _, q in qualifiers(p527, v) do

I don't really get the difference between both. The id is in "datavalue" no?

  • (edit:   Done)Here you can help, at line 5419 we have
pcall(function() riderTeam[i] = WPlink( changedTeam , 'team', changedTime ) end)
--riderTeam[i]  = getTeam(changedTeam, changedTime, v.qualifiers)

So still, the old, ugly WPlink. I wanted to use getTeam (second line), but I don't quite understand how works the "q" argument. Can you make it works. Thanks!

Otherwise, when we look at the main functions, only stageinfobox is still not rewritten. I let you do it as infobox-master and as it is not emergent(stage pages are any how not too full). So a huge progress already! Psemdel (talk) 11:49, 6 October 2018 (UTC)

Psemdel, something is bronken on lvwiki, see lv:Astana Team. Could be missing some sorting stuff (also needed as in ru/mk despite using Latin alphabet). --Papuass (talk) 17:16, 16 October 2018 (UTC)
Removed "errortext" from line 5578 for now (in lvwiki module). It was too hard to track its usage to initialize it properly as it was returning nil. --Papuass (talk) 17:46, 16 October 2018 (UTC)
Sorry for the disagrement, it is difficult to evaluate if it works well on wiki where I don't understand the language. If there is still problem, don't hesitate. The goal is to have a module without any compromise.

For errortext, it is filled at line 5452. It is there to display the problems, otherwise the result is wrong and everybody think it is correct... I imagine that the problem comes from the difference between variable "i" and "index[i]". For all wikipedia it is the same, except for lv, ru and mk. Edit: I imagined well! Problem found and solved in 2 minutes :) Psemdel (talk) 19:17, 16 October 2018 (UTC)

Thank you! --Papuass (talk) 07:30, 17 October 2018 (UTC)


I wrote a function startlist :). I will work on my skript to fulfill it automatically (classification of prologue on one side and classification final on the other side). Psemdel (talk) 20:17, 18 October 2018 (UTC)

Cycling race|calendarcustom

Made calendars for Challenge Desgrange-Colombo (Q1060092), but they are not displayed

UCI["CDC"] = { -- Q1060092
['1958'] = 'Q19848488',['1957'] = 'Q19848490', ['1956'] = 'Q19848487',['1955'] = 'Q19848486',['1954'] = 'Q19848485', ['1953'] = 'Q19818874',['1952'] = 'Q19848483', ['1951'] = 'Q19848484', ['1950'] = 'Q19787432',['1949'] = 'Q2081502',['1948'] = 'Q2395083'

GAN (talk) 10:31, 3 November 2018 (UTC)

Hello, I see it only now. Thank you for the feedback. I made a test, it is because I filter the class with the function calendar. Here the races you inserted have no class and are therefore filtered. I don't know: was there any class at that time? If not, then we should insert a mode "no class". Psemdel (talk) 21:27, 9 November 2018 (UTC)

Stageinfobox and end of transition phase

Hi everyone, I am very proud today to announce that I cleaned the function stageinfobox. No more pcall, no more entity. With this change the old functions can be deleted. The present code has a single pcall, and almost no entity loading. Most of the sub-functions are now common to the main functions. Of course, it is still possible to improve the elegance of the code. For instance, stageinfobox is still not as beautiful as infobox. Nevertheless, it is clearly today a milestone, as no more major changes are needed from my point of view. Psemdel (talk) 21:48, 28 November 2018 (UTC)

Hi, Psemdel! Thank you for all your effort. I just updated the code to lvwiki and there is a bug in lv:Katusha–Alpecin (but not in lv:Team Dimension Data). --Papuass (talk) 13:56, 30 November 2018 (UTC)
Nevermind: it was the same fix as last time, somehow lost. --Papuass (talk) 14:02, 30 November 2018 (UTC)
Thank you for the fix, no idea what happened. Psemdel (talk) 18:51, 1 December 2018 (UTC)
Return to "Cycling race/archive5" page.