Skip to content

shanyas10/covid_p2p_simulation

 
 

Repository files navigation

COVID-19 Spread Simulator for Tracing App

This is a sub-project of Peer-to-Peer AI Tracing App delegated by Prof. Yoshua Bengio. Read more about the app in Prof. Bengio's blog post.

The simulator is built using simpy. It simulates human mobility along with infectious disease (COVID) spreading in a city, where city has houses, grocery stores, parks, workplaces, and other non-essential establishments.

Human mobility simulation is based on Spatial-EPR model. More details on this model are here and here.

The infection spread in this simulator is modeled according to what is known about COVID-19. The assumptions about the COVID-19 spread and mobility implemented in the simulator are in the Google Doc. The same document also details our current understanding of COVID-19. Our understanding is based on the published research as well as interactions with the epidemiologists. We plan to update the simulator as more and more about COVID-19 will be known.

Dependencies

Following python packages are required (python>=3.6)

pip install -r requirements.txt

How to run it using command line?

Run the simulator as -

python run.py sim --n_people 100 --n_stores 100 --n_parks 10 --n_misc 100 --init_percent_sick 0.01 --outfile data --seed 0

Output will be in data.pkl. It is a list of dict.

How to run tests?

Run -

python run.py test

Parameters

@click.option('--n_people', help='population of the city', type=int, default=100)
@click.option('--n_stores', help='number of grocery stores in the city', type=int, default=100)
@click.option('--n_parks', help='number of parks in the city', type=int, default=20)
@click.option('--n_misc', help='number of non-essential establishments in the city', type=int, default=100)
@click.option('--init_percent_sick', help='% of population initially sick', type=float, default=0.01)
@click.option('--simulation_days', help='number of days to run the simulation for', type=int, default=30)
@click.option('--outfile', help='filename of the output (file format: .pkl)', type=str, required=False)
@click.option('--print_progress', is_flag=True, help='print the evolution of days', default=False)
@click.option('--seed', help='seed for the process', type=int, default=0)

Accessing Simulation Data

Load the output of the simulator as following

data = pickle.load(open("data.pkl", 'rb'))

How to run it as a function?

Although not designed with this usage in mind one can still call it like this

from run import run_simu
monitors = run_simu(n_stores=100, n_parks=50, n_people=100, n_misc=100, init_percent_sick=0.01, print_progress=False, seed=0)

data is a list of dict.

Base SEIR plots

Following will require cufflinks and plotly.

python run.py base --toy_human

It will open a browser window with the plot of SEIR curves.

Semantics of code

Human class builds people, and Location class builds stores, parks, workplaces, households, and non-essential establishments.

Semantics of Data

data is a list. Each entry in the list is an event represented as a dict. The detailed information about events is in docs/events.md

Contributing

Please get in touch with me at pgupta@turing.ac.uk. There are several people working on it, so it will be the best use of everyone's time and effort if we all work on different aspects of this project.

Some areas that need work are listed here. We track and manage our tasks using Google Sheets.

Collaborators

@marco-gires, @marie-pellat, @teganmaharaj, @giancarlok, @thechange, @soundarya98

About

Simulator for COVID-19 spread

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%