Author Archives: Jacek Błocki

Covid-19 cases, deaths and mortality rate

Let’s have a closer look at Covid-19 mortality rate. We focus on mortality among detected cases, since population fraction affected is still very tiny. Mortality rate defined as quotient of cumulative death cases and cumulative detected cases can vary between 0.3% and 11%, a factor of 30 difference. Quite a significant difference indeed.

Data in table below below come from 2020-03-30 ECDC set, columns are explained below the table. As predicted in my previous post USA took the top spot in number of Covid-19 cases, China is now number 3, Spain will likely displace it on March 31st. Please note China started to report new cases albeit number is low (121).

DateRepCountrYCasesDeathsCCasesCDeathsMort%pop2018
02020-03-30United States of America1836031814302525091.75327167434
12020-03-30Italy5217758976891078111.0460431283
22020-03-30China12158246333114.021392730000
32020-03-30Spain65498387879765288.2846723749
42020-03-30Germany475166572984550.7982927922
52020-03-30France25992924017426066.4966987244
62020-03-30Iran29011233830926406.8981800269
72020-03-30United Kingdom24332091952212286.2966488991
82020-03-30Switzerland112222142742571.808516543
92020-03-30Netherlands1104132108667717.1017231017
102020-03-30Belgium170278108364313.9811422068
112020-03-30South Korea78696611581.6451635256
122020-03-30Turkey18152392171311.4282319724
132020-03-30Austria522188813860.988847037
142020-03-30Canada86916255610.9837058856
152020-03-30Portugal7921959621192.0010281762
162020-03-30Brazil3522242561363.20209469333
172020-03-30Israel62834247150.358883800
182020-03-30Norway25724102220.545314336
192020-03-30Australia28424093160.3924992369

Table columns are explained below

  • CASES, DEATHS – cases and deaths at reporting date (column DATEREP)
  • CCASES, CDEATHS – cumulative cases and deaths
  • MORT% – cumulative cases mortality rate CCCASES/CDEATHS in percentage points
  • POP2018 – country population in 2018

Table below shows how top20 countries compare with entire world.

top 20 worldtop %
Cumulative cases64985971566990.8
Cumulative Deaths322613357496.1
population 20182601228993745910165234.9
count2019610.2

As we see top 20 countries cover 91% of Covid-19 cases detected worldwide and account for 96% deaths. Similar comparison for top 5 countries below:

topworldtop %
CumCases45927271566964.2
CumDeaths235843357470.2
pop20181909980388745910165225.6
count51962.6

From table above we see Top 5 countries: had 459272 cases 23584 deaths in total, for population of 1909980388, close to 2 billion (US, 10E9). Of course China contributes more than half of the latter number. Let’s calculate some rations for top 5 countries:

  • cases/population 0.024%
  • deaths/population 0.0012%
  • deaths/cases 5.14%

First two numbers are distorted by China huge population count. Covid-19 outbreak in China is officially declared contained, other countries are in full swing. Last number is both concerning and interesting because there are countries with high and low mortality rates. Lets have a look at them. From top 20 countries we have selected 5 with lowest and 5 with highest mortality rate. Data are presented below sorted on cases mortality in highest to lowest order.

Low and high cases mortality countries

Table below show low case mortality countries selected form top 20 table:

DateRepCountriesCasesDeathsCCasesCDeathsmort%
142020-03-30Canada86916255610.98
42020-03-30Germany475166572984550.79
182020-03-30Norway25724102220.54
192020-03-30Australia28424093160.39
172020-03-30Israel62834247150.35

High mortality countries follow

DateRepCountriesCasesDeathscCasesCDeathsMort%
12020-03-30Italy5217758976891078111.04
32020-03-30Spain65498387879765288.28
92020-03-30Netherlands1104132108667717.10
62020-03-30Iran29011233830926406.89
52020-03-30France25992924017426066.49

