Skip to main content

Smartnoise Synth Logger

Logger for Smartnoise Synth Transformers

License: MIT Python ci tests

Serialize and deserialize Smartnoise Synth constraints to and from JSON. Constraints as specified in the Smartnoise Synth Transforms documentation: https://docs.smartnoise.org/synth/transforms/index.html with tt = TableTransformer(constraint).

Installation

Install with pip:

pip install smartnoise-synth-logger

Example

from snsynth.transform import (
    AnonymizationTransformer,
    BinTransformer,
    ChainTransformer,
    ClampTransformer,
    DropTransformer,
    LabelTransformer,
    LogTransformer,
    MinMaxTransformer,
    OneHotEncoder,
    StandardScaler,
)

constraints = {
    "id": AnonymizationTransformer("uuid4"),
    "email": "email", # also possible
    "income": ChainTransformer(
        [
            LogTransformer(),
            BinTransformer(bins=20, lower=0, upper=50),
        ]
    ),
    "height": ChainTransformer(
        [
            StandardScaler(lower=0, upper=1),
            BinTransformer(bins=20, lower=0, upper=1),
        ]
    ),
    "weight": ChainTransformer(
        [ClampTransformer(lower=10, upper=200), BinTransformer(bins=20)]
    ),
    "age": MinMaxTransformer(lower=0, upper=100),
    "sex": ChainTransformer(
        [LabelTransformer(nullable=True), OneHotEncoder()]
    ),
    "rank": LabelTransformer(nullable=False),
    "job": DropTransformer(),
}

Serialise

from smartnoise_synth_logger import serialise_constraints

serialised_constraints = serialise_constraints(constraints)

Deserialise

from smartnoise_synth_logger import deserialise_constraints

deserialised_constraints = deserialise_constraints(serialised_constraints)
tt = TableTransformer(deserialised_constraints)

It can now be expected that the deserialised_constraints has the same constraints as constraints.

NOTE: lambda function in AnonymizationTransformer are not supported.

Metadata

Release files for smartnoise-synth-logger 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smartnoise-synth-logger 0.0.4
File Size Uploaded Provenance Actions
smartnoise_synth_logger-0.0.4.tar.gz 6.6 kB Without provenance Details for smartnoise_synth_logger-0.0.4.tar.gz

Release files / smartnoise_synth_logger-0.0.4.tar.gz

Download URL smartnoise_synth_logger-0.0.4.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
644db993806c10d92fae7c1d122469c4776ebeff1314a96a28dc94cd751da200
BLAKE2b-256 checksum
How to use checksums
0fa6f27e6cc048e4a188dda70332b90adf936c0956ac00c5ac197846326f44ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Security for smartnoise-synth-logger 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page