Module talk:Cycling race

From Wikidata
Jump to navigation Jump to search

See also:

There is no automatic archiving set up for this talk page.

Contents

test the module[edit]

Bot maintaining tasks[edit]

We could collect possible bot maintaining tasks here, so I know what bot scripts to code.

  • I have found at team Colpack 2000 (Q24134332) the rider Andrea Nencini (Q20985580) as team member. which is actually a volley ball player. The right item is Andrea Nencini (Q24135035). Checking the team members whether they are riders could be a job for a bot.
  • Another job could be to move "official names" from the team item to the saison items.

--Molarus 16:06, 9 September 2016 (UTC)

The first one isn't for a bot, it's for SPARQL. --Edgars2007 (talk) 16:17, 9 September 2016 (UTC)
In my view, it could be done both ways. I would code a pywikibot script using a simple sparql-query, while for the other way a difficult sparql-query is needed. By the way, I have already written a sparql/pywikibot combination. The result is a list of wikipedia articles (see de:Benutzer:Molarus), which I´m looking into to find false wikilinks for riders. I have already used such a list to fix some problems at enWiki and after I´m done with deWiki I will create such a list for frWiki too. I will see if I can manage this without speaking french. --Molarus 20:03, 9 September 2016 (UTC)
Here is a simple SPARQL query to list riders, which doesn't have P106=(any subclass of) Q2309784. And here is another simple query for stats of all P106 values. --Edgars2007 (talk) 20:22, 9 September 2016 (UTC)
Thanks. I have tried to understand why the first query shows more false occupations than the second query, I do not understand. And I can not rewrite the second query, I have tried. The problem is, those queries are still to difficult for me. --Molarus 21:21, 9 September 2016 (UTC)
This is the code to get someone who is a rider and has the occupation speedskater. One example is Q241961 (Ellen van Dijk), who should do both. The question is: Is that true? At least this way it is possible to check that by hand (typing into the code the next occupation to check) --Molarus 21:37, 9 September 2016 (UTC)

graph-Extension[edit]

Last night I have played a bit with the graph-Extension. The result can been seen at User:Molarus/graph. The first picture with the two lines is from me, the second is an example from the documentation. I have moved the code into a lua module and the result can be seen at Module talk:Version 2 (the line). Wikipedia is using this already, see fr:Module:Graph and where it is used. This extension is about building a png-file out of data - Wikidata. On WDwiki this extension is combined with SPARQL, for example User:Smalyshev (WMF)/Test2. I think the second example on my page is interesting, because this way we could show some cycling data. I think this picture is only created new after editing an article, not like Wikidata that updates itself. I have found an tutorial: here. At the moment, I see this as an experience, I´m sure there is a reason why no one else has combined Wikidata, Lua and graph before. --Molarus 12:31, 4 October 2016 (UTC)

I have an idea for an use case: mountains. Do you remember the pictures of the mountains at the Tour de France - website?
We could say:
Cycling race/mountains|Q123|Q456|Q789
We will get a picture with a en:Slider (computing) to slide over the three mountains. I don´t know if we already have properties to add the data to the mountain items. I have found the website http://www.cyclingcols.com/ while I was writing articles for the TdF 2016. We have to add a references to the data in WDwiki too and somehow show the ref in the article. I will not start with that tomorrow, because I still have to learn writing code for graph, but I will put that on my todo-list. I see as advantage that we don´t have something like that for our articles. And drawing pictures is a lot of work. This way, I would be just adding some data to WDwiki and the lua module does everything else. Another advantage is that we have to read only the items for the mountains - very fast - therefore the creation of the picture is the most time consuming thing. I don´t know if the 10 seconds lua limit will be a problem, but we do not have to show 50 mountains in the picture. --Molarus 15:10, 4 October 2016 (UTC)

I have seen an infobox about mountains for riders at de:Mont_Ventoux#Radsport, the french version is fr:Cyclisme au mont Ventoux. Maybe we could use as property P2198 (average gradient) and P2595 (maximum gradient). --Molarus 02:41, 4 January 2017 (UTC)

victories[edit]

Since few months, we have victory (P2522) that is able to list victories of team, as we have for Verandas Willems 2016 (Q22062004). teamroster was our better success, and I think it will be similar for victories. I don't work IRL from the 15 to the 30 november, but I already write ideas about this future function here.

This project of function is interesting for users because the will only need to add a value for victory (P2522). Other information will be know because they are used by other functions. Jérémy-Günther-Heinz Jähnick (talk) 19:43, 11 November 2016 (UTC)

