cutplace


Namecutplace JSON
Version 0.9.2 PyPI version JSON
download
home_pagehttps://github.com/roskakori/cutplace
Summaryvalidate data stored in CSV, PRN, ODS or Excel files
upload_time2024-12-10 21:29:54
maintainerNone
docs_urlNone
authorThomas Aglassinger
requires_python<4,>=3.9
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://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": null,
    "docs_url": null,
    "requires_python": "<4,>=3.9",
    "maintainer_email": null,
    "keywords": "check, csv, excel, ods, validate",
    "author": "Thomas Aglassinger",
    "author_email": "roskakori@users.sourceforge.net",
    "download_url": "https://files.pythonhosted.org/packages/82/3d/152072db0087523e18b27ac24515c3d5c32331032cf968f8d3bf557f9d2b/cutplace-0.9.2.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://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.2",
    "project_urls": {
        "Changes": "https://cutplace.readthedocs.io/en/latest/changes.html",
        "Documentation": "https://cutplace.readthedocs.io",
        "Homepage": "https://github.com/roskakori/cutplace",
        "Issue Tracker": "https://github.com/roskakori/cutplace/issues",
        "Repository": "https://github.com/roskakori/cutplace.git"
    },
    "split_keywords": [
        "check",
        " csv",
        " excel",
        " ods",
        " validate"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0c982bcc81b5d352c8368a3e264dcb02af087d6f6874a83cdbd2a13fe90e8165",
                "md5": "c4a3fc11123987ab1d48343b4ea5ebc5",
                "sha256": "9530da835534b4f898945c4787339a75169eefacf4c77d010fa17f7c35ebe9a8"
            },
            "downloads": -1,
            "filename": "cutplace-0.9.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c4a3fc11123987ab1d48343b4ea5ebc5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.9",
            "size": 67781,
            "upload_time": "2024-12-10T21:29:52",
            "upload_time_iso_8601": "2024-12-10T21:29:52.436804Z",
            "url": "https://files.pythonhosted.org/packages/0c/98/2bcc81b5d352c8368a3e264dcb02af087d6f6874a83cdbd2a13fe90e8165/cutplace-0.9.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "823d152072db0087523e18b27ac24515c3d5c32331032cf968f8d3bf557f9d2b",
                "md5": "aa7d272a551b7a88c2cfa7f94b0d1ede",
                "sha256": "dc402ea72348e1fcb70565e16bff3385f00ccb2261017cfae7daca58eed74865"
            },
            "downloads": -1,
            "filename": "cutplace-0.9.2.tar.gz",
            "has_sig": false,
            "md5_digest": "aa7d272a551b7a88c2cfa7f94b0d1ede",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.9",
            "size": 58634,
            "upload_time": "2024-12-10T21:29:54",
            "upload_time_iso_8601": "2024-12-10T21:29:54.042963Z",
            "url": "https://files.pythonhosted.org/packages/82/3d/152072db0087523e18b27ac24515c3d5c32331032cf968f8d3bf557f9d2b/cutplace-0.9.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-10 21:29:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "roskakori",
    "github_project": "cutplace",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "cutplace"
}
        
Elapsed time: 0.40460s