pyedi830


Namepyedi830 JSON
Version 1.5.2 PyPI version JSON
download
home_pagehttps://github.com/dev0088/pyedi830
SummaryEDI 830 parser/converter
upload_time2023-08-30 16:27:17
maintainer
docs_urlNone
authorNinja Dev
requires_python
licenseMIT
keywords x12 edi 830 csv pdf html
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyedi830
Pyedi830 uses JSON format definitions to make it easy to parse and convert from EDI830 file to JSON and CSV file/data.

## TODOs

* Finish 830 definition
* Implement colorful exceptions

## EDI Format Definitions
EDI830 parser messages consist of a set of Segments (usually lines) comprised of Elements. Some segments can be part of a Loop. These formats are defined in JSON. See the provided format(s) for examples.

A loop has certain expected properties:

* `id` (Loop ID)
* `repeat` (Max times the loop can repeat)

Each segment has certain expected properties:

* `id` (Segment ID)
* `name` (Human-readable segment name)
* `req` (Whether segment is required: [M]andatory, [O]ptional)
* `max_uses` (Some segments can be included more than once)
* `notes` (Optional details for hinting documentation)
* `syntax` (An optional list of syntax rules, defined below)
* `elements` (List of included elements)

Each element has certain expected features: 

* `id` (Element ID)
* `name` (Human-readable element name)
* `req` (Whether segment is required: [M]andatory, [O]ptional)
* `data_type` (Type of segment data, defined below)
* `data_type_ids` (If `data_type` is `ID`, this is a dict of valid IDs with descriptions)
* `length` (Dict specifying field length)
    * `min` (Min length of field)
    * `max` (Max length of field)

Valid data types include:

* `AN` (Any data type)
* `DT` (Date, must be provided as Python DATE or DATETIME object)
* `ID` (Alphanumeric ID. List of valid IDs provided as dict with descriptions)
* `R`  (Percentage)
* `Nx` (Number with `x` decimal points)
* `TM` (Time, must be provided as Python TIME or DATETIME object)

Syntax rules are specified as a dict with a `rule` and a list of `criteria`. Valid syntax rules include:

* `ATLEASTONE` (where at least one of the element IDs in the `criteria` list is included and is not empty)
* `ALLORNONE` (where either all of the element IDs in the `criteria` list are included, or none are)
* `IFATLEASTONE` (if the first element in `criteria` is included, then at least one of the other elements must be included)

# Code Examples

```python
    from pyedi830 import EDIParser
    from pyedi830 import EDI2CSV
    from pyedi830 import EDI2PDF


    edi_file_path = "test/test_edi_830_forecast.edi"

    # Convert to json file
    json_file_path = "test_edi_830_forecast.json"
    edi_parser = EDIParser(
        edi_format="830_Forecast",
        element_delimiter="*",
        segment_delimiter="~",
        use_parent_key_detail=True,
        use_parent_detail=True,
        parent_headers=['symbol', 'name', 'type', 'notes'],
        use_child_key_detail=True,
        use_child_detail=False,
        use_debug=True
    )
    edi_parser.to_json(edi_file_path, json_file_path)

    # Parse to json data
    json_data = edi_parser.parse(edi_file_path)


    # Convert to csv file.
    csv_file_path = "edi_830.csv"
    edi2csv = EDI2CSV(use_debug=True)
    edi2csv.to_csv(edi_file_path=edi_file_path, csv_file_path=csv_file_path)


    # Convert to html
    html_file_path = "edi_830.html"
    edi2csv = EDI2PDF(use_debug=True)
    edi2csv.to_html(edi_file_path=edi_file_path, html_file_path='html_file_path')

    # Convert to pdf
    pdf_file_path = "edi_830.pdf"
    edi2csv.to_pdf(edi_file_path=edi_file_path, pdf_file_path=pdf_file_path, temp_html_file_path=html_file_path)

```

# Install

Install system-wide

    pip install pyedi830

Or install in a virtual environment

    virtualenv my_env
    pip -E my_env install pyedi830

# Licensing

