Skip to main content

A library to process raw data into a structured format

Project description

⚗️ Zeolite


Zeolite is a Python library that uses a simple configuration approach to define a table/schema structure. Raw data can normalised, cleaned, and validated against the schema in a performant and standardised way.

The final datasets are guaranteed to be in the correct format and can be easily exported to a variety of formats. In addition, Zeolite captures errors and warnings during the processing of the data, which can be used to improve the quality of the data.

Example

import zeolite as z

individual_schema = z.schema("individual").columns(
    z.str_col("id")
    .clean(to="id", prefix="ORG_X::")
    .validations(
        z.check_is_value_empty(warning="any", error=0.1, reject=0.01, treat_empty_strings_as_null=True),
        z.check_is_value_duplicated(check_on_cleaned=True, reject="any"),
    ),
    
    z.str_col("birthdate")
    .clean(to="date")
    .validations(z.check_is_value_invalid_date(reject="all")),
    
    z.str_col("gender").clean(
        to="enum",
        sanitize="lowercase",
        enum_map={
            "m": "Male", "male": "Male",
            "f": "Female", "female": "Female",  
            "d":"Gender Diverse", "diverse": "Gender Diverse"
        },
    ),
    
    z.str_col("is_active").clean(
        to="boolean", 
        true_values={"yes", "active"}, false_values={"no", "inactive"}
    ),
    
    z.str_col("ethnicity").clean(to="sanitised_string"),
    z.str_col("ethnicity_2").clean(to="sanitised_string"),
    z.derived_col(
        "is_maori",
        function=(
            z.ref("ethnicity").clean().col.eq("maori")
            | z.ref("ethnicity_2").clean().col.eq("maori")
        ),
        data_type="boolean",
    ),
)

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

zeolite-0.1.7.tar.gz (62.8 kB view details)

Uploaded Source

Built Distribution

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

zeolite-0.1.7-py3-none-any.whl (58.0 kB view details)

Uploaded Python 3

File details

Details for the file zeolite-0.1.7.tar.gz.

File metadata

  • Download URL: zeolite-0.1.7.tar.gz
  • Upload date:
  • Size: 62.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.12

File hashes

Hashes for zeolite-0.1.7.tar.gz
Algorithm Hash digest
SHA256 f63418e85a44819f0b0f9c37a033cc315d5845ccee7516c9a12860cfa9e3eaf8
MD5 fdd0e8a3ddc7deb3414e3ad35e2664fc
BLAKE2b-256 495c37fa704adbc787d0993fafbd9dc7ed44c1f22a6d01cc97dd3f2e9c8065d1

See more details on using hashes here.

File details

Details for the file zeolite-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: zeolite-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 58.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.12

File hashes

Hashes for zeolite-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 0fa5586a7774637d0d4cedb8cdf960c1e9d71d255d97fd3f80145a72d02e7da6
MD5 272fd89b019282e9126af4ce8d6c4d5d
BLAKE2b-256 6c5b2afe09a3ed67bd14d0ecc158c572afdb6297f699dd45f45b8a73170f606e

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