OpenEvidence Data Handling
Table of Contents
Overview
Implement HIPAA-compliant Protected Health Information (PHI) handling for OpenEvidence clinical AI integrations. Covers PHI detection, de-identification, encrypted storage, retention policies, and audit trails.
Prerequisites
- Signed BAA with OpenEvidence
- Understanding of HIPAA regulations
- Data classification policy
- Encryption infrastructure
HIPAA Data Categories
| Category |
Examples |
Handling |
| PHI Identifiers |
Name, DOB, SSN, MRN |
Never send to OpenEvidence |
| Clinical Data |
Conditions, medications |
May send de-identified |
| Query Results |
Answers, citations |
Cache with encryption, audit access |
| Audit Logs |
User actions, timestamps |
Retain 6 years, encrypt |
Instructions
Step 1: Implement PHI Detection
Create regex patterns for SSN, MRN, phone, email, DOB, dates, names, and addresses. Auto-detect and replace with [TYPE_REDACTED] placeholders before any API call.
Step 2: De-identify Patient Context
Map exact ages to ranges (infant/child/adolescent/young-adult/adult/middle-aged/elderly). Map specific conditions to categories (cardiovascular, metabolic, respiratory). Map medications to drug classes.
Step 3: Encrypt Cached Data
Use AES-256-GCM encryption for all cached OpenEvidence responses. Store IV + AuthTag + ciphertext. Implement EncryptedCacheStore wrapping Redis.
Step 4: Configure Retention Policies
- Audit logs: 2190 days (6 years, HIPAA minimum), archive after 1 year
- Query cache: 1 day maximum
- DeepConsult reports: 365 days, archive after 90 days
- Error logs: 90 days (no PHI)
Step 5: Build Audit Trail
Log all PHI access with userId, userRole, action, resourceId, encrypted IP and userAgent. Support filtered queries with pagination for compliance review.
Output
- PHI detection and auto-sanitization
- Patient context de-identification (age ranges, condition categories, drug classes)
- AES-256-GCM encrypted cache store
- HIPAA-compliant retention policies with archival
- Comprehensive audit trail with encryption
Error Handling
| Data Issue |
Detection |
Resolution |
| PHI detected in query |
Pattern matching |
Auto-sanitize and warn |
| Decryption failure |
Cache read error |
Delete corrupted entry, re-query |
| Retention job fails |
Cron monitoring |
Check database permissions, re-run |
| Audit gap |
Compliance review |
Add middleware to missing routes |
Examples
18 HIPAA Identifiers (Never Send)
Names, geographic data, dates, phone/fax, email, SSN, MRN, health plan numbers, account numbers, certificate/license numbers, vehicle/device identifiers, URLs, IPs, biometrics, photos, other unique characteristics.
Data Flow
User Query -> PHI Detection -> De-identification -> OpenEvidence API
| |
Audit Log (encrypted) Encrypted Cache
See detailed implementation for advanced patterns.
Resources
1---2name: openevidence-data-handling3description: |4 Implement HIPAA-compliant PHI data handling for OpenEvidence integrations.5 Use when implementing data protection, configuring retention policies,6 or ensuring compliance for clinical AI data flows.7 Trigger with phrases like "openevidence phi", "openevidence data",8 "openevidence hipaa data", "clinical data handling", "patient data protection".9allowed-tools: Read, Write, Edit10version: 1.0.011license: MIT12author: Jeremy Longshore <jeremy@intentsolutions.io>13compatible-with: claude-code, codex, openclaw14metadata:15 source: https://skillmd.com/skills/micsapp/openevidence-data-handling16---1718# OpenEvidence Data Handling1920## Table of Contents21- [Overview](#overview)22- [Prerequisites](#prerequisites)23- [Instructions](#instructions)24- [Output](#output)25- [Error Handling](#error-handling)26- [Examples](#examples)27- [Resources](#resources)2829## Overview30Implement HIPAA-compliant Protected Health Information (PHI) handling for OpenEvidence clinical AI integrations. Covers PHI detection, de-identification, encrypted storage, retention policies, and audit trails.3132## Prerequisites33- Signed BAA with OpenEvidence34- Understanding of HIPAA regulations35- Data classification policy36- Encryption infrastructure3738## HIPAA Data Categories3940| Category | Examples | Handling |41|----------|----------|----------|42| PHI Identifiers | Name, DOB, SSN, MRN | Never send to OpenEvidence |43| Clinical Data | Conditions, medications | May send de-identified |44| Query Results | Answers, citations | Cache with encryption, audit access |45| Audit Logs | User actions, timestamps | Retain 6 years, encrypt |4647## Instructions4849### Step 1: Implement PHI Detection50Create regex patterns for SSN, MRN, phone, email, DOB, dates, names, and addresses. Auto-detect and replace with `[TYPE_REDACTED]` placeholders before any API call.5152### Step 2: De-identify Patient Context53Map exact ages to ranges (infant/child/adolescent/young-adult/adult/middle-aged/elderly). Map specific conditions to categories (cardiovascular, metabolic, respiratory). Map medications to drug classes.5455### Step 3: Encrypt Cached Data56Use AES-256-GCM encryption for all cached OpenEvidence responses. Store IV + AuthTag + ciphertext. Implement `EncryptedCacheStore` wrapping Redis.5758### Step 4: Configure Retention Policies59- Audit logs: 2190 days (6 years, HIPAA minimum), archive after 1 year60- Query cache: 1 day maximum61- DeepConsult reports: 365 days, archive after 90 days62- Error logs: 90 days (no PHI)6364### Step 5: Build Audit Trail65Log all PHI access with userId, userRole, action, resourceId, encrypted IP and userAgent. Support filtered queries with pagination for compliance review.6667## Output68- PHI detection and auto-sanitization69- Patient context de-identification (age ranges, condition categories, drug classes)70- AES-256-GCM encrypted cache store71- HIPAA-compliant retention policies with archival72- Comprehensive audit trail with encryption7374## Error Handling75| Data Issue | Detection | Resolution |76|------------|-----------|------------|77| PHI detected in query | Pattern matching | Auto-sanitize and warn |78| Decryption failure | Cache read error | Delete corrupted entry, re-query |79| Retention job fails | Cron monitoring | Check database permissions, re-run |80| Audit gap | Compliance review | Add middleware to missing routes |8182## Examples8384### 18 HIPAA Identifiers (Never Send)85Names, geographic data, dates, phone/fax, email, SSN, MRN, health plan numbers, account numbers, certificate/license numbers, vehicle/device identifiers, URLs, IPs, biometrics, photos, other unique characteristics.8687### Data Flow88```89User Query -> PHI Detection -> De-identification -> OpenEvidence API90 | |91 Audit Log (encrypted) Encrypted Cache92```9394See [detailed implementation](${CLAUDE_SKILL_DIR}/references/implementation.md) for advanced patterns.9596## Resources97- [HIPAA Privacy Rule](https://www.hhs.gov/hipaa/for-professionals/privacy/index.html)98- [HIPAA Security Rule](https://www.hhs.gov/hipaa/for-professionals/security/index.html)99- [OpenEvidence Security](https://www.openevidence.com/security)