covasim


Namecovasim JSON
Version 3.1.6 PyPI version JSON
download
home_pagehttp://covasim.org
SummaryCOVID-19 Agent-based Simulator
upload_time2024-01-30 03:43:48
maintainer
docs_urlNone
authorCliff Kerr, Robyn Stuart, Romesh Abeysuriya, Dina Mistry, Lauren George, and Daniel Klein, on behalf of the IDM COVID-19 Response Team
requires_python
license
keywords covid covid-19 coronavirus sars-cov-2 stochastic agent-based model interventions epidemiology
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            =======
Covasim
=======

About Covasim
=============

Covasim is a stochastic agent-based simulator for performing COVID-19 analyses. These include projections of indicators such as numbers of infections and peak hospital demand. Covasim can also be used to explore the potential impact of different interventions, including social distancing, school closures, testing, contact tracing, quarantine, and vaccination.

The original scientific paper describing Covasim is available at http://paper.covasim.org. The recommended citation is:

    **Covasim: an agent-based model of COVID-19 dynamics and interventions**. Kerr CC, Stuart RM, Mistry D, Abeysuriya RG, Rosenfeld R, Hart G, Núñez RC, Cohen JA, Selvaraj P, Hagedorn B, George L, Jastrzębski M, Izzo A, Fowler G, Palmer A, Delport D, Scott N, Kelly S, Bennette C, Wagner B, Chang S, Oron AP, Wenger E, Panovska-Griffiths J, Famulare M, Klein DJ (2021). *PLOS Computational Biology* **17** (7): e1009149. doi: https://doi.org/10.1371/journal.pcbi.1009149.

Covasim's immunity module (including vaccines and variants) is described here:

    **Mechanistic modeling of SARS-CoV-2 immune memory, variants, and vaccines**. Cohen JA, Stuart RM, Núñez RC, Wagner B, Chang ST, Rosenfeld K, Kerr CC, Famulare M, Klein DJ (under review; posted 2021-06-01). *medRxiv* 2021.05.31.21258018; doi: https://doi.org/10.1101/2021.05.31.21258018.

The Covasim webapp is available at https://app.covasim.org, and the repository for it is available `here <https://github.com/institutefordiseasemodeling/covasim_webapp>`__.

Covasim was developed by the `Institute for Disease Modeling <https://idmod.org/>`__, with additional contributions from the `University of Copenhagen <https://www.math.ku.dk/english>`__, the `Burnet Institute <https://www.burnet.edu.au/>`__, `GitHub <https://github.com/>`__, and `Microsoft <https://www.microsoft.com/en-us/ai/ai-for-health-covid-data>`__.

Questions or comments can be directed to info@covasim.org, or on this project's
GitHub_ page. Full information about Covasim is provided in the documentation_.

.. _GitHub: https://github.com/institutefordiseasemodeling/covasim
.. _documentation: https://docs.covasim.org


.. contents:: **Contents**
   :local:
   :depth: 2


Background
==========

Covasim has been used for analyses in over a dozen countries, both to inform policy decisions (including in the US, UK, and Australia), and as part of research studies. Some key papers that have been written using Covasim include:

1. **Controlling COVID-19 via test-trace-quarantine**. Kerr CC, Mistry D, Stuart RM, Rosenfeld R, Hart G, Núñez RC, Selvaraj P, Cohen JA, Abeysuriya RG, George L, Hagedorn B, Jastrzębski M, Fagalde M, Duchin J, Famulare M, Klein DJ (2021). *Nature Communications* 12:2993. doi: https://doi.org/10.1038/s41467-021-23276-9.

2. **Determining the optimal strategy for reopening schools, the impact of test and trace interventions, and the risk of occurrence of a second COVID-19 epidemic wave in the UK: a modelling study**. Panovska-Griffiths J, Kerr CC, Stuart RM, Mistry D, Klein DJ, Viner R, Bonnell C (2020-08-03). *Lancet Child and Adolescent Health* S2352-4642(20) 30250-9. doi: https://doi.org/10.1016/S2352-4642(20)30250-9.

3. **Estimating and mitigating the risk of COVID-19 epidemic rebound associated with reopening of international borders in Vietnam: a modelling study**. Pham QD, Stuart RM, Nguyen TV, Luong QC, Tran DQ, Phan LT, Dang TQ, Tran DN, Mistry D, Klein DJ, Abeysuriya RG, Oron AP, Kerr CC (2021-04-12). *Lancet Global Health* S2214-109X(21) 00103-0; doi: https://doi.org/10.1016/S2214-109X(21)00103-0.

A more complete list of papers is given in ``papers.rst``.

If you've written a paper or report using Covasim, we'd love to know about it! Please write to us `here <mailto:info@covasim.org>`__.


Requirements
============

Python 3.9-3.11 (64-bit). (Note: Python 2.7 and Python 3.12 are not supported, the latter being due to `Numba <https://numba.pydata.org/>`_ not supporting Python 3.12 at the time of writing.)

We also recommend, but do not require, installing Covasim in a virtual environment. For more information, see documentation for e.g. Anaconda_.

.. _Anaconda: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.htmlCovasim


Quick start guide
==================

Install with ``pip install covasim``. If everything is working, the following Python commands should bring up a plot::

  import covasim as cv
  sim = cv.Sim()
  sim.run()
  sim.plot()


Full installation instructions
==============================

If you would rather download the source code rather than using the ``pip`` package, follow these steps:

1.  Clone a copy of the repository. If you intend to make changes to the code, we recommend that you fork it first.

2.  (Optional) Create and activate a virtual environment.

3.  Navigate to the root of the repository and install the Covasim Python package using one of the following options:

    *   For normal installation (recommended)::

          pip install -e .

    *   To install Covasim and optional dependencies (be aware this may fail since it relies on nonstandard packages)::

          pip install -e .[full]

    The module should then be importable via ``import covasim as cv``.


Usage examples
==============

There are several examples in the ``examples`` folder. These can be run as follows:

* ``python examples/simple.py``

  This example creates a figure using default parameter values.

* ``python examples/run_sim.py``

  This shows a slightly more detailed example, including creating an intervention and saving to disk.

* ``python examples/run_scenarios.py``

  This shows a more complex example, including running an intervention scenario, plotting uncertainty, and performing a health systems analysis.

Other examples in that folder are taken from the tutorials.


Module structure
================

All core model code is located in the ``covasim`` subfolder; standard usage is ``import covasim as cv``. The ``data`` subfolder is described below.

The model consists of two core classes: the ``Person`` class (which contains information on health state), and the ``Sim`` class (which contains methods for running, calculating results, plotting, etc.).

The structure of the ``covasim`` folder is as follows, roughly in the order in which the modules are imported, building from most fundamental to most complex:

* ``version.py``: Version, date, and license information.
* ``requirements.py``: A simple module to check that imports succeeded, and turn off features if they didn't.
* ``utils.py``: Functions for choosing random numbers, many based on Numba, plus other helper functions.
* ``misc.py``: Miscellaneous helper functions.
* ``settings.py``: User-customizable options for Covasim (e.g. default font size).
* ``defaults.py``: The default colors, plots, etc. used by Covasim.
* ``parameters.py``: Functions for creating the parameters dictionary and loading the input data.
* ``plotting.py``: Plotting scripts, including Plotly graphs for the webapp (used in other Covasim classes, and hence defined first).
* ``base.py``: The ``ParsObj`` class, the fundamental class used in Covasim, plus basic methods of the ``BaseSim`` and ``BasePeople`` classes, and associated functions.
* ``people.py``: The ``People`` class, for handling updates of state for each person.
* ``population.py``: Functions for creating populations of people, including age, contacts, etc.
* ``interventions.py``: The ``Intervention`` class, for adding interventions and dynamically modifying parameters, and classes for each of the specific interventions derived from it.
* ``immunity.py``: The ``strain`` class, and functions for computing waning immunity and neutralizing antibodies.
* ``sim.py``: The ``Sim`` class, which performs most of the heavy lifting: initializing the model, running, and plotting.
* ``run.py``: Functions for running simulations (e.g. parallel runs and the ``Scenarios`` and ``MultiSim`` classes).
* ``analysis.py``: The ``Analyzers`` class (for performing analyses on the sim while it's running), the ``Fit`` class (for calculating the fit between the model and the data), the ``TransTree`` class, and other classes and functions for analyzing simulations.

The ``data`` folder within the Covasim package contains loading scripts for the epidemiological data in the root ``data`` folder, as well as data on age distributions for different countries and household sizes.



Other folders
=============

Please see the readme in each subfolder for more information.


Bin
---

This folder contains a command-line interface (CLI) version of Covasim; example usage::

  covasim --pars "{pop_size:20000, pop_infected:1, n_days:360, rand_seed:1}"

Note: the CLI is currently not compatible with Windows. You will need to add
this folder to your path to run from other folders.


Data
----

Scripts to automatically scrape data (including demographics and COVID epidemiology data),
and the data files themselves (which are not part of the repository).


Tutorials
---------

This folder contains Jupyter notebooks for nine tutorials that walk you through using Covasim, from absolute basics to advanced topics such as calibration and creating custom populations.


Examples
--------

This folder contains demonstrations of simple Covasim usage, with most examples taken from the tutorials. 


Cruise ship
~~~~~~~~~~~

An early application of Covasim to the Diamond Princess cruise ship.


Calibration
~~~~~~~~~~~

Examples of how to calibrate simulations, including `Optuna`_ (also covered in the tutorial) and `Weights and Biases`_.

.. _Optuna: https://optuna.org/
.. _Weights and Biases: https://www.wandb.com/


Tests
-----

Integration, development, and unit tests. While not (yet) beautifully curated, these folders contain many usage examples. See README in the tests folder for more information.


Disclaimer
==========

The code in this repository was developed by IDM, the Burnet Institute, the University of Copenhagen, and other collaborators to support our joint research on COVID. We’ve made it publicly available under the MIT License to provide others with a better understanding of our research and an opportunity to build upon it for their own work. Note that Covasim depends on a number of user-installed Python packages that can be installed automatically via ``pip install``. We make no representations that the code works as intended or that we will provide support, address issues that are found, or accept pull requests. You are welcome to create your own fork and modify the code to suit your own modeling needs as contemplated under the MIT License. See the contributing and code of conduct READMEs for more information.

            

Raw data

            {
    "_id": null,
    "home_page": "http://covasim.org",
    "name": "covasim",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "COVID,COVID-19,coronavirus,SARS-CoV-2,stochastic,agent-based model,interventions,epidemiology",
    "author": "Cliff Kerr, Robyn Stuart, Romesh Abeysuriya, Dina Mistry, Lauren George, and Daniel Klein, on behalf of the IDM COVID-19 Response Team",
    "author_email": "info@covasim.org",
    "download_url": "https://files.pythonhosted.org/packages/2e/70/ab585de682f29695b258e536e723bd56519a64b261dbf4405649ec6b42be/covasim-3.1.6.tar.gz",
    "platform": "OS Independent",
    "description": "=======\nCovasim\n=======\n\nAbout Covasim\n=============\n\nCovasim is a stochastic agent-based simulator for performing COVID-19 analyses. These include projections of indicators such as numbers of infections and peak hospital demand. Covasim can also be used to explore the potential impact of different interventions, including social distancing, school closures, testing, contact tracing, quarantine, and vaccination.\n\nThe original scientific paper describing Covasim is available at http://paper.covasim.org. The recommended citation is:\n\n    **Covasim: an agent-based model of COVID-19 dynamics and interventions**. Kerr CC, Stuart RM, Mistry D, Abeysuriya RG, Rosenfeld R, Hart G, N\u00fa\u00f1ez RC, Cohen JA, Selvaraj P, Hagedorn B, George L, Jastrz\u0119bski M, Izzo A, Fowler G, Palmer A, Delport D, Scott N, Kelly S, Bennette C, Wagner B, Chang S, Oron AP, Wenger E, Panovska-Griffiths J, Famulare M, Klein DJ (2021). *PLOS Computational Biology* **17** (7): e1009149. doi: https://doi.org/10.1371/journal.pcbi.1009149.\n\nCovasim's immunity module (including vaccines and variants) is described here:\n\n    **Mechanistic modeling of SARS-CoV-2 immune memory, variants, and vaccines**. Cohen JA, Stuart RM, N\u00fa\u00f1ez RC, Wagner B, Chang ST, Rosenfeld K, Kerr CC, Famulare M, Klein DJ (under review; posted 2021-06-01). *medRxiv* 2021.05.31.21258018; doi: https://doi.org/10.1101/2021.05.31.21258018.\n\nThe Covasim webapp is available at https://app.covasim.org, and the repository for it is available `here <https://github.com/institutefordiseasemodeling/covasim_webapp>`__.\n\nCovasim was developed by the `Institute for Disease Modeling <https://idmod.org/>`__, with additional contributions from the `University of Copenhagen <https://www.math.ku.dk/english>`__, the `Burnet Institute <https://www.burnet.edu.au/>`__, `GitHub <https://github.com/>`__, and `Microsoft <https://www.microsoft.com/en-us/ai/ai-for-health-covid-data>`__.\n\nQuestions or comments can be directed to info@covasim.org, or on this project's\nGitHub_ page. Full information about Covasim is provided in the documentation_.\n\n.. _GitHub: https://github.com/institutefordiseasemodeling/covasim\n.. _documentation: https://docs.covasim.org\n\n\n.. contents:: **Contents**\n   :local:\n   :depth: 2\n\n\nBackground\n==========\n\nCovasim has been used for analyses in over a dozen countries, both to inform policy decisions (including in the US, UK, and Australia), and as part of research studies. Some key papers that have been written using Covasim include:\n\n1. **Controlling COVID-19 via test-trace-quarantine**. Kerr CC, Mistry D, Stuart RM, Rosenfeld R, Hart G, N\u00fa\u00f1ez RC, Selvaraj P, Cohen JA, Abeysuriya RG, George L, Hagedorn B, Jastrz\u0119bski M, Fagalde M, Duchin J, Famulare M, Klein DJ (2021). *Nature Communications* 12:2993. doi: https://doi.org/10.1038/s41467-021-23276-9.\n\n2. **Determining the optimal strategy for reopening schools, the impact of test and trace interventions, and the risk of occurrence of a second COVID-19 epidemic wave in the UK: a modelling study**. Panovska-Griffiths J, Kerr CC, Stuart RM, Mistry D, Klein DJ, Viner R, Bonnell C (2020-08-03). *Lancet Child and Adolescent Health* S2352-4642(20) 30250-9. doi: https://doi.org/10.1016/S2352-4642(20)30250-9.\n\n3. **Estimating and mitigating the risk of COVID-19 epidemic rebound associated with reopening of international borders in Vietnam: a modelling study**. Pham QD, Stuart RM, Nguyen TV, Luong QC, Tran DQ, Phan LT, Dang TQ, Tran DN, Mistry D, Klein DJ, Abeysuriya RG, Oron AP, Kerr CC (2021-04-12). *Lancet Global Health* S2214-109X(21) 00103-0; doi: https://doi.org/10.1016/S2214-109X(21)00103-0.\n\nA more complete list of papers is given in ``papers.rst``.\n\nIf you've written a paper or report using Covasim, we'd love to know about it! Please write to us `here <mailto:info@covasim.org>`__.\n\n\nRequirements\n============\n\nPython 3.9-3.11 (64-bit). (Note: Python 2.7 and Python 3.12 are not supported, the latter being due to `Numba <https://numba.pydata.org/>`_ not supporting Python 3.12 at the time of writing.)\n\nWe also recommend, but do not require, installing Covasim in a virtual environment. For more information, see documentation for e.g. Anaconda_.\n\n.. _Anaconda: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.htmlCovasim\n\n\nQuick start guide\n==================\n\nInstall with ``pip install covasim``. If everything is working, the following Python commands should bring up a plot::\n\n  import covasim as cv\n  sim = cv.Sim()\n  sim.run()\n  sim.plot()\n\n\nFull installation instructions\n==============================\n\nIf you would rather download the source code rather than using the ``pip`` package, follow these steps:\n\n1.  Clone a copy of the repository. If you intend to make changes to the code, we recommend that you fork it first.\n\n2.  (Optional) Create and activate a virtual environment.\n\n3.  Navigate to the root of the repository and install the Covasim Python package using one of the following options:\n\n    *   For normal installation (recommended)::\n\n          pip install -e .\n\n    *   To install Covasim and optional dependencies (be aware this may fail since it relies on nonstandard packages)::\n\n          pip install -e .[full]\n\n    The module should then be importable via ``import covasim as cv``.\n\n\nUsage examples\n==============\n\nThere are several examples in the ``examples`` folder. These can be run as follows:\n\n* ``python examples/simple.py``\n\n  This example creates a figure using default parameter values.\n\n* ``python examples/run_sim.py``\n\n  This shows a slightly more detailed example, including creating an intervention and saving to disk.\n\n* ``python examples/run_scenarios.py``\n\n  This shows a more complex example, including running an intervention scenario, plotting uncertainty, and performing a health systems analysis.\n\nOther examples in that folder are taken from the tutorials.\n\n\nModule structure\n================\n\nAll core model code is located in the ``covasim`` subfolder; standard usage is ``import covasim as cv``. The ``data`` subfolder is described below.\n\nThe model consists of two core classes: the ``Person`` class (which contains information on health state), and the ``Sim`` class (which contains methods for running, calculating results, plotting, etc.).\n\nThe structure of the ``covasim`` folder is as follows, roughly in the order in which the modules are imported, building from most fundamental to most complex:\n\n* ``version.py``: Version, date, and license information.\n* ``requirements.py``: A simple module to check that imports succeeded, and turn off features if they didn't.\n* ``utils.py``: Functions for choosing random numbers, many based on Numba, plus other helper functions.\n* ``misc.py``: Miscellaneous helper functions.\n* ``settings.py``: User-customizable options for Covasim (e.g. default font size).\n* ``defaults.py``: The default colors, plots, etc. used by Covasim.\n* ``parameters.py``: Functions for creating the parameters dictionary and loading the input data.\n* ``plotting.py``: Plotting scripts, including Plotly graphs for the webapp (used in other Covasim classes, and hence defined first).\n* ``base.py``: The ``ParsObj`` class, the fundamental class used in Covasim, plus basic methods of the ``BaseSim`` and ``BasePeople`` classes, and associated functions.\n* ``people.py``: The ``People`` class, for handling updates of state for each person.\n* ``population.py``: Functions for creating populations of people, including age, contacts, etc.\n* ``interventions.py``: The ``Intervention`` class, for adding interventions and dynamically modifying parameters, and classes for each of the specific interventions derived from it.\n* ``immunity.py``: The ``strain`` class, and functions for computing waning immunity and neutralizing antibodies.\n* ``sim.py``: The ``Sim`` class, which performs most of the heavy lifting: initializing the model, running, and plotting.\n* ``run.py``: Functions for running simulations (e.g. parallel runs and the ``Scenarios`` and ``MultiSim`` classes).\n* ``analysis.py``: The ``Analyzers`` class (for performing analyses on the sim while it's running), the ``Fit`` class (for calculating the fit between the model and the data), the ``TransTree`` class, and other classes and functions for analyzing simulations.\n\nThe ``data`` folder within the Covasim package contains loading scripts for the epidemiological data in the root ``data`` folder, as well as data on age distributions for different countries and household sizes.\n\n\n\nOther folders\n=============\n\nPlease see the readme in each subfolder for more information.\n\n\nBin\n---\n\nThis folder contains a command-line interface (CLI) version of Covasim; example usage::\n\n  covasim --pars \"{pop_size:20000, pop_infected:1, n_days:360, rand_seed:1}\"\n\nNote: the CLI is currently not compatible with Windows. You will need to add\nthis folder to your path to run from other folders.\n\n\nData\n----\n\nScripts to automatically scrape data (including demographics and COVID epidemiology data),\nand the data files themselves (which are not part of the repository).\n\n\nTutorials\n---------\n\nThis folder contains Jupyter notebooks for nine tutorials that walk you through using Covasim, from absolute basics to advanced topics such as calibration and creating custom populations.\n\n\nExamples\n--------\n\nThis folder contains demonstrations of simple Covasim usage, with most examples taken from the tutorials. \n\n\nCruise ship\n~~~~~~~~~~~\n\nAn early application of Covasim to the Diamond Princess cruise ship.\n\n\nCalibration\n~~~~~~~~~~~\n\nExamples of how to calibrate simulations, including `Optuna`_ (also covered in the tutorial) and `Weights and Biases`_.\n\n.. _Optuna: https://optuna.org/\n.. _Weights and Biases: https://www.wandb.com/\n\n\nTests\n-----\n\nIntegration, development, and unit tests. While not (yet) beautifully curated, these folders contain many usage examples. See README in the tests folder for more information.\n\n\nDisclaimer\n==========\n\nThe code in this repository was developed by IDM, the Burnet Institute, the University of Copenhagen, and other collaborators to support our joint research on COVID. We\u2019ve made it publicly available under the MIT License to provide others with a better understanding of our research and an opportunity to build upon it for their own work. Note that Covasim depends on a number of user-installed Python packages that can be installed automatically via ``pip install``. We make no representations that the code works as intended or that we will provide support, address issues that are found, or accept pull requests. You are welcome to create your own fork and modify the code to suit your own modeling needs as contemplated under the MIT License. See the contributing and code of conduct READMEs for more information.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "COVID-19 Agent-based Simulator",
    "version": "3.1.6",
    "project_urls": {
        "Homepage": "http://covasim.org"
    },
    "split_keywords": [
        "covid",
        "covid-19",
        "coronavirus",
        "sars-cov-2",
        "stochastic",
        "agent-based model",
        "interventions",
        "epidemiology"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "11d810b7637dfc853e17788790e9c2028bb1c9a29d53220d51a6b62442ff34f7",
                "md5": "838b6d8f8bf7e81d868f9817d0637509",
                "sha256": "f2483844101bcaa094724a5828ec674693285daeafeb4f5807177a76b40de5a7"
            },
            "downloads": -1,
            "filename": "covasim-3.1.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "838b6d8f8bf7e81d868f9817d0637509",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 1633456,
            "upload_time": "2024-01-30T03:43:44",
            "upload_time_iso_8601": "2024-01-30T03:43:44.885749Z",
            "url": "https://files.pythonhosted.org/packages/11/d8/10b7637dfc853e17788790e9c2028bb1c9a29d53220d51a6b62442ff34f7/covasim-3.1.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2e70ab585de682f29695b258e536e723bd56519a64b261dbf4405649ec6b42be",
                "md5": "487e19263d55136b07d59e12ec93756c",
                "sha256": "d13ae4e8691936aa2339d9543d47a19d1f117425db8a7b5d57be7602d7782050"
            },
            "downloads": -1,
            "filename": "covasim-3.1.6.tar.gz",
            "has_sig": false,
            "md5_digest": "487e19263d55136b07d59e12ec93756c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 1730942,
            "upload_time": "2024-01-30T03:43:48",
            "upload_time_iso_8601": "2024-01-30T03:43:48.171637Z",
            "url": "https://files.pythonhosted.org/packages/2e/70/ab585de682f29695b258e536e723bd56519a64b261dbf4405649ec6b42be/covasim-3.1.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-30 03:43:48",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "covasim"
}
        
Elapsed time: 0.17431s