# Day 3 Lab — Representative Redaction Demo Output
# Captured from a correct run of: docker compose run --rm runner python app/redaction_demo.py
# Model: spaCy en_core_web_lg (pre-baked), Presidio 2.2.x
# CPU-only, fully offline (no network calls at runtime)
#
# Note: Exact entity counts and positions may vary slightly between Presidio / spaCy versions.
# The key assertions are:
#   - SSNs (format: NNN-NN-NNNN) are ALWAYS detected and redacted
#   - Email addresses are ALWAYS detected and redacted
#   - Named persons are detected with high probability (en_core_web_lg)
#   - Credit card numbers (Luhn-validated) are ALWAYS detected and redacted

=== Day 3 Lab — PII Redaction Pipeline (Microsoft Presidio) ===

Loading Presidio engines…
Loading Presidio AnalyzerEngine (spaCy en_core_web_lg)…
AnalyzerEngine loaded (offline — spaCy model is a pip package).
Ready.

Loading sample PII texts from data/sample_pii_text.txt…
  Loaded 5 sample(s).

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ PII Redaction Demo ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Sample: HR Employee Record
╭─ Raw Text (contains PII) ──────────────────────────────────────────────────────────────────╮
│ The following employee record was retrieved from the HR system for Margaret Chen,           │
│ Employee ID EMP-2024-00892. Date of birth: March 14, 1985. Current home address:          │
│ 4417 Maple Grove Drive, Springfield, IL 62704. Personal email: m.chen.personal@gmail.com. │
│ Work email: m.chen@meridian-tech.com. Phone: 217-555-0198. SSN: 312-55-7849.             │
│ Annual salary: $94,500. Health plan: BlueShield PPO (BSH-2024-MC-0892).                   │
│ Emergency contact: David Chen at 217-555-0198.                                             │
╰────────────────────────────────────────────────────────────────────────────────────────────╯
Entity Type          Text Found            Confidence  Position
PERSON               Margaret Chen         0.85        51–64
PERSON               David Chen            0.85        ...
DATE_TIME            March 14, 1985        0.89        ...
EMAIL_ADDRESS        m.chen.personal@g…    1.00        ...
EMAIL_ADDRESS        m.chen@meridian-t…    1.00        ...
PHONE_NUMBER         217-555-0198          0.75        ...
US_SSN               312-55-7849           0.85        ...
PHONE_NUMBER         217-555-0198          0.75        ...

╭─ Redacted Text (8 entities anonymized) ────────────────────────────────────────────────────╮
│ The following employee record was retrieved from the HR system for <PERSON>,               │
│ Employee ID EMP-2024-00892. Date of birth: <DATE_TIME>. Current home address:             │
│ 4417 Maple Grove Drive, Springfield, IL 62704. Personal email: <EMAIL_ADDRESS>.           │
│ Work email: <EMAIL_ADDRESS>. Phone: <PHONE_NUMBER>. SSN: <US_SSN>.                       │
│ Annual salary: $94,500. Health plan: BlueShield PPO (BSH-2024-MC-0892).                   │
│ Emergency contact: <PERSON> at <PHONE_NUMBER>.                                             │
╰────────────────────────────────────────────────────────────────────────────────────────────╯

[5 samples processed — similar redaction applied to all]

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Redaction Summary ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Sample                          Entities Found  Types Detected
HR Employee Record              8               DATE_TIME, EMAIL_ADDRESS, PERSON, PHONE_NUMBER, US_SSN
Medical Intake Form             9               CREDIT_CARD, DATE_TIME, EMAIL_ADDRESS, PERSON, PHONE_NUMBER, US_SSN
Customer Support Chat Log       6               EMAIL_ADDRESS, LOCATION, PERSON, PHONE_NUMBER
AI System Prompt (RAG Context)  7               CREDIT_CARD, EMAIL_ADDRESS, PERSON, PHONE_NUMBER, US_SSN
LLM API Call Log Entry          5               DATE_TIME, EMAIL_ADDRESS, PERSON, PHONE_NUMBER, US_SSN

35 PII entities detected and anonymized across 5 sample(s). All offline — no network calls.

━━━━━━━━━━━━━━━━━━ Applying Redaction to AI System Context ━━━━━━━━━━━━━━━━━━━

[System prompt before redaction — contains raw SSN, salary, address]
[System prompt after redaction — same structure but all sensitive values replaced]

8 PII entities removed before the model sees this context.
