Jump to content

Module talk:SportsRankings

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Jts1882 (talk | contribs) at 11:26, 15 December 2018 (moved talk on module from my talk page). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Updating data

Hi Jts1882, Just wondering if there's any protocol or consensus already in place for updating all the ranking data? I see that the November rankings were released, but the Module:SportsRankings/data/FIFA World Rankings page still has the data from October. Is this something that you'll be maintaining as author of the module data? Or is there a quick way to pull the data from FIFA (etc) and repopulate the data so that someone else can do it if they notice its out of date? --Philk84 Talk Contributions 12:07, 4 December 2018 (UTC)[reply]

@Philk84: I hadn't really thought about it. I can do it, but the the more people who can make the updates the better. Do you want to volunteer and I'll talk you through it?
I have an Excel file where I copy the data and use a formula to generate the appropriate lines. If the rank is in column A, teams in column B, ... points in colume E, then this formula should work:
=CONCAT("          {  '", B11, "',  ",A11,",  ",E11,", ",LEFT(C11,FIND("(",C11)-1)," },  ")
Then it just needs copying into the rankings section of the data. The name in the Ivory Coast entry also needs to be change to { "Côte d'Ivoire", xx, x, xxxx }, as unfortunately Excel only allows double quotes in strings.
If you don't have time, let me know and I'll make the changes.   Jts1882 | talk  12:38, 4 December 2018 (UTC)[reply]
I don't have time at the moment (end of year deadlines in 'the real world'), but it could be something I can look into sporadically next year. How do you get the data into Excel? Does FIFA give an export somewhere? --Philk84 Talk Contributions 12:50, 4 December 2018 (UTC)[reply]
I just copy and paste table from their rankings page. I'll make the changes. I note they have changed the format of the table so it will need a different formula.   Jts1882 | talk  12:54, 4 December 2018 (UTC)[reply]
Not sure if it would help, but as a starting point I made a quick JavaScript function that you could use, rather than having to copy everything to Excel: https://jsfiddle.net/yux387b2/ copy the JS, open the console on the FIFA page (F12 in Chrome) and paste the JS and run it (enter). It will then output the table in a similar format to what you need for the data. Next time I find some spare time, I'll try to make it grab all pages rather than just the one you're on, as at the moment you'd need to combine 5 sets of console outputs into one. I can also see about a code version of the list (FRA instead of France etc). Assuming this would be helpful? --Philk84 Talk Contributions 13:12, 4 December 2018 (UTC)[reply]
Very useful. I didn't even know that was possible. You can also change your code to put the countries in double quotes and that allows "Côte d'Ivoire".
The data module has a table of country names and codes, which is used for aliases when country code is used in {{FIFA_World_Rankings/sandbox|CIV}} (Output:
 ), although having it in the same data table might be useful in future.   Jts1882 | talk  14:04, 4 December 2018 (UTC)[reply]
Try https://jsfiddle.net/philipbkemp/sorhxqg2/2/. You'll need to copy the JS into the console, then type pullData(), change page, type pullData() again (repeating until you've called pullData() on each page). Then, use printData() to get all data, in both formats, displayed in the console output. I tried to get it to paginate automatically, but it's a bit tricky as the next page data only comes at a random time later. Hopefully this should be enough for now and you can copy/paste the output into the data file. Can you take a look and let me know if this sufficient? When I find a few spare minutes here and there, I'll see about making scripts for similar Sports Rankings datasets. --Philk84 Talk Contributions 10:08, 5 December 2018 (UTC)[reply]

References