Skip to main content

HIPAA Fundamentals

The Health Insurance Portability and Accountability Act (HIPAA) is the cornerstone of healthcare data protection in the United States. Understanding its requirements is essential before building any healthcare application.
Learning Objectives:
  • Identify the 18 HIPAA identifiers
  • Understand covered entities and business associates
  • Know the Privacy Rule vs Security Rule
  • Understand breach notification requirements

What is HIPAA?

HIPAA was enacted in 1996 and has been updated multiple times, most significantly with the HITECH Act in 2009. It establishes national standards for:
HIPAA Framework showing Privacy Rule, Security Rule, and Breach Notification Rule

HIPAA Framework - The Three Core Rules


Protected Health Information (PHI)

PHI is any information about health status, provision of health care, or payment for health care that can be linked to an individual.
Visual representation of the 18 HIPAA identifiers that create PHI

The 18 HIPAA PHI Identifiers

The 18 HIPAA Identifiers

When any of these identifiers is associated with health information, it becomes PHI:
#IdentifierExamples
1NamesFull name, maiden name, alias
2Geographic dataStreet address, city (smaller than state)
3DatesBirth date, admission date, discharge date, death date
4Phone numbersHome, mobile, work
5Fax numbersAny fax number
6Email addressesPersonal or work email
7Social Security numbersSSN
8Medical record numbersMRN
9Health plan beneficiary numbersInsurance ID
10Account numbersPatient account numbers

PHI vs PII vs ePHI

# Understanding the differences

class DataClassification:
    """
    PII (Personally Identifiable Information):
    - Any data that can identify an individual
    - Regulated by various laws (GDPR, CCPA, etc.)
    
    PHI (Protected Health Information):
    - PII + Health Information
    - Regulated by HIPAA
    
    ePHI (Electronic PHI):
    - PHI in electronic form
    - Subject to HIPAA Security Rule
    """
    
    @staticmethod
    def is_phi(data: dict) -> bool:
        """Check if data contains PHI"""
        has_health_info = any([
            'diagnosis' in data,
            'treatment' in data,
            'prescription' in data,
            'medical_record' in data,
            'lab_results' in data,
        ])
        
        has_identifier = any([
            'name' in data,
            'ssn' in data,
            'email' in data,
            'phone' in data,
            'address' in data,
            'dob' in data,
            'mrn' in data,
        ])
        
        return has_health_info and has_identifier

# Examples
patient_record = {
    "name": "John Smith",           # Identifier
    "dob": "1985-03-15",            # Identifier  
    "diagnosis": "Hypertension",     # Health info
    "prescription": "Lisinopril"     # Health info
}
# This is PHI ✅

anonymous_stats = {
    "age_range": "40-50",
    "condition": "Diabetes",
    "region": "Northeast"
}
# This is NOT PHI (de-identified) ✅
Data classification diagram showing relationship between PII, PHI, and ePHI

Data Classification: PII vs PHI vs ePHI


Covered Entities & Business Associates

HIPAA Covered Entities and Business Associates relationship diagram

Covered Entities and Business Associates

Who Must Comply with HIPAA?

Covered entities and their business associates are directly subject to HIPAA regulations:

Business Associate Agreement (BAA)

If you’re building healthcare software, you’ll need a BAA with covered entities:
# Key elements of a Business Associate Agreement

class BusinessAssociateAgreement:
    """
    Required contractual elements between 
    Covered Entity and Business Associate
    """
    
    required_provisions = [
        "Permitted uses and disclosures of PHI",
        "Prohibition on unauthorized use/disclosure",
        "Implementation of appropriate safeguards",
        "Reporting of security incidents and breaches",
        "Ensuring subcontractors agree to same restrictions",
        "Access to PHI for individual rights requests",
        "Amendment of PHI when requested",
        "Accounting of disclosures",
        "Compliance with Security Rule requirements",
        "Return or destruction of PHI at termination",
    ]
    
    # Cloud Provider BAAs
    cloud_baa_support = {
        "AWS": "Available via AWS Artifact",
        "GCP": "Available via Cloud Console",
        "Azure": "Available via Trust Center",
        "Heroku": "Available with Shield plans",
        "MongoDB Atlas": "Available with dedicated plans",
    }
Critical: Never handle PHI without a signed BAA in place! This includes:
  • Development and testing with real PHI
  • Storing PHI in cloud services
  • Using third-party analytics on PHI

The Privacy Rule

The Privacy Rule establishes standards for protecting PHI and gives patients rights over their health information.

