Python package to validate data against whip specifications
Project description
# pywhip
The pywhip package is a Python package to validate data against
[whip specifications](https://github.com/inbo/whip), a human and
machine-readable syntax to express specifications for data.
* Free software: MIT license
* Documentation: https://inbo.github.io/pywhip
[![Build Status](https://img.shields.io/pypi/v/pywhip.svg)](https://pypi-hypernode.com/pypi/pywhip)
[![Build Status](https://travis-ci.org/inbo/pywhip.svg?branch=master)](https://travis-ci.org/inbo/pywhip)
[![Updates](https://pyup.io/repos/github/inbo/pywhip/shield.svg)](https://pyup.io/repos/github/inbo/pywhip/)
Check the [documentation pages](https://inbo.github.io/pywhip/installation.html) for more information.
## Installation
To install pywhip, run this command in your terminal:
```shell
pip install pywhip
```
For more detailed installation instructions, see the
[documentation pages](https://inbo.github.io/pywhip/installation.html).
## Test pywhip in jupyter notebook
Launch a jupyter notebook to interactively try out the pywhip package:
[![Binder](https://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/inbo/pywhip/master?filepath=notebooks%2Fwhip_csv_data.ipynb)
## Quickstart
To validate a CSV data file with the field headers `country`, `eventDate`
and `individualCount`, write whip specifications, according to the
[whip syntax](https://github.com/inbo/whip):
```
specifications = """
country:
allowed: [BE, NL]
eventDate:
dateformat: '%Y-%m-%d'
mindate: 2016-01-01
maxdate: 2018-12-31
individualCount:
numberformat: x # needs to be an integer value
min: 1
max: 100
"""
```
To whip your data set, e.g. ``my_data.csv``, pass the data to
whip specifications:
```python
from pywhip import whip_csv
example = whip_csv("my_data.csv", specifications, delimiter=',')
```
and write the output report to an html file:
```python
with open("report_example.html", "w") as index_page:
index_page.write(example.get_report('html'))
```
Resulting in a [report](https://inbo.github.io/pywhip/report_observations.html) like this. For a more
detailed introduction, see [the documentaton tutorial](https://inbo.github.io/pywhip/tutorial.html).
## Credits
This package was created with [Cookiecutter](https://github.com/audreyr/cookiecutter)
and the [audreyr/cookiecutter-pypackage](https://github.com/audreyr/cookiecutter-pypackage)
project template.
Validation of data rows is using the [Cerberus](http://docs.python-cerberus.org/en/stable/)
package.
=======
History
=======
0.3.1 (2018-08-27)
------------------
* Add CLI support to pywhip for CSV files
0.3.0 (2018-08-23)
------------------
* Update to new whip specifications
* Support csv and Darwin Core Archive handling
* Add html and json reporting
* Provide updated sphinx documentation
0.2.1 (2018-04-06)
------------------
* Update towards new cerberus version
0.1.1 (2017-09-12)
------------------
* First release on PyPI.
* Package structure with CI integration
* tox testing on multiple Python versions
The pywhip package is a Python package to validate data against
[whip specifications](https://github.com/inbo/whip), a human and
machine-readable syntax to express specifications for data.
* Free software: MIT license
* Documentation: https://inbo.github.io/pywhip
[![Build Status](https://img.shields.io/pypi/v/pywhip.svg)](https://pypi-hypernode.com/pypi/pywhip)
[![Build Status](https://travis-ci.org/inbo/pywhip.svg?branch=master)](https://travis-ci.org/inbo/pywhip)
[![Updates](https://pyup.io/repos/github/inbo/pywhip/shield.svg)](https://pyup.io/repos/github/inbo/pywhip/)
Check the [documentation pages](https://inbo.github.io/pywhip/installation.html) for more information.
## Installation
To install pywhip, run this command in your terminal:
```shell
pip install pywhip
```
For more detailed installation instructions, see the
[documentation pages](https://inbo.github.io/pywhip/installation.html).
## Test pywhip in jupyter notebook
Launch a jupyter notebook to interactively try out the pywhip package:
[![Binder](https://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/inbo/pywhip/master?filepath=notebooks%2Fwhip_csv_data.ipynb)
## Quickstart
To validate a CSV data file with the field headers `country`, `eventDate`
and `individualCount`, write whip specifications, according to the
[whip syntax](https://github.com/inbo/whip):
```
specifications = """
country:
allowed: [BE, NL]
eventDate:
dateformat: '%Y-%m-%d'
mindate: 2016-01-01
maxdate: 2018-12-31
individualCount:
numberformat: x # needs to be an integer value
min: 1
max: 100
"""
```
To whip your data set, e.g. ``my_data.csv``, pass the data to
whip specifications:
```python
from pywhip import whip_csv
example = whip_csv("my_data.csv", specifications, delimiter=',')
```
and write the output report to an html file:
```python
with open("report_example.html", "w") as index_page:
index_page.write(example.get_report('html'))
```
Resulting in a [report](https://inbo.github.io/pywhip/report_observations.html) like this. For a more
detailed introduction, see [the documentaton tutorial](https://inbo.github.io/pywhip/tutorial.html).
## Credits
This package was created with [Cookiecutter](https://github.com/audreyr/cookiecutter)
and the [audreyr/cookiecutter-pypackage](https://github.com/audreyr/cookiecutter-pypackage)
project template.
Validation of data rows is using the [Cerberus](http://docs.python-cerberus.org/en/stable/)
package.
=======
History
=======
0.3.1 (2018-08-27)
------------------
* Add CLI support to pywhip for CSV files
0.3.0 (2018-08-23)
------------------
* Update to new whip specifications
* Support csv and Darwin Core Archive handling
* Add html and json reporting
* Provide updated sphinx documentation
0.2.1 (2018-04-06)
------------------
* Update towards new cerberus version
0.1.1 (2017-09-12)
------------------
* First release on PyPI.
* Package structure with CI integration
* tox testing on multiple Python versions
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
pywhip-0.3.1.tar.gz
(114.8 kB
view details)
Built Distribution
File details
Details for the file pywhip-0.3.1.tar.gz
.
File metadata
- Download URL: pywhip-0.3.1.tar.gz
- Upload date:
- Size: 114.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.20.0 CPython/3.5.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 935f3f8ee8ec75f876cc32a8316a6eb9f440471f407f29a84bda2ed63742bde5 |
|
MD5 | c215b5661946b7126c2923888c57a6c9 |
|
BLAKE2b-256 | 4b5583882495b54955bce8f27ca79fec146530465f7f5045c2f0f8a35db019c6 |
File details
Details for the file pywhip-0.3.1-py2.py3-none-any.whl
.
File metadata
- Download URL: pywhip-0.3.1-py2.py3-none-any.whl
- Upload date:
- Size: 18.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.20.0 CPython/3.5.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25f39117b1e18c7b5885317c99b5a74381e54254f34818dda3bbec00bd0b49ad |
|
MD5 | 555934a721f38f58de3cee4c93756f06 |
|
BLAKE2b-256 | 288296bb5aa07a182ddf3e205cad943f1180f7f44aa4af40b04ea8155594001e |