CovsirPhy: COVID-19 analysis with phase-dependent SIRs
PyPI version Downloads PyPI - Python Version Build Status
GitHub license Maintainability Test Coverage Open Source Helpers

CovsirPhy introduction

Documentation | Installation | Quickest usage | API reference | GitHub | Qiita (Japanese)

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


  • Monitor the spread of COVID-19

  • Keep track parameter values/reproduction number 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 are always welcomed. Questions are also great. Please read Guideline of contribution in advance.


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

pip install --upgrade covsirphy


Quickest tour of CovsirPhy is here. The following codes analyze the records in Japan, but we can change the country name when creating Scenario class instance for your own analysis.

import covsirphy as cs
# Download and update datasets
data_loader = cs.DataLoader("input")
jhu_data = data_loader.jhu()
# Select country name and register the data
snl = cs.Scenario(country="Japan")
# Check records
# S-R trend analysis
# Parameter estimation of SIR-F model
# History of reproduction number
_ = snl.history(target="Rt")
# History of parameters
_ = snl.history_rate()
_ = snl.history(target="rho")
# Simulation for 30 days
_ = snl.simulate()

Further information:

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.


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


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

This project started in Kaggle platform. 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. First release in PyPI (version 2.3.0) was on 28Jun2020.

License: Apache License 2.0

Please refer to LICENSE file.


We have no original papers the author and contributors wrote, but please cite this library as follows with version number (import covsirphy as cs; cs.__version__).

CovsirPhy Development Team (2020-2021), CovsirPhy version [version number]: Python library for COVID-19 analysis with phase-dependent SIR-derived ODE models,

If you want to use SIR-F model, S-R trend analysis, phase-dependent approach to SIR-derived models, and other scientific method performed with CovsirPhy, please cite the next Kaggle notebook.

Hirokazu Takaya (2020-2021), Kaggle Notebook, COVID-19 data with SIR model,

We can check the citation with the following script.

import covsirphy as cs


Indices and tables