Template talk:COVID-19 pandemic death rates by country

Latest comment: 2 years ago by Jroberson108 in topic Date of last update. Location

Change to template format

edit

I have suggested adding this template to COVID-19 pandemic by country and territory, but this would require changing the format of the template to be a box with scrolling, the same as Template:COVID-19 pandemic data. See the discussion at Talk:COVID-19 pandemic by country and territory#Add new template?. Do other editors agree to this change and if so does anyone know how to do it? Dudley Miles (talk) 11:46, 27 August 2020 (UTC)Reply

That would be a bad idea. It would make the page here a lot less useful. Plus it is unnecessary. I believe they could include this template as is. In other words, this template could be put inside a separate scrolling template. Or inside a vertically scrolling div. See:
https://www.google.com/search?q=vertically+scrolling+divs
A vertically scrolling div or table can also have expand/collapse links. Some expanding divs or tables are set up with only a "expand" link. I prefer that they also have the "collapse" link that shows up too. Some people want to get past long lists quickly when done with them, and go back to scrolling through the prose. That is not easy if a table stays open after expansion, and can't be closed back to its original size.
But all that can be done in the other article. Nothing has to be changed with this template. See:
Help:Table#Scrolling
Help:Table#Collapsible tables
Help:Collapsing
mw:Manual:Collapsible_elements
--Timeshifter (talk) 18:31, 27 August 2020 (UTC)Reply
Mfb. Can you please advise what to do? This is way beyond my technical knowledge. I agree with Timeshifter that it is best to keep this template as it is and do the conversion in the article. Dudley Miles (talk) 18:35, 27 August 2020 (UTC)Reply
In the end they may end up just copying the data from the source like we do. Some very complex CSS and tables are used for their existing data table:
Template:COVID-19 pandemic data
--Timeshifter (talk) 18:51, 27 August 2020 (UTC)Reply
It's much more difficult to get that in a nice format if the table has no idea that it will be included in such a div. The other template has the expansion/scrolling elements included for a good reason. Maybe I'll play around with it a bit at some point, let's see, but making the display nice for every browser and screen resolution could be a mess. --mfb (talk) 19:00, 27 August 2020 (UTC)Reply

(Unindent). The simplest thing may be just to put the template in a fully collapsed table in the other article:

