Skip to content

hnekoeiq/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 know about COVID-19. The assumptions about the COVID 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_miscs 100 --init_percent_sick 0.01 --outfile data

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

How to run tests?

Run -

python run.py test

Parameters

parser.add_argument( '--n_people', help='population of the city', type=int, default=1000)
parser.add_argument( '--n_stores', help='number of grocery stores in the city', type=int, default=100)
parser.add_argument( '--n_parks', help='number of parks in the city', type=int, default=20)
parser.add_argument( '--n_miscs', help='number of non-essential establishments in the city', type=int, default=100)
parser.add_argument( '--init_percent_sick', help='% of population initially sick', type=float, default=0.01)
parser.add_argument( '--simulation_days', help='number of days to run the simulation for', type=int, default=30)
parser.add_argument( '--outfile', help='filename of the output (file format: .pkl)', type=str, default="")
parser.add_argument( '--print_progress', help='print the evolution of days', action='store_true')

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 simulate import sim
data = sim(n_stores=100, n_parks=50, n_people=100, n_misc=100, init_percent_sick=0.01, print_progress=False)

data is a list of dict.

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 [email protected]. There are several people working, 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.

Collaborators

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

About

Simulator for COVID-19 spread

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages