[PYTHON] Let's test the medical collapse hypothesis of the new coronavirus

Introduction

Regarding the threat of the new coronavirus infection (COVID-19), a state of emergency has been issued in Japan as well, calling for the danger of medical collapse. In particular, in response to the rapid increase in the number of infected people in urban areas, measures such as accepting mild and asymptomatic people to accommodation facilities have begun. In addition, as reported on TV, it has been pointed out that medical collapse has occurred in China, Italy, the United States, etc., and there are cases where sufficient treatment cannot be received due to paralysis of hospital functions. In this article, I would like to define ** medical collapse quantitatively ** based on the data published by Johns Hopkins University, while defining what medical collapse is.

What is medical collapse?

According to Wikipedia, the origin of medical collapse It seems that it is used to mean "a stable and continuous medical care provision system will not be established due to a decline in the morale of doctors, an increase in defensive medicine, deterioration of hospital management, etc.", but regarding COVID-19, " There is a shortage of medical staff and medical equipment, and it is difficult to treat the severely ill. " In other words, it seems that the meaning changes slightly depending on the context in which it is used. In the former sense, [this graph](https://ja.wikipedia.org/wiki/%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB:Oecd- Looking at doctorconsult2013.svg), it seems that Japan and South Korea stand out as countries with a large number of consultations compared to the number of doctors per population. This time, I would like to define the definition of medical collapse * related to * COVID-19 as follows.

Quantify medical collapse

Data published by Johns Hopkins University aggregates daily cumulative infections, recovery, and deaths from around the world. I am. Based on this data, the following two indicators are calculated.

  1. Mortality rate rD: Number of deaths on that day generated from the number of people requiring treatment (C) on the previous day
  2. Recovery rate rR: Number of recoverers on that day generated from the number of people requiring treatment (C) on the previous day

Actually, there is a time lag from hospitalization to death, or from hospitalization to recovery, so it is necessary to take this into account when calculating, but since it does not include data on the time required for death or recovery per patient, it is simple. I decided to calculate. Although it is simple, the number of patients requiring treatment (C) seems to include patients with varying days from hospitalization, so it is considered to be an index to some extent. By the way, the number of people requiring treatment is calculated by the following formula.

Try to calculate with Python

This code is available on GitHub. It is saved in Jupyter Notebook format. (File name: 03_R0_estimation-WLD-RDR-01c.ipynb)

code

I won't cover all of the code in the article because it will be long, but I will explain the key points in the calculation.

Johns Hopkins University data is aggregated by country and state, but since there is a mixture of country-specific and country-wide data, we are re-aggregating by country. ..

def getSumOfCountry01(df, country):
    df1 = df[df["Country/Region"] == country]
    # summarise for each country/region
    if df1['Province/State'].isnull().any():
        df2 = df1.fillna({'Province/State':'SUM'})
        df3 = df2[df2['Province/State'] == 'SUM']
    else:
        df3 = pd.DataFrame(df1.sum(axis=0)).T
        df3['Province/State'] = 'SUM'
        df3['Country/Region'] = df1.iloc[0,1]    
    return df3

This is the part that calculates the above mortality rate rD and recovery rate rR. The moving average is taken with a little consideration of the time lag.

def calcCRD(df, keys):
    #
    nth = keys['nth']
    tf = keys['tf']
    #
    nrow  = len(df)
    getV  = lambda s, tag: df.loc[s, tag] if s < nrow else np.NaN
    # tf [days]Moving average to the end
    getV2 = lambda s, tag: np.nanmean([getV(u, tag) for u in range(s,s + tf)])
    df.loc[0, 'C'] = 0.
    for t in range(1, nrow):
        df.loc[t, 'C'] = getV(t, 'PS') - getV(t, 'RS') - getV(t, 'DS')
        if df.loc[t-1, 'C'] > nth: #For measures against small denominator
            df.loc[t, 'rR'] = getV2(t, 'R') / df.loc[t-1, 'C']
            df.loc[t, 'rD'] = getV2(t, 'D') / df.loc[t-1, 'C']
        else:
            df.loc[t, 'rR'] = np.NaN
            df.loc[t, 'rD'] = np.NaN
    return df

Multiple files are combined into one data frame.

def CRDinWorldArea01(area):
    keys = { 'nth':100, 'tf': 3 }
    df1 = makeCalcFrame(100) #
    df2 = readCsvOfWorldArea_Confirmed(area)
    df3 = readCsvOfWorldArea_Recovered(area)
    df4 = readCsvOfWorldArea_Deaths(   area)
    df = df1
    df = mergeCalcFrame(df, df2)
    df = mergeCalcFrame(df, df3)
    df = mergeCalcFrame(df, df4)
    df = calcCRD(df, keys)
    return df

result of analysis

Now let's take a look at the calculation results. The calculation target is countries where the number of infected people exceeds 5,000 as of April 15.

Overall trend

First, plot the average recovery rate rR on the horizontal axis and the average mortality rate rD on the vertical axis. CRD_COVID-19_Map_WLD.png Mortality rates vary considerably from country to country. Countries with particularly high mortality rates include EU countries such as Spain, the United Kingdom, Italy, France and Belgium and Iran. Conversely, countries with low mortality rates include Australia, Israel, Norway, Chile, South Korea and Germany. The recovery rate also varies widely, but it is characteristic that Iran and Peru are high. China seems to have a high recovery rate because it has been a long time since the pandemic.

Comparison within G7

Let's make a comparison within the G7. First is the mortality rate. The country on the left has a relatively low mortality rate, and the country on the right has a relatively high mortality rate. CRD_COVID-19_DTR_G7.png In countries with relatively low mortality rates (left), mortality rates tend to decrease as the number of people requiring treatment increases. In particular, the United States has the highest number of infected people in the world, but it is suppressed to around 0.5%. In countries with relatively high mortality rates (right), ** mortality rates tend to increase as the number of people requiring treatment increases **. When the number of people requiring treatment exceeds 1000, the mortality rate has increased rapidly from around 1% to around 3% at maximum.

Let's look at the recovery rate. CRD_COVID-19_RTR_G7.png In countries with relatively low mortality rates (left), with the exception of the United States, recovery rates appear to increase when the number of people requiring treatment is relatively small. In Canada and Germany, the recovery rate is skyrocketing when the number of people requiring treatment reaches a certain level. In countries with relatively high mortality rates (right), ** the recovery rate tends to decrease as the number of people requiring treatment increases **.

Comparison of countries with high and low mortality rates worldwide

Let's look at a comparison of countries with high and low mortality rates globally. First is the mortality rate. The country on the left has a relatively low mortality rate, and the country on the right has a relatively high mortality rate. CRD_COVID-19_DTR_GoodBad.png In countries with relatively low mortality (left), a flat shape of 0.5% or less can be seen. In countries with relatively high mortality rates (right), without exception, ** mortality rates tend to increase as the number of people requiring treatment increases **.

Let's look at the recovery rate. CRD_COVID-19_RTR_GoodBad.png In countries with relatively low mortality rates (left), recovery rates have skyrocketed at a certain number of people requiring treatment. In countries with relatively high mortality rates (right), recovery rates tend to decline as the number of people requiring treatment increases.

BCG Japanese strain inoculated countries and neighboring countries

A paper on whether regular BCG vaccine vaccination may affect COVID-19 was published in Germany, the Netherlands, Australia, etc. The clinical trial has begun. So let's take a look at the impact of BCG, especially Japanese equities. First is the mortality rate. The left is the country inoculated with BCG Japanese strains, and the right is the neighboring country with non-BCG Japanese strains inoculated. CRD_COVID-19_DTR_BCG.png Mortality is high in Iran, but mortality is relatively low in other non-BCG Japanese strain-inoculated countries.

Let's look at the recovery rate. CRD_COVID-19_RTR_BCG.png In BCG Japanese strain inoculated countries, the number of people requiring treatment is less than 1000 and the recovery rate is high, but in non-BCG Japanese strain inoculated countries, the recovery rate does not increase unless the number of people requiring treatment increases to 1000 or more. .. In other words, ** BCG Japanese strain inoculation does not have the effect of lowering the mortality rate, but it may have the effect of increasing the recovery rate at an early stage **.

Consideration

From the above, the following trends were found from the data as the verification results regarding the collapse of medical care.

Furthermore ...

Reference link

I referred to the following page.

  1. Medical collapse
  2. Data published by Johns Hopkins University
  3. Association of BCG vaccination policy with prevalence and mortality of COVID-19
  4. Correlation between universal BCG vaccination policy and reduced morbidity and mortality for COVID-19: an epidemiological study
  5. JSatoNotes

Recommended Posts

Let's test the medical collapse hypothesis of the new coronavirus
Plot the spread of the new coronavirus
Estimate the peak infectivity of the new coronavirus
Let's calculate the transition of the basic reproduction number of the new coronavirus by prefecture
Factfulness of the new coronavirus seen in Splunk
GUI simulation of the new coronavirus (SEIR model)
Let's examine the convergence time from the global trend of the effective reproduction number of the new coronavirus
Let's put out a ranking of the number of effective reproductions of the new coronavirus by prefecture
Let's visualize the number of people infected with coronavirus with matplotlib
Quantify the degree of self-restraint required to contain the new coronavirus
Let's simulate the effect of introducing a contact tracking app as a countermeasure against the new coronavirus
Significance of narrowing down the test target of PCR test for new coronavirus understood by Bayes' theorem
Let's measure the test coverage of pushed python code on GitHub.
Test the goodness of fit of the distribution
Hypothesis of why the new coronavirus is not so common in urban areas such as Tokyo
Let's take a look at the infection tendency of the new coronavirus COVID-19 in each country and the medical response status (additional information).
Analyzing the age-specific severity of coronavirus
I tried using PDF data of online medical care based on the spread of the new coronavirus infection
Let's decide the winner of bingo
The story of the student who developed the new coronavirus countermeasure site (Ishikawa version)
I tried to predict the behavior of the new coronavirus with the SEIR model.
Folding @ Home on Linux Mint to contribute to the analysis of the new coronavirus
Let's summarize the construction of NFS server
Let's investigate the mechanism of Kaiji's cee-loline
[AWS] Let's run a unit test of Lambda function in the local environment
Scraping the number of downloads and positive registrations of the new coronavirus contact confirmation app
The epidemic forecast of the new coronavirus was released on the Web at explosive speed
I tried to automatically send the literature of the new coronavirus to LINE with Python
[Python] Test the moon matagi of relative delta
I touched some of the new features of Python 3.8 ①
[Django] Let's try to clarify the part of Django that was somehow through in the test
Verify the effect of leave as a countermeasure against the new coronavirus with the SEIR model
The theory that the key to controlling infection with the new coronavirus is hyperdispersion of susceptibility
I tried to visualize the characteristics of new coronavirus infected person information with wordcloud