COVID-19 pandemic death rates by country.
Updated November 10, 2024.
COVID-19 pandemic cases and mortality by country[1]
Country Deaths / million Deaths Cases
World[a] 885 7,073,453 776,753,553
Peru 6,601 220,975 4,526,977
Bulgaria 5,677 38,751 1,337,733
North Macedonia 5,428 9,990 352,043
Bosnia and Herzegovina 5,117 16,402 403,960
Hungary 5,069 49,092 2,236,219
Croatia 4,805 18,775 1,348,642
Slovenia 4,686 9,914 1,359,884
Georgia 4,519 17,151 1,864,383
Montenegro 4,317 2,654 251,280
Czech Republic 4,093 43,687 4,811,887
Moldova 4,039 12,281 650,609
Latvia 3,973 7,475 977,765
Slovakia 3,882 21,249 1,883,895
Greece 3,806 39,639 5,727,906
San Marino 3,693 126 25,292
Romania 3,594 68,899 3,566,594
United States 3,531 1,206,141 103,436,829
Lithuania 3,496 9,848 1,400,088
United Kingdom 3,404 232,112 25,010,212
Brazil 3,338 702,116 37,511,921
Italy 3,313 197,542 26,826,486
Chile 3,297 64,482 5,403,559
Martinique 3,159 1,104 230,354
Poland 3,149 120,897 6,758,426
Armenia 3,046 8,778 453,016
Gibraltar 3,002 113 20,550
Belgium 2,949 34,339 4,889,242
Paraguay 2,940 19,880 735,759
Trinidad and Tobago 2,934 4,390 191,496
Argentina 2,878 130,697 10,106,404
European Union[b] 2,819 1,265,282 186,262,640
Portugal 2,786 29,027 5,669,567
Russia 2,772 403,557 24,572,846
Colombia 2,758 142,727 6,394,361
Aruba 2,708 292 44,224
Ukraine 2,677 109,923 5,541,305
Sweden 2,670 28,006 2,765,204
Serbia 2,658 18,057 2,583,470
Guadeloupe 2,653 1,021 203,235
France 2,615 168,091 39,024,965
Mexico 2,603 334,783 7,622,283
Spain 2,547 121,852 13,980,340
Bermuda 2,547 165 18,860
Guam 2,536 419 52,287
Austria 2,485 22,534 6,082,860
Tunisia 2,427 29,423 1,153,361
French Polynesia 2,318 650 79,451
Saint Lucia 2,293 410 30,288
Uruguay 2,266 7,686 1,041,682
Liechtenstein 2,262 89 21,605
Suriname 2,256 1,406 82,503
Estonia 2,220 2,998 612,467
Sint Maarten 2,182 92 11,051
Bahamas 2,135 849 39,127
Barbados 2,100 593 108,835
Germany 2,080 174,979 38,437,756
Finland 2,058 11,466 1,499,712
Grenada 2,035 238 19,693
Ecuador 2,022 36,055 1,078,795
Andorra 1,994 159 48,015
Panama 1,989 8,756 1,044,987
Republic of Ireland 1,937 9,900 1,750,138
Lebanon 1,905 10,947 1,239,904
Kosovo 1,869 3,212 274,279
Bolivia 1,853 22,387 1,212,149
Costa Rica 1,844 9,374 1,235,724
Puerto Rico 1,832 5,938 1,252,713
Hong Kong 1,798 13,466 2,876,106
Montserrat 1,787 8 1,403
Malta 1,751 925 123,136
Monaco 1,720 67 17,181
Belize 1,708 688 71,430
Denmark 1,680 9,919 3,442,484
British Virgin Islands 1,669 64 7,628
Curaçao 1,645 305 45,883
South Africa 1,644 102,595 4,072,813
Iran 1,640 146,837 7,627,863
Switzerland 1,611 14,170 4,468,044
Collectivity of Saint Martin 1,591 46 12,324
Cyprus 1,586 1,492 708,580
Guyana 1,584 1,302 74,491
Antigua and Barbuda 1,572 146 9,106
Jersey 1,555 161 66,391
Luxembourg 1,530 1,000 396,017
United States Virgin Islands 1,525 132 25,389
Caribbean Netherlands 1,430 41 11,922
Canada 1,424 55,282 4,819,055
Namibia 1,422 4,110 172,556
Israel 1,395 12,707 4,841,558
French Guiana 1,384 413 98,041
Isle of Man 1,378 116 38,008
Seychelles 1,370 172 51,892
Netherlands 1,283 22,986 8,644,647
Albania 1,275 3,608 337,195
Jamaica 1,274 3,618 157,326
Jordan 1,254 14,122 1,746,997
Saint Vincent and the Grenadines 1,214 124 9,674
Eswatini 1,170 1,427 75,356
Turkey 1,164 101,419 17,004,729
Botswana 1,148 2,801 330,696
Guatemala 1,131 20,203 1,250,392
Dominica 1,106 74 16,047
New Caledonia 1,093 314 80,203
Malaysia 1,076 37,351 5,318,418
Palestine 1,075 5,708 703,228
Honduras 1,062 11,114 472,909
Réunion 1,056 921 494,595
Guernsey 1,051 67 35,326
Norway 1,050 5,732 1,524,523
Azerbaijan 1,005 10,353 836,474
Bahrain 1,001 1,536 696,614
Saint Kitts and Nevis 984 46 6,607
Oman 978 4,628 399,449
Australia 963 25,236 11,861,161
Fiji 962 885 69,047
Kazakhstan 951 19,072 1,504,370
Libya 891 6,437 507,269
Northern Mariana Islands 889 41 14,985
Turks and Caicos Islands 872 40 6,824
New Zealand 865 4,442 2,652,096
Anguilla 844 12 3,904
Mauritius 841 1,074 329,121
Cabo Verde 802 417 64,474
Wallis and Futuna 782 9 3,760
Belarus 775 7,118 994,038
Cuba 771 8,530 1,113,662
Sri Lanka 740 16,907 672,809
Taiwan 739 17,672 9,970,937
American Samoa 702 34 8,359
South Korea 693 35,934 34,571,873
El Salvador 673 4,230 201,960
Mongolia 630 2,136 1,011,489
Mayotte 612 187 42,027
Maldives 602 316 186,694
Japan 597 74,694 33,803,572
Philippines 586 66,864 4,173,631
Indonesia 581 162,059 6,829,704
Federated States of Micronesia 579 65 31,765
Iraq 575 25,375 2,465,545
Palau 562 10 6,372
Kuwait 559 2,570 667,290
Faroe Islands 518 28 34,658
Cayman Islands 516 37 31,472
Iceland 489 186 210,675
Thailand 484 34,734 4,803,632
Saint Barthélemy 456 5 5,507
Morocco 436 16,305 1,279,115
Vietnam 433 43,206 11,624,000
Marshall Islands 424 17 16,297
Nepal 404 12,031 1,003,450
Brunei 397 181 349,279
Dominican Republic 390 4,384 661,103
Greenland 374 21 11,971
India 374 533,653 45,044,196
Myanmar 362 19,494 643,215
Singapore 358 2,024 3,006,155
Zimbabwe 357 5,740 266,396
Sao Tome and Principe 353 80 6,771
Saint Pierre and Miquelon 347 2 3,426
Lesotho 310 709 36,138
Saudi Arabia 299 9,646 841,469
Solomon Islands 254 199 25,954
Qatar 238 690 514,524
United Arab Emirates 229 2,349 1,067,030
Egypt 220 24,830 516,023
Venezuela 207 5,856 552,695
Mauritania 204 997 63,876
Zambia 202 4,078 349,892
Afghanistan 197 7,998 235,214
Comoros 191 160 9,109
Kiribati 183 24 5,085
Cambodia 177 3,056 139,325
Bangladesh 174 29,499 2,051,463
Macau 174 121 3,514
Djibouti 166 189 15,690
Algeria 151 6,881 272,173
Kyrgyzstan 147 1,024 88,953
Samoa 144 31 17,057
Gambia 141 372 12,627
Syria 140 3,163 57,423
Cook Islands 135 2 7,375
Malawi 130 2,686 89,168
Gabon 126 307 49,056
Pakistan 125 30,656 1,580,631
Tonga 123 13 16,992
Senegal 111 1,972 89,312
Rwanda 107 1,468 133,266
Kenya 104 5,689 344,109
Sudan 102 5,046 63,993
Equatorial Guinea 101 183 17,130
Timor-Leste 100 138 23,460
Tuvalu 99 1 2,943
Laos 88 671 219,060
China[c] 85 122,367 99,381,078
Nauru 84 1 5,393
Guinea-Bissau 84 177 9,614
Uganda 76 3,632 172,159
Somalia 76 1,361 27,334
Haiti 74 860 34,556
Cameroon 71 1,974 125,279
Mozambique 68 2,252 233,845
Papua New Guinea 65 670 46,864
Republic of the Congo 64 389 25,234
Ethiopia 60 7,574 501,239
Yemen 56 2,159 11,945
Liberia 54 294 8,090
Angola 54 1,937 107,482
Madagascar 46 1,428 68,575
Vanuatu 44 14 12,019
Ghana 44 1,462 172,210
Nicaragua 36 245 16,194
Guinea 33 468 38,582
Mali 32 743 33,171
Togo 31 290 39,533
Eritrea 30 103 10,189
Uzbekistan 29 1,016 175,081
Ivory Coast 27 835 88,448
Bhutan 26 21 62,697
Central African Republic 22 113 15,443
Burkina Faso 17 400 22,146
Sierra Leone 15 126 7,985
Democratic Republic of the Congo 14 1,474 100,976
Nigeria 14 3,155 267,189
South Sudan 13 147 18,847
Tanzania 13 846 43,263
Niger 12 315 9,528
Tajikistan 12 125 17,786
Benin 11 163 28,036
Chad 10 194 7,702
Burundi 1 15 54,569
Vatican City 0 0 26
Niue 0 0 1,092
Falkland Islands 0 0 1,923
Saint Helena, Ascension and Tristan da Cunha 0 0 2,166
Pitcairn Islands 0 0 4
Tokelau 0 0 80
North Korea 0 0 0
Turkmenistan 0 0 0
  1. ^ Countries which do not report data for a column are not included in that column's world total.
  2. ^ Data on member states of the European Union are individually listed, but are also summed here for convenience. They are not double-counted in world totals.
  3. ^ Does not include special administrative regions (Hong Kong and Macau) or Taiwan.
{| class="wikitable mw-collapsible mw-collapsed"
![[COVID-19 pandemic death rates by country]]. 
|-
|{{Template:COVID-19 pandemic death rates by country}}
|}

