cutplace


Namecutplace JSON
Version 0.9.1 PyPI version JSON
download
home_pagehttps://github.com/roskakori/cutplace
Summaryvalidate data stored in CSV, PRN, ODS or Excel files
upload_time2022-12-29 22:22:31
maintainer
docs_urlNone
authorThomas Aglassinger
requires_python>=3.7,<4.0
licenseLGPL-3.0-only
keywords check csv excel ods validate
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            .. image:: https://img.shields.io/pypi/v/cutplace
    :target: https://pypi.org/project/cutplace/
    :alt: PyPI

.. image:: https://readthedocs.org/projects/cutplace/badge/?version=latest
    :target: https://cutplace.readthedocs.io/
    :alt: Documentation

.. image:: https://github.com/roskakori/cutplace/actions/workflows/build.yaml/badge.svg
    :target: https://travis-ci.org/roskakori/cutplace
    :alt: Build Status

.. image:: https://coveralls.io/repos/roskakori/cutplace/badge.png?branch=master
    :target: https://coveralls.io/r/roskakori/cutplace?branch=master
    :alt: Test coverage

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/psf/black
    :alt: Black

Cutplace is a tool and API to validate that tabular data stored in CSV,
Excel, ODS and PRN files conform to a cutplace interface definition (CID).

As an example, consider the following ``customers.csv`` file that stores data
about customers::

    customer_id,surname,first_name,born,gender
    1,Beck,Tyler,1995-11-15,male
    2,Gibson,Martin,1969-08-18,male
    3,Hopkins,Chester,1982-12-19,male
    4,Lopez,Tyler,1930-10-13,male
    5,James,Ana,1943-08-10,female
    6,Martin,Jon,1932-09-27,male
    7,Knight,Carolyn,1977-05-25,female
    8,Rose,Tammy,2004-01-12,female
    9,Gutierrez,Reginald,2010-05-18,male
    10,Phillips,Pauline,1960-11-09,female

A CID can describe such a file in an easy to read way. It consists of
three sections. First, there is the general data format:

==  ==============  ===========
..  Property        Value
==  ==============  ===========
D   Format          Delimited
D   Encoding        UTF-8
D   Header          1
D   Line delimiter  LF
D   Item delimiter  ,
==  ==============  ===========

Next there are the fields stored in the data file:

==  =============  ==========  =====  ======  ========  ==============================
..  Name           Example     Empty  Length  Type      Rule
==  =============  ==========  =====  ======  ========  ==============================
F   customer_id    3798                       Integer   0...99999
F   surname        Miller             ...60
F   first_name     John        X      ...60
F   date_of_birth  1978-11-27                 DateTime  YYYY-MM-DD
F   gender         male        X              Choice    female, male
==  =============  ==========  =====  ======  ========  ==============================

Optionally you can describe conditions that must be met across the whole file:

==  =======================  ========  ===========
..  Description              Type      Rule
==  =======================  ========  ===========
C   customer must be unique  IsUnique  customer_id
==  =======================  ========  ===========

The CID can be stored in common spreadsheet formats, in particular
Excel and ODS, for example ``cid_customers.ods``.

Cutplace can validate that the data file conforms to the CID::

    $ cutplace cid_customers.ods customers.csv

Now add a new line with a broken ``date_of_birth``::

    73921,Harris,Diana,04.08.1953,female

Cutplace rejects this file with the error message:

    customers.csv (R12C4): cannot accept field 'date_of_birth': date must
    match format YYYY-MM-DD (%Y-%m-%d) but is: '04.08.1953'

Additionally, cutplace provides an easy to use API to read and write
tabular data files using a common interface without having to deal with
the intrinsic of data format specific modules. To read and validate the
above example::

    import cutplace
    import cutplace.errors

    cid_path = 'cid_customers.ods'
    data_path = 'customers.csv'
    try:
        for row in cutplace.rows(cid_path, data_path):
            pass  # We could also do something useful with the data in ``row`` here.
    except cutplace.errors.DataError as error:
        print(error)

For more information, read the documentation at
http://cutplace.readthedocs.org/ or visit the project at
https://github.com/roskakori/cutplace.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/roskakori/cutplace",
    "name": "cutplace",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7,<4.0",
    "maintainer_email": "",
    "keywords": "check,csv,excel,ods,validate",
    "author": "Thomas Aglassinger",
    "author_email": "roskakori@users.sourceforge.net",
    "download_url": "https://files.pythonhosted.org/packages/2d/37/8017f70e50336795ee094fefd1ef6138b1374c587dbb63a1bf2c8b26e1b5/cutplace-0.9.1.tar.gz",
    "platform": null,
    "description": ".. image:: https://img.shields.io/pypi/v/cutplace\n    :target: https://pypi.org/project/cutplace/\n    :alt: PyPI\n\n.. image:: https://readthedocs.org/projects/cutplace/badge/?version=latest\n    :target: https://cutplace.readthedocs.io/\n    :alt: Documentation\n\n.. image:: https://github.com/roskakori/cutplace/actions/workflows/build.yaml/badge.svg\n    :target: https://travis-ci.org/roskakori/cutplace\n    :alt: Build Status\n\n.. image:: https://coveralls.io/repos/roskakori/cutplace/badge.png?branch=master\n    :target: https://coveralls.io/r/roskakori/cutplace?branch=master\n    :alt: Test coverage\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n    :target: https://github.com/psf/black\n    :alt: Black\n\nCutplace is a tool and API to validate that tabular data stored in CSV,\nExcel, ODS and PRN files conform to a cutplace interface definition (CID).\n\nAs an example, consider the following ``customers.csv`` file that stores data\nabout customers::\n\n    customer_id,surname,first_name,born,gender\n    1,Beck,Tyler,1995-11-15,male\n    2,Gibson,Martin,1969-08-18,male\n    3,Hopkins,Chester,1982-12-19,male\n    4,Lopez,Tyler,1930-10-13,male\n    5,James,Ana,1943-08-10,female\n    6,Martin,Jon,1932-09-27,male\n    7,Knight,Carolyn,1977-05-25,female\n    8,Rose,Tammy,2004-01-12,female\n    9,Gutierrez,Reginald,2010-05-18,male\n    10,Phillips,Pauline,1960-11-09,female\n\nA CID can describe such a file in an easy to read way. It consists of\nthree sections. First, there is the general data format:\n\n==  ==============  ===========\n..  Property        Value\n==  ==============  ===========\nD   Format          Delimited\nD   Encoding        UTF-8\nD   Header          1\nD   Line delimiter  LF\nD   Item delimiter  ,\n==  ==============  ===========\n\nNext there are the fields stored in the data file:\n\n==  =============  ==========  =====  ======  ========  ==============================\n..  Name           Example     Empty  Length  Type      Rule\n==  =============  ==========  =====  ======  ========  ==============================\nF   customer_id    3798                       Integer   0...99999\nF   surname        Miller             ...60\nF   first_name     John        X      ...60\nF   date_of_birth  1978-11-27                 DateTime  YYYY-MM-DD\nF   gender         male        X              Choice    female, male\n==  =============  ==========  =====  ======  ========  ==============================\n\nOptionally you can describe conditions that must be met across the whole file:\n\n==  =======================  ========  ===========\n..  Description              Type      Rule\n==  =======================  ========  ===========\nC   customer must be unique  IsUnique  customer_id\n==  =======================  ========  ===========\n\nThe CID can be stored in common spreadsheet formats, in particular\nExcel and ODS, for example ``cid_customers.ods``.\n\nCutplace can validate that the data file conforms to the CID::\n\n    $ cutplace cid_customers.ods customers.csv\n\nNow add a new line with a broken ``date_of_birth``::\n\n    73921,Harris,Diana,04.08.1953,female\n\nCutplace rejects this file with the error message:\n\n    customers.csv (R12C4): cannot accept field 'date_of_birth': date must\n    match format YYYY-MM-DD (%Y-%m-%d) but is: '04.08.1953'\n\nAdditionally, cutplace provides an easy to use API to read and write\ntabular data files using a common interface without having to deal with\nthe intrinsic of data format specific modules. To read and validate the\nabove example::\n\n    import cutplace\n    import cutplace.errors\n\n    cid_path = 'cid_customers.ods'\n    data_path = 'customers.csv'\n    try:\n        for row in cutplace.rows(cid_path, data_path):\n            pass  # We could also do something useful with the data in ``row`` here.\n    except cutplace.errors.DataError as error:\n        print(error)\n\nFor more information, read the documentation at\nhttp://cutplace.readthedocs.org/ or visit the project at\nhttps://github.com/roskakori/cutplace.\n",
    "bugtrack_url": null,
    "license": "LGPL-3.0-only",
    "summary": "validate data stored in CSV, PRN, ODS or Excel files",
    "version": "0.9.1",
    "split_keywords": [
        "check",
        "csv",
        "excel",
        "ods",
        "validate"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "4e4cb5c1f47283d345e285bf640ce01d",
                "sha256": "e2f658c2326c26d066f55525f0d4e1aad66e1212e36a5fe01f3f3feaca4eae6e"
            },
            "downloads": -1,
            "filename": "cutplace-0.9.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4e4cb5c1f47283d345e285bf640ce01d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<4.0",
            "size": 67325,
            "upload_time": "2022-12-29T22:22:29",
            "upload_time_iso_8601": "2022-12-29T22:22:29.529504Z",
            "url": "https://files.pythonhosted.org/packages/56/b9/568985c75b50b2f4116d765b357de8f245179988cc7928a3845f05fdf836/cutplace-0.9.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "7a54372fe15d39f7cb02ec47b895eded",
                "sha256": "630547872a9e3586f53734206f02152bcc5cbe0c54ec8263b43dfb11297a68c2"
            },
            "downloads": -1,
            "filename": "cutplace-0.9.1.tar.gz",
            "has_sig": false,
            "md5_digest": "7a54372fe15d39f7cb02ec47b895eded",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<4.0",
            "size": 58938,
            "upload_time": "2022-12-29T22:22:31",
            "upload_time_iso_8601": "2022-12-29T22:22:31.267475Z",
            "url": "https://files.pythonhosted.org/packages/2d/37/8017f70e50336795ee094fefd1ef6138b1374c587dbb63a1bf2c8b26e1b5/cutplace-0.9.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-29 22:22:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "roskakori",
    "github_project": "cutplace",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "cutplace"
}
        
Elapsed time: 0.04785s