Epidemiological weeks based on the CDC (MMWR) and ISO week numbering systems.
Project description
A Python package to calculate epidemiological weeks using the CDC (MMWR) and ISO week numbering systems.
Features
Support for both the CDC (MMWR) and ISO week numbering systems.
Accurate and tested calculations.
Intuitive, clean, and easy-to-use interface.
Calculation of the start and end dates of weeks.
Iteration of year’s weeks or week’s dates.
Rich comparison between weeks.
Logical operations for weeks (addition, subtraction and containment).
Validation of input data.
Works on Python 3.6+ with zero dependencies.
Thoroughly tested on all supported Python versions.
Installation
$ pip install -U epiweeks
Basic Usage
from epiweeks import Week, Year
week = Week(2019, 1)
print(week.enddate())
# 2019-01-05
for week in Year(2019).iterweeks():
print(week.enddate())
# 2019-01-05
# 2019-01-12
# ...
# 2019-12-21
# 2019-12-28
Online Tool
The following is a simple online tool that was developed to calculate epidemiological weeks (CDC system only) using the latest version of this package:
Documentation
Please see https://epiweeks.readthedocs.io/ for full documentation of this package, including overview, more usage examples and API reference.
Contributing
Contributions are welcome! See CONTRIBUTING.rst for more info.
License
This package is distributed under an MIT license. See LICENSE.
Change Log
2.1.2
Improved exception messages by including the type or value used.
Improved PyPI packaging by removing unnecessary files.
Updated related tests and documentations.
2.1.1
Fixed some typos.
Improved documentation.
2.1.0
Changed the parameter method, which sets how the weeks are numbered, to system for better clarity and intuitive usage.
Updated documentation and unit tests.
Other minor fixes and enhancements.
2.0.0
Dropped support for Python 3.5.
Added fromstring() classmethod to allow constructing the Week object from a formatted string, for example ‘2019W08’ or ‘201908’.
Added cdcformat() method to return a formatted string like the one used by US CDC for epi weeks, for example for week 8 of 2019 it returns ‘201908’.
Added daydate() method to return the date of specific weekday for a week.
Changed the optional value ‘WHO’ of the parameter method to ‘ISO’.
Changed the fromdate() classmethod of Week object to accept a date object as an argument instead of year, month, and day.
Made the Week and Year objects hashable.
Improved rich comparison methods.
Improved input data validation.
Updated and improved documentation examples.
Updated unit tests.
Other minor fixes and enhancements.
1.0.0
First release.
Project details
Release history Release notifications | RSS feed
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 epiweeks-2.1.2.tar.gz
.
File metadata
- Download URL: epiweeks-2.1.2.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc33d1942fb0b21fcc613501f9eaa18499b6a3ca2a76f49df81c9b26563d7a3f |
|
MD5 | f6494e2beb7df8fc21a7ea5bc4913de7 |
|
BLAKE2b-256 | 4b2374e129a1df7467df64a8ff35297c21e0e405eaeeb7fb2d0e2a8f9ce45378 |
File details
Details for the file epiweeks-2.1.2-py3-none-any.whl
.
File metadata
- Download URL: epiweeks-2.1.2-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69e736b71d0003320246e64c3f4cccec647c223e73772cf3e5d8f6e03886b04c |
|
MD5 | 30df2d4dc453fe63c688cd9aa012c135 |
|
BLAKE2b-256 | 77538e931dff428c7a4fdeb9ec7b4de3a41f60fe8ef1cb842898de832e051c13 |