As we can see there is a wide difference in case mortality rate, it range s form 11.04% for Italy to 0.35% for Israel. You can argue Israel is in early development, but Germany has mortality rate at 0.79% and it has 57 thousands cases which is comparable with mortality record beating Italy 97 thousands cases. Italy and Germany are very similar countries in terms of size, population, wealth, economic development. I see no other explanation for order of magnitude mortality rate difference other than Covid-19 testing approach, discussed in previous post. Let’s have a look at mortality rate evolution over time.

Cases mortality rate evolution

We show picture for low cases mortality countries first. Data are shown as soon as cumulative deaths exceed 5. This eliminates initial fluctuations.

Mortality evolution low rate countries

Please note Germany started with mortality rate around 0.2% of detected cases and its stayed at that level quite long. I believe the rate started to climb once growing number of cases made test diverted from general application to heavier cases. This is positive scenario.

For high mortality rate countries we show data once cumulative death cases exceed 20. Again this eliminate early fluctuations. Iran was an extreme example here, initial number of deaths equaled number of cases. Iran example shows how testing influences detected cases mortality rate.

Mortality evolution high rate countries

One more comment on Iran curve. Is started very high, dropped to 2% range, then climbed back in a almost Italian fashion (favorite explanation lack of test of course). Recently we see Iran detected case mortality heading down. Iran rate is going better than for other high mortality countries. Does a poor Iran has a more reasonable approach to disease handling than wealthy European countries? They may have less means but doe to recent turbulent history has much more experience in handling emergency situations, thus better allocation of its limited resources.

Figure below shows low and high rate countries combined. Some low rate countries don’t qualify since 20 cumulative deaths threshold is applied.

Mortality evolution high an low rate countries compared

It extremely important to understand cases mortality difference between Germany and high rate countries. It would allow us to estimate actual Covid-19 impact on population.

Final remarks

I write a lot about importance of broad population testing. I believe difference in cases mortality rate comes from distortion of cases detection process in high mortality countries. Tests are scarce and used on heavier cases, more likely to end as fatalities, thus mortality rate goes up. I try to get a reliable data on number of tests performed in countries, but no success so far. I have contacted ECDC (European Centre for Disease Prevention and Control) my primary source, but thy have no such data data available. I see no other way to estimate true number of Covid-19 cases in population than a test on a random sample coming from actual population distribution. This process has to be separate from testing patients showing clear Covid-19 symptoms. If anyone knows where to find a reliable data on number of tests performed in countries I’d appreciate if you share it.

Covid-19 mortality rate estimation for closed population

Among news on growing Covid-19 threat and lock downs we forgot about an early outbreak on Diamond Princess cruiser ship. The case gives us opportunity to learn how Covid-19 develops in human population and measure its impact in terms of infection and mortality rate . I found Diamond Princess case a couple of days ago, while preparing data for this post. Then it made to top 20 countries by number of detected Covid-19 cases. I was looking at this group and a strange country coded JPG11668 attracted my attention, it turned out to be Diamond Princess cruise ship. As of 26th March ECDC data JPG11668 does not qualify to top 20, it ranks 39. I would have missed it if only it was positioned like that a couple of days ago. Sometimes a pure luck reveals an important piece of information. This one allows to estimate Covid-19 target infection rate at 20% and mortality at 0.2% of total population affected.

Table below displays countries and regions sorted according to cumulative Covid-19 cases detected. China remains a leader, Italy is the second. Judging from recent progress US is likely to overtake China soon. Italy is a sad leader in fatalities, growing to more than double Chinese figure. Diamond Princess (JPG11668) is easily dwarfed by above numbers.

GeoIdCountries and territoriesCumCasesCumDeathsCasesMortality%
0CNChina8196832934.02
1ITItaly74386750510.09
2USUnited_States_of_America6919410501.52
3ESSpain4761034347.21
4DEGermany365081980.54
5IRIran2701720777.69
6FRFrance2523313315.27
7CHSwitzerland97141031.06
8UKUnited_Kingdom95294224.43
9KRSouth_Korea92411311.42
39JPG11668Cases_on_an_international_conveyance_Japan70570.99

Covid-19 on Diamond Princess

