Giter VIP home page Giter VIP logo

apsrm's Introduction

apsrm

An agent based model originally developed for assessing potential interventions to mitigate the risk of COVID-19 transmission via aerosols in workplaces, assuming all rooms within the workplace are well mixed. Risk of transmission from other mechanisms (e.g. fomites or breathing exhaled air directly) are not considered.

The name is an acronym for Airborne Pathogen Spread Risk Model.

The framework has been designed to separate the specification of the behaviour of individuals and the characteristics of different workplaces. The core of the framework simply provides a set of algorithms that execute the following steps (in order) in each day:

  1. track the movement of individuals through rooms which comprise the workplace;

  2. track the quanta emissions of each infected individual in each room, through time;

  3. calculate the resulting concentration in each room over the course of a day;

  4. track the exposure of the susceptible individuals to over the course of the day;

  5. estimate the aggregate infection risk to each susceptible individual; and

  6. randomly infects susceptible individuals based on their infection risk.

Getting Started

On a proper operating system (in this case, one with make installed), after cloning this repository, you can run

make initial-setup

This will create a virtual environment at ./venv with the package installed for development (which means you can work on it and the changes will be reflected in the installation). It will also install everything you need for building the package and running the Jupyter notebooks, which can be found in the subfolders under ./workplaces.

In order to run analyses and alike you will need to activate the virtual environment with

. venv/bin/activate

The easiest place to get started is in the office, with something like

. venv/bin/activate
cd workplaces/office
jupyter notebook

which should open a browser in that folder. The notebook simulation provides examples on how one might run simulations. Please read the docs to learn about working with Jupyter.

Dependencies

  • Python 3 (we started at 3.6).

  • virtualenv for making environments, though you can probably just use the venv module as per the advice at that link. This is not required, but life is much easier with a virtual environment.

  • To generate the data used by the PCR test (which you can do with make data), you will need Rscript (installed as part of the standard R installation) with the packages fitdistrplus and rjson. The processed data is versioned, so you would only need to do this if you change that data.

Contents

Folders

  • data: Static data and scripts for working with it.

  • doc: Sphinx documentation and configuration. You can generate the documentation with make sphinx-doc. You can once built, you can find the documentation at ./doc/build/index.html.

  • apsrm: Code for the Python package. Run make initial-setup or make venv to install it for development.

  • outputs: Default output directory for results generated using the Jupyter notebooks under workplaces.

  • tests: Tests. After installation (with .[dev]), run pytest to run the tests.

  • workplaces: Models for different workplaces. Each workplace is in a separate folder. The analyses themselves are in Jupyter notebooks. The file workplaces/run-all.py will run the notebooks required to produce outputs for the original paper, but they may, of course, be run interactively.

Files

  • Dockerfile: Docker build file.

  • Makefile: Make file for common tasks. This is good place to see how to do things, even if you haven't got a reasonable operating system that doesn't support make.

  • MANIFEST.in: Tells setup.py what files should be installed with the package.

  • setup.py: The setup script for the package. Will accept optional dependencies dev and notebooks.

  • version: Contains a version number for the Python package.

  • ./apsrm/emissions.json: Data on breathing rates and pathogen emissions rates for different activities by variant. Produced by the script ./data/load-emissions.py.

  • ./apsrm/prcbetaparams.json: The estimates of the Beta parameters produced by ./data/pcr-beta-bernoulli.R.

  • ./apsrm/vaccineefficacy.json: Daily vaccine efficacy (proportional reduction in the probability of becoming infected from an exposure) for the first 731 days after vaccination. Produced by the script ./data/vaccine-efficacy.R.

  • run-all.py: A script that runs the analyses presented in our JRSI paper... remember to activate your venv before running this!

The implementation is mostly in private modules under ./apsrm and the public API is manged in ./apsrm/init.py. Please follow your nose from there.

Misc Stuff

Docker

Provided for convenience. Might be useful if you don't have a proper operating system but can install Docker. Build with

docker build -t diser .

To then run a Jupyter notebook (available at port 8888 on the host) from a Docker container

docker run -it --rm \
    -p 8888:8888 \
    -v `pwd`:/nbs \
     diser \
         jupyter notebook --allow-root --ip=0.0.0.0 --no-browser --notebook-dir=/nbs

Developer Documentation

make sphinx-doc

Generated documenation can be found at ./doc/build/index.html.

Optional Requirements (which can be specified when installing the package)

dev

Optional requirements for development. At the moment this is stuff for building the documentation and running tests. You will need this for make commands sphinx-doc and initial-setup.

notebooks

Optional requirements for running the Jupyter notebooks found under workplaces.

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.