Skip to main content

Presidio structured package - analyzes and anonymizes structured and semi-structured data.

Project description

Presidio structured

Description

The Presidio structured package is a flexible and customizable framework designed to identify and protect structured sensitive data. This tool extends the capabilities of Presidio, focusing on structured data formats such as tabular formats and semi-structured formats (JSON). It leverages the detection capabilities of Presidio-Analyzer to identify columns or keys containing personally identifiable information (PII), and establishes a mapping between these column/keys names and the detected PII entities. Following the detection, Presidio-Anonymizer is used to apply de-identification techniques to each value in columns identified as containing PII, ensuring the sensitive data is appropriately protected.

Installation

As a python package

To install the presidio-structured package, run the following command:

pip install presidio-structured

Getting started

Anonymizing Data Frames:

import pandas as pd
from presidio_structured import StructuredEngine, PandasAnalysisBuilder
from presidio_anonymizer.entities import OperatorConfig
from faker import Faker # optionally using faker as an example

# Initialize the engine with a Pandas data processor (default)
pandas_engine = StructuredEngine()

# Create a sample DataFrame
sample_df = pd.DataFrame({'name': ['John Doe', 'Jane Smith'], 'email': ['john.doe@example.com', 'jane.smith@example.com']})

# Generate a tabular analysis which describes PII entities in the DataFrame.
tabular_analysis = PandasAnalysisBuilder().generate_analysis(sample_df)

# Define anonymization operators
fake = Faker()
operators = {
    "PERSON": OperatorConfig("replace", {"new_value": "REDACTED"}),
    "EMAIL_ADDRESS": OperatorConfig("custom", {"lambda": lambda x: fake.safe_email()})
}

# Anonymize DataFrame
anonymized_df = pandas_engine.anonymize(sample_df, tabular_analysis, operators=operators)
print(anonymized_df)

More information

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

presidio_structured-0.0.7.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

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

presidio_structured-0.0.7-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file presidio_structured-0.0.7.tar.gz.

File metadata

  • Download URL: presidio_structured-0.0.7.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for presidio_structured-0.0.7.tar.gz
Algorithm Hash digest
SHA256 30219fb9a9907f08c27b3b0e46facb2c5cbde2fb2d0fe9e44ef59a3268adcc8d
MD5 42896e0c2a2546bccc37664e905d069e
BLAKE2b-256 e8437612c3ea38f874018360d9349b73a5d8c5a8275b93701e984dae72bd96fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for presidio_structured-0.0.7.tar.gz:

Publisher: release.yml on data-privacy-stack/presidio

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

File details

Details for the file presidio_structured-0.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for presidio_structured-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 d1594e1fc7bcc5888ab8cb3ade21965b7b32e134fd6f5b352e5eb40c50115bfb
MD5 c6590c69ae668ce574c66f07e8fabae5
BLAKE2b-256 cd0d2eb2de67ab3d571e9e427e217b85aa005614cddccac20ac98ca67e0be61c

See more details on using hashes here.

Provenance

The following attestation bundles were made for presidio_structured-0.0.7-py3-none-any.whl:

Publisher: release.yml on data-privacy-stack/presidio

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