Skip to content

RemDelaporteMathurin/epidemic-simulator

Repository files navigation

epidemic-simulator

Many countries in Europe and around the world are currently on lockdown. Yet many people still choose to go out in the street despite the control measures! We'll first explain why applying control measures and lockdown during an epidemic are indeed a good thing and then we'll then try to use this model to do some predictions !

Installation

$ git clone https://github.com/RemiTheWarrior/epidemic-simulator
$ cd epidemic-simulator
$ pip3 install -r requirements.txt

Usage

$ python3 fit_any_country.py France

or

$ python3 fit_any_country.py China

will simulate the evolution of the epidemic in a specific country based on pomber/covid19 dataset.

Alternatively, visit the web application.

Mathematical model

Let's first try to create a mathematical model that represents the population and the way some get contaminated, some recover, and some people die. We'll name the Susceptible (healthy) population, the Infected population, the population which has Recovered from the disease and produced its own antibodies and the part of the population that has Died. The temporal evolution of each population can be modelled with the following system of equations:

where is the contamination probability, is the recovery probability, is the death probability.

We'll assume the contamination probability increases with people's mobility . If people were 100% immobile that would mean . We'll assume that usual people's mobility is .

Here is arbitrary.

Effect of control measures

How does this model behaves in time ?

drawing

First, more and more people get contaminated. Then as people recover and developp antibodies, a contamination peak can be seen after which contaminated population decreases until reaching zero: the epidemic has ended.

By decreasing people's mobility, the contamination peak is delayed and is less significant in terms of contaminated people. Also the epidemic ends later.

Overall, the curve has been flatted!

Great! But why would we care ?

Well let's take a look at the ammount of dead people now...

drawing

Here we start to see the importance of taking control measures! As the mobility decreases, deaths decrease as well! That's because if less people get sick, then obviously less people a likely to die from the disease!

But that's not quite the way our health system works right ? People don't miraculously heal themselves (at least not all of them): some of them go to the hospital. And if there are too many patients then ... it is more likely that people will die and heal less rapidly.

In order to take this effect into account in our model, let's first assume a hospital capacity . If the number of sick people is above this capacity, the recovering probability will decrease by 50% and the death probability will increase by 50%. What will happen then ?

drawingdrawing

We added to the previous graphs dashed lines corresponding to the extended model with a hospital saturation limit. If people's mobility is not reduced enough the number of sick people increases by 12%! But more important is that the number of deaths almost doubled!

That's pretty much it! The simple code I used is available if you wish to play with it and tweak the parameters a little!

Takeaway message: stay home!

Model validation and predictions

Alright. Is this model actually representing what's happening in reality ? One way to found out: try to reproduce actual epidemics that happened in the past!

Let's do it with the recent Covid-19 epidemic in China that is nearly ended by now. The model's parameters (contamination, recovering and death rates) will be adjusted in order to fit actual data as best as we can.

drawingdrawing

Not that bad afterall! We now know that our model can reproduce actual epidemic behaviour with more or less accuracy. Could we use this fitting process to try and predict the future ? I'd really like to know when I'll be authorised to go out again...so let's do it for France!

drawingdrawing

Alright, so this is obviously not as accurate as the case for China cause we simply don't have enough data yet. This means that the predictions will gain in accuracy day by day! But so far, all we can expect is that the epidemic in France (assuming there won't be any changes in the confinement measures) won't be over until the end of April! We'll come back then and check if the results were okay!

About

Simple equations for simulating epidemics... Why are we all on lockdown ? When will all of this be over ?

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages