Skip to content

Commit 48b323e

Browse files
authored
Merge pull request #438 from starsimhub/quarto-docs
Quarto docs
2 parents f699e01 + 5bd668d commit 48b323e

104 files changed

Lines changed: 3909 additions & 3394 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Runs manually or on version tags.
2+
3+
name: Publish Covasim docs
4+
5+
on:
6+
push:
7+
tags:
8+
- 'v*'
9+
workflow_dispatch:
10+
11+
jobs:
12+
publish:
13+
name: Quarto
14+
timeout-minutes: 45
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.11"
26+
27+
- name: Install Covasim and doc dependencies
28+
run: |
29+
pip install -e .[full]
30+
pip install -r docs/requirements.txt
31+
32+
- name: Set up Quarto
33+
uses: quarto-dev/quarto-actions/setup@v2
34+
35+
- name: Install Quarto interlinks extension
36+
working-directory: ./docs
37+
run: quarto add machow/quartodoc --no-prompt
38+
39+
- name: Publish docs to GitHub Pages
40+
working-directory: ./docs
41+
run: |
42+
git config --global user.name "github-actions"
43+
git config --global user.email "github-actions@users.noreply.github.com"
44+
./publish

.readthedocs.yaml

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,21 @@
1-
# .readthedocs.yaml
2-
# Read the Docs configuration file
3-
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
1+
# Read the Docs configuration — Quarto build
2+
# https://docs.readthedocs.com/platform/stable/config-file/v2.html
43

5-
# Required
64
version: 2
75