References

  1. ^ Mathieu, Edouard; Ritchie, Hannah; Rodés-Guirao, Lucas; Appel, Cameron; Giattino, Charlie; Hasell, Joe; Macdonald, Bobbie; Dattani, Saloni; Beltekian, Diana; Ortiz-Ospina, Esteban; Roser, Max (2020–2024). "Coronavirus Pandemic (COVID-19)". Our World in Data. Retrieved 2024-11-10.

The reference will show up in the article references. I used {{talk refs}} here to place the references in this talk section.
--Timeshifter (talk) 19:28, 27 August 2020 (UTC)Reply

Timeshifter and Mfb I would strongly oppose adding the template collapsed. I think it is very important to add the death rates table to the article as total figures without taking into account population size are misleading, and the more informative comparison in this template should not be collapsed. Altering the view I gave above, I think that the change should be made in this template. It is not a problem if there is a 'show all' option. It is the article that matters, as it has more than 40,000 page views a day, not this template which has under 50. Dudley Miles (talk) 19:43, 27 August 2020 (UTC)Reply
This template has over 2000 page views per day in its current article: See page views banner at the top of Talk:COVID-19 pandemic death rates by country.
Mfb and Dudley Miles. I asked for help here:
Help talk:Table#Partially collapsed table with vertical scrolling and show/hide links?
--Timeshifter (talk) 19:51, 27 August 2020 (UTC)Reply
The template has minimal page views but I see that the article which uses it has 2000 per day. COVID-19 pandemic by country and territory has 49,000 per day. I do not see the problem with having the template partially collapsed with a show all option. Dudley Miles (talk) 20:14, 27 August 2020 (UTC)Reply
For one thing it is against MOS:SCROLL. Exceptions are made for most rules on Wikipedia. But in list articles I rarely see partially collapsed tables. There is an obvious need for an exception at COVID-19 pandemic by country and territory for the existing table.
Plus I don't understand your objection to a fully collapsed table being used at COVID-19 pandemic by country and territory. You mentioned "taking into account population size". Are you talking about adding a column for population by country? That would be difficult since the table is not in alphabetical order.
And I don't see the need. The death rates are based on deaths per population. I don't need to know the population to understand death rates. The John Hopkins University source already took care of those calculations. If you want populations we can link to a population by country article.
But let's wait for replies at the Help:Table request for help.
In the end I would rather create 2 templates if necessary. One for this article, and one for the other article. You can update the new template, and I can keep updating the template here daily. Same amount of work for you, just in the other article.
--Timeshifter (talk) 20:30, 27 August 2020 (UTC)Reply
Duplicating data is the worst option I think. Before we do that I would make a template that grabs the information from here and puts it in a different table structure. Still a bit awkward but better than having two tables with the same numbers. --mfb (talk) 21:14, 27 August 2020 (UTC)Reply
Mfb Does User:Dudley Miles/sandbox do what you are suggesting? It copies across the instructions for updating, which should not be in any of the articles which use the template. Would it be best to move them to this talk page? Dudley Miles (talk) 12:46, 28 August 2020 (UTC)Reply
@Dudley Miles: I would have thought that the obvious place to put the update instructions is in Template:COVID-19 pandemic death rates by country/doc, the documentation page for the template. You could always leave a link to it from a hidden html comment inside the template itself (like the <!-- Update table from here onwards --> message), so that every page that transcludes the template will know where to go to update it. At present, anybody using a screen reader hears that huge caption every time they call up a list of tables for the article. We should be kinder to the visually impaired. --RexxS (talk) 13:30, 28 August 2020 (UTC)Reply
Well you live and learn. I did not know that templates have a documentation page. I have done as you suggested, but I am not sure whether I have put in the link to the documentation page correctly. Please correct it if not. Dudley Miles (talk) 13:52, 28 August 2020 (UTC)Reply
@Dudley Miles: What you did was fine. I've moved it to its own line to give it a bit more prominence in case it gets lost in the clutter of the caption and reference. I've also shortened the caption because I don't think we need to attribute uncontested information and the reader will see the source if they check the reference anyway. If you think the longer caption is preferable for whatever reason, by all means add the JHU stuff back. --RexxS (talk) 14:11, 28 August 2020 (UTC)Reply

