Template talk:COVID-19 pandemic death rates by country

Change to template format
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. 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)


 * 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
 * Help:Table
 * Help:Collapsing
 * mw:Manual:Collapsible_elements
 * --Timeshifter (talk) 18:31, 27 August 2020 (UTC)


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


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

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

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)


 * and 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)
 * 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.
 * and . I asked for help here:
 * Help talk:Table
 * --Timeshifter (talk) 19:51, 27 August 2020 (UTC)


 * 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)
 * 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)
 * 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)
 * 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)
 * 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 &lt;!-- 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)
 * 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)
 * 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)

Date style
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)
 * OK. --Timeshifter (talk) 14:30, 29 August 2020 (UTC)

Link to scrollable sandbox version and Help:Table discussion about it
See:
 * Help talk:Table
 * https://en.wikipedia.org/w/index.php?title=User:Dudley_Miles/sandbox&oldid=975626376

. I suggest using numbered sandboxes. You and others can then keep working on this. From Help:Table: --Timeshifter (talk) 06:37, 30 August 2020 (UTC)


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


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


 * That is not toggling.
 * The experts are involved with this template: Template:COVID-19 pandemic data. See talk:
 * Template talk:COVID-19 pandemic data
 * 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
 * --Timeshifter (talk) 10:31, 30 August 2020 (UTC)

Made table narrower
I made the table narrower by putting breaks in the headers, and removing  from the 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)
 * Template:COVID-19 pandemic death rates by country/styles.css
 * 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)
 * 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)

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

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


 * . 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 WikiProject Flag Template.
 * 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)


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

Need JHU source in caption for template in COVID-19 pandemic by country and territory
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:
 * List of countries by life expectancy
 * List of countries by infant and under-five mortality rates

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)
 * 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)
 * . 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)
 * 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)
 * 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)
 * . Chris55 replied again recently here:
 * Talk:COVID-19 pandemic by country and territory
 * 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)
 * 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)

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

Python Helper
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) 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"|||{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
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 to avoid a discussion fork. Thank you! Tol (talk &#124; contribs) @ 17:49, 23 September 2021 (UTC)

Row numbers
. 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)

Country rank column
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)
 * . Thought you might be interested in this. --Timeshifter (talk) 12:52, 10 December 2021 (UTC)
 * 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 &#124; contribs) @ 19:25, 10 December 2021 (UTC)

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


 * @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  Tol  (talk &#124; contribs) @ 03:52, 11 December 2021 (UTC)

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)


 * and . 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)
 * This is an issue with Template:COVID-19 pandemic death rates by country. I am moving the discussion there. Tol  (talk &#124; contribs) @ 20:01, 16 January 2022 (UTC)
 * Moved. Tol  (talk &#124; contribs) @ 20:02, 16 January 2022 (UTC)
 * @Timeshifter: Alright. It looks like @Jroberson108's recent edit removed the static row numbers. Tol  (talk &#124; contribs) @ 20:06, 16 January 2022 (UTC)
 * 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)
 * 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)
 * Thanks, @Jroberson108! Tol  (talk &#124; contribs) @ 21:51, 16 January 2022 (UTC)

Date of last update. Location
. 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:
 * Template:2022 first half. Monthly cumulative COVID-19 death totals by country
 * Template:2021 2nd half. Monthly cumulative COVID-19 death totals by country
 * Template:2021 first half. Monthly cumulative COVID-19 death totals by country
 * Template:2020 monthly cumulative COVID-19 death totals by country
 * Template:2021 monthly cumulative COVID-19 death totals by country

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

. 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)
 * Template:2022 first half. Monthly cumulative COVID-19 death totals by country
 * Template:COVID-19 pandemic death rates by country.
 * Correct. That is what I explained in my previous post. Jroberson108 (talk) 15:33, 4 February 2022 (UTC)
 * 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)