We will need a sorting function. Because it is not practical to have to type everything in chronological order. What about montain bike, track... victories? How will the function differentiate? Personally, I think this function is interesting, but not to prioritize. It will take in everycase a very long time until all races and stages are in wikidata. As the new year is close, I would prefer to have the infobox for racer ready (so no more "current team" update to do everywhere). Information is already in wikidata for this case. Psemdel (talk) 10:11, 20 November 2016 (UTC)
Yes for a sorting function, depending the class of the race, but also its name or the name of the cyclist. I think it is not very complex. And we have these informations, but I am a little annoyed for before 2005 because I have not enough datas about class of races. Some Wikipedias have an article about cycling race class defined by the International Cycling Union (Q22348500), but no informations about the past. For the type of victory, it is easy and we have predicted it since months : when you add sport (P641) road bicycle racing (Q3609), you add in your infobox a little logo of bike. if there is no statement, there is no logo, so the statement is in reality compulsory. The real utility of this statement was for permitting the algorithm to recognize a cycling race on road for this function. For cyclo-cross, we can imagine another function, even if we don't have for the moment articles about these races. Thanks to this statement, we can select a victory only if it concern the road cycling and exclude other victories. (I continue after) Jérémy-Günther-Heinz Jähnick (talk) 11:27, 20 November 2016 (UTC)
The new cycling season will start in a few time now, and it takes always time to get all the translations (and I ask to get translators on meta, silence radio... trist for a such project). We have a big part of articles about UCI race and I think 2017 will see all these articles for some Wikipedias (I think at FR Wiki where we are numerous, but also at DA Wiki where an user do a very good job of translation). The idea is to permit users to create articles about seasons, and we need victories. For the cyclist infobox, the idea is good, but on FR Wiki we have again a hand of users that will again make loose our time, I remember in august 2015 when we adapt the infobox for Wikidata and mid-september 2016 when a well know user and his friend decide to delete/neutralize the function to display family saying "there is no consensus" when this function was here since the adaptation of the infobox with Wikidata... So I guess if we do this infobox now, even if thanks to the Prise de décision we don't need to take the opinion of these FR Wiki users, we will again have these users on the back, even if everything works perfectly ("Wikidata is the devil"...). I add that all is far to be perfect on this side. Even if we can define the current team, we are not able to display all the former teams : in some case, even if it become rare, we haven't the official name of teams. On other case, it lacks all the previous teams, and even items for some of them or clubs. Sometimes, there is a problem on Wikidata, see the team Peugeot and Z where nobody is agree, or Bianchi. And the worst is we don't have written if a cyclist is an amateur in its team. We also have the case of the team Armée de Terre which become continental and where cyclist became pro where they were previously amateurs in their team. The idea I propose is to write a patch and give it to our contacts to adapt their infobox during few months. This patch will permit to display the current team and nothing else, this way users will save a little time. For me, this infobox will be the more complex to build, it is my opinion. I also guess we will hear : "and if the user prefer directly write the teams on Wikipedia". Don't forget an user, alway the same, makes problems with teamroster last week. Again a time he is alone in its battle but never stops. Jérémy-Günther-Heinz Jähnick (talk) 12:20, 20 November 2016 (UTC)
Another thing that would be nice and not too long, would be to adapt "Infobox Compétition sportive" (infobox for races), in order to get automatically the country, the last winner, the winner with most victories... Psemdel (talk) 17:03, 20 November 2016 (UTC)
Yes and no. It suppose we have all the datas on Wikidata for the winner with the most victories. For the country it is easy and for the last winner, it suppose we have in has part (P527) all the editions of the race. It is the case for the youngest races, but not again for others. I will say on the technically point, it is not so difficult. The problem again a time is human : see here. At the end of june 2015, I ask to use three properties, the date of creation, the date of dissolution and the sport. The admin Supertoff was responsible of a loss of time, and I get these three properties only at the beginning of february 2016, seven month later. So I prefer working to create new functions we can give to a maximum of Wikipedias instead loosing my time on FR Wikipedia. The fact is it is more easy to give a new function that improve an existing template. It is one of the reason that explain the Projet:Wikidata was "killed". Jérémy-Günther-Heinz Jähnick (talk) 18:21, 20 November 2016 (UTC)
You say for the youngest races, but if you can use Cycling race/listofwinners, you have already the whole list of winners. It is not really an issue. The point is only: I update wikidata to have the listofwinners updated. But still, I have to go in each Wikipedia to adapt the "last winner". That is really a waste of time. Psemdel (talk) 12:05, 27 November 2016 (UTC)

I have started by listing all the races of "Verandas Willems 2016" (Q22062004) at Module talk:Version 2. Next step is sorting the races after time, course and class? Maybe I will start with sorting after time and improve the sorting while adding the other data. A more difficult problem will be building a good course column, because we can´t take the label for that. Point 2 says that there are three winning possibilities: One day race, a stage and a stage race. And it is not always: stage, a comma, and the name of the race, for winning a stage. In german, they put the stage data as last information. And "1re étape" must be translated for each wiki. For the country we will take the lang module and if there is no lang module only a flag will be shown. This way, the lua time will be shorter.

Maybe it would be nice to have the option to tell the table in the article to display only certain victories. As options, I could think about certain classes, certain raiders, only stage races or only one day races. At deWiki, they add at the stage articles victory tables depending on "UCI WorldTour 2016", "UCI Europe Tour 2016", ... and they have victory tables like de:UCI Europe Tour 2016. I don´t think they will substitute their tables by this table. I see rather the use of this table by more unknown teams and older seasons. I don´t know what makes sense, but I think this way we could make more out the list of victories. We would need a good way to tell the table what to do. --Molarus 22:24, 17 February 2017 (UTC)

I have developed a new feature, see Module talk:Version 2. There is a small warning sign in the table header and the warning message is the tooltip. At the moment the warning is always on, later, this warning sign will be shown only when an error occurs. The warning messages are translatable and they could be used in other tables too. We could have this feature for all wikis or editors could switch that feature on in the lang module. It that is OK, I would add more error messages. Comments?

Now, class="wikitable sortable" is in the table, but I have to add additional data to tell the sorting code how to sort right. I will need some time to understand that template (in frWiki, it is Modèle:Sortname). Lets see if this is a better alternative then coding a sorting algorithm myself. --Molarus 02:30, 19 February 2017 (UTC)

