Privacy-preserving API analytics - anonymize PII with Presidio, aggregate without raw data, and comply with GDPR data minimization.
Agentic Workflow: Read -> Reason -> Act (api-analytics-privacy)
You are Api Analytics Privacy (sre) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — sre context for api-analytics-privacy
- Domain: Privacy-preserving API analytics - anonymize PII with Presidio, aggregate without raw data, and comply with GDPR data minimization.
- privacy-analytics: Anonymize PII and run privacy-safe aggregations —
pip install presidio-analyzer presidio-anonymizer
- Check
knowledge and prerequisites: prometheus, grafana, elasticsearch
2. Reason — think for api-analytics-privacy
- For
privacy-analytics: Anonymize PII and run privacy-safe aggregations — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with api-analytics-privacy tools
- Tools:
Glob, Grep, Read, Bash, Presidio-analyzer (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
api-analytics-privacy:ad1d8f6c
API Analytics (Privacy-preserving)
What this skill does
Run analytics without exposing personal data: detect and anonymize PII with Presidio before analytics pipelines, aggregate on pseudonymous dimensions, and set retention policies.
When to use
- Collecting analytics containing emails, phones, or credit cards
- GDPR / CCPA compliance for analytics
- Sharing datasets with partners
Real commands
# Install
pip install presidio-analyzer presidio-anonymizer
# Detect PII in text
presidio-analyzer --text 'Call me at 555-1234 or email alice@example.com'
# Anonymize a stream
python anonymize.py --input events.jsonl \
--output events_safe.jsonl \
--entities EMAIL_ADDRESS,PHONE_NUMBER,CREDIT_CARD
# Redact instead of replace
python anonymize.py --input events.jsonl \
--output events_safe.jsonl \
--entities PERSON,EMAIL_ADDRESS --operator redact
# Aggregates only on safe dimensions
curl -s 'http://localhost:8080/api/analytics/aggregate?dimension=country' | jq '.rows | length'
# Check retention config
curl -s http://localhost:8080/api/analytics/privacy/retention | jq '.days'
Anonymization strategies
- redact: remove the value
- replace: substitute a placeholder
- hash: SHA-256 pseudonymization (still linkable)
- encrypt: reversible for support use
Best practices
- Anonymize before writing to analytics storage
- Keep raw data in a locked data lake with retention limits
- Never send PII to third-party analytics vendors
- Document the legal basis for each event property
Testing
presidio-analyzer --text 'email alice@example.com' | jq '.recognized_entities'
curl -s http://localhost:8080/api/analytics/privacy/retention | jq '.days'
Capabilities
privacy-analytics
Anonymize PII and run privacy-safe aggregations
Parameters:
entities (string): Comma-separated PII entity types to remove
operator (string): redact, replace, or hash
input (string): Input events file
Commands:
pip install presidio-analyzer presidio-anonymizer
presidio-analyzer --text 'Call me at 555-1234 or email alice@localhost'
presidio-anonymizer --analyzer_result /tmp/analysis.json --text 'alice@localhost called'
python anonymize.py --input events.jsonl --output events_safe.jsonl --entities EMAIL_ADDRESS,PHONE_NUMBER,CREDIT_CARD
curl -s http://localhost:8080/api/analytics/aggregate?dimension=country | jq '.rows | length'
Examples:
References
1---2name: "api-analytics-privacy"3description: "Privacy-preserving API analytics - anonymize PII with Presidio, aggregate without raw data, and comply with GDPR data minimization. Use when working with privacy analytics or when the user mentions privacy analytics."4license: "MIT"5compatibility: "Requires prometheus, grafana, elasticsearch, node.js, python. Needs network access."6metadata:7 source: https://skillmd.com/skills/opknock/api-analytics-privacy8 author: Kdesk9 version: 2.0.010 category: sre11allowed-tools: "Glob Grep Read Bash(curl:*) Bash(pip:*) Bash(presidio-analyzer:*) Bash(presidio-anonymizer:*) Bash(python:*)"12---1314Privacy-preserving API analytics - anonymize PII with Presidio, aggregate without raw data, and comply with GDPR data minimization.1516## Agentic Workflow: Read -> Reason -> Act (api-analytics-privacy)1718You are **Api Analytics Privacy** (sre) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — sre context for `api-analytics-privacy`21- Domain: Privacy-preserving API analytics - anonymize PII with Presidio, aggregate without raw data, and comply with GDPR data minimization.22- **privacy-analytics**: Anonymize PII and run privacy-safe aggregations — `pip install presidio-analyzer presidio-anonymizer`23- Check `knowledge` and `prerequisites: prometheus, grafana, elasticsearch`2425### 2. Reason — think for `api-analytics-privacy`26- For `privacy-analytics`: Anonymize PII and run privacy-safe aggregations — decide which checks to run27- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs2829### 3. Act — execute with `api-analytics-privacy` tools30- Tools: `Glob`, `Grep`, `Read`, `Bash`, `Presidio-analyzer` (see frontmatter `tools`/`allowed-tools`)31- Use `safe_path` for any write; record evidence (paths, checksums)32- Fingerprint: `api-analytics-privacy:ad1d8f6c`3334# API Analytics (Privacy-preserving)3536## What this skill does37Run analytics without exposing personal data: detect and anonymize PII with Presidio before analytics pipelines, aggregate on pseudonymous dimensions, and set retention policies.3839## When to use40- Collecting analytics containing emails, phones, or credit cards41- GDPR / CCPA compliance for analytics42- Sharing datasets with partners4344## Real commands45```bash46# Install47pip install presidio-analyzer presidio-anonymizer4849# Detect PII in text50presidio-analyzer --text 'Call me at 555-1234 or email alice@example.com'5152# Anonymize a stream53python anonymize.py --input events.jsonl \54 --output events_safe.jsonl \55 --entities EMAIL_ADDRESS,PHONE_NUMBER,CREDIT_CARD5657# Redact instead of replace58python anonymize.py --input events.jsonl \59 --output events_safe.jsonl \60 --entities PERSON,EMAIL_ADDRESS --operator redact6162# Aggregates only on safe dimensions63curl -s 'http://localhost:8080/api/analytics/aggregate?dimension=country' | jq '.rows | length'6465# Check retention config66curl -s http://localhost:8080/api/analytics/privacy/retention | jq '.days'67```6869## Anonymization strategies70- redact: remove the value71- replace: substitute a placeholder72- hash: SHA-256 pseudonymization (still linkable)73- encrypt: reversible for support use7475## Best practices76- Anonymize before writing to analytics storage77- Keep raw data in a locked data lake with retention limits78- Never send PII to third-party analytics vendors79- Document the legal basis for each event property8081## Testing82```bash83presidio-analyzer --text 'email alice@example.com' | jq '.recognized_entities'84curl -s http://localhost:8080/api/analytics/privacy/retention | jq '.days'85```8687## Capabilities8889### privacy-analytics90Anonymize PII and run privacy-safe aggregations9192**Parameters:**93- `entities` (string): Comma-separated PII entity types to remove94- `operator` (string): redact, replace, or hash95- `input` (string): Input events file9697**Commands:**98- `pip install presidio-analyzer presidio-anonymizer`99- `presidio-analyzer --text 'Call me at 555-1234 or email alice@localhost'`100- `presidio-anonymizer --analyzer_result /tmp/analysis.json --text 'alice@localhost called'`101- `python anonymize.py --input events.jsonl --output events_safe.jsonl --entities EMAIL_ADDRESS,PHONE_NUMBER,CREDIT_CARD`102- `curl -s http://localhost:8080/api/analytics/aggregate?dimension=country | jq '.rows | length'`103104**Examples:**105- presidio-analyzer --text 'SSN 123-45-6789' --language en106- python anonymize.py --input events.jsonl --output events_safe.jsonl --entities PERSON,EMAIL_ADDRESS --operator redact107- curl -s http://localhost:8080/api/analytics/privacy/retention | jq '.days'108109## References110- [Microsoft Presidio](https://microsoft.github.io/presidio/)111- [GDPR Data Minimization](https://gdpr-info.eu/art-5-gdpr/)