Library

Volume 1 · Security, Compliance & Responsible AI

Notebook
Sign in

Section 38

HIPAA Compliance for AI Systems (PHI, Privacy Rule, Security Rule, BAA)

718 words · about 3 min

38.1 HIPAA Overview for AI Architects

Rule Requirement AI Implication
Privacy Rule Controls use/disclosure of PHI AI must not expose PHI inappropriately
Security Rule Administrative, physical, technical safeguards Encryption, access controls, audit trails
Breach Notification Report breaches within 60 days AI PHI leakage = reportable breach
Minimum Necessary Access only PHI needed for the task AI should not access unnecessary PHI
Business Associate Agreement (BAA) Required with every vendor handling PHI Required for Bedrock, Azure OpenAI, etc.

38.2 PHI — The 18 HIPAA Identifiers

1. Names                     10. Account numbers
2. Dates (except year)       11. SSN
3. Phone numbers             12. Medical record numbers
4. Fax numbers               13. Health plan beneficiary #
5. Email addresses           14. Certificate/license numbers
6. SSN                       15. Vehicle identifiers
7. Medical record numbers    16. Device identifiers
8. Health plan numbers       17. Web URLs
9. Account numbers           18. IP addresses
                             + Biometric identifiers, photos, any unique ID

38.3 HIPAA Compliance Checklist for AI Systems

Technical safeguards:

  • [ ] Encryption at rest (AES-256 via KMS)
  • [ ] Encryption in transit (TLS 1.2+)
  • [ ] Access controls (RBAC, least privilege)
  • [ ] Audit controls (all PHI access logged)
  • [ ] Integrity controls (detect unauthorized PHI modification)
  • [ ] Authentication (MFA for PHI access)

AI-specific:

  • [ ] BAA with LLM provider (AWS Bedrock, Azure OpenAI)
  • [ ] PHI never sent to models without BAA coverage
  • [ ] De-identification before embedding/vector storage (or BAA-covered DB)
  • [ ] No PHI in training data without explicit consent
  • [ ] PHI leakage detection in all AI outputs
  • [ ] AI decision audit trail (who asked what, what PHI was accessed)
  • [ ] Right to access — patients can request records of AI processing of their data

38.4 De-Identification Methods

Method Approach Strength Use Case
Safe Harbor Remove all 18 identifiers Strong Research, analytics
Expert Determination Statistical re-identification risk analysis Flexible When Safe Harbor is too restrictive
Pseudonymization Replace identifiers with tokens Moderate When linkage is needed
Tokenization Replace with random tokens + maintained mapping Good AI processing needing reference-back
def deidentify_for_ai(clinical_note, patient_id):
    """Replace PHI with tokens, maintain mapping for re-identification."""
    phi_mapping = {}

    names = detect_names(clinical_note)
    for name in names:
        token = f"[PATIENT_{patient_id[:4]}]"
        phi_mapping[token] = name
        clinical_note = clinical_note.replace(name, token)

    dates = detect_dates(clinical_note)
    for date in dates:
        shifted = shift_date(date, days=random.randint(-30, 30))
        phi_mapping[shifted] = date
        clinical_note = clinical_note.replace(str(date), str(shifted))

    identifiers = detect_identifiers(clinical_note)
    for ident in identifiers:
        token = f"[{ident.type}_{hash(ident.value)[:6]}]"
        phi_mapping[token] = ident.value
        clinical_note = clinical_note.replace(ident.value, token)

    return clinical_note, phi_mapping

38.5 Secure Deployment Architecture (PHI Never Traverses the Public Internet)

┌─────────────────────────────────────────────────┐
│ Production Environment  VPC: 10.0.0.0/16          │
│                                                    │
│ ┌────────────────┐    ┌────────────────────┐    │
│ │ Public Subnet   │    │ Private Subnet      │    │
│ │ ALB / API GW    │───▶│ EKS Cluster          │    │
│ │ (TLS termination)│   │                      │    │
│ │ WAF             │    │ SageMaker Endpoints  │    │
│ └────────────────┘    │ (Private VPC endpoint)│    │
│                        │ RDS (encrypted)      │    │
│                        │ OpenSearch (encrypted)│    │
│                        └────────────────────┘    │
│ ┌────────────────────────────────────────────┐  │
│ │ PrivateLink Endpoints (No Internet)         │  │
│ │ Bedrock / S3 / SageMaker / CloudWatch VPC EP│  │
│ └────────────────────────────────────────────┘  │
└─────────────────────────────────────────────────┘

38.6 Q&A

Q1: How do you ensure HIPAA compliance when using LLMs for healthcare data processing?

  • Provider selection: use HIPAA-eligible services with a signed BAA (AWS Bedrock, Azure OpenAI). Never send PHI to consumer AI services.
  • Data handling: de-identify/tokenize before sending to LLMs where possible; if PHI must flow, route exclusively through VPC endpoints.
  • Access controls: RBAC at API level, full access logging (identity, timestamp, data accessed).
  • Output security: scan every AI output for PHI leakage before returning to users — critical for RAG systems that might retrieve another patient’s data.
  • Audit: complete audit trail retained per HIPAA (6 years), reviewed regularly.

Q2: What counts as a “breach” for an AI system under HIPAA? Any unauthorized access, use, or disclosure of PHI that compromises its privacy or security — for an AI system, this includes a model outputting PHI to an unauthorized user, PHI leaking through prompt injection, or PHI appearing in training data/logs accessible beyond minimum necessary scope. All must be assessed and reported within 60 days if it meets the breach threshold.