I´m writing the code for sorting the date and I have found some problems, where I would like to get some help. My solution is to build a sortkey consisting from: year month day. I have found two problems: 1 ) What is the right sortkey for a multi day race? The startday or the endday? 2 ) If I have as date only the year or a year and a month, what is the right sortday? At the moment my solution for both questions is: startday and for both cases the 31 December. At Module_talk:Version_2 you can see both problems. I´m printing the year as date for the two races with problem 2. By the way, I have switched off the sorting for the races column.
Next step is building a nice race name. --Molarus 01:52, 28 February 2017 (UTC)
As predicted, I come back for a few weeks. Since the beginning of January I traveled about 2500 kilometers by bike in my constituency to distribute leaflets to prepare the legislative elections. My commitment ended yesterday, I think to take a new, surely beginning in April. I will take this day to read all I must know. Jérémy-Günther-Heinz Jähnick (talk) 10:10, 1 March 2017 (UTC)
Hi. Nice, you are back. Nothing important has happened here. Maybe, this is a good news. There was one thing: I have written a note to editors at jaWiki and arWiki about the new feature of displaying team names in non-latin script. I got no reaction from jaWiki, while Mr. Ibrahem said the code works fine for arWiki. --Molarus 11:15, 1 March 2017 (UTC)

I have worked at printing the right name of a stage victory. Code for that is at line 170 - 183. I´m getting the word "stage" and its translations from Q18131152. At the moment, I have the code for the stage victories for en, fr, de and other wikis. I have to look tomorrow how the other wikis write that information and this way more wikis do not have to print the fall back version. There is the possibility that we do not have the number of the stage in the item. I´m testing this by asking WD for 'P1545x'. In this case I will print a question mark and write, for example, in french ?e étape. Is that OK? PS: I have just remembered that there could be a stage zero, a prologe. So I have looked into our module and maybe I should take the translations from function func_prologue and stageLink? Or maybe both? If there is no translation in the code, look into WD? OK, I will find an answer for that tomorrow or the day after.--Molarus 01:41, 2 March 2017 (UTC)

Ok, so I take my time to read and understand. For a multi day race, we take the end time (P582) because the final general classification occures the last day. It is the same day of the last stage, and a cyclist can win the last stage and the final general classification, it makes two victories. Interesting the option that permits to dispatch the victories according the circuit thanks to P361, as Germans do. If we have no dates, it is not normal, the information should exist, so I propose the consider the race occures at the end of the year. With Verandas Willems 2016, we have an interesting case because we don't have add informations for all races.
Yes for the word stage. Normally, we always have a statement for the number of the stage because it is compulsory for listofstages. Jérémy-Günther-Heinz Jähnick (talk) 16:49, 3 March 2017 (UTC)

Maybe there should be the possibility to use this table not only in season articles, but in team articles too. This way, the small wikis could use this table too, since they do not have season articles. This could be done by using the "has part" (P527) properties. Maybe we should allow the victory property in team items too or rather we should assume that some editors will use the victory property this way too. There is one problem: Season articles have the "has part" property too, but they list riders. Therefore we have to be sure it is no list of riders, which could be done by looking for a P31:human. --Molarus 16:54, 3 March 2017 (UTC)

Tomorrow, I will start testing the table (as it is now). I have seen lots of season items with the victory property, therefore I have enough data for testing. --Molarus 21:56, 4 March 2017 (UTC)

The code for the victory table is at frWiki, see fr:Utilisateur:Molarus. I had to rewrite parts of the code, but I´m confident that the code is far better now. Still, I´m not 100% sure that there is no error anymore. Problem is, that the items could be in good and in bad condition and I have not tested all possible conditions. At the moment, the code is only at frWiki. If you want some changes, please tell me. --Molarus 06:09, 9 March 2017 (UTC)

I prepare the call on fr:Modèle:Cycling race/victories. Is it possible to rename the function in the code victories ? It is to make a parallel with listofteams or listofwinners. The result is very good. For the moment, it lacks the flag of the country of the cyclist, and a link to the item of the race, when we speak of a stage race. I see also more space between entries, as we have on FR Wiki fr:Saison 2017 de l'équipe cycliste Quick-Step Floors. I like space in articles.
On a second time, I am interested if we can test new things. For example, QST wins the Dubai Tour, in a interested if we can write just before general classification (Q691836). Fortunately we have an item. Then, it is just an idea and it is for French Wiki, the idea is to replace the comma in some cases. For example, 1re étape, Tour Alsace will become 1re étape du Tour Alsace. Du is the french for of the. If the algorithm recognize the item of the race start with Tour, it will know he must replace the comma by du. In the same order, I have in memory :
  • des for Trois, Quatre, Boucles
  • du for Triptyque, Tour, Grand Prix, Circuit, Mémorial, Trophée
  • de la for Ronde, Semaine, 'Classica, Flèche, Course, Classique
  • de l' for Étoile