I found information on Diamond Princess on National Institute of Infectious Diseases (NIID) page. The source is close to subject since she is mooring in Yokohama Japan. As of 5 February, there was a total of 3711 individuals on board the Diamond Princess, with 2666 passengers and 1045 crew members. Actual number of death cases is 7.

Chart below shows Covid-19 cumulative cases evolution and mortality among detected cases. Diamond Princess population was thoroughly tested, with almost 100% of passengers and crew covered. We can assume all Covid-19 cases were detected.

Diamond princess Covid-19 cases and mortality

Chart below shows detected cases and mortality data, bot per day and cumulative figures. Gaps on cumulative data are due to gaps in ECDC data set. Most probably reporting was discontinued once disembarkation completed on Feb 28th. However on 03-10 there was another death case reported making a total of 7. This day data shows a negative (-9) number of cases. The latter figure is bit unusual, since ECDC showed only new cases as positive number. Perhaps it reflected some data correction e.g. previously reported cases were false positives. Lack of recovered cases reporting is one of ECDC data improvement areas.

Diamond Princess Covid-19 detected cases and deaths

Quarantine efficiency

Let’s have a look at timing data:

  • 2020-02-05 first case reported
  • 2020-03-10 last case reported
  • 2020-02-16 peak cases reported per day
  • 34 days between first and last case
  • 11 days between first case and peak

Covid-19 spread was quick, start to peak in just 11 days. Cruising ship is a confined space pretty crowded comparing to on shore standards. Diamond Princess was not build with passenger isolation in mind and it was hard to convert her into mass isolation facility. Quarantine was called for cases on board, but how effective was it? In my opinion everyone on Diamond Princess had contact with Covid-19 virus and chance to contract it. Faster disembarkment would slow down/limit the virus spread at expense of greater on shore transfer risk. It is an old custom to prevent ship with disease outbreak to enter port (yellow flag).

Around 20% of population as infected 80% was not. I would attribute this split to natural resilience to Covid-19 in 80% of ship population, who were exposed to the virus but did not contract illness. Cruise ship crew and passengers can be considered a random sample drawn from population. There is a good chance Diamond Princess case models Covid-19 outbreak in any population.

Population impact

Chart below shows Diamond Princess population share infected by Covid-19. We divide number of detected cases by total ship population (3711). Infection share peaks around 20% (19% technically speaking,). Slight drop at the right end side results form negative new cases number reported 10.03 discussed above. Red bars show death cases (7), they distribute more or less evenly over time. For time series counting 7 samples it is hard to discuss curve shape. We can calculate mortality rate for population: 7/3711 gives around 0.2%

Diamond Princess infected population and daily deaths

Diamond Princess infected population and mortality summary is the following:

  • Population 3711, infected 696, dead 7
  • 20% infection rate for population (696 out of 3711)
  • Infection rate reached plateau after 20 days
  • 0.2% mortality rate for population (7 out of 3711)
  • 1% mortality rate for infected cases (7 out of 696)

Diamond Princess Covid-19 test penetration was almost 100%

Diamond Princess projection to countries

Projecting Diamond Princess data to counties is challenging since we are comparing fully developed disease with developing one. Countries differ widely by detected cases mortality rate. Table below in last column shows ratio of country mortality to the German one. There is a factor of 20 difference between Italy and Germany! In my opinion the only explanation is data sample distortion.

CountryCasesDeathsCases Mortality %Mortality / Mortality DE
1Italy74386750510.0918.7
4Germany365081980.541.0
11Austria5888340.581.1
15Norway2916120.410.8
39Diamond Princess70570.991.8

Country sample distortion mechanism

ECDC data set does not include number of tests performed in each country. I found some information Germany executed broad testing covering at least 250 thousands samples. While Italy was focusing on testing cases showing symptoms. Let’s suppose testing is a bottleneck, then the following picture will develop:

  1. Tests are available population is tested, positive cases emerge
  2. Initial fatalities are detected, mortality for detected cases is low
  3. Disease develops, more cases are detected, tests are running low, priority is given to cases with symptoms
  4. Cases with symptoms testing makes detected cases loaded with heavier ones
  5. Mortality rate in detected cases grows rapidly
  6. Growing number of cases creates positive feedback loop, mortality rate for detected cases soars

