Code Monkey home page Code Monkey logo

covid_p2p_simulation's Introduction

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_misc 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

covid_p2p_simulation's People

Contributors

marcoclearmetal avatar mariepellat avatar pg2455 avatar teganmaharaj avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.