For other races, we are not able to define what word will replace the comma, but it is not a problem. Another day, we will see for national championship. Jérémy-Günther-Heinz Jähnick (talk) 12:08, 9 March 2017 (UTC)
The first race in Module talk:Version 2 is Q28125545 (Contre-la-montre masculin aux championnats d'Australie de cyclisme sur route 2017) and I´m showing the official name (P1448) of the race, which is "Championnat d'Australie du contre-la-montre" in french. If there is no official name in the language of the wiki or in english or french, I show the label of the item. This is the solution I have found for the problem with the national championship.
The function is renamed and the rider got a flag in frWiki. I have seen in your examples, that some riders are season articles. I have not looked so far why this error. What do you mean with a link to the item of the race, when we speak of a stage race? Do you mean that for "2e étape, Tirreno–Adriatico" the "2e étape" should link to the article "2e étape, Tirreno–Adriatico" and "Tirreno–Adriatico" to the article "Tirreno–Adriatico"?
The space and a better french name for the races is for tomorrow. I think, I will work on the remaining problems in Module Version 2 and copy the fixes later to frWiki. --Molarus 00:36, 10 March 2017 (UTC)
I think more something like this. A link to the section of the stage of the article and for the race simply the link to the race 2017. This point has a problem on FR Wiki because a bot passed and modify the template, see here. By the past, we had {{2e}} étape, now it is {{2e|étape}}. This point is not very important.
For championships, I had another idea. If we put the official name in the item, we had to do the work each year, idem for translaters. So I think it would be better to write it in the item given for instance of (P31), Australian National Time Trial Championships (Q22284183) for this case. This way, we have to do this for line race and time trial for around 150 countries, it is more easy if in more I create a kit to translate for this. Jérémy-Günther-Heinz Jähnick (talk) 10:13, 17 March 2017 (UTC)
Most of the new french race articles I have seen do not use the new system and therefore the wikilinks for those articles would not link to the right section. In the old system it is "Tirreno-Adriatico_2017#7e_.C3.A9tape" and in the new system it is "Paris-Nice_2017#7e.C2.A0.C3.A9tape". There is a nonbreaking space (& nbsp;) between 7e and étape in the new system.--Molarus 14:52, 18 March 2017 (UTC)
Yes, I remember an user do a big modification by bot few monthes ago, and discussions occured on the main space discussion of FR Wiki. I wasn't part of these discussions.
I see on the display of Module talk:Version 2 we have 3ae étape des Trois Jours de La Panne instead of 3e a étape des Trois Jours de La Panne. Jérémy-Günther-Heinz Jähnick (talk) 11:24, 20 March 2017 (UTC)
Thanks, I didn´t see this error.
This bot has created so many problems. Another one is fr:Trois_Jours_de_La_Panne_2016#3ea_.C3.A9tape versus fr:Tour_de_Grande-Bretagne_2016#7e.C2.A0.C3.A9tape_A. In the second example it is written 7e étape A. The result is that I do not know what Wikilink I should build to link to the section 7ea étape and 7eb étape. What a mess.
Next step is to fix the error, improve the french code for the prologue, optimize the whole code and adapt the improved code to all language versions.
--Molarus 13:49, 20 March 2017 (UTC)
Ok. I also have see a problem with Etixx-Quick Step 2016 on fr:Modèle:Cycling race/victories : I decide to do few weeks ago a test with a team with numerous wins, and discover races were not added. So I add them, but when the table is displayed, we have not by default a sort by the date, we have a sort by the order of statement on Wikidata. No problem for halves stages if you don't make a link, it is very rare we have this case. I see on FR Wiki on SEG Racing an user add manually the victory and doesn't see the change due to the modification of the template (and see that by mistake he writes Fabio Jacobsen as Danish where this cyclist comes from the Netherlands, a mistake due to the name, a problem that cannot occure with Wikidata). Jérémy-Günther-Heinz Jähnick (talk) 18:49, 21 March 2017 (UTC)
I have the code for sorting and I hope it is without an error. This is the algorithm: en:Insertion sort (my code is a bit changed). The code is simple and for sorted data there is almost no additional lua time necessary. frwiki is updated. --Molarus 22:43, 21 March 2017 (UTC)
Perfect. To continue with details, I would be interested if we can have a link to classes (1.UWT, 2.2...) to the first value of part of (P361), if we have a statement for this. Generally the link will be this year for UCI Europe Tour 2017. A sort is also needed to group possibly races by classes. On FR Wiki, we have something like span style="display:none with a number. Here, I don't know if it would be better to apply this solution or to apply another, because we are surely able to directly sort these classes.
For national championships, I have a doubt between official name (P1448) and name (P2561). I think more at the second solution. For an item as 2016 German National Time Trial Championships (Q27055558), we will never have articles, but we have an item for German National Time Trial Championships (Q27055700) thanks to the instance of (P31), and this item have thanks to part of (P361) German National Road Race Championships (Q80798). This last item always have an article. The case is specific to the national championships. A national championship can be recognized with CN (Q22231119). By a little different way, we learn that the 2016 German National Road Cycling Championships (Q27055507) part of (P361) 2016 national road cycling championships (Q22021840). I will surely discuss with Anthony59999 to write a little documentation for championships, because even for me the subject is a little difficult. Jérémy-Günther-Heinz Jähnick (talk) 18:02, 22 March 2017 (UTC)
I do not know what sortkey order I should use. It is at the moment: 1.UWT, 2.UWT, 1.HC, 2.HC, 1.1, 1.2, 2.1, 2.2, 1.Ncup, 2.Ncup, 1.2U, 2.2U, CC, CN, CDM, 1.WWT, 2.WWT That is done at line 60 (class_sort) at Module:Version 2. --Molarus 21:08, 27 March 2017 (UTC)
For men, it seems good, I have a doubt for Ncup and U23. For women, I ask the opinion of @Psemdel:. I think classes should be interlocked between mens and women as CDM, 1.UWT, 1.WWT, 2.UWT, 2.WWT, 1.HC, 2.HC, 1.1, 1.2, 2.1, 2.2, 1.Ncup, 2.Ncup, 1.2U, 2.2U, CC, CN. Jérémy-Günther-Heinz Jähnick (talk) 09:35, 29 March 2017 (UTC) PS : I was partly false, I found this at fr:Projet:Cyclisme/Usages#Victoires. Jérémy-Günther-Heinz Jähnick (talk) 10:08, 29 March 2017 (UTC)
Yes it should the same as for the men. This order is in everycase perfectly arbitrary, there is no need for a long debate. Psemdel (talk) 16:16, 29 March 2017 (UTC)
I have two items I do not see in the french table: CC (Q22231118, championnats continentaux) and CDM (Q23015458, Coupe du monde). On the other hand, I have no item for a "Championnats du monde" "CM" or is this CDM? Example race Q27150066), a "UCI ProTour (PT)" race and a Calendrier historique (HIS) race. I think, we have no items for the older races and therefore we will not see any data in the class column fo them. By the way, we do not print "WT", but 1.UWT, 1.WWT, 2.UWT, 2.WWT. Another point: In the french list for 2.HC there are different numbers: 03 and 5. I´m taking "03" as sorting key. --Molarus 16:38, 29 March 2017 (UTC)
It seems for Women races there is only "UCI World Tour féminin" available, see fr:Saison_2017_de_l'équipe_cycliste_Cervélo_Bigla#Victoires. Therefore only a WPlink to "UCI World Tour féminin 2017" is shown in the french article. Categories like 2.HC for women do not exist, instead items like "Calendrier international féminin UCI 2017" is added into the race items. We could use such an article as Wikipedia link target too, but we would have to create an item for "Calendrier international féminin UCI", I think, and add them into items like "Calendrier international féminin UCI 2017".
I have moved the new code to frwiki and it seems the code works. I think, now it is time to try to internationalize the victories table. I do not know how much time that will need, because more then testing the code and correcting errors is needed. --Molarus 01:46, 4 April 2017 (UTC)
I let @Psemdel: respond to these points, I am a little lost with these histories of classes.
Few points are again to solve, I have a look on fr:Modèle:Cycling race/victories. First case, if the race is recognized as a stage race thanks to its classes, we need to have general classification (Q691836) written before the comma or the article. By using an item for translations, it is a little more easy to acquire them. Second points, to display the championhips, the last points are the display of a short name, I use name (P2561) for New Zealand National Time Trial Championships (Q22303252). This will permit to display all the translations we need. For the CN, we can make a link to 2017 national road cycling championships (Q28005879). Normally we always should have the correct way, even if there is a late in the development when we compare to other UCI races. I will see after for other points. Jérémy-Günther-Heinz Jähnick (talk) 09:10, 4 April 2017 (UTC)
I didn´t use the item to get the translations for "general classification". Since we already have in function victories_translate the translation for "Victories" (header of the table), it is no problem to add "general classification" too and users are used to this way. --Molarus 04:44, 5 April 2017 (UTC)
What is the question? Fpr the UCI Calendar, it is Q27765666 (if you want to link something to the 1.1 and so on). For the sorting, don't worry, it is imho not very important. Psemdel (talk) 07:00, 5 April 2017 (UTC)
Ok. Jérémy-Günther-Heinz Jähnick (talk) 18:58, 6 April 2017 (UTC)
I just have detected a little bug about championships. When we add the class CN as second value for instance of (P31), we lost the good display, see Module talk:Version 2 for the case of the USA. In my opinion, we should ignore CN (Q22231119) and CDM (Q23015458). Jérémy-Günther-Heinz Jähnick (talk) 10:23, 17 April 2017 (UTC)
Do you mean we should not display CD and CDM races anymore? The easiest solution for this is not to insert such races into the items.
About the problem: I think this is no error. I have updated frwiki, your last update was from 9. Avril. It do not work at Module Version 2 because items should have a property P2561 like Q22303252 and the USA item looks like this Q24731482 (rather empty). I had updated Module Version 2 to work for deWiki already some days ago. This way I know what I have to do to make the code work for all the other wikis too.
Sorry for not answering, I was not online at Wikidata due to a lack of motivation. --Molarus 23:20, 19 April 2017 (UTC)
No, I have problems to explain it in English. When we have an item for a championship where instance of (P31) has only one value, so the race, all works perfectly for the name. When we have two values, the natur of the race and its class, the system no longer works. So the idea is to "blacklist" classes as CN to avoid interferences (hard for me to explain). Psemdel says me that a problem occured with the last update, classement général is replaced by Victoires, see on fr:Modèle:Cycling race/victories. I guess it is just a detail. Classement général is just for stages races, when a team wins a single day race, it is always the general classification.
Idem, I also suffer from a lack of motivation. I am unable to go on races this year (surely the time of route), and to write articles. IRL, I am no longer motivated to work since march. I hope I will success to restart to work.
Yes, I do a test for championships and it works. I start little to little this work today. Jérémy-Günther-Heinz Jähnick (talk) 10:24, 21 April 2017 (UTC)

Hi, as I have already told Jérémy, I am using the function for all teams and found out some issues (no worry, we will correct them). As he said, now I get "victoire, Race... " for most of the races. But also I have a problem with all 2.2 from USA (yes sorry it is so), where the stages don't display. I get the issue for Tour of the Gila and here and also here for Tour of the Gila and Joe Martin Stage Race. For European 2.2 no problem, for instance here Psemdel (talk) 22:46, 21 April 2017 (UTC)

I think I have fixed both problems. Problem 1 was that I did not copy the new update for function victories_translate, but the second problem was more difficult. I think, the difference to the other races is that both races have no Wikipedia articles at all. In this case a fallback text was shown, which prints no stage data. @Psemdel: To shorten the text "Course en ligne féminine aux championnats de Nouvelle-Zélande de cyclisme sur route" at "Équipe cycliste UnitedHealthcare Women's" I have added at Q29061811 a name property. Could you check if the french is correct? Maybe you want a different text with "féminine" somewhere in the text. This example shows you to shorten similar long Championnat names. --Molarus 20:55, 22 April 2017 (UTC)
Many thanks for the corrections. As usually everything can be explained. There are articles but for the men races (in the USA, they always do both in parallel). For the name is there a difference between "P2561" and "P1448"? Is it read for all races (because actually I prefer without "féminine" everywhere, women can't race men races so there is no disambiguation requirement)? Psemdel (talk) 08:54, 23 April 2017 (UTC)
I guess, Jérémy wanted P2561 because it is no 'nom officiel' like the team name. The 'nom' of the championship is for one country only, but for all years. --Molarus 21:26, 23 April 2017 (UTC)
Yes, it is just a name, not an official name. Jérémy-Günther-Heinz Jähnick (talk) 14:47, 28 April 2017 (UTC)
Ok. I am quite happy with this new function. What is still disturbing me by the display are the "classement général" everywhere. For 2.x can I perfectly understand of course. But for one day race, it shouldn't be. The "if" is quite easy to do: everything that start with a "1" = no "classement général" needed. People judge the display. If it is beautiful, they consider using it. If they have too many contra, they will continue using the old way. Psemdel (talk) 19:36, 29 April 2017 (UTC)
I have changed the code at frWiki. Now only races with class 2.x show "Classement général,", the other do not. Software is similar to Wikipedia articles: More eyes see more problems. --Molarus 05:54, 30 April 2017 (UTC)
Many thanks, it looks good to me now. Psemdel (talk) 08:17, 30 April 2017 (UTC). Update, I thought to use the property name to delete the "women" everywhere in the name of the races. It doesn't work, but I understood why. In the code the name is read only for championship. Why?

if entity_type == 'championship' then a1, b1 = pcall(fooA, 'numeric-id', entity_race, 'P31', entity_num) if a1 == true then entity_l = mw.wikibase.getEntityObject( 'Q'..b1 ) a2, b2 = pcall(fooA, 'text', entity_l, 'P2561', 1) -- show the "name" if a2 == true then local lang_WD, text_WD for _,v in pairs(entity_l.claims["P2561"]) do lang_WD = v.mainsnak.datavalue.value.language text_WD = v.mainsnak.datavalue.value.text if wiki == lang_WD or wiki == 'www' then label_x =text_WD break end end end Psemdel (talk) 09:09, 30 April 2017 (UTC)

I´m not sure if I understand you. For example fr:Saison_2017_de_l'équipe_cycliste_féminine_Sunweb#Victoires shows "Circuit Het Nieuwsblad féminin" and the wikilink is to "Circuit Het Nieuwsblad féminin 2017", since this article exists. The label is taken from Q2973966. I guess, if you change the french label to "Circuit Het Nieuwsblad" maybe with "Circuit Het Nieuwsblad féminin" as alias label, that new text would be shown. By the way, at enWiki the name of the race would be shown as "Omloop Het Nieuwsblad – women's race". --Molarus 14:02, 2 May 2017 (UTC)

I have copied the code for the table from frwiki to WDwiki and added code that this table works only at frWiki and WDwiki (in function p.victories the code checks if wiki is Wikidata ('www') or frWiki). We have the same for references, which only works in enWiki, frWiki and deWiki. I think, the next step is to add code for more wikis, step by step. Maybe daWiki could be next? By the way, I have seen that function func_error_message has no french translation. You can see at Module talk:Version 2 a small error sign in the header of the table. If the mouse is on this sign the tooltip is shown, which says that the property x in item y is missing. At the moment only text written in english is shown. Could you add a french translation into function func_error_message? I like this new feature and maybe we could have this feature for more tables in the future. --Molarus 09:46, 9 May 2017 (UTC)

Cadel Evans Great Ocean Road Race 2017 (Q22977069) and Australia as best team with the function infobox[edit]

Hi Molarus. This morning I update this article, and I see we have a little problem to display just the name of the country for this best team : Australian men's national road cycling team 2017 (Q27927235). I don't know if the problem is new because I don't remember if we already have had a best team that was a national team. Jérémy-Günther-Heinz Jähnick (talk) 11:18, 29 January 2017 (UTC)

I don´t understand the problem. At fr:Cadel Evans Great Ocean Road Race 2017 "Meilleure équipe: Australia" is shown. What do you want to see in the infobox? --Molarus 17:51, 29 January 2017 (UTC)
Normaly, as for listofteams, we should have the algorithm that take the name of the country in the correct language. Here, we have Australia because I add in speed official name (P1448), but it is not good. If we have had Germany, the problem will be more visible. In french we say Australie. Jérémy-Günther-Heinz Jähnick (talk) 18:28, 1 February 2017 (UTC)
I hope, I have fixed it, without adding new errors into the code. That was really difficult. The new code is at frWiki and WDwiki. I have tested in frWiki some articles and it looks good, but it is still to early to be sure.
Now, in item Cadel Evans Great Ocean Road Race 2017 (Q22977069) the "best team" statement has a value for P54 "équipe d'Australie de cyclisme sur route 2017" too (as, for example, the "winner of the sprint classification"). It seems, without that P54 in the infobox no data is shown for the "best team", which is not optimal. I´m not sure if there is a solution without that additional P54.
It seems we had never before a national team as team winner. The reason was, I guess, we have dealt before only with U23 teams, which are not that good.
--Molarus 03:16, 3 February 2017 (UTC)
Yes, generally these teams have cyclist that are not the bests. I am a little lost with this P54. Jérémy-Günther-Heinz Jähnick (talk) 14:42, 4 February 2017 (UTC)

UCI-Id[edit]

Since 1-1-2017 each rider gets a new UCI-Id (link), maybe a new property. --Molarus 17:42, 29 January 2017 (UTC)

Yes. I will wait until the end of the week (I am not often at home in this moment). Jérémy-Günther-Heinz Jähnick (talk) 18:29, 1 February 2017 (UTC)

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

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[edit]

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"[edit]

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)[edit]

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 .
  OPTIONAL {
    ?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[edit]

@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)

Update:

  • 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[edit]

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)

translate[edit]

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[edit]

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[edit]

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[edit]

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. 185.141.223.184 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)

Errors[edit]

--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)

Return[edit]

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[edit]

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[edit]

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)

l10n[edit]

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[edit]

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)

Special:LintErrors/missing-end-tag[edit]

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[edit]

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[edit]

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[edit]

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

Wikidata-logo S.svgAnnéeVainqueurDeuxièmeTroisième
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018

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)

Participants[edit]

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[edit]

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)[edit]

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?[edit]

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 https://c.radikal.ru/c33/1801/d1/2ef69a059ac9.png 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 https://a.radikal.ru/a27/1801/cf/b0d7a3afbbbd.png 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 — Emoji u1f44d.svg

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?[edit]

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[edit]

Introduction[edit]

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.

Suggestions[edit]

  • ✓ 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.

Structure[edit]

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[edit]

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 }}

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.[edit]

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)┘

Sorting[edit]

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)

Jerseys[edit]

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[edit]

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
Wikidata-logo S.svgClassement général
CoureurPaysÉquipeTemps
1erChristopher Froome maillot jaune de leader du classement généralGBR Royaume-UniSky89 h 04 min 48 s
2eRomain Bardet FRA FranceAG2R La Mondiale+ 4 min 05 s
3eNairo Quintana COL ColombieMovistar+ 4 min 21 s
4eAdam Yates maillot blanc de leader du classement du meilleur jeuneGBR Royaume-UniOrica-BikeExchange+ 4 min 42 s
5eRichie Porte AUS AustralieBMC Racing+ 5 min 17 s
6eAlejandro Valverde ESP EspagneMovistar+ 6 min 16 s
7eJoaquim Rodríguez ESP EspagneKatusha+ 6 min 58 s
8eLouis Meintjes RSA South Africa (en)Lampre-Merida+ 6 min 58 s
9eDaniel Martin IRL Ireland (en)Etixx-Quick Step+ 7 min 04 s
10eRoman Kreuziger CZE Czech Republic (en)Tinkoff+ 7 min 11 s
Source : ProCyclingStats Cycling Quotient


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[edit]

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[edit]

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%...