Recommendations for potential Covid-19 patients in Italy confirm above mechanism may be indeed in place. Stay at home if not experiencing serious problems eliminates light and moderate cases from sample, tests are run by hospitals. Picture below also supports our hypothesis. We see even for countries with high initial testing cases mortality starts to go up. Cases mortality for Diamond Princess stopped at 1%, it is not shown on chart (y scale limit), instead we show mortality for entire population. It topped at 0.2% with 20% of total population affected as discussed above.

Diamond Princess Covid-19 mortality comparison with selected countries

Hope from numbers

Let’s assume in countries Covid-19 final stage will look like Diamond Princess. Penetration will reach 20% and mortality 0.2% population. Cases mortality will be 1%. We can then estimate actual cases figure from death count by simply dividing it by 1% (0.01). Results are in table below:

CountryCasesDeathsPopulationEstimated CasesEstimated Penetration %
Italy743867505604807505001.24
Germany3650819882790198000.02
Austria588834882234000.04
Norway291612536812000.02
Cases count estimated after death count using Diamond Princess stats, population data are in thousands

Please note: This section has been edited on 2020-04-02. Original version used 0.2% cases mortality, figure representing initial mortality for cases in Germany. Diamond Princess cases mortality was 1%. Of course recalculated estimate values are 5 times lower than original ones. There is a chance Diamond Princess case mortality can be revised down, but it requires a separate discussion.

Population data are in thousands. Cases and deaths are cumulative. Italy has a huge gap between detected cases and estimated ones. The later is close to a million. For Germany, Austria and Norway number of detected cases is higher than Diamond Princess figure. This may be related to either lower mortality rate, or time lag between epidemic start and fatalities build up. For Germany detected cases mortality fluctuated around 0.2% between 10 and 20 March and a considerable buildup of detected cases took place in that period. It makes me to believe German cases mortality rate may be around 0.2% not 1% like Diamond Princess.

Action needed

Run Covid-19 tests to verify actual penetration in Italy population. If discrepancy on cases is as huge as estimated (74 thousands detected vs. 750 thousands actual) it will be immediately confirmed by a simple statistical poll over representative sample drawn from population. If estimated penetration figure is confirmed current lock down measures have to be reconsidered.

Covid-19 why Germany is different from Italy

Covid-19 outbreak made me look at some data available from European Centre for Disease Prevention and Control (ECDC). The calamity has a lot of emotionally loaded media coverage, I’ll focus on numbers and conclusions that can be made from them. I use data coming from documented sources considered reliable. The data show results produced by same virus in various countries are widely different.

WHO defines pandemic as worldwide spread of a new disease. According to table below Covid-19 indeed matches this definition, it was detected in almost every country. Please note worldwide population is around 7.8 billion, so cases detected as of 2020.03.22 08:00 represent 0.0039% of the world population. Pandemic evolution should be viewed using affected population size as reference.

casesdeathscount
world30527512942179
top2825641263620
top 20 % share92.697.6

Countries with most cases detected are listed in table below, ECDC naming is preserved. The table represents ECDC data as of 03.22.

GeoIdCasesDeathsCountries and territories
0CN814993267China
1IT535784827Italy
2US26747340United_States_of_America
3ES249261326Spain
4DE2146367Germany
5IR206101556Iran
6FR14459562France
7KR8897104South_Korea
8CH607756Switzerland
9UK5018233United_Kingdom
10NL3631136Netherlands
11AT30248Austria
12BE281567Belgium
13NO19267Norway
14SE174620Sweden
15DK132613Denmark
16PT128012Portugal
17CA123113[Canada, CANADA]
18MY11834Malaysia
19BR112818Brazil

How Covid-19 started – early stage

