Skip to main content
CovsirPhy: COVID-19 analysis with phase-dependent SIRs

PyPI version Downloads PyPI - Python Version GitHub license Quality Check Test Coverage

CovsirPhy introduction

Documentation | Installation | Tutorial | API reference | GitHub | Qiita (Japanese)

CovsirPhy is a Python library for infectious disease (COVID-19: Coronavirus disease 2019, Monkeypox 2022) data analysis with phase-dependent SIR-derived ODE models. We can download datasets and analyze them easily. Scenario analysis with CovsirPhy enables us to make data-informed decisions.

Data flow diagram: data science for infectious diseases with CovsirPhy Python library

Inspiration

  • Monitor the spread of COVID-19/Monkeypox with SIR-derived ODE models
  • Predict the number of cases in each country/province
  • Find the relationship of reproductive number and measures taken by each country

If you have ideas or need new functionalities, please join this project. Any suggestions with Github Issues and Twitter: @lisphilar are always welcomed. Questions are also great. Please refer to Guideline of contribution.

Installation

The latest stable version of CovsirPhy is available at PyPI (The Python Package Index): covsirphy and supports Python 3.8 or newer versions. Details are explained in Documentation: Installation.

pip install --upgrade covsirphy

Demo

Quickest tour of CovsirPhy is here. The following codes analyze the records in Japan.

import covsirphy as cs
# Data preparation,time-series segmentation, parameter estimation with SIR-F model
snr = cs.ODEScenario.auto_build(geo="Japan", model=cs.SIRFModel)
# Check actual records
snr.simulate(name=None);
# Show the result of time-series segmentation
snr.to_dynamics(name="Baseline").detect();
# Perform simulation with estimated ODE parameter values
snr.simulate(name="Baseline");
# Predict ODE parameter values (30 days from the last date of actual records)
snr.build_with_template(name="Predicted", template="Baseline");
snr.predict(days=30, name="Predicted");
# Perform simulation with estimated and predicted ODE parameter values
snr.simulate(name="Predicted");
# Add a future phase to the baseline (ODE parameters will not be changed)
snr.append();
# Show created phases and ODE parameter values
snr.summary()
# Compare reproduction number of scenarios (predicted/baseline)
snr.compare_param("Rt");
# Compare simulated number of cases
snr.compare_cases("Confirmed");
# Describe representative values
snr.describe()

Output of snr.simulate(name="Predicted");

Tutorial

Tutorials of functionalities are included in the CovsirPhy documentation.

Release notes

Release notes are here. Titles & links of issues are listed with acknowledgement.

We can see the release plan for the next stable version in milestone page of the GitHub repository. If you find a highly urgent matter, please let us know via issue page.

Developers

CovsirPhy library is developed by a community of volunteers. Please see the full list here.

This project started in Kaggle platform. Hirokazu Takaya (@lisphilar) published Kaggle Notebook: COVID-19 data with SIR model on 12Feb2020 and developed it, discussing with Kaggle community. On 07May2020, "covid19-sir" repository was created. On 10May2020, covsirphy version 1.0.0 was published in GitHub. The first release in PyPI (version 2.3.0) was on 28Jun2020. Many APIs were reviewed via 2.x series and version 3.0.0 was released on 12May2023.

Support

Please support this project as a developer (or a backer). Become a backer

License: Apache License 2.0

Please refer to LICENSE file.

Citation

Please cite this library as follows with version number (import covsirphy as cs; cs.__version__).

Hirokazu Takaya and CovsirPhy Development Team (2020-2024), CovsirPhy version [version number]: Python library for COVID-19 analysis with phase-dependent SIR-derived ODE models, https://github.com/lisphilar/covid19-sir

This is the output of covsirphy.__citation__.

import covsirphy as cs
cs.__citation__

We have no original papers the author and contributors wrote, but note that some scientific approaches, including SIR-F model, S-R change point analysis, phase-dependent approach to SIR-derived models, were developed in this project.

Metadata

Release files for covsirphy 3.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for covsirphy 3.1.2
File Size Uploaded Provenance Actions
covsirphy-3.1.2.tar.gz 76.6 kB Without provenance Details for covsirphy-3.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for covsirphy 3.1.2
File Interpreter ABI Platform Actions
covsirphy-3.1.2-py3-none-any.whl Python 3 none any Details for covsirphy-3.1.2-py3-none-any.whl

Total release size: 183.8 kB

Release files / covsirphy-3.1.2.tar.gz

Download URL covsirphy-3.1.2.tar.gz
Size 76.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2d9009d8ce04f90989ff254625b434456cbc014c3c69454ee47367ac11a0ce60
BLAKE2b-256 checksum
How to use checksums
7b8425d9bb497b12b7299477c3be72632b9ce5cc204bce280c9acf1c4fa7ed1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.3 Linux/5.15.153.1-microsoft-standard-WSL2

Release files / covsirphy-3.1.2-py3-none-any.whl

Download URL covsirphy-3.1.2-py3-none-any.whl
Size 107.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98fded8d395335ab94b87813fa63ce6f58dc057cbd3f2fd0d32f1f75301cafce
BLAKE2b-256 checksum
How to use checksums
23bcc8b38c1a6b1cf2db461682129d5883006734c3d0c0b730ad7efc95e9a8c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.3 Linux/5.15.153.1-microsoft-standard-WSL2

Security for covsirphy 3.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

3.1.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page