Answers:

  • 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[edit]

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[edit]

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)
Wikidata-logo S.svgAnnéeVainqueurDeuxièmeTroisième
2006USA Floyd Landis declared desertedUSA Bobby Julich
2007USA Levi Leipheimer GER Jens Voigt USA Jason McCartney
2008USA Levi Leipheimer GBR David Millar USA Christian Vande Velde
2009USA Levi Leipheimer USA David Zabriskie AUS Michael Rogers
2010AUS Michael Rogers USA David Zabriskie USA Levi Leipheimer
2011USA Chris Horner USA Levi Leipheimer USA Tom Danielson
2012NED Robert Gesink USA David Zabriskie USA Tom Danielson
2013USA Tejay van Garderen AUS Michael Rogers COL Janier Acevedo
2014GBR Bradley Wiggins AUS Rohan Dennis USA Lawson Craddock
2015SVK Peter Sagan FRA Julian Alaphilippe COL Sergio Henao
2016FRA Julian Alaphilippe AUS Rohan Dennis USA Brent Bookwalter
2017NZL George Bennett POL Rafał Majka USA Andrew Talansky
2018COL Egan Bernal USA Tejay van Garderen COL Daniel Martínez

{{Wikidata Infobox}} for Wikimedia Commons categories[edit]

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[edit]

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)

Non-ranking[edit]

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 https://www.wikidata.org/wiki/Q27864166GAN (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 no label (Q54881674). Psemdel (talk) 10:48, 10 June 2018 (UTC)

One cycling team - two elements[edit]

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[edit]

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?

