Skip to main content

A logger wrapper for OpenDP to keep track of, import, export the AST

Project description

OpenDP Logger

Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. License: MIT Python ci tests

The OpenDP logger makes it possible to serialize and deserialize OpenDP Measurements/Transformations to/from JSON.

Serialize

Enable logging (globally) before you build your transformations and/or measurements:

from opendp_logging import enable_logging
enable_logging()

Once this is enabled, Transformations/Measurements have a method .to_json() that returns a JSON string.

Deserialize

Deserialize a JSON string into a Transformation/Measurement by invoking opendp_logger.make_load_json.

Example

from opendp_logger import enable_logging
from opendp.mod import enable_features

enable_logging()
enable_features("contrib")

import opendp.transformations as trans

preprocessor = (
    # load data into a dataframe where columns are of type Vec<str>
    trans.make_split_dataframe(separator=",", col_names=["hello", "world"])
    >>
    # select a column of the dataframe
    trans.make_select_column(key="income", TOA=str)
)

# the ast object maintained in the pipeline
print("ast:", preprocessor.ast)

# serialize the ast to json
json_obj = preprocessor.to_json()
print("json:", json_obj)

from opendp_logger import make_load_json

# reconstruct the obj from the json string
test = make_load_json(json_obj)

print(test.ast)

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

opendp-logger-0.1.7.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

opendp_logger-0.1.7-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file opendp-logger-0.1.7.tar.gz.

File metadata

  • Download URL: opendp-logger-0.1.7.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.13

File hashes

Hashes for opendp-logger-0.1.7.tar.gz
Algorithm Hash digest
SHA256 0176cd467468be4b27101cf045e977c99cf785f2e226e52b9534817a897a240b
MD5 adf7db18ca5c99c94be145b03b3cee7c
BLAKE2b-256 56dc47c21fc27389f1f58d4daabe15d1c309db91b4abac21dfb0b337e8a10fff

See more details on using hashes here.

File details

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

File metadata

  • Download URL: opendp_logger-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.13

File hashes

Hashes for opendp_logger-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 82cedba3232469be091375fef9f374b7c4637506e477d3f132062c994708e7bf
MD5 fe0efef3de374225725b7d314c28f599
BLAKE2b-256 94ca76bbcd4dbf8ad48adeffc0044ae8f6dd37066cc25b375868fac22a33eeaf

See more details on using hashes here.

Supported by

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