Skip to main content

High-performance k-anonymity and reconstruction risk engine for privacy-preserving data analysis

Project description

K-Anonymity Core

Proprietary k-anonymity and reconstruction risk engine for financial trade data.

Implementation: Rust with PyO3 bindings
Distribution: Private PyPI package
License: Proprietary - All rights reserved

Overview

This library provides privacy-preserving risk assessment for financial trades:

  • k-anonymity: Measures how many records share the same quasi-identifiers
  • l-diversity: Ensures diversity of sensitive attributes within equivalence classes
  • t-closeness: Distribution similarity between equivalence class and overall population
  • Reconstruction risk: Probability that original data can be inferred

Installation

# From private PyPI
pip install k-anonymity-core --index-url https://your-private-pypi/simple/

Quick Start

from k_anonymity_core import RiskEngineService

engine = RiskEngineService(
    k_threshold=5,
    l_threshold=3.0,
    reconstruction_threshold=0.15
)

result = engine.assess_risk({
    "asset_class": "equity",
    "sector": "financial",
    "region": "eu_regulated",
    "liquidity_tier": 2,
    "volatility_tier": 2,
    "trade_size_bucket": 2
})

if result["can_send_to_llm"]:
    print("Safe to process with LLM")
else:
    print(f"Blocked: {result['blocking_reasons']}")

Development

Prerequisites

  • Docker & Docker Compose
  • Rust 1.76+ (installed in Docker)
  • Python 3.9+

Setup

# Start development environment
./scripts/dev.sh

# Inside container
cd rust_core
cargo build --release
cargo test
maturin develop

# Run Python tests
pytest ../python/tests/ -v

Build Wheels

./scripts/build.sh
# Wheels appear in ./dist/

Architecture

┌─────────────────────────────────────────┐
│  Python API (k_anonymity_core)          │
├─────────────────────────────────────────┤
│  PyO3 Bindings                          │
├─────────────────────────────────────────┤
│  Rust Core (compiled binary)            │
│  - k_anonymity.rs                       │
│  - l_diversity.rs                       │
│  - reconstruction.rs                    │
│  - rarity.rs                            │
│  - uniqueness.rs                        │
└─────────────────────────────────────────┘

License

This software is proprietary and confidential. Unauthorized copying, modification, distribution, or use is strictly prohibited.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