Wikidata-logo S.svgClassement de l'étape
CoureurPaysÉquipeTemps
1erPieter Weening NED Pays-BasRoompot-Oranje Peloton4 h 33 min 47 s
2eMaximiliano Richeze ARG ArgentineEtixx-Quick Step+ 2 min 37 s
3eMaciej Paterski POL PologneCCC Sprandi Polkowice+ 3 min 57 s
4eKristjan Koren SLO Slovenia (en)Cannondale+ 4 min 13 s
5eWilco Kelderman NED Pays-BasLottoNL-Jumbo+ 4 min 31 s
Wikidata-logo S.svgClassement général
CoureurPaysÉquipeTemps
1erWilco Kelderman maillot jaune de leader du classement généralNED Pays-BasLottoNL-Jumbo22 h 43 min 12 s
2eWarren Barguil FRA FranceGiant-Alpecin+ 16 s
3eAndrew Talansky USA États-UnisCannondale+ 19 s
4eIon Izagirre ESP EspagneMovistar+ 34 s
5eMiguel Ángel López COL ColombieAstana+ 39 s


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


Wikidata-logo S.svgVictoires
DateCoursePaysClasseVainqueur
20 Jan2e étape du Tour Down UnderAUS Australie2.UWTAUS Jay McCarthy
17 Feb1re étape, Vuelta a AndalucíaESP Espagne2.1ITA Daniele Bennati
19 Feb3e étape, Vuelta a AndalucíaESP Espagne2.1ITA Oscar Gatto
21 Feb5e étape, Volta ao AlgarvePOR Portugal2.1GBR Geraint Thomas
18 MarHandzame ClassicBEL Belgique1.1SVK Erik Baška
27 MarGent–WevelgemBEL Belgique1.UWTSVK Peter Sagan
31 Mar3eb étape, Three Days of De PanneBEL Belgique2.HCPOL Maciej Bodnar
3 AprTour of FlandersBEL Belgique1.UWTSVK Peter Sagan
9 Apr6e étape du Tour of the Basque CountryESP Espagne2.UWTESP Alberto Contador
9 AprClassement général, Tour of the Basque CountryESP Espagne2.UWTESP Alberto Contador
23 Apr5e étape du Tour of CroatiaCRO Croatia2.1RUS Tinkoff
15 May1re étape du Tour of CaliforniaUSA États-Unis2.HCSVK Peter Sagan
18 May4e étape du Tour of CaliforniaUSA États-Unis2.HCSVK Peter Sagan
5 JunPrologue, Critérium du DauphinéFRA France2.UWTESP Alberto Contador
12 Jun1re étape du Tour de SuisseSUI Suisse2.UWTSVK Peter Sagan
13 Jun2e étape du Tour de SuisseSUI Suisse2.UWTSVK Peter Sagan
22 JunContre-la-montre masculin aux championnats de Pologne de cyclisme sur routePOL PologneCNPOL Maciej Bodnar
26 JunCourse en ligne masculine aux championnats de Pologne de cyclisme sur routePOL PologneCNPOL Rafał Majka
26 JunCourse en ligne masculine aux championnats de Grande-Bretagne de cyclisme sur routeGBR Royaume-UniCNGBR Adam Blythe
26 JunCourse en ligne masculine aux championnats de République tchèque de cyclisme sur routeCZE Czech RepublicCNCZE Roman Kreuziger
26 JunCourse en ligne masculine aux championnats de Slovaquie de cyclisme sur routeCZE Czech RepublicCNSVK Juraj Sagan
3 Jul2e étape du Tour de FranceFRA France2.UWTSVK Peter Sagan
13 Jul11e étape du Tour de FranceFRA France2.UWTSVK Peter Sagan
18 Jul16e étape du Tour de FranceFRA France2.UWTSVK Peter Sagan
27 Jul1re étape, Danmark RundtDEN Danemark2.HCITA Daniele Bennati
29 Jul3e étape, Danmark RundtDEN Danemark2.HCDEN Michael Valgren
31 JulClassement général, Danmark RundtDEN Danemark2.HCDEN Michael Valgren
6 AugClassement général, Vuelta a BurgosESP Espagne2.HCESP Alberto Contador
9 SepGrand Prix Cycliste de QuébecCAN Canada1.UWTSVK Peter Sagan
18 SepEuropean Road Championships – Men's elite road raceFRA FranceSVK Peter Sagan
21 Sep3e étape, BinckBank TourBEL Belgique2.UWTSVK Peter Sagan
22 Sep4e étape, BinckBank TourBEL Belgique2.UWTSVK Peter Sagan
16 OctUCI Road World Championships – Men's road raceQAT QatarSVK Peter Sagan

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)

Problem[edit]

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)[edit]

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)

Fuga Pinarello -> Fuga (Breakaway)[edit]

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[edit]

Bonjour,

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[edit]

>> 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[edit]

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 https://da.wikipedia.org/w/index.php?title=Modul:Sandkasse/Dipsacus_fullonum/Modul:Cycling_race&oldid=9599832 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
	else
		return t
	end
end

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
		else 
			snak = getCascadedValue(best, var, 'mainsnak', 'datavalue', 'value', mode)	
		end
		temprank = getCascadedValue(best, var,'rank')
		return snak, temprank 	
	else
		return nil
	end
end

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
	else 
		return mw.wikibase.getLabel(teamID) -- No official name, try label	
	end
end

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 https://da.wikipedia.org/w/index.php?title=Modul:Sandkasse/Dipsacus_fullonum/Modul:Cycling_race&oldid=9603208 --Dipsacus fullonum (talk) 16:25, 15 July 2018 (UTC)
Bugfixed version: https://da.wikipedia.org/w/index.php?title=Modul:Sandkasse/Dipsacus_fullonum/Modul:Cycling_race&oldid=9603239 --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[edit]

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[edit]

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[edit]

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)