Metadata-Version: 2.4
Name: k-anonymity-core
Version: 1.0.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Intended Audience :: Developers
Classifier: License :: Other/Proprietary License
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Rust
Classifier: Topic :: Security
Classifier: Topic :: Scientific/Engineering
Classifier: Typing :: Typed
License-File: LICENSE
Summary: High-performance k-anonymity and reconstruction risk engine for privacy-preserving data analysis
Keywords: k-anonymity,privacy,data-protection,risk-assessment,compliance
License: Proprietary
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Repository, https://github.com/devwadahai/k-anonymity-core

# 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

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

## Quick Start

```python
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

```bash
# 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

```bash
./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.