pyedi830 has a BSD license. The full license text is included with the source code for the package. 

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dev0088/pyedi830",
    "name": "pyedi830",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "x12 edi 830 csv pdf html",
    "author": "Ninja Dev",
    "author_email": "ninjadev999@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/df/90/d66c6778f950c3b70097c8e5ca48e9f87140cf2ba54f146f81e93c5c1640/pyedi830-1.5.2.tar.gz",
    "platform": null,
    "description": "# pyedi830\nPyedi830 uses JSON format definitions to make it easy to parse and convert from EDI830 file to JSON and CSV file/data.\n\n## TODOs\n\n* Finish 830 definition\n* Implement colorful exceptions\n\n## EDI Format Definitions\nEDI830 parser messages consist of a set of Segments (usually lines) comprised of Elements. Some segments can be part of a Loop. These formats are defined in JSON. See the provided format(s) for examples.\n\nA loop has certain expected properties:\n\n* `id` (Loop ID)\n* `repeat` (Max times the loop can repeat)\n\nEach segment has certain expected properties:\n\n* `id` (Segment ID)\n* `name` (Human-readable segment name)\n* `req` (Whether segment is required: [M]andatory, [O]ptional)\n* `max_uses` (Some segments can be included more than once)\n* `notes` (Optional details for hinting documentation)\n* `syntax` (An optional list of syntax rules, defined below)\n* `elements` (List of included elements)\n\nEach element has certain expected features: \n\n* `id` (Element ID)\n* `name` (Human-readable element name)\n* `req` (Whether segment is required: [M]andatory, [O]ptional)\n* `data_type` (Type of segment data, defined below)\n* `data_type_ids` (If `data_type` is `ID`, this is a dict of valid IDs with descriptions)\n* `length` (Dict specifying field length)\n    * `min` (Min length of field)\n    * `max` (Max length of field)\n\nValid data types include:\n\n* `AN` (Any data type)\n* `DT` (Date, must be provided as Python DATE or DATETIME object)\n* `ID` (Alphanumeric ID. List of valid IDs provided as dict with descriptions)\n* `R`  (Percentage)\n* `Nx` (Number with `x` decimal points)\n* `TM` (Time, must be provided as Python TIME or DATETIME object)\n\nSyntax rules are specified as a dict with a `rule` and a list of `criteria`. Valid syntax rules include:\n\n* `ATLEASTONE` (where at least one of the element IDs in the `criteria` list is included and is not empty)\n* `ALLORNONE` (where either all of the element IDs in the `criteria` list are included, or none are)\n* `IFATLEASTONE` (if the first element in `criteria` is included, then at least one of the other elements must be included)\n\n# Code Examples\n\n```python\n    from pyedi830 import EDIParser\n    from pyedi830 import EDI2CSV\n    from pyedi830 import EDI2PDF\n\n\n    edi_file_path = \"test/test_edi_830_forecast.edi\"\n\n    # Convert to json file\n    json_file_path = \"test_edi_830_forecast.json\"\n    edi_parser = EDIParser(\n        edi_format=\"830_Forecast\",\n        element_delimiter=\"*\",\n        segment_delimiter=\"~\",\n        use_parent_key_detail=True,\n        use_parent_detail=True,\n        parent_headers=['symbol', 'name', 'type', 'notes'],\n        use_child_key_detail=True,\n        use_child_detail=False,\n        use_debug=True\n    )\n    edi_parser.to_json(edi_file_path, json_file_path)\n\n    # Parse to json data\n    json_data = edi_parser.parse(edi_file_path)\n\n\n    # Convert to csv file.\n    csv_file_path = \"edi_830.csv\"\n    edi2csv = EDI2CSV(use_debug=True)\n    edi2csv.to_csv(edi_file_path=edi_file_path, csv_file_path=csv_file_path)\n\n\n    # Convert to html\n    html_file_path = \"edi_830.html\"\n    edi2csv = EDI2PDF(use_debug=True)\n    edi2csv.to_html(edi_file_path=edi_file_path, html_file_path='html_file_path')\n\n    # Convert to pdf\n    pdf_file_path = \"edi_830.pdf\"\n    edi2csv.to_pdf(edi_file_path=edi_file_path, pdf_file_path=pdf_file_path, temp_html_file_path=html_file_path)\n\n```\n\n# Install\n\nInstall system-wide\n\n    pip install pyedi830\n\nOr install in a virtual environment\n\n    virtualenv my_env\n    pip -E my_env install pyedi830\n\n# Licensing\n\npyedi830 has a BSD license. The full license text is included with the source code for the package. \n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "EDI 830 parser/converter",
    "version": "1.5.2",
    "project_urls": {
        "Homepage": "https://github.com/dev0088/pyedi830"
    },
    "split_keywords": [
        "x12",
        "edi",
        "830",
        "csv",
        "pdf",
        "html"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d999dead6cd84a3991cdcc0ed3f0a11250349a0be6417b95a52b06bc988ca8f0",
                "md5": "8441cf3f8aaf65f731d2e1b41ac5cf2b",
                "sha256": "f437e0fc6c9e9aedd1b9bda28d552fce86d9e1e883b030056c64bb73ae05f0a3"
            },
            "downloads": -1,
            "filename": "pyedi830-1.5.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8441cf3f8aaf65f731d2e1b41ac5cf2b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 81481,
            "upload_time": "2023-08-30T16:27:14",
            "upload_time_iso_8601": "2023-08-30T16:27:14.940437Z",
            "url": "https://files.pythonhosted.org/packages/d9/99/dead6cd84a3991cdcc0ed3f0a11250349a0be6417b95a52b06bc988ca8f0/pyedi830-1.5.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "df90d66c6778f950c3b70097c8e5ca48e9f87140cf2ba54f146f81e93c5c1640",
                "md5": "d8dcd4797700278e614abe04736015d7",
                "sha256": "702507029205b610707cd33d41718a74ede5becfc3b0f535116326e2a5ddffea"
            },
            "downloads": -1,
            "filename": "pyedi830-1.5.2.tar.gz",
            "has_sig": false,
            "md5_digest": "d8dcd4797700278e614abe04736015d7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 64171,
            "upload_time": "2023-08-30T16:27:17",
            "upload_time_iso_8601": "2023-08-30T16:27:17.130314Z",
            "url": "https://files.pythonhosted.org/packages/df/90/d66c6778f950c3b70097c8e5ca48e9f87140cf2ba54f146f81e93c5c1640/pyedi830-1.5.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-30 16:27:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dev0088",
    "github_project": "pyedi830",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pyedi830"
}
        
Elapsed time: 0.38747s