Date style

edit

I plan to add this table to COVID-19 pandemic by country and territory and that article uses British style dates. Is it OK if I change the date style in this template in order to avoid inconsistent styles in the article? Dudley Miles (talk) 10:58, 29 August 2020 (UTC)Reply

OK. --Timeshifter (talk) 14:30, 29 August 2020 (UTC)Reply
edit

See:

Dudley Miles. I suggest using numbered sandboxes. You and others can then keep working on this. From Help:Table:

Sandboxes help a lot. For example; your user page: Special:MyPage. Create and bookmark some personal sandboxes too. Visual Editor will load very fast in empty sandboxes: Special:MyPage/Sandbox, Special:MyPage/Sandbox2, Special:MyPage/Sandbox3. As many as you want. Share the link when asking for help. To find all your sandboxes: Special:PrefixIndex/User: – click link, add user name to the spot labeled "Display pages with prefix:".

--Timeshifter (talk) 06:37, 30 August 2020 (UTC)Reply

The latest version is at Template:COVID-19 pandemic death rates. Please advise any improvements needed to this. There is extra space between V.T.E. and the heading which I cannot delete. Dudley Miles (talk) 09:39, 30 August 2020 (UTC)Reply
The "show all" button needs to toggle to a "collapse" button and vice versa. It should collapse back to the scrollable chart. --Timeshifter (talk) 10:00, 30 August 2020 (UTC)Reply
I do not know how to do this. Can you advise? On my computer I can toggle by clicking the back arrow. Dudley Miles (talk) 10:11, 30 August 2020 (UTC)Reply
That is not toggling.
The experts are involved with this template: Template:COVID-19 pandemic data. See talk:
Template talk:COVID-19 pandemic data#Need a link to collapse it back to its original scroll box size
I think it needs to be done in the CSS:
Template:COVID-19 pandemic data/styles.css
I don't know how. I asked here too:
Template talk:COVID-19 pandemic data/styles.css#Collapse link needed to collapse back to the original scroll box
--Timeshifter (talk) 10:31, 30 August 2020 (UTC)Reply

