Skip to main content

covid-seird

Downloads MIT License HitCount CodeFactor Grade GitHub repo size

About

covid-seird is a small Python package inspired by Henri Froese's post 'Infectious Disease Modelling: Beyond the Basic SIR Model'.

It implements the SEIRD Epidemiological Model on COVID-19 data.

  • First, it fits a the SEIRD Model into the real timeline data of confirmed cases of COVID-19 of a country.
  • Then, it simulates the SEIRD curves based on the previously fitted Model.
  • As a result, the country's basic reproduction number (Ro) of COVID-19 is computed.
  • Also, the fit and simulation plots are available.

NOTE: The COVID-19 timelines data are obtained using the COVID19Py package in order to retrieve the Worldwide Data repository operated by the Johns Hopkins University Center for Systems Science and Engineering (JHU CSSE).

Installation

In order to install this package, simply run:

pip install covid-seird

Usage

To use covid-seird, you first need to import the package and then create a new instance, passing the country code as a parameter:

from covid_seird import CountryCovidSeird

brazil = CountryCovidSeird("br")

Getting the country codes

CountryCovidSeird.code_search("brazil")

output:

{'BR': 'Brazil'}

Fit the SEIRD Model

brazil.fit()

After the fit method's call, the fit score (R2) can be accessed:

brazil.r2

output:

0.797994368607109

Also after fit method's call, the basic reproduction number (Ro) will be available:

brazil.r0

output:

2.280428864655168

Fit plot

brazil.plot_fit("brazil_fit_plot")

a plot file named 'brazil_fit_plot' will be created.

fit plot

SEIRD simulation

The simulation method receives as a parameter how many days ahead of the real data the SEIRD model will be computed.

brazil.simulation(days_ahead=150)

The SEIRD curves can be accessed after the simulation method's call

brazil.curves['infected']

output:

array([4.77396851e-09, 5.32992037e-09, 5.95375686e-09, 6.59631344e-09,
       7.32558927e-09, 8.14396099e-09, 9.05142859e-09, 1.00479921e-08,
       ...
       7.48473200e-03, 7.06776956e-03, 6.67386382e-03, 6.30175876e-03,
       5.95026480e-03, 5.61825534e-03, 5.30466353e-03, 5.00847963e-03])

Simulation plots

brazil.plot_simulation("brazil_simulation_plot")

a plot file named 'brazil_simulation_plot' will be created.

simulation plot

Metadata

Release files for covid-seird 0.0.8

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

Source distribution (sdist)

Source distribution for covid-seird 0.0.8
File Size Uploaded Provenance Actions
covid-seird-0.0.8.tar.gz 6.4 kB Without provenance Details for covid-seird-0.0.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for covid-seird 0.0.8
File Interpreter ABI Platform Actions
covid_seird-0.0.8-py3-none-any.whl Python 3 none any Details for covid_seird-0.0.8-py3-none-any.whl

Total release size: 13.4 kB

Release files / covid-seird-0.0.8.tar.gz

Download URL covid-seird-0.0.8.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d63e36fe15714c78c8729476124b4d8fc4dbb10d79f171283a79f38304f4129b
BLAKE2b-256 checksum
How to use checksums
311249d7a42ba9926fd18ec59fb3c4be01fb4f6aff830b7acf998a1c485f6199
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.6.8

Release files / covid_seird-0.0.8-py3-none-any.whl

Download URL covid_seird-0.0.8-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a82aaa43cc2162b2090e196d2ba76d67e2ba511b5ae7b291e3a8db5d33e0b7b
BLAKE2b-256 checksum
How to use checksums
7ccc6b1befcb3096511cf3804ba4a09e2352ec7e9ead3242e7b8ba50bab00682
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.6.8

Security for covid-seird 0.0.8

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.

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