covid-19, pandemic

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.

covid-19, pandemic

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!

covid-19, pandemic

The data we need is: population of the country, current number of cases, and the estimated rate of new cases.

For 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

covid-19, pandemic

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.

covid-19, pandemic

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.

covid-19, pandemic

Also, disclaimer:

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:
git.rys.io/rysiek/covid/blob/m

covid-19, pandemic

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:

rys.io/covid/

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:
en.wikipedia.org/wiki/File:Epi

covid-19, pandemic

It is now possible to:

- link directly to a particular infection site data: 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.

covid-19, pandemic

Added the ability to link directly to data for a number of countries simultaneously, for example:
rys.io/covid/#iceland,united-s

covid-19, pandemic

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:

rys.io/covid/#iceland,united-s

Fun fact, Sweden for some reason is missing a day of data:
rys.io/covid/#sweden

Need to look at the data I guess.

covid-19, pandemic

A bunch of fixes in. In the meantime, someone on 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!

covid-19, pandemic

Compare the graph to the video:
rys.io/covid/#china,united-sta

To be absolutely clear, this is not funny. This is fucking scary.

covid-19, pandemic

Added the ability to choose between logarithmic (default) and linear scales:
rys.io/covid/#china,united-sta

covid-19, pandemic

You can now choose between cumulative and new cases chart:
rys.io/covid/#china,united-sta

These both work with the logarithmic and linear scale choice, of course.

covid-19, pandemic

It is now possible to anchor the chart on the day of the first, tenth, hundredth, and thousandth case:
rys.io/covid/#italy

Starting on the tenth case day is also now the default.

Thank you for suggestions., @etam and @dredmorbius

covid-19, pandemic

Made it possible to remove infection sites. Works both using the [-] button, and directly from the URL hash:
rys.io/covid/#italy,china,unit

Also fixed: population data is now hard-coded, so one fewer round-trip to Wikipedia.

Also, I added a simple test routine, and so I know that ~60 infection sites do not get proper data when fetching from Wikipedia. I'll try to fix them, or consider switching to a better source. Ideas for the latter welcome!

covid-19, pandemic

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):
rys.io/covid/#iceland,united-s

I have a hunch some of you might enjoy the readme more than the graphs, in fact.

· · Web · · ·

covid-19, pandemic

As requested by @michele and @tga , there is now a switch to show per-million numbers:
rys.io/covid/#italy,china,unit

covid-19, pandemic

On @smarimc's suggestion, I added a rolling average configuration for new cases mode:
rys.io/covid/#italy,china,unit

(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:
git.rys.io/rysiek/covid/blob/m

covid-19, pandemic

Wikipedia data was too messy and broke too often. So I had to switch to something saner:
rys.io/covid/#global,united-st

Currently using John Hopkin's University data:
github.com/CSSEGISandData/COVI

...as cleaned and provided by pomber/covid19: 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.

covid-19, pandemic

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:
rys.io/covid/#global,united-st

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.

covid-19, pandemic

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):
rys.io/covid/#global,united-st

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

Privacy matters.

covid-19, pandemic

No idea why it took me so long, but added *active cases* graph; that is: confirmed - (deaths + recovered):
rys.io/covid/#china,united-sta

I think that's a pretty useful graph. I should have added it sooner.

covid-19, pandemic

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!

covid-19, pandemic

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":
rys.io/covid/#iceland,china

covid-19, pandemic

Added the ability to chart the data from a selected date. This might be more natural way of viewing the charts for many people:
rys.io/covid/#china,iran,italy

(select "Start on <date>" below the graph).

covid-19, pandemic

Made the chart nicer, with a title, way better legend, and some gradients for the guidelines:
rys.io/covid/#china,iran,italy

Already got some additional ideas for next steps. And I have some time tomorrow to implement them. Stay tuned.

covid-19, pandemic

rys.io/covid/

Here's hope - 6 sites with highest daily active cases drop:
rys.io/covid/#iran,germany,swi

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!

covid-19, pandemic

Added a case fatality rate mode:
rys.io/covid/#united-kingdom,n

This is calculated by dividing deaths by a sum of deaths and recoveries. More context:
en.wikipedia.org/wiki/Case_fat

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.

covid-19, pandemic

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

But this is the real world and thus, for example, 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.

covid-19, pandemic

Okay, finally implemented passing chart settings (along with countries/infection sites) in the URL hash:
rys.io/covid/#active,delta,ave

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.

covid-19, pandemic

Another bugfix. Things should not lock-up if data sources are switched quickly.

And here's a graph for you:
rys.io/covid/#active,linear,hu

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

covid-19, pandemic

@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

covid-19, pandemic

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

covid-19, pandemic

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

covid-19, pandemic

@rysiek I think deaths per 100k could be interesting... it is a bit more reliable although not completely.

covid-19, pandemic

@rysiek @michele @tga
In this mode, the X start points should also be per 1M

covid-19, pandemic

@wolf480pl @michele @tga oh you mean "start at 1st/M, 10th/M, 100th/M, 1000th/M"?

Hummm. Need to ponder.

covid-19, pandemic

@rysiek @michele @tga
yup.
Otherwise, the graphs end up being so out of sync that it's hard to compare the curves.

covid-19, pandemic

@wolf480pl @rysiek @tga yes, that would be better, but it’s already a great starting point! Thanks @rysiek!

covid-19, pandemic

@michele @wolf480pl @tga well then, fixed it just for you.

covid-19, pandemic

@rysiek
recoveries on this one look clearly wrong:
rys.io/covid/#poland,czechia

covid-19, pandemic

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

covid-19, pandemic

@rysiek Do you know if there's any decent data available von testing rates? Also thanks for the great tool!

covid-19, pandemic

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

covid-19, pandemic

@rysiek and their testing is still woefully low

covid-19, pandemic

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

covid-19, pandemic

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

covid-19, pandemic

Fatality or mortality?

covid-19, pandemic

covid-19, pandemic

So IFR?

covid-19, pandemic

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

covid-19, pandemic

@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

covid-19, pandemic

@thamesynne well, it is possible to see the active cases curve angling downwards for these countries:
rys.io/covid/#germany,australi

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

covid-19, pandemic

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

covid-19, pandemic

@CSB nope.

covid-19, pandemic

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

covid-19, pandemic

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

covid-19, pandemic

@mathew I just pushed a fix for the pushstate thingy, should be way fewer pushstate calls now.

covid-19, pandemic

@rysiek Is this down rigght now? No data appearing, no country selectors, though basic site loads.

covid-19, pandemic

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

covid-19, pandemic

@dredmorbius fixed. Will need to work a bit on a more long-term fix. But works for now. :)

covid-19, pandemic

@rysiek Thanks. Great service, pass this on to your boss ;-)

(She should know you're appreciated.)

covid-19, pandemic

@dredmorbius haha, I'll make sure to let her know!

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.

re: covid-19, pandemic

@rysiek Makes sense now, thanks.

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!