Skip to main content

Converts structure, keys and fields from a record according to predefined rules

Project description

PyPI Package latest release Supported versions Documentation Status

A rule-based record transformation library for Python. Converts input dicts into desired output formats using YAML or dict-based rule configurations. Designed to normalize records of the same data type from different sources into a single validated structure.

Features

  • Map fields using simple string paths or JMESPath expressions for nested access

  • Transform field values in-place with 25+ built-in conversion actions (string ops, math, URL cleanup, phone parsing, etc.)

  • Compute output values with command processors (GeoJSON points, joins, splits, list transforms)

  • Convert between date formats (Unix timestamps, DD-MM-YYYY, YYYY_MM_DD, etc.)

  • Run records through Pydantic models or dataclasses with optional method invocation

  • Conditionally execute rules or skip entire records

  • Extend with custom field convertors, date formatters, and command classes via protocols

Installation

pip install record-convertor

Quick Start

from record_convertor import RecordConvertorWithRulesDict

rules = {
    "name": "item.name",
    "brand": "item.brand.name",
    "price": "item.price",
}

convertor = RecordConvertorWithRulesDict(rule_dict=rules)

result = convertor.convert({
    "item": {
        "name": "Widget",
        "brand": {"name": "Acme"},
        "price": 9.99,
    }
})
# {"name": "Widget", "brand": "Acme", "price": 9.99}

Documentation

Full documentation is available at https://record-convertor.readthedocs.io/

License

LGPL-3.0-or-later

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

record_convertor-1.2.0.tar.gz (75.7 kB view details)

Uploaded Source

Built Distribution

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

record_convertor-1.2.0-py3-none-any.whl (59.6 kB view details)

Uploaded Python 3

File details

Details for the file record_convertor-1.2.0.tar.gz.

File metadata

  • Download URL: record_convertor-1.2.0.tar.gz
  • Upload date:
  • Size: 75.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for record_convertor-1.2.0.tar.gz
Algorithm Hash digest
SHA256 bced67de0ea48dd7a0779348dcec37141e112979b064e7c45f5042b9c2e9fe2b
MD5 304a1dc90369aa002f48b6dbc1a3bba2
BLAKE2b-256 ae6d1d9da401fca29042074c7365f8c7fb2dddcb4e95685084ed939f0a803f81

See more details on using hashes here.

Provenance

The following attestation bundles were made for record_convertor-1.2.0.tar.gz:

Publisher: main.yml on OlivettaDataGarden/record-convertor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file record_convertor-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for record_convertor-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4884e2f36377e1b43ae3edc1b340fc0fd7e3e62f15693efa4374e90c4e3c6aba
MD5 d650db87ca6494bb297f0415dea883a6
BLAKE2b-256 38ee2a6dc666814860cb815dda2a905ced4b439e750e81dc5354dc2d4cc7add0

See more details on using hashes here.

Provenance

The following attestation bundles were made for record_convertor-1.2.0-py3-none-any.whl:

Publisher: main.yml on OlivettaDataGarden/record-convertor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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