After talking to @smarimc and thinking about it a bit, one metric importance became obvious: days-to-herd-immunity.
I'll explain in a sec; but first, let's make one thing clear: basically, we're all getting COVID-19 sooner or later. The fight is now about how many people get it *simultaneously*, or more importantly: how many people need to be simultaneously hospitalized.
Here's a decent explanation: https://medium.com/@ariadnelabs/social-distancing-this-is-not-a-snow-day-ac21d7fa78b4
So it's all about slowing down the spread. How much?
Well, as mentioned by a lot of different sources, we need to slow it down such that the peak of infections is still something we can handle in the healthcare systems.
And the peak can be expected not that much sooner than when herd immunity kicks in. Let's say herd immunity kicks in at ~70-75% of population.
Well, now we have some numbers to work with!
The data we need is: population of the country, current number of cases, and the estimated rate of new cases.
For #Iceland that's 364260 (population), 161 (current number of cases), 1.17 (rate of infection).
Herd immunity at 75% is 273195 people (infected, and those who already recovered). How long will it take?
Well, solve for x!
161*1.17^x = 273195
1.17^x = 273195/161
1.17^x ~= 1697
x=ln(1697)/ln(1.17) ~= 47 days
That also roughly means that the last day before herd immunity kicks in we can expect ~40.000 new infections. On that single day.
Now, if we lower the infection rate to 1.09, that we get 86 days to deal with it ( 🕶️ ), and the last day we get ~20.000 cases. Way more manageable.
This is all back-of-a-napkin math, obviously, there's a crap ton of variables that are not accounted for, plus it kinda makes most sense for isolated places like Iceland.
Still, eye-opening for me.
Few more takeaways from this:
1. 20k new cases on the idealized "day before herd immunity kicks in" still means that people who were infected before continue to need care. And 20k cases × 15% is 3k new patients needing hospital beds.
2. So... it would be better to spread it even further. If we go down to an infection rate of 1.04 we get peak at 10k cases, 1.5k new hospital patients. But that also means spreading it over 189 days!
3. Get used to it. It will take a long while.
1. This is all very naive, back-of-a-napkin math. Take it with a grain (or better yet, a whole spoon) of salt, do your own analysis.
2. I am not a healthcare professional and all of this can just as well be complete bullshit (if you know it is bullshit, let me know, eager to learn!).
3. The numbers are for Iceland. Plug in your own numbers. Here's my spreadsheet:
Okay, I started making a thing, because I had too much time on my hands (quarantine, yay!), and because I was annoyed about not having seen a decent place to get up-to-date stats on COVID-19 in different places:
It pulls the data from Wikipedia and applies to it the math I mentioned earlier in the thread.
Next steps are to implement:
1. comparisons between 2-3 countries
2. graphs similar to this one but updated with fresh data:
It is now possible to:
- link directly to a particular infection site data: https://rys.io/covid/#iceland
- display data for several (as many as you like, I guess) infection sites side-by-side.
There are still bugs, and the styling is awkward right now. But perhaps it's useful.
Added the ability to link directly to data for a number of countries simultaneously, for example:
Added graphs. These are still buggy (don't try to display more than 6 countries 😉 ), and the x axis is hardcoded, but I feel they're already kinda useful:
Fun fact, Sweden for some reason is missing a day of data:
Need to look at the data I guess.
A bunch of fixes in. In the meantime, someone on #Wikipedia just decided to completely change the way data is recorded for Mainland China, which screws up my data retrieval completely.
Come on, I've been fixing and cleaning Mainland China data for the last 5 days, give me a break!
Compare the graph to the video:
To be absolutely clear, this is not funny. This is fucking scary.
Added the ability to choose between logarithmic (default) and linear scales:
You can now choose between cumulative and new cases chart:
These both work with the logarithmic and linear scale choice, of course.
Deployed some fixes (the chart now resizes correctly, and I think I finally fixed a long-standing bug that someties made the chart disappear when multiple sites were fetching data simultaneously):
Also, added a readme to the codebase: https://git.rys.io/rysiek/covid/
I have a hunch some of you might enjoy the readme more than the graphs, in fact.
As requested by @michele and @tga , there is now a switch to show per-million numbers:
On @smarimc's suggestion, I added a rolling average configuration for new cases mode:
(note: the configuration UI only shows up when "Cases: new" is selected)
Not entirely certain of my code though, so it would be good if anyone could do a reality check on it:
Wikipedia data was too messy and broke too often. So I had to switch to something saner:
Currently using John Hopkin's University data:
...as cleaned and provided by pomber/covid19: https://github.com/pomber/covid19
Good news: data is more reliable and complete. Also, Global infection site is now available.
Bad news: each time you visit a single request goes to the GitHub-hosted data thingy. I will improve on this tomorrow.
Since I am now using better data source, I can do additional things. So you can now choose between a chart of confirmed cases, recoveries, or deaths:
All other controls work with either of these, of course.
This is becoming quite a flexible tool, if I may be so bold to say.
Okay, fixed the privacy issue - JSON data is now fetched from my server, which proxies the request for it upstream (while setting all headers like User-Agent and such to some irrelevant values):
This means that your IP nor your User Agent will not show up anywhere else apart from my server (which you're already visiting to see the shiny shiny graphs).
No idea why it took me so long, but added *active cases* graph; that is: confirmed - (deaths + recovered):
I think that's a pretty useful graph. I should have added it sooner.
One thing that becomes evident in the "active cases" mode is that the US currently has almost four times the active cases that China had at their worst moment.
...and switch to "active cases", "linear".
I really need to implement the ability to link to a particular chart mode too. One day!
Bunch of fixes for the chart:
- the y-axis legend now properly reflects the data the chart is showing (confirmed cases / recoveries / deaths / active cases);
- lowered the lineTension of the charts, so it's a bit more jagged, but a bit less weird when data changes dramatically day to day;
- negative values now charted correctly, especially with linear y-axis.
Go here and switch to "active cases", "linear", "new":
Added the ability to chart the data from a selected date. This might be more natural way of viewing the charts for many people:
(select "Start on <date>" below the graph).
Made the chart nicer, with a title, way better legend, and some gradients for the guidelines:
Already got some additional ideas for next steps. And I have some time tomorrow to implement them. Stay tuned.
Here's hope - 6 sites with highest daily active cases drop:
Also, a bunch of fixes, "mortality" is now correctly called "death-to-case ratio", and "clear all" and "reset all settings" buttons.
Ideas for "load 6 sites that" buttons welcome!
Added a case fatality rate mode:
This is calculated by dividing deaths by a sum of deaths and recoveries. More context:
Thanks to @bjarni for inspiration.
Also, cleaned up some names in the interface, and improved legends and the title on the chart to better reflect selected options. And added a button to load 6 sites with the highest case fatality rate.
Fun fact: if all countries did extensive testing of the population and recorded reliable data on confirmed cases, recoveries, and deaths, case fatality rate would reflect how good each country is in their #COVID19 response.
But this is the real world and thus, for example, #UK doesn't seem to record recoveries anymore. Thus, CFR becomes useful to tell which countries do not do a good job recording/reporting the data.
Okay, finally implemented passing chart settings (along with countries/infection sites) in the URL hash:
So you can share a chart along with the settings you used to get it. Wooo!
Also, some bugfixes and cleanups here and there.
Testing welcome, this bit was a bit hairy and I might have introduced some bugs.
Another bugfix. Things should not lock-up if data sources are switched quickly.
And here's a graph for you:
These are 6 countries with most recoveries (cumulative), as of yesterday. Graphing active cases.
Note how everyone apart from the US seems to be either past the peak active case count or very close to it.
In the US it's going to still get worse before it gets better...
@rysiek looks great. What do you think of adding scaling of the growth based on population? if you see the US graph it's almost vertical and compared to Italy (where I'm from) it doesn't really make sense if you think of cases for 1Ms of people
@michele yeah, multiple people suggested that already. Might make sense, no clue when I get to implement it.
Patches welcome though! You might want to look at getSiteCases(), updateChartData(), and updateChartSettings() functions - this is where the magic happens. The first one is particularly hairy, but I tried commenting everything reasonably well.
@michele patches welcome! :)
For this to work you'd need to:
- add the interface for switching between per-M and absolute values
- either pre-generate the per-M data in getSiteCases() or generate it on the fly in updateChartData()
- add it to the chart in updateChartData()
- modify updateChartSettings() probably a bit.
@rysiek I think deaths per 100k could be interesting... it is a bit more reliable although not completely.
@wolf480pl it does look weird, I wonder if that's in the data. No time right now to check, but if you'd like to dive into the JSON I am fetch()ing and compare to what's on the graph, feel free.
@rysiek Do you know if there's any decent data available von testing rates? Also thanks for the great tool!
@nebby no idea. Haven't seen testing numbers in the John Hopkins University dataset. Are there testing data on the Wikipedia? If so, check where they're getting them from?
@rysiek Thats a nice one. Thanks, makes it easy to check different stats. 👍
Can you also add the data on number of tests done and per million stats?
@pavi that's sadly not easy, since:
1. the dataset I am using (John Hopkins University data, via pomber/covid19) does not have that data.
2. I have not found a reliable source of that. Wikipedia has it for *some* areas, but not many.
"The term infection fatality rate (IFR) also applies to infectious disease outbreaks, and represents the proportion of deaths among all the infected individuals. It is closely related to the CFR, but attempts to additionally account for all asymptomatic and undiagnosed infections."
Same Wikipedia article.
@rysiek i'm not quite sure why we did it for 2 days and then went "actually, why bother?"
but it might have been because the numbers were far from encouraging... and would never be anything else, being even laggier and less reliable than the death toll
@thamesynne well, it is possible to see the active cases curve angling downwards for these countries:
...specifically because we *do have * both deaths and recoveries data. Negative active cases delta is a very good sign, and you won't have that without knowing how many recoveries there were.
@rysiek This is a huge issue so I think it is better to look at total death by country and compare it with a "normal" year or even better a median of normal years.
Deaths has to be reported but not the cause of it. Testing and administration takes a toll on personell resources that may be better used to care for the sick.
Which will show the over-all consequences of the pandemic as not all affected will have covid-19.
@rysiek Safari says "SecurityError: Attempt to use history.pushState() more than 100 times per 30 seconds" but it eventually starts working after a shift-refresh.
@mathew huh, interesting why the pushState gets called so often. I'll check that out! Thanks!
That being said, no promises made for Safari. Apple fails to implement some things I am using (like <input type="date">), and I refuse to use polyfills.
@mathew I just pushed a fix for the pushstate thingy, should be way fewer pushstate calls now.
@rysiek Is this down rigght now? No data appearing, no country selectors, though basic site loads.
@dredmorbius huh, something's not right with the data JSON.
> curl: (18) transfer closed with 1760357 bytes remaining to read
Basically, looks like the file got too large. I need to fiddle with the timeouts. Thanks for reporting!
@dredmorbius fixed. Will need to work a bit on a more long-term fix. But works for now. :)
@rysiek Thanks. Great service, pass this on to your boss ;-)
(She should know you're appreciated.)
re: covid-19, pandemic
@rysiek I had to look at the code to figure out what the difference was between confirmed and active cases. Looks like the former is positive tests, and the latter is that minus deaths and recoveries.
So it doesn't make sense to graph new active cases, right?
re: covid-19, pandemic
@rysiek "Cumulative active cases" would mean "here is how many people are currently infected and haven't yet resolved". "New active cases" would be... how many people tested positive that day, minus how many people tested negative again? I guess you could look at that as a trend of whether more people are getting sick vs. recovering?
re: covid-19, pandemic
@varx well, "new active cases" should probably be called "active cases delta" or some such.
But it does make sense: it's the meaningful way of measuring whether or not the outbreak is under control.
For example, in Iceland "new active cases" have been negative for a few days. That means that more people recover (or die, but there were barely any deaths in IS) than get diagnosed. Which means we *might* be over the hump here.
Server run by the main developers of the project It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!