ESC
Type to search guides, tutorials, and reference documentation.
Verified by Garnet Grid

HIPAA Engineering Controls

Implement HIPAA technical safeguards for electronic protected health information. Covers access controls, audit logging, encryption at rest and in transit, data backup, integrity controls, and the patterns that make healthcare software HIPAA-compliant.

HIPAA (Health Insurance Portability and Accountability Act) applies to covered entities and business associates that handle electronic Protected Health Information (ePHI). Violations carry fines up to $1.5 million per category per year, plus potential criminal penalties. Engineering teams must implement the Technical Safeguard standards specified in the Security Rule.


HIPAA Technical Safeguards

Access Control (§164.312(a)):
  Required:
  ☐ Unique user identification (no shared accounts)
  ☐ Emergency access procedure
  ☐ Automatic logoff after inactivity
  ☐ Encryption and decryption of ePHI

Audit Controls (§164.312(b)):
  Required:
  ☐ Record and examine access to ePHI
  ☐ Hardware, software, and procedural mechanisms
  ☐ Audit logs retained for 6 years minimum

Integrity (§164.312(c)):
  Required:
  ☐ Mechanism to authenticate ePHI
  ☐ Protect ePHI from improper alteration or destruction
  ☐ Electronic signatures where applicable

Person/Entity Authentication (§164.312(d)):
  Required:
  ☐ Verify identity of person/entity seeking access
  ☐ Multi-factor authentication recommended

Transmission Security (§164.312(e)):
  Required:
  ☐ Protect ePHI during transmission
  ☐ Encryption of ePHI in transit (TLS 1.2+)
  ☐ Integrity controls during transmission

Implementation

class HIPAACompliantService:
    """Service that handles ePHI with required safeguards."""
    
    def __init__(self):
        self.audit_logger = AuditLogger()
        self.encryptor = FieldLevelEncryption(key_from_kms=True)
    
    # Access Control: Every access to ePHI is authenticated + authorized
    def get_patient_record(self, user: AuthenticatedUser, patient_id: str):
        # Verify user has role-based access
        if not user.has_permission("patient:read"):
            self.audit_logger.log_access_denied(user, patient_id, "patient:read")
            raise AccessDenied("Insufficient permissions for ePHI access")
        
        # Verify user has need-to-know for this patient
        if not self.is_care_team_member(user.id, patient_id):
            self.audit_logger.log_access_denied(user, patient_id, "care_team_check")
            raise AccessDenied("Not a member of patient's care team")
        
        # Fetch and decrypt ePHI
        encrypted_record = self.db.get_patient(patient_id)
        record = self.encryptor.decrypt_fields(encrypted_record, [
            "ssn", "diagnosis", "medications", "notes",
        ])
        
        # Audit log: WHO accessed WHAT and WHEN
        self.audit_logger.log_access(
            who=user.id,
            what=f"patient_record:{patient_id}",
            when=datetime.utcnow(),
            action="READ",
            fields_accessed=["demographics", "diagnosis", "medications"],
            source_ip=user.ip_address,
        )
        
        return record
    
    # Encryption at Rest: Field-level encryption for ePHI
    def store_patient_record(self, user: AuthenticatedUser, record: dict):
        # Encrypt sensitive fields before storage
        encrypted = self.encryptor.encrypt_fields(record, [
            "ssn", "diagnosis", "medications", "notes",
        ])
        
        # Store with integrity hash
        encrypted["integrity_hash"] = self.compute_integrity_hash(encrypted)
        
        self.db.save_patient(encrypted)
        
        self.audit_logger.log_access(
            who=user.id,
            what=f"patient_record:{record['patient_id']}",
            action="WRITE",
        )

Audit Log Requirements

class HIPAAAuditLogger:
    """Immutable audit trail for all ePHI access."""
    
    def log_access(self, who, what, action, **kwargs):
        entry = {
            "timestamp": datetime.utcnow().isoformat(),
            "user_id": who,
            "resource": what,
            "action": action,  # READ, WRITE, DELETE, EXPORT
            "source_ip": kwargs.get("source_ip"),
            "user_agent": kwargs.get("user_agent"),
            "fields_accessed": kwargs.get("fields_accessed", []),
            "outcome": kwargs.get("outcome", "SUCCESS"),
        }
        
        # Write-once storage (cannot be modified or deleted)
        self.immutable_store.append(entry)
        
        # Retention: HIPAA requires 6 years minimum
        # Do NOT set TTL on audit logs

Anti-Patterns

Anti-PatternConsequenceFix
Shared service accountsCannot audit individual accessUnique user IDs for every person
ePHI in application logsLogs become ePHI storage (must protect)Strip ePHI from all logs
No encryption at restBreach = immediate HIPAA violationAES-256 at minimum, field-level preferred
Audit logs modifiableCannot prove complianceAppend-only, immutable audit storage
No BAA with cloud providerUsing cloud without BAA = violationBAA required before storing ePHI

HIPAA compliance is binary — you are either compliant or you are not. There is no “mostly HIPAA-compliant.” Every ePHI touch point must have access controls, encryption, and audit logging.

Jakub Dimitri Rezayev
Jakub Dimitri Rezayev
Founder & Chief Architect • Garnet Grid Consulting

Jakub holds an M.S. in Customer Intelligence & Analytics and a B.S. in Finance & Computer Science from Pace University. With deep expertise spanning D365 F&O, Azure, Power BI, and AI/ML systems, he architects enterprise solutions that bridge legacy systems and modern technology — and has led multi-million dollar ERP implementations for Fortune 500 supply chains.

View Full Profile →