k_anonymity_core-1.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (264.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

k_anonymity_core-1.0.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (254.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

k_anonymity_core-1.0.0-cp311-cp311-win_amd64.whl (166.6 kB view details)

Uploaded CPython 3.11Windows x86-64

k_anonymity_core-1.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (265.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

k_anonymity_core-1.0.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (255.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

k_anonymity_core-1.0.0-cp311-cp311-macosx_11_0_arm64.whl (235.9 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

k_anonymity_core-1.0.0-cp311-cp311-macosx_10_12_x86_64.whl (249.4 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

k_anonymity_core-1.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (265.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

k_anonymity_core-1.0.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (255.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

k_anonymity_core-1.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (265.5 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

k_anonymity_core-1.0.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (255.6 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

File details

Details for the file k_anonymity_core-1.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for k_anonymity_core-1.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3e60bf34bd7eaa3a087a72192b81eed25c94e795af63b943f5e95fafd0da0584
MD5 b3097dfd1ecedaadeb21d8b92615738c
BLAKE2b-256 c333f73b8d86078ecc44c30f409cfc091893b57a1d671b2e82df14a2a36bd374

See more details on using hashes here.

Provenance

The following attestation bundles were made for k_anonymity_core-1.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build-publish.yml on devwadahai/k-anonymity-core

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

File details

Details for the file k_anonymity_core-1.0.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for k_anonymity_core-1.0.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d3059698b32da069f795bb5e7e2746eb2e686b19b54f679cfc08138ace772714
MD5 80debb91db7127058a5bde63c4b9fd88
BLAKE2b-256 e77df83e74dcb20142f6b5d18e2ea4f7ebc16653387c2a10b4a151a2d07afcc1

See more details on using hashes here.

Provenance

The following attestation bundles were made for k_anonymity_core-1.0.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: build-publish.yml on devwadahai/k-anonymity-core

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

File details

Details for the file k_anonymity_core-1.0.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for k_anonymity_core-1.0.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 484a3690726398eba50c2c6faf8ede21dc30af9191c223b58decdb42bc662929
MD5 e742a12d01e0bd5f0b78f468c9a39ba8
BLAKE2b-256 0e6e3e0487895a25164dbe85401fdbee839e917f0689885cf59774f7fe8655f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for k_anonymity_core-1.0.0-cp311-cp311-win_amd64.whl:

Publisher: build-publish.yml on devwadahai/k-anonymity-core

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

File details

Details for the file k_anonymity_core-1.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for k_anonymity_core-1.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f6c994576c74833c4a1f5f6b7cef14c496196f478eadd90ae6685e595bdf1ce3
MD5 8b889b9059696a7164db8d0bc547d63b
BLAKE2b-256 3ea1aadbd0746f7c541d650b18ee928561a7e259758c57881ec477e0d303a5c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for k_anonymity_core-1.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build-publish.yml on devwadahai/k-anonymity-core

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

File details

Details for the file k_anonymity_core-1.0.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for k_anonymity_core-1.0.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 95a66a2981f8e7e357cfaf979afd692e84a0c0a8daddc43511054959c0422bf2
MD5 e1d4a3048311353ec6ff7b45525d5a71
BLAKE2b-256 5e8e0d15a8a81b7763190e6cde62c14ac7e2fc5f57cae5eba48e328f3027eb5c

See more details on using hashes here.

Provenance

The following attestation bundles were made for k_anonymity_core-1.0.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: build-publish.yml on devwadahai/k-anonymity-core

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

File details

Details for the file k_anonymity_core-1.0.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for k_anonymity_core-1.0.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 996bf5999f5e294857c49c149b734e13ade948b6a35c84dc7fe998e6b1b76978
MD5 adc3d6d050d9fd3e87d9a7f349c67b5f
BLAKE2b-256 a59a75ac70c27c82a675d1a4a118ffb4f16304285b359660d28a38295e7538a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for k_anonymity_core-1.0.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: build-publish.yml on devwadahai/k-anonymity-core

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

File details

Details for the file k_anonymity_core-1.0.0-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for k_anonymity_core-1.0.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 dd6077e1c94310a685ac9737893848f7f08265f0d5ef9adf46df3d5ec6794df1
MD5 28852434af31c6200d1e9adac4b116b1
BLAKE2b-256 457cd87c7dd0e198b68fd3dc4c1f5e5f828e0cd804b6d925c035b440d58d5552

See more details on using hashes here.

Provenance

The following attestation bundles were made for k_anonymity_core-1.0.0-cp311-cp311-macosx_10_12_x86_64.whl:

Publisher: build-publish.yml on devwadahai/k-anonymity-core

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

File details

Details for the file k_anonymity_core-1.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for k_anonymity_core-1.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 89ccd02fa0b9fb82f8ac451b146905318e9e5ebaaa65fa4a4cbd69c8c8a1eaba
MD5 3b1d9d430356c3a1db0efee7d1ef87b0
BLAKE2b-256 26ba30150c53c8cbc0ad232de0f5977dfddd0dac72b173c9cf7624640dae7d8f

See more details on using hashes here.

Provenance

The following attestation bundles were made for k_anonymity_core-1.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build-publish.yml on devwadahai/k-anonymity-core

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

File details

Details for the file k_anonymity_core-1.0.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for k_anonymity_core-1.0.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 eaac5ef1aee539c55a574e7cc60ef74892df6b56112cecf30b51ffe3ffce28a7
MD5 d453edbfb1999d6fc6a13a1bc3ef6961
BLAKE2b-256 e42c51cdc95095d00bc86277e6d26cf95e2b94a62c5e7846a71f0fdcb07aac61

See more details on using hashes here.

Provenance

The following attestation bundles were made for k_anonymity_core-1.0.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: build-publish.yml on devwadahai/k-anonymity-core

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

File details

Details for the file k_anonymity_core-1.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for k_anonymity_core-1.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bc94c2b1a038d2309477b6e84b4efb77f45005b9f0f39ed5a1cf9e476b225d26
MD5 0ad85c45b9e32057cb8adb6982f8917a
BLAKE2b-256 c0541f5440db52b359263c23ffb16bb248c8c9d4ed3c037684f49029a8d726fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for k_anonymity_core-1.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build-publish.yml on devwadahai/k-anonymity-core

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

File details

Details for the file k_anonymity_core-1.0.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for k_anonymity_core-1.0.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a8248f1dc699e789523d38e39e92d1cdb277663e80e406709cc028681590c16d
MD5 f1e706f1747cecc789c5b1f7b185a065
BLAKE2b-256 0dd2319df948eec848d2be815b8f10a740191648e627ed8122f165a9815a2313

See more details on using hashes here.

Provenance

The following attestation bundles were made for k_anonymity_core-1.0.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: build-publish.yml on devwadahai/k-anonymity-core

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