Skip to main content

No project description provided

Project description

detakon

PyPI - Version PyPI - Python Version


Description

A data converter than uses configuration files (referred to as detamaps) to map fields in the source data to output data, and perform operations on the data before outputting. Detamaps may also contain configuration data for the data source and output, and defaults to use if fields are missing, or blank/empty.

[!NOTE] Detakon is in early development and may have breaking changes between versions. Detamaps, methods, and usage may change between minor versions until version 1.0 release. After version 1.0 release, any breaking changes will result in a major version bump. Recommended to use PyPI version. Version in source code is next planned release on PyPI, and is not official until pushed to PyPI.

Table of Contents

Documentation

The latest documentation can be found at https://detakon.readthedocs.io/

For older versions of documentation, they can be found inside your copy of the respository under the "/docs" directory and built using Sphinx. The first version that contained documentation was v0.3.0.

Installation

pip install detakon

Usage

[!WARNING] Status: Currently in pre-release, as minimal viable product for CSV to CSV conversions only. Not for usage in production systems, breaking changes are coming in future releases. Some planned changes can be viewed in the ROADMAP.md file.

Converter(detamap, source, destination).process()

Sample:

from detakon.detakon import Converter

invoice_converter = Converter("invoice_detamap.json", "data_dump_2026-01-01.csv", "invoice_2026-01-01.csv")
invoice_converter.process()

Detamap Files

A detamap configuration file is used to provide all details necessary for the data conversion.

A datamap must be a Python dictionary, or convertable to a Python dictionary. Currently this means either a dictionary or JSON file (plans to add TOML support).

Please see the documentation for more detail on detamaps.

A detamap typically has the following sections:

A detamap JSON file may look similar to:

{
    "Mappings": {
        "Customer Id": "External ID",
        "First Name": "First Name",
        "Last Name": "Last Name",
        "Company": "Company",
        "Country": "Country",
        "Phone 1": "Phone",
        "Phone 2": "Cell",
        "Email": "Email",
        "Website": "URL",
        "Postal Code": "Zip"
    },
    "Defaults": {
        "Postal Code": "00000"
    },
    "Operations": [
        {"hashmap": {"fields": "Country",
                        "arguments": [{
                            "United States of America": "USA",
                            "Antarctica (the territory South of 60 deg S)": "Antarctica"}]
                        }
                    },
        {"strip": {"fields": "*"}},
        {"strip": {"arguments": ["+1-"], "fields": ["Phone 1", "Phone 2"]}},
        {"upper": {"fields": ["Email", "Last Name", "First Name"]}}
    ],
    "Source": {
        "argument": "filepath",
        "type": "str",
        "encoding": "utf-8",
        "format": "csv",
        "delimiter": ","
    },
    "Output": {
        "fields": ["External ID", "Company", "Last Name", "First Name", "Country", "Zip", "Phone", "Cell", "Email", "URL"],
        "argument": "filepath",
        "type": "str",
        "append": false,
        "omit_heading": false,
        "encoding": "utf-8",
        "format": "csv",
        "delimiter": ","
    }
}

Above sample is not all-inclusive. Detamaps, source data, and output expect full chain of custody. No security guarantees are made. Users are advised not to use untrusted, or malformed data.

Join us on Discord

Join the Detakon Discord Server.

License

detakon is distributed under the terms of the MIT license.

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

detakon-0.4.0.tar.gz (49.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

detakon-0.4.0-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file detakon-0.4.0.tar.gz.

File metadata

  • Download URL: detakon-0.4.0.tar.gz
  • Upload date:
  • Size: 49.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.2 cpython/3.11.2 HTTPX/0.28.1

File hashes

Hashes for detakon-0.4.0.tar.gz
Algorithm Hash digest
SHA256 a8fc24037ecaa74e170a9c8f06f4a9c37458703dee02bcc4e780311b1006cddc
MD5 5f7469f7751691d7ac7c352b4a7bcc37
BLAKE2b-256 47360eb944a30ffd24dc03e3a68922b75a0b0dc11331904b3d607105d0ae84de

See more details on using hashes here.

File details

Details for the file detakon-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: detakon-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.2 cpython/3.11.2 HTTPX/0.28.1

File hashes

Hashes for detakon-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bdd18d538e72b279e9686c977797e9986568c6d553e827c78054c64e6c8c35cb
MD5 01f88078cba52ef8be7d5c68ac812a56
BLAKE2b-256 6a2363f5f701be2f01851c922ad45a37ebe4fa54fd1f69c9bf85b69db80a4a6f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page