First Covid-19 cases were reported in China and China outbreak made the virus famous. The virus comes form group responsible for common cold, but this mutation causes in some fraction of cases acute respiratory problems, pneumonia and may result in patient death even if treated in proper hospital. There is no known working vaccine, nor medication targeting the virus, its elimination depends on patient immunological system. My understanding is Covid-19 causes cold like illness that for some cases results in life threatening complications. I am not a medical professional, it may be over simplified. My goal is estimate infection complications probability from available statistics.

Early stage definition

I define early stage of epidemic as period between 1st case and 300th cases detected in a country. The latter number is set arbitrary.

Early stage Covid-19 in China
Early stage Covid-19 in Italy
Early stage Covid-19 in Germany
Early stage Covid-19 in Belgium

Early stage conclusions

  1. Early stage in China started end of Dec 2019
  2. Early stage in Europe started one month later than China
  3. Early stage lasted 3 to 5 weeks depending on country
  4. New year holiday season promoted silent transfer of virus
  5. Common cold symptoms allow Covid-19 move under disguise
  6. Covid-19 requires specialized tests to confirm
  7. Time from infection to life threatening symptoms development is probably long
  8. Steady buildup of acute respiratory problems cases in hospitals triggered epidemic alarm, increased testing followed
  9. Once road Covid-19 tests started, number of detected cases surged

Developed stage definition

I define epidemic is in developed stage in a country once cumulative number of detected cases exceeds 200. There is an overlap between early (up to 300) and developed stage (more than 200) and it is deliberate. Again 200 cumulative cases detected is arbitrary.

Developed stage Covid-19 in China
Developed stage Covid-19 in Italy
Developed stage Covid-19 in Germany
Developed stage Covid-19 in Belgium

Developed stage so far (03.22 data)

China epidemic subsided. Unfortunately new cases are building up in Europe. Italy is most heavily hit. However close to 54 thousands detected cases in Italy translates to 0.09% of population (60 million). From pure volume perspective this is not a countrywide disaster yet, it may or may not develop into one.

Mortality rate

We define cumulative mortality rate dividing cumulative deaths by cumulative cases. Please note the latter number may be much less accurate than the former. We almost all fatalities with CoVID-19 symptoms are tested for virus, while general population is not. Thus actual number of cases can be much higher than detected one.

Covid-19 detected cases and mortality evolution in Italy

We see initial mortality rate was around 2-3%, which is consistent with WHO findings for China outbreak. Then the mortality rate started to climb. I believe it resulted from shortage of tests. Available ones were used on cases with severe symptoms qualifying for hospital treatment. Light cases were left undetected.

Mortality comparison

Following pictures show cumulative detected cases and mortality for top 8 countries selected after cumulative cases

Covid-19 detected cases and mortality evolution in China, Italy, Spain and Iran
  1. China moved from 2% to 4%
  2. Spain moved from 1% to 5%
  3. Italy and Iran moved form 2% to 8-9% range
Covid-19 detected cases and mortality evolution in USA, France, South Korea and Germany
  1. USA moved down from 3.5% to 1.3%
  2. France moved up from 1.5% to 4% range
  3. South Korea moved from .5% to 1.2% range
  4. Germany stays below 0.3% and it has 20 thousands cases detected, this is 1/3 of Italy volume

Germany case suggests actual Covid-19 mortality may be much lower than data from other countries suggest. Let’s compare mortality rates on a single chart. I’ve seen data suggesting Germany tested over 250 thousands people for Covid-19.

Mortality comparison for selected countries

Covid-19 mortality among detected cases in selected countries

We see a wide difference in mortality rate among detected cases. Italy is at 9% level, while Germany at 0.3% level. This represents a factor of 30 difference. I attribute this difference to the scale of testing. Germany tests cover much broader population, while Italy focuses testing on severe cases. In result true number of Covid-19 cases is under reported in Italy thus pushing mortality rate up. I’ll move further discussion of Covid-19 mortality to another post.

Multiple Python versions on Linux

Linux comes with Python bundled, but if it often lags recent developments. If you need a specific version of Python you can download it from python.org and install on your box. You can take .xz archive, it is slightly smaller and tar available on you linux box should handle it.