8-
# Set the version of Python and other tools you might need
96
build:
10-
os: ubuntu-20.04
7+
os: ubuntu-22.04
118
tools:
12-
python: "3.9"
9+
python: "3.11"
10+
commands:
11+
- pip install -e .[full]
12+
- pip install -r docs/requirements.txt
13+
- curl -LO https://github.com/quarto-dev/quarto-cli/releases/download/v1.6.40/quarto-1.6.40-linux-amd64.deb
14+
- sudo dpkg -i quarto-1.6.40-linux-amd64.deb
15+
- cd docs && quarto add machow/quartodoc --no-prompt && quarto render
16+
- mkdir -p $READTHEDOCS_OUTPUT/html && cp -r docs/_site/* $READTHEDOCS_OUTPUT/html/
1317

14-
# Build documentation in the docs/ directory with Sphinx
15-
sphinx:
16-
configuration: docs/conf.py
17-
18-
# If using Sphinx, optionally build your docs in additional formats such as PDF
19-
#formats:
20-
# - htmlzip
21-
22-
# Optionally declare the Python requirements required to build your docs
2318
python:
2419
install:
25-
- requirements: docs/requirements.txt
2620
- method: pip
2721
path: .

CHANGELOG.md

Lines changed: 1163 additions & 0 deletions
Large diffs are not rendered by default.

CHANGELOG.rst

Lines changed: 0 additions & 1290 deletions
This file was deleted.
Lines changed: 20 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,45 @@
1-
===============
2-
Code of conduct
3-
===============
1+
# Code of conduct
42

5-
Our pledge
6-
==========
3+
## Our pledge
74

85
We believe that a diverse, equitable, and inclusive environment is essential for producing the best quality software. In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in Covasim development and the Covasim community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
96

10-
Our standards
11-
=============
7+
## Our standards
128

139
Examples of behavior that contributes to creating a positive environment include:
1410

15-
* Using welcoming and inclusive language
16-
* Being respectful of differing viewpoints and experiences
17-
* Gracefully accepting constructive criticism
18-
* Focusing on what is best for the community
19-
* Showing empathy towards other community members
11+
- Using welcoming and inclusive language
12+
- Being respectful of differing viewpoints and experiences
13+
- Gracefully accepting constructive criticism
14+
- Focusing on what is best for the community
15+
- Showing empathy towards other community members
2016

2117
Examples of unacceptable behavior by participants include:
2218

23-
* The use of sexualized language or imagery and unwelcome sexual attention or advances
24-
* Trolling, insulting/derogatory comments, and personal or political attacks
25-
* Public or private harassment
26-
* Publishing others' private information, such as a physical or electronic address, without explicit permission
27-
* Other conduct which could reasonably be considered inappropriate in a professional setting
19+
- The use of sexualized language or imagery and unwelcome sexual attention or advances
20+
- Trolling, insulting/derogatory comments, and personal or political attacks
21+
- Public or private harassment
22+
- Publishing others' private information, such as a physical or electronic address, without explicit permission
23+
- Other conduct which could reasonably be considered inappropriate in a professional setting
2824

29-
Our responsibilities
30-
====================
25+
## Our responsibilities
3126

3227
Covasim maintainers are responsible for clarifying the standards of acceptable behavior and will take appropriate and fair corrective action in response to any instances of unacceptable behavior.
3328

3429
Covasim maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
3530

36-
Scope
37-
=====
31+
## Scope
3832

3933
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing Covasim or its community. Examples of representing the Covasim project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
4034

41-
Enforcement
42-
===========
35+
## Enforcement
4336

44-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at info@covasim.org. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The Covasim team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at <info@covasim.org>. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The Covasim team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
4538

4639
Covasim maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of Covasim's leadership.
4740

48-
Attribution
49-
===========
41+
## Attribution
5042

51-
This Code of Conduct is adapted from the `Contributor Covenant`_, version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html.
43+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 1.4, available at <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>.
5244

53-
.. _Contributor Covenant: https://www.contributor-covenant.org
54-
55-
For answers to common questions about this code of conduct, see the FAQ_.
56-
57-
.. _FAQ: https://www.contributor-covenant.org/faq
45+
For answers to common questions about this code of conduct, see the [FAQ](https://www.contributor-covenant.org/faq).

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
include LICENSE
22
global-include requirements*.txt
3-
global-include *.rst
3+
global-include *.md
44
recursive-include covasim *.py
55
recursive-include covasim *.json
66
recursive-include covasim *.ttf

README.md

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# Covasim
2+
3+
## About Covasim
4+
5+
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.
6+
7+
The original scientific paper describing Covasim is available at <http://paper.covasim.org>. The recommended citation is:
8+
9+
> **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>.
10+
11+
Covasim's immunity module (including vaccines and variants) is described here:
12+
13+
> **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>.
14+
15+
The Covasim webapp is available at <https://app.covasim.org>, and the repository for it is available [here](https://github.com/institutefordiseasemodeling/covasim_webapp).
16+
17+
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).
18+
19+
Questions or comments can be directed to <info@covasim.org>, or on this project's [GitHub](https://github.com/institutefordiseasemodeling/covasim) page. Full information about Covasim is provided in the [documentation](https://docs.covasim.org).
20+
21+
**Note:** Covasim is no longer actively maintained. Please see [Starsim](https://github.com/starsimhub/starsim) for our current work on agent-based disease modeling.
22+
23+
24+
## Background
25+
26+
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:
27+
28+
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>.
29+
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>.
30+
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>.
31+
32+
A more complete list of papers is given in [papers.md](papers.md).
33+
34+
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).
35+
36+
## Requirements
37+
38+
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.)
39+
40+
We also recommend, but do not require, installing Covasim in a virtual environment. For more information, see documentation for e.g. [Anaconda](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html).
41+
42+
## Quick start guide
43+
44+
Install with `pip install covasim`. If everything is working, the following Python commands should bring up a plot:
45+
46+
import covasim as cv
47+
sim = cv.Sim()
48+
sim.run()
49+
sim.plot()
50+
51+
## Full installation instructions
52+
53+
If you would rather download the source code rather than using the `pip` package, follow these steps:
54+
55+
1. Clone a copy of the repository. If you intend to make changes to the code, we recommend that you fork it first.
56+
57+
2. (Optional) Create and activate a virtual environment.
58+
59+
3. Navigate to the root of the repository and install the Covasim Python package using one of the following options:
60+
61+
- For normal installation (recommended):
62+
63+
pip install -e .
64+
65+
- To install Covasim and optional dependencies (be aware this may fail since it relies on nonstandard packages):
66+
67+
pip install -e .[full]
68+
69+
The module should then be importable via `import covasim as cv`.
70+
71+
## Usage examples
72+
73+
There are several examples in the `examples` folder. These can be run as follows:
74+
75+
- `python examples/simple.py`
76+
77+
This example creates a figure using default parameter values.
78+
79+
- `python examples/run_sim.py`
80+
81+
This shows a slightly more detailed example, including creating an intervention and saving to disk.
82+
83+
- `python examples/run_scenarios.py`
84+
85+
This shows a more complex example, including running an intervention scenario, plotting uncertainty, and performing a health systems analysis.
86+
87+
Other examples in that folder are taken from the tutorials.
88+
89+
## Module structure
90+
91+
All core model code is located in the `covasim` subfolder; standard usage is `import covasim as cv`. The `data` subfolder is described below.
92+
93+
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.).
94+
95+
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:
96+
97+
- `version.py`: Version, date, and license information.
98+
- `requirements.py`: A simple module to check that imports succeeded, and turn off features if they didn't.
99+
- `utils.py`: Functions for choosing random numbers, many based on Numba, plus other helper functions.
100+
- `misc.py`: Miscellaneous helper functions.
101+
- `settings.py`: User-customizable options for Covasim (e.g. default font size).
102+
- `defaults.py`: The default colors, plots, etc. used by Covasim.
103+
- `parameters.py`: Functions for creating the parameters dictionary and loading the input data.
104+
- `plotting.py`: Plotting scripts, including Plotly graphs for the webapp (used in other Covasim classes, and hence defined first).
105+
- `base.py`: The `ParsObj` class, the fundamental class used in Covasim, plus basic methods of the `BaseSim` and `BasePeople` classes, and associated functions.
106+
- `people.py`: The `People` class, for handling updates of state for each person.
107+
- `population.py`: Functions for creating populations of people, including age, contacts, etc.
108+
- `interventions.py`: The `Intervention` class, for adding interventions and dynamically modifying parameters, and classes for each of the specific interventions derived from it.
109+
- `immunity.py`: The `strain` class, and functions for computing waning immunity and neutralizing antibodies.
110+
- `sim.py`: The `Sim` class, which performs most of the heavy lifting: initializing the model, running, and plotting.
111+
- `run.py`: Functions for running simulations (e.g. parallel runs and the `Scenarios` and `MultiSim` classes).
112+
- `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.
113+
114+
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.
115+
116+
## Other folders
117+
118+
Please see the readme in each subfolder for more information.
119+
120+
### Bin
121+
122+
This folder contains a command-line interface (CLI) version of Covasim; example usage:
123+
124+
covasim --pars "{pop_size:20000, pop_infected:1, n_days:360, rand_seed:1}"
125+
126+
Note: the CLI is currently not compatible with Windows. You will need to add this folder to your path to run from other folders.
127+
128+
### Data
129+
130+
Scripts to automatically scrape data (including demographics and COVID epidemiology data), and the data files themselves (which are not part of the repository).
131+
132+
### Tutorials
133+
134+
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.
135+
136+
### Examples
137+
138+
This folder contains demonstrations of simple Covasim usage, with most examples taken from the tutorials.
139+
140+
#### Cruise ship
141+
142+
An early application of Covasim to the Diamond Princess cruise ship.
143+
144+
#### Calibration
145+
146+
Examples of how to calibrate simulations, including [Optuna](https://optuna.org/) (also covered in the tutorial) and [Weights and Biases](https://www.wandb.com/).
147+
148+
### Tests
149+
150+
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.
151+
152+
## Disclaimer
153+
154+
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.

0 commit comments

Comments
 (0)