Made table narrower

edit

I made the table narrower by putting breaks in the headers, and removing width: 6em; from the CSS:

  • Template:COVID-19 pandemic death rates by country/styles.css

See diff. On my monitor at the default font size the table went from 9 7/8 inches wide to 8 1/4 inches wide. --Timeshifter (talk) 11:53, 30 August 2020 (UTC)Reply

The problem with that is that anybody using a screen reader would be liable to hear line breaks every time the column header is spoken. If they are navigating around in table mode, that's every cell. We should not be sacrificing the experience for some users just to trim a couple of inches off a table width. Who benefits from that? --RexxS (talk) 12:40, 30 August 2020 (UTC)Reply
edit

Adding country links is an improvement but how do we stop them being overwritten each time the table is updated? Dudley Miles (talk) 13:24, 30 August 2020 (UTC)Reply

Timeshifter and RexxS It would be best to link to the article on the COVID-19 outbreak in each country, as Template:COVID-19 pandemic data does. This could be achieved by converting each country name from eg San Marino to {{flag+link|COVID-19 pandemic in|San Marino}}, but is there a way of automating this so that it can be done after each update? Dudley Miles (talk) 13:39, 30 August 2020 (UTC)Reply

Dudley Miles. The country links and flags are created each time you update. See instructions in the template documentation. It is instant.
I don't know how to do the links you want. I suggest looking at {{flaglist}} documentation. Template docs usually list all the other related templates. One of them might have a linking option.
Also, you might then contact User:PrimeHunter if necessary to find another regular expression to change all the links at once.
Or you might find a way with simple global find-and-replace in the wikitext. As a first or second step in combination with the existing regular expression I used from PrimeHunter.
See also: Template:Flag/doc and Wikipedia:WikiProject Flag Template#List.
{{flag+link}} exists. I thought you were making it up as a desired template. Next time, please link more. Play with find-and-replace. --Timeshifter (talk) 15:51, 30 August 2020 (UTC)Reply
Dudley Miles. I see you succeeded. That's great! Please explain in the template documentation what additional steps you took. So others can apply this here and elsewhere. --Timeshifter (talk) 16:45, 30 August 2020 (UTC)Reply

Need JHU source in caption for template in COVID-19 pandemic by country and territory

edit

See: COVID-19 pandemic by country and territory. 2 scrolling tables are in the same section.

In list articles with separate tables from different sources it is common to put the source either in the section header or the table caption. See examples:

If the 2 scrolling tables in COVID-19 pandemic by country and territory were put in different sections, then the JHU source could be put in the section header. Then it could be removed again from the template caption.

In COVID-19 pandemic death rates by country the JHU source is mentioned in the lead. So it is not really necessary to repeat the source in the table caption. Because the table is in the section that immediately follows the lead. --Timeshifter (talk) 11:29, 2 September 2020 (UTC)Reply