# change to a suitable directory and unpack python
tar xf ~/Downloads/Python-3.8.0.tar.xz 
./configure --prefix $HOME/.local    # any directory you can write to is fine
make
make test
make install
# make sure $HOME/.local/bin is on your $PATH
# python versions come with a nice naming convention
python3.8    # invokes python 3.8 interpreter you have installed
pip3.8       # installs packages for your version
# now you can create a virtual environment for your development
python3.8 -m venv project_directory

You don’t need to install python with sudo if you need it for private use. System rights are only needed if you want the software available for other users. If a software can run without system rights it should be run without them.

Are circular imports in python evil?

Circular imports can be confusing because import does two things:
1. executes imported module code
2. adds imported module to global symbol table of importing module
The former is done only once, while the latter at each import statement. Circular import creates situation when importing module uses imported one with partially executed code. In consequence it will not see objects created after import statement, below code sample demonstrates it.

main.py

print 'import b'
import b
print 'a in globals() {}'.format('a' in globals())
print 'import a'
import a
print 'a in globals() {}'.format('a' in globals())
if __name__ == '__main__':
print 'imports done'
print 'b has y {}, a is b.a {}'.format(hasattr(b, 'y'), a is b.a)

b.by

print "b in, __name__ = {}".format(__name__)
x = 3
print 'b imports a'
import a
y = 5
print "b out"

a.py

print 'a in, __name__ = {}'.format(__name__)
print 'a imports b'
import b
print 'b has x {}'.format(hasattr(b, 'x'))
print 'b has y {}'.format(hasattr(b, 'y'))
print "a out"

python main.py output with comments

import b
b in, __name__ = b # b code execution started
b imports a
a in, __name__ = a # a code execution started
a imports b # b code execution is already in progress
b has x True
b has y False # b defines y after a import,
a out # module a code executed
b out
a in globals() False # import only adds a to main global symbol table
import a
a in globals() True
imports done
b has y True, a is b.a True # all b objects are available

Circular imports are not the ultimate evil to be avoided at all cost. In some frameworks like Flask they are quite natural and tweaking your code to eliminate them does not make the code better.

Skok na bank centralny

Przestępczość oparta na wiedzy osiągnęła kolejny etap rozwoju, wyprowadzono pieniądze z banku centralnego. Bank centralny Bangladeszu nie jest pierwszym wśród podobnych sobie instytucji ale banki centralne maja kluczowe znacznie dla światowego systemu finansowego. Atak na jeden z nich jest atakiem na cały system. Continue reading

Migracja WordPress

Za sprawą polityki cenowej dostawcy usługi coroczna migracja ijbd.eu stała się tradycją. W home.pl, którego używam co łatwo sprawdzić za pomocą magicznych zaklęć nslookup i whois, jest duża różnica między regularną i promocyjną ceną usługi hostingowej. Ponieważ nie popieram dyskryminacji stałych klientów korzystam z promocyjnej oferty i co roku zmieniam serwer. Oczywiście trzeba przenieść usługę ze starego serwera na nowy i po to żeby operacja przebiegała sprawnie napisałem tę instrukcję. Mam nadzieję, że instrukcja będzie użyteczna także przy zmianie dostawcy usługi. Continue reading

Narzędzia w Agile w praktyce

Narzędzia w Agile były tematem #107 spotkania Agile Warsaw. Pierwszy punkt Agile Manifesto stawia ludzi i współpracę między nimi ponad narzędziami i procesami (Individuals and interactions over processes and tools) i dlatego dobór narzędzi jest ważny. Złe narzędzia zamiast pomagać będą szkodzić niepotrzebnie kierując uwagę zespołu na utrzymanie narzędzi. Continue reading

Poczta Polityka Prywatność

W ostatnich dniach wypłynęła informacja o ważnym urzędniku amerykańskim, który używał prywatnej poczty elektronicznej do celów służbowych. Tym urzędnikiem jest nie kto inny jak Hilary Clinton, była szefowa Departamentu Stanu ( U.S. State Department) i potencjalna kandydatka partii demokratycznej w wyborach roku 2016. Continue reading