This package enables obtain key metrics regarding covid situation in Canada
Project description
canadacovidmetrics
This is a Python package that provides key metrics regarding COVID-19 situation in Canada across provinces using the OpenCovid API.
Summary
This package allows users to obtain key metrics on COVID-19 situation in Canada at national or provincial level for a specific time period. The 4 functions will return key metrics, including total cumulative cases, total cumulative deaths, total cumulative recovered cases and total cumulative vaccine completion, using data from OpenCovid API. The users may use the key metrics to conduct further analyses on COVID-19 situation in Canada.
Functions
There are 4 functions in this package:
-
get_cases
Query total cumulative cases with ability to specify province and date range of returned data. -
get_deaths
Query total cumulative deaths with ability to specify province and date range of returned data. -
get_recoveries
Query total cumulative recovered cases with ability to specify province and date range of returned data. -
get_vaccinations
Query total cumulative vaccine completion with ability to specify province and date range of returned data.
Installation
$ pip install canadacovidmetrics
Usage & Examples
Total number of deaths over past week by province
from canadacovidmetrics import canadacovidmetrics as ccm
import datetime as dt
deaths_last_week = ccm.get_deaths(after=str(dt.date.today() - dt.timedelta(days=7)))
deaths_last_week.groupby('province').sum('deaths').plot.barh(y='deaths', title='Deaths by province in past week');
National vaccination completion in 2021
from canadacovidmetrics import canadacovidmetrics as ccm
vaccines_2021 = ccm.get_vaccinations(loc='canada', after='2021-01-01', before='2021-12-31')
vaccines_2021.plot('date_vaccine_completed', 'cumulative_cvaccine', title='Cumulative national vaccinations');
Daily new case count by province
from canadacovidmetrics import canadacovidmetrics as ccm
cases_data = ccm.get_cases().set_index('date_report')
cases_data.groupby('province')['cases'].plot(legend=True, figsize=(10,6), title='Number of reported cases by day by province');
Python ecosystem
There are several packages for easy access to COVID-19 key metrics or data using different APIs, examples include
- covid using John Hopkins University API
- COVID19Py using Coronavirus Tracker API
- covid19pyclient using RKI API
To our knowledge, there is no similar package using OpenCovid API in the Python ecosystem.
Documentation
Documentation canadacovidmetrics can be found at Read the Docs
Contributors
- Adam Morphy (@adammorphy)
- Brandon Lam (@ming0701)
- Lakshmi Santosha Valli Akella (@valli180)
- Luke Collins (@LukeAC)
We welcome and recognize all contributions. Please find the guide for contribution in Contributing Document.
License
canadacovidmetrics
was created by the Contributors. The dependant API from the COVID-19 Canada Open Data Working Group dataset project has adopted the Creative Commons Attribution 4.0 International license, which allows freedom of two primary contributions:
Sharing — copy and redistribute the material in any medium or format Adapting — remix, transform, and build upon the material for any purpose, even commercially.
As contributors to this community, our package has adopted the same creative commons license, in order to enable anyone to share or adapt the Canada Covid Metrics package in R or Python subject to the license.
Credits
canadacovidmetrics
was created with cookiecutter
and the py-pkgs-cookiecutter
template.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file canadacovidmetrics-0.2.5.tar.gz
.
File metadata
- Download URL: canadacovidmetrics-0.2.5.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3abb0a399253ba2689575a4ee0431d931453e81f865ecfdab74539851fd07afb |
|
MD5 | f3ee93a0957a9babe946bdc76fb4cd68 |
|
BLAKE2b-256 | c69689dd96e867dd866c801bd340f7f1b626a85492fa93d91809a5111b07ee44 |
File details
Details for the file canadacovidmetrics-0.2.5-py3-none-any.whl
.
File metadata
- Download URL: canadacovidmetrics-0.2.5-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5cfae7a714f8d99b419225cc8c94637c3b458de53def572dc16e74e96636a5c2 |
|
MD5 | c5eb0c6d3b5e51a816495228d40f7e50 |
|
BLAKE2b-256 | b8b76eefe66ee985f599d359e3b6c2110554f86fc97560dd7471e01006282672 |