I think it is fine as it is. Having the tables side by side in COVID-19 pandemic by country and territory allows readers to easily compare the positions of countries with absolute and proportional figures, while having the source in the caption helps to explain why the figures for each country are slightly different in the two tables. The JHU source could be deleted from the lead in COVID-19 pandemic death rates by country to avoid repetition. Dudley Miles (talk) 11:37, 2 September 2020 (UTC)Reply
Dudley Miles. I agree with you that having JHU in the caption is fine. Especially if you want to keep the 2 tables side by side, and you want readers, including blind readers, to be able to understand the differences between the 2 tables better right away. I am talking about in COVID-19 pandemic by country and territory. The tables are in the same section, and are either side-by-side, or they follow one another. It depends on the the screen width.
RexxS apparently gave you permission to return JHU to the caption previously. See diff. And it is fine by me if you remove the JHU mention from the lead of COVID-19 pandemic death rates by country. That way blind readers will not have to hear that twice in a short time. --Timeshifter (talk) 14:33, 2 September 2020 (UTC)Reply
The table caption is used by screen readers to identify the table when calling up a list of tables in an article. We should not force them to listen to an unnecessarily long caption each time they do that. Brevity is the soul of accessibility. --RexxS (talk) 13:36, 2 September 2020 (UTC)Reply
I am not clear where the discussion has got to. I think that the two tables should be side be side in COVID-19 pandemic by country and territory so that readers can easily compare them. I am neutral on other issues. Dudley Miles (talk) 14:40, 2 September 2020 (UTC)Reply
Dudley Miles. Chris55 replied again recently here:
Talk:COVID-19 pandemic by country and territory#Add new template?
He apparently wants some explanation about the differences between the 2 tables.
I leave the location of that explanation to you.
I don't see why a blind reader would not want that explanation any less than other readers. As long as the explanation is not duplicated. --Timeshifter (talk) 14:50, 2 September 2020 (UTC)Reply
A blind visitor using a screen reader will hear the explanation of the source in the reference. The template caption is used by them to identify the table when they call up a list of tables in article. Do you see any reason why they need to be told the data comes from JHU every time they hear the list? --RexxS (talk) 16:02, 2 September 2020 (UTC)Reply

Comment. Please see previous replies. Why subject a blind reader to having to go to a reference in order to find out the difference in 2 tables at COVID-19 pandemic by country and territory? And see diff. I will be removing this template, its talk page, and COVID-19 pandemic death rates by country from my watchlist. I can find much more productive uses of my time. --Timeshifter (talk) 16:53, 2 September 2020 (UTC)Reply

Reply Please see my previous replies. Why subject a blind visitor to hearing that the data comes from JHU every time they call up a list of tables in the article. The purpose of a caption is to give a brief description of the subject of the table, which can be used to identify it. The purpose of a reference is to provide the source used for the information. They are two different things and should not be confused with each other. --RexxS (talk) 16:59, 2 September 2020 (UTC)Reply

Python Helper

edit

If anyone passing by feels like wanting to update this page, it is possible to do it in seconds by using the python script below (written by me, released here as public domain). Please only run if you are able to read it and conclude it is safe by yourself, wikimedia can't take any responsibility for scripts written by contributors. Also note that it works as of 2021-04-16, JHU can change their page formatting, and it would eventually break the script, so use your good judgment to conclude the data being generated is safe. If anything seems not correct please message brunoff asking for a fix or fix the script by yourself. Brunoff (talk) 01:30, 3 January 2021 (UTC)Reply

from requests import get as reqget
from json import loads as jsonloads
from pyperclip import copy as clipcp

t = reqget('https://coronavirus.jhu.edu/data/mortality').text
i = t.find('/static/js/main')
t = reqget('https://coronavirus.jhu.edu'+t[i:t.find('.chunk.js"',i)+9]).text
i = t.find('{"Country":{')
t = t[i:t.find('}}\'',i)+2].replace('\\xf4','ô').replace('\\','').replace('"nan"','"-"')
d = jsonloads(t)
clipcp('|-\n'.join([f"|{{{{flag+link|COVID-19 pandemic in|{d['Country'][i]}}}}}||{d['Confirmed'][i]}||{d['Deaths'][i]}||{d['Case-Fatality'][i]}||{d['Deaths/100k pop.'][i]}\n" for i in d['Country'].keys()]))

Note: the pyperclip copy is optional. It copies the table contents to the clipboard, all needed after running the script is pasting the clipboard in the template source on its correct location.

Automation of updates

edit

Hello! I'm Tol, and I've been working on automating updating of COVID-19 data templates using Module:COVID-19 data. I've discussed this with Timeshifter on my talk (permalink), and I'd like to see what the general opinion is. This would probably entail replacing deaths per hundred thousand with deaths per million, and may also include removing the case–fatality ratio (I could write some custom code to calculate it, but I'd prefer not to, and Timeshifter has brought up problems with it depending on testing rates). Please discuss at Template talk:COVID-19 pandemic death rates#Automation of updates to avoid a discussion fork. Thank you! Tol (talk | contribs) @ 17:49, 23 September 2021 (UTC)Reply

Row numbers

edit

Jroberson108. See diff. I noticed that row numbers were removed recently: {{Static row numbers}}.

I would like them returned. This is an expanded table, and many people like row numbers for ranking of any column. Row numbers are on many tables.

Keep {{Import-blanktable}} for the row highlighting and white background. And so class=srn-white-background does not need to be returned.

Keep the plainrowheaders if they are used with a white background for the row headers. Keep the scopes. --Timeshifter (talk) 21:59, 15 January 2022 (UTC)Reply

Country rank column

edit

Not sure if it's my imagination, but I'm pretty sure until recently "World" didn't have a number against it in the left-hand column (which I assume is a simple ranking). This would make sense, since "World" is always at the top. The rank is one of the most impactful and quotable columns (country **** is the ****th worse for xxx), but is now compromised (e.g. at the time of writing, it appears that Romania has the 10th worst rate of deaths, rather than the 9th).
If this has been a glitch of some sort and someone is looking at changing it back, it would be useful to exclude the rank number for the European Union as well - it's interesting to see the grouping but (especially as it moves up the table) misleading. I understand this might be a different issue, since the EU number is sorted with the rest of the data rather than remaining distinct at the top. — Preceding unsigned comment added by 2A00:23C6:7787:7601:542A:D95F:E851:B897 (talk) 11:00, 10 December 2021 (UTC)Reply

Tol. Thought you might be interested in this. --Timeshifter (talk) 12:52, 10 December 2021 (UTC)Reply
Thanks, @Timeshifter. It looks like this was a problem in Template:COVID-19 pandemic death rates by country. I've reverted the Module:COVID-19 data change that broke this. I don't think I can make the EU row not have a number. Tol (talk | contribs) @ 19:25, 10 December 2021 (UTC)Reply

Tol. Would putting the EU row at the top like this be possible in your system?:

|- class="sorttop static-row-header"
| style=text-align:left |European Union||

--Timeshifter (talk) 02:10, 11 December 2021 (UTC)Reply

@Timeshifter: Not really — the whole thing is sorted by deaths per million. "World" has a special case carved out for it so that it's always on top, but adding that for the EU would require significant changes to either
  • fork main() (the main table-generating function), which I don't really want to do — vac(), a main() fork for Template:COVID-19 vaccination data (which has a unique data fallback system) is already getting out of date, or
  • implement this as a custom option to be called in the template, like by specifying |eu_top=yes in the template, which would also be very tricky.
Tol (talk | contribs) @ 03:52, 11 December 2021 (UTC)Reply


The Country Rank number has disappeared completely. Any chance it could be restored, since it's really useful? — Preceding unsigned comment added by 2A02:C7F:8D60:9000:54D3:21E2:8795:E996 (talk) 12:22, 16 January 2022 (UTC)Reply

Jroberson108 and Tol. See above comment. I would like the row number column back too, if not too much trouble. {{static row numbers}}. --Timeshifter (talk) 19:57, 16 January 2022 (UTC)Reply
This is an issue with Template:COVID-19 pandemic death rates by country. I am moving the discussion there. Tol (talk | contribs) @ 20:01, 16 January 2022 (UTC)Reply
Moved. Tol (talk | contribs) @ 20:02, 16 January 2022 (UTC)Reply
@Timeshifter: Alright. It looks like @Jroberson108's recent edit removed the static row numbers. Tol (talk | contribs) @ 20:06, 16 January 2022 (UTC)Reply
The rank doesn't sort with the data, so it is a bit useless and misleading after a sort except to tell you how many rows there are. Jroberson108 (talk) 20:26, 16 January 2022 (UTC)Reply
After a little more thought, I realized you aren't using it as a "Deaths Ranking" column, but a general rank regardless of sort. I'll add it back. Jroberson108 (talk) 20:36, 16 January 2022 (UTC)Reply
Thanks, @Jroberson108! Tol (talk | contribs) @ 21:51, 16 January 2022 (UTC)Reply

Date of last update. Location

edit

Jroberson108. See diff. Edit summary: "Revert, table's note outside accessibility, as we already discussed."

You left the sort month above the scrolling table after our last discussion. For these templates:

So I thought you understood my point of view. You are making the date inaccessible to the vast majority of readers by burying it in the scrolling table (after one scrolls deep into the table).

So I moved the date of the last update above the scrolling table. To get to the date it is a lot easier to scroll the whole page a couple inches, versus scrolling a couple feet if already deep inside the scrolling table. That is the only way to get back to the date of the last update. --Timeshifter (talk) 14:27, 3 February 2022 (UTC)Reply

@Timeshifter: Regarding the topic of our discussion, it was about you moving the table's note on one of those tables and creating accessibility issues. The solution was fix it right or ask for help. You can look at how the note was moved on one of those tables and do the same here or ask for help. Jroberson108 (talk) 14:37, 3 February 2022 (UTC)Reply
I thought I did do it right this time. The date can be placed anywhere on a page. I believe I have placed it above the scrolling table on other pages before you got involved, and no one complained. So I was bold, and did the same this time. Please fix it. Why didn't you fix it, rather than revert it? --Timeshifter (talk) 14:52, 3 February 2022 (UTC)Reply
@Timeshifter: Now that I'm available again and have some time, I can respond. If you read the other discussion again, then you will see the issue was you moving the table's notes (content required to explain the table) outside the "aria-label", "role", and "tabindex" attributes, creating an accessibility issue for screen readers that might tab to the content, which would completely skip the table's note. If you view the source of those other tables, you will see that I also moved those attributes so the note remains contained in those attributes. I also provided links to pages that explain those attributes so that you can learn more about them.
You seem to have some additional misunderstandings, so I will try to clear those up. The table doesn't scroll and never did. What scrolls is the class="covid19-wrapper" div element that wraps/contains content, which it currently contains the VTE links, expand/collapse links, table's note, and table in that order. The table note isn't "inaccessible" as you claim and you are misusing the term, probably confusing it with "usability" (read accessibility). If the table note were inaccessible, then everything else in the scrolling div would also be inaccessible. If you recall, you asked a visually impaired user to access the content in the scrolling div with their screen reader and I also tested it with Windows Narrator, which we both could access the content without issue.
In regards to "usability", I didn't give my opinion on the other discussion, which was about the accessibility issue you created. Since you asked what I understand, then I will state it here. I don't feel moving the table's note above the scrollable div helps that much since currently a "wide" table with a "long" note are both fully readable with the same task of scrolling/swiping. A "small" note, which is what is presently there, as well as the VTE links and expand/collapse links are all fully readable before any scrolling/swiping occurs. If the table isn't "wide" and fits the width of a small device, then a "long" note would wrap to the table's width and is fully readable without scrolling/swiping. The table's note uses minimal text so it is easier to read, and it is treated the same as the table's caption, which both are "general" descriptions/explanations/clarifications about the table's "general" content with nothing too specific about any one piece of data. The column and row headers are used to distinguish the differences in the grouping of data, which is why those are sticky and not the general caption and note that don't always need to be visible when scrolling. A user choosing not to read any of it is their own choice, and quite frankly irrelevant especially since the table's note uses minimal text for easier readability and all elements are displayed in a direction English readers are accustomed to (left-to-right, top-to-bottom). Leaving the table's note in the scrollable div has the added benefit of reducing the height of the entire template. Moving the note outside the scrollable div contributes to the original problem of displaying really tall tables (219 rows in this table) and related elements on a page without the scrollable div, which takes up several pages on a desktop browser.
I understand your preference is different, and please feel free to not restate or re-explain any opinions you have already explained since I have already read it both on this discussion and the other one. I don't care for long discussions that take too much time. I don't feel strongly about the placement of the table's note since moving it only adds one line to the template's height, which is why I moved it on those other tables to your preference. Now that I have some time, I can do the same on the other tables that use the new styles. Jroberson108 (talk) 03:34, 4 February 2022 (UTC)Reply
@Timeshifter: If the usability issue is accidental scrolling, then the only thing I can think of to fix it with styles is to add a light gray border around the scrollable div to indicate where to start swipping. Otherwise, I would recommend adding a paragraph above the scrollable div inside those attributes as a summary or analysis of the table's content and leave the explanatory note inside the scrollable div. I would also recommend moving the VTE links above the paragraph as a visual indicator of where the template starts. Jroberson108 (talk) 12:35, 4 February 2022 (UTC)Reply
@Timeshifter: I adjusted the markup so the attributes are on the parent element. This will make it easier for you or others to move/add content inside those attributes and above the scrollable div. Try to maintain the same indenting on the HTML tags/elements (two spaces) so visually it is easier to identify issues. More on indenting HTML. Jroberson108 (talk) 13:41, 4 February 2022 (UTC)Reply

Jroberson108. Am I correct in assuming that the accessibility problem has been solved with this template, even though the note is above the scrolling part?:

And the reason it works is because the note is below the aria div and above the covid19-wrapper div? If so, I assume I can move the note up in this template since it now has the same order after this diff?:

--Timeshifter (talk) 15:25, 4 February 2022 (UTC)Reply

@Timeshifter: Correct. That is what I explained in my previous post. Jroberson108 (talk) 15:33, 4 February 2022 (UTC)Reply
A general note since this is related and recent. To accommodate this request to relocate the expand/collapse links outside/above the scrollable div, the styles and markup have been restructured. In summary, the "covid19-wrapper" class was renamed to "covid19-container" and moved with "id" to contain all content, and a new "scroll-container" class was added to contain the scrollable content. More details found on that request. Jroberson108 (talk) 00:57, 5 February 2022 (UTC)Reply