Key Privacy Principles

Minimum Necessary

Only use or disclose the minimum amount of PHI necessary to accomplish the intended purpose.

Notice of Privacy Practices

Patients must receive notice of how their PHI may be used and their rights.

Patient Rights

Patients can access, amend, and receive an accounting of disclosures of their PHI.

Authorization

Most uses beyond treatment, payment, and operations require patient authorization.

Permitted Uses Without Authorization

# PHI can be used/disclosed without authorization for:

class PermittedDisclosures:
    """Uses that don't require patient authorization"""
    
    WITHOUT_AUTHORIZATION = [
        # Treatment, Payment, Healthcare Operations (TPO)
        "treatment",           # Providing care
        "payment",             # Billing, claims
        "healthcare_ops",      # Quality assessment, training
        
        # Required by law
        "legal_requirement",   # Court orders, subpoenas
        "public_health",       # Disease reporting
        "abuse_reporting",     # Child/elder abuse
        "health_oversight",    # Audits, investigations
        
        # Special circumstances
        "research",            # With IRB approval + limited data
        "organ_donation",      # Organ procurement
        "coroners",            # Death investigations
        "national_security",   # Intelligence activities
    ]
    
    REQUIRES_AUTHORIZATION = [
        "marketing",           # Marketing communications
        "sale_of_phi",         # Selling PHI
        "psychotherapy_notes", # Mental health notes
        "third_party_apps",    # Patient-authorized apps
    ]

Patient Rights

┌─────────────────────────────────────────────────────────────────────────────┐
│                       PATIENT RIGHTS UNDER HIPAA                             │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                              │
│  RIGHT TO ACCESS                        RIGHT TO AMEND                      │
│  ───────────────                        ──────────────                      │
│  • Request copies of PHI                • Request corrections               │
│  • Electronic format if requested       • Response within 60 days           │
│  • Response within 30 days              • Denial must be explained          │
│  • Reasonable fee allowed               • Amendment attached if denied      │
│                                                                              │
│  RIGHT TO ACCOUNTING                    RIGHT TO RESTRICT                   │
│  ──────────────────                     ─────────────────                   │
│  • List of disclosures                  • Request limits on use             │
│  • Last 6 years                         • Not required to agree             │
│  • Excludes TPO disclosures             • Must agree if patient pays        │
│                                           out-of-pocket in full             │
│                                                                              │
│  RIGHT TO CONFIDENTIAL                  RIGHT TO COMPLAIN                   │
│  COMMUNICATIONS                         ─────────────────                   │
│  ─────────────────                      • File with covered entity          │
│  • Alternative contact methods          • File with HHS OCR                 │
│  • Must accommodate reasonable          • No retaliation allowed            │
│    requests                                                                 │
│                                                                              │
└─────────────────────────────────────────────────────────────────────────────┘
Six patient rights under HIPAA Privacy Rule

Patient Rights Under HIPAA


The Security Rule

The Security Rule specifies safeguards to protect ePHI. It requires three types of safeguards:
Administrative, Physical, and Technical safeguards for ePHI

HIPAA Security Safeguards - Three Pillars

Administrative Safeguards

# Administrative safeguards implementation checklist

class AdministrativeSafeguards:
    """
    Policies, procedures, and actions to manage 
    security measures and workforce conduct
    """
    
    requirements = {
        "security_management": {
            "risk_analysis": "Identify PHI risks",
            "risk_management": "Implement security measures",
            "sanction_policy": "Consequences for violations",
            "information_system_review": "Regular audits",
        },
        
        "workforce_security": {
            "authorization": "Role-based access",
            "clearance": "Background checks",
            "termination": "Revoke access on departure",
        },
        
        "information_access": {
            "access_authorization": "Who grants access",
            "access_establishment": "How access is granted",
            "access_modification": "How access is changed",
        },
        
        "security_awareness": {
            "security_reminders": "Regular training",
            "malware_protection": "Security software",
            "login_monitoring": "Track failed logins",
            "password_management": "Strong password policies",
        },
        
        "contingency_plan": {
            "data_backup": "Regular backups",
            "disaster_recovery": "Recovery procedures",
            "emergency_mode": "Emergency operations",
            "testing": "Regular testing",
            "criticality_analysis": "Priority systems",
        },
    }

Physical Safeguards

class PhysicalSafeguards:
    """
    Physical measures to protect electronic systems 
    and buildings housing ePHI
    """
    
    requirements = {
        "facility_access": {
            "contingency_operations": "Emergency access procedures",
            "facility_security_plan": "Physical security measures",
            "access_control": "Badge systems, locks",
            "maintenance_records": "Log repairs and modifications",
        },
        
        "workstation_use": {
            "policies": "Appropriate workstation use",
            "location": "Screen positioning, secure areas",
        },
        
        "workstation_security": {
            "physical_access": "Restrict workstation access",
            "automatic_logoff": "Screen locks",
        },
        
        "device_controls": {
            "disposal": "Secure destruction of media",
            "media_reuse": "Sanitize before reuse",
            "accountability": "Track device movement",
            "backup_storage": "Secure backup locations",
        },
    }

Technical Safeguards

class TechnicalSafeguards:
    """
    Technology and policies for electronic PHI access control
    """
    
    requirements = {
        "access_control": {
            "unique_user_id": "Individual user accounts",
            "emergency_access": "Break-glass procedures",
            "automatic_logoff": "Session timeouts",
            "encryption": "Encrypt ePHI at rest",
        },
        
        "audit_controls": {
            "logging": "Record PHI access",
            "log_analysis": "Review audit logs",
            "log_protection": "Tamper-proof logs",
        },
        
        "integrity": {
            "authentication": "Verify PHI not altered",
            "checksums": "Data integrity verification",
        },
        
        "transmission_security": {
            "integrity_controls": "Verify transmission integrity",
            "encryption": "Encrypt PHI in transit",
        },
        
        "authentication": {
            "person_or_entity": "Verify identity of users",
            "mfa": "Multi-factor authentication",
        },
    }

# Implementation example
class HIPAACompliantSystem:
    """Example implementation of technical safeguards"""
    
    def __init__(self):
        self.session_timeout = 900  # 15 minutes
        self.password_min_length = 12
        self.mfa_required = True
        self.encryption_algorithm = "AES-256-GCM"
        self.tls_version = "1.3"
        
    def access_control(self, user, resource):
        """Implement access control requirements"""
        if not self.verify_user_identity(user):
            self.log_failed_access(user, resource)
            raise AuthenticationError("Identity not verified")
            
        if not self.check_authorization(user, resource):
            self.log_unauthorized_access(user, resource)
            raise AuthorizationError("Access denied")
            
        self.log_access(user, resource)
        return self.decrypt_and_return(resource)

Breach Notification Rule

When a breach occurs, specific notification requirements apply:

What Constitutes a Breach?

class BreachAssessment:
    """
    A breach is unauthorized acquisition, access, use, or 
    disclosure of PHI that compromises its security or privacy
    """
    
    # Exceptions (NOT a breach)
    exceptions = [
        "unintentional_internal",  # Workforce member acting in good faith
        "inadvertent_disclosure",  # Internal disclosure, not further used
        "good_faith_belief",       # Unauthorized person couldn't retain data
    ]
    
    # Risk assessment factors
    def assess_breach(self, incident: dict) -> dict:
        """Perform 4-factor risk assessment"""
        
        return {
            "nature_of_phi": self._assess_phi_type(incident),
            "unauthorized_recipient": self._assess_recipient(incident),
            "phi_actually_acquired": self._assess_acquisition(incident),
            "risk_mitigated": self._assess_mitigation(incident),
        }
    
    def _assess_phi_type(self, incident):
        """What types of identifiers and health info were involved?"""
        high_risk_elements = [
            "ssn", "financial_info", "sensitive_diagnoses",
            "mental_health", "hiv_status", "substance_abuse"
        ]
        # More sensitive = higher risk
        
    def _assess_recipient(self, incident):
        """Who received the PHI?"""
        # Healthcare provider = lower risk
        # Unknown party = higher risk
        
    def _assess_acquisition(self, incident):
        """Was PHI actually viewed or just transmitted?"""
        # Encrypted and key not compromised = lower risk
        # Actually viewed = higher risk
        
    def _assess_mitigation(self, incident):
        """What steps were taken to mitigate harm?"""
        # PHI recovered and destroyed = lower risk

Notification Requirements

HIPAA breach notification timeline and requirements

Breach Notification Timeline

Key timelines and requirements vary by the scale of the breach.

Notification Content

class BreachNotification:
    """Required content for breach notifications"""
    
    required_content = [
        "description_of_breach",         # What happened
        "types_of_phi_involved",         # What info was exposed
        "steps_individuals_should_take", # Self-protection steps
        "what_entity_is_doing",          # Mitigation efforts
        "contact_procedures",            # How to get more info
    ]
    
    def generate_notification(self, breach: dict) -> str:
        """Generate compliant breach notification"""
        
        template = """
        NOTICE OF DATA BREACH
        
        Date of Notice: {date}
        
        What Happened:
        {description}
        
        What Information Was Involved:
        {phi_types}
        
        What We Are Doing:
        {mitigation_steps}
        
        What You Can Do:
        {protective_steps}
        
        For More Information:
        {contact_info}
        """
        
        return template.format(**breach)

Penalties and Enforcement

HIPAA violations can result in both civil and criminal penalties.
HIPAA violation tiers and penalty ranges

HIPAA Penalty Structure

Civil Penalties

TierViolation TypePenalty per ViolationAnnual Maximum
1Did not know100100 - 50,000$25,000
2Reasonable cause1,0001,000 - 50,000$100,000
3Willful neglect (corrected)10,00010,000 - 50,000$250,000
4Willful neglect (not corrected)$50,000+$1,500,000

Criminal Penalties

TierViolation TypeMaximum Penalty
1Knowingly obtaining/disclosing PHIUp to $50,000 + 1 year prison
2Under false pretensesUp to $100,000 + 5 years prison
3For personal gain or harmUp to $250,000 + 10 years prison

Notable HIPAA Settlements

# Real HIPAA enforcement examples

major_settlements = [
    {
        "entity": "Anthem Inc.",
        "year": 2018,
        "amount": 16_000_000,
        "violation": "Data breach affecting 79M individuals",
        "lesson": "Risk analysis and access controls",
    },
    {
        "entity": "Premera Blue Cross",
        "year": 2020,
        "amount": 6_850_000,
        "violation": "Breach affecting 10.4M individuals",
        "lesson": "Timely risk assessment updates",
    },
    {
        "entity": "Advocate Medical Group",
        "year": 2016,
        "amount": 5_550_000,
        "violation": "Unencrypted laptops stolen",
        "lesson": "Encrypt all portable devices",
    },
    {
        "entity": "Memorial Healthcare System",
        "year": 2017,
        "amount": 5_500_000,
        "violation": "Employees accessed PHI without authorization",
        "lesson": "Audit controls and access monitoring",
    },
]

De-identification

De-identified data is not PHI and not subject to HIPAA. There are two methods:

Expert Determination

A qualified expert determines that the risk of re-identification is very small.

Safe Harbor Method

Remove all 18 identifiers and have no actual knowledge that remaining information could identify an individual.
class DeIdentification:
    """HIPAA Safe Harbor de-identification"""
    
    identifiers_to_remove = [
        "names",
        "geographic_subdivisions_smaller_than_state",
        "dates_except_year",  # if over 89, use 90+
        "phone_numbers",
        "fax_numbers",
        "email_addresses",
        "ssn",
        "medical_record_numbers",
        "health_plan_beneficiary_numbers",
        "account_numbers",
        "certificate_license_numbers",
        "vehicle_identifiers",
        "device_identifiers",
        "urls",
        "ip_addresses",
        "biometric_identifiers",
        "full_face_photos",
        "other_unique_identifiers",
    ]
    
    def safe_harbor_deidentify(self, record: dict) -> dict:
        """Remove all 18 identifiers"""
        deidentified = record.copy()
        
        for identifier in self.identifiers_to_remove:
            if identifier in deidentified:
                del deidentified[identifier]
        
        # Handle dates - keep only year
        if "date_of_birth" in deidentified:
            year = deidentified["date_of_birth"].year
            if year < 1935:  # Over 89 years old
                deidentified["age_group"] = "90+"
            else:
                deidentified["birth_year"] = year
            del deidentified["date_of_birth"]
        
        # Handle geographic data - keep only state
        if "address" in deidentified:
            deidentified["state"] = deidentified["address"].get("state")
            del deidentified["address"]
            
        return deidentified

Key Takeaways

Know Your Data

Identify all PHI in your systems and document data flows

Sign BAAs

Never handle PHI without appropriate agreements in place

Implement Safeguards

Administrative, physical, and technical controls are all required

Plan for Breaches

Have an incident response plan before you need it

Practice Exercise

1

Identify PHI

Review a sample patient record and identify all 18 HIPAA identifiers present.
2

Classify Data

Categorize the data as PHI, PII, or non-sensitive.
3

De-identify

Apply Safe Harbor method to de-identify the record.
4

Document Controls

List the administrative, physical, and technical safeguards your system needs.

Next Steps