Dev.to Security ๐Ÿ” Cybersecurity ๐Ÿ‘ 1 ๐Ÿ“– 17 min read

n8n for HealthTech & Digital Health SaaS Vendors: 5 Automations for ONC 21st Century Cures, HIPAA, HL7 FHIR R4, and FDA SaMD Compliance

If you run a HealthTech or Digital Health SaaS company, your automation layer is not just an ops tool. It is part of your compliance perimeter. ONC 21st Century Cures Act ยง170.315(g)(10) requires certified EHR technolog

If you run a HealthTech or Digital Health SaaS company, your automation layer is not just an ops tool. It is part of your compliance perimeter.

ONC 21st Century Cures Act ยง170.315(g)(10) requires certified EHR technology to expose a live HL7 FHIR R4 API. HIPAA ยง164.312 mandates audit controls on every system that touches PHI. FDA 21 CFR ยง806.10(b) gives you 10 working days to file a SaMD correction/removal report once you discover a Class II issue. The CMS Interoperability Rule requires payer-to-payer FHIR data exchange within one business day of a patient request.

Routing these workflows through a cloud iPaaS like Zapier or Make creates a PHI egress problem, a BAA scope expansion, a SOC 2 CC9.2 vendor risk assessment obligation, and โ€” in the case of ONC information blocking โ€” a potential $1M/day civil penalty exposure for any third party that could delay a patient's access to their own data.

Self-hosted n8n solves all five. Here are the five workflows every HealthTech SaaS vendor should have running.

The compliance stack for HealthTech SaaS vendors

Regulation Fastest Clock Penalty Exposure
FDA SaMD 21 CFR ยง806.10(b) 48h (10 working days) โ€” Class II correction/removal report Warning letter, recall, $15k/day civil penalty
ONC Information Blocking 45 CFR ยง171.300 Immediate โ€” complaint filed with OIG $1M/day civil monetary penalty per occurrence
CMS Interoperability Rule CMS-9115-F 1 business day โ€” payer-to-payer data exchange CMS enforcement action, public reporting
HIPAA Breach Notification 45 CFR ยง164.408 60 days โ€” HHS + media notification (500+ individuals) OCR investigation, $100โ€“$50k per violation, Wall of Shame
FDA MDR ยง803.50 30 days โ€” adverse event from SaMD malfunction FDA warning letter, import alert
ONC FHIR R4 uptime SLA ยง170.315(g)(10) 4h extended downtime โ€” may constitute information blocking OIG investigation
DEA Telemedicine ยง1306.03 5 business days โ€” controlled substance records production DEA prescribing suspension

Workflow 1: HealthTech SaaS Customer Onboarding Drip

What it does: Tier-segmented 7-day onboarding sequence. Injects the customer's ONC/HIPAA/FDA compliance clocks into Day 0 email. Day 3 focuses on FHIR API health monitor setup. Day 7 runs the HIPAA breach response drill.

The tiers covered:

  • ENTERPRISE_EHR_VENDOR
  • DIGITAL_HEALTH_PLATFORM_VENDOR
  • TELEHEALTH_SAAS_VENDOR
  • HEALTH_DATA_ANALYTICS_SAAS
  • REMOTE_PATIENT_MONITORING_VENDOR
  • MEDICAL_DEVICE_SOFTWARE_VENDOR
  • HEALTH_INSURANCE_INTEROPERABILITY_SAAS

The compliance flags injected:

  • ONC_21ST_CENTURY_CURES_CERTIFIED
  • HIPAA_COVERED_ENTITY_OR_BA
  • FDA_SAMD_CLASS_II_CLEARED
  • CMS_INTEROPERABILITY_RULE_APPLICABLE
  • HL7_FHIR_R4_API_REQUIRED
  • DEA_TELEMEDICINE_APPLICABLE
  • SOC2_REQUIRED
{
  "name": "HealthTech SaaS Customer Onboarding Drip",
  "nodes": [
    {
      "id": "trigger-1",
      "name": "New Customer Trigger",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "parameters": {
        "documentId": "your-crm-sheet-id",
        "sheetName": "NewCustomers",
        "event": "rowAdded"
      }
    },
    {
      "id": "flags-1",
      "name": "Inject Compliance Flags",
      "type": "n8n-nodes-base.code",
      "parameters": {
        "jsCode": "\nconst d = $input.first().json;\nconst tier = d.customer_tier || 'DIGITAL_HEALTH_PLATFORM_VENDOR';\nconst flags = (d.compliance_flags || '').split(',').map(f => f.trim()).filter(Boolean);\nconst clockMap = {\n  ONC_21ST_CENTURY_CURES_CERTIFIED: 'ONC 21st Century Cures Act 45 CFR \u00a7170.315(g)(10) \u2014 certified EHR technology must provide HL7 FHIR R4 API access; information blocking prohibition 45 CFR \u00a7171.300 carries $1M/day civil penalties per occurrence',\n  HIPAA_COVERED_ENTITY_OR_BA: 'HIPAA Breach Notification Rule 45 CFR \u00a7164.408 \u2014 breaches affecting 500+ individuals require HHS notification within 60 days of discovery; media notice required for breaches affecting 500+ in a state',\n  FDA_SAMD_CLASS_II_CLEARED: 'FDA SaMD 21 CFR \u00a7806.10(b) \u2014 Class II device correction or removal report required within 10 working days (48h effective clock); \u00a7803.50 MDR for adverse events within 30 calendar days',\n  CMS_INTEROPERABILITY_RULE_APPLICABLE: 'CMS Interoperability and Patient Access Rule \u2014 payer-to-payer data exchange must be completed within 1 business day of patient request; API availability SLA enforced by CMS',\n  HL7_FHIR_R4_API_REQUIRED: 'ONC \u00a7170.315(g)(10) \u2014 FHIR R4 API must be available and documented; information blocking complaint investigation by OIG can result in civil monetary penalties up to $1M per day',\n  DEA_TELEMEDICINE_APPLICABLE: 'DEA Special Registration for Telemedicine \u2014 Schedule III-V controlled substance prescribing via telemedicine requires DEA registration per practice state; audit requests must be answered within 5 business days \u00a71306.03',\n  SOC2_REQUIRED: 'SOC 2 Type II \u2014 annual audit cycle (customer BAA and enterprise contract requirement; CC9.2 vendor risk management applies to all subprocessors including your automation layer)'\n};\nconst clocks = flags.map(f => clockMap[f] || f).join('\\n');\nreturn [{json: {tier, flags, clocks, customer_email: d.customer_email, company_name: d.company_name, ts: new Date().toISOString()}}];\n"
      }
    },
    {
      "id": "day0-1",
      "name": "Day 0 \u2014 Compliance Clocks Email",
      "type": "n8n-nodes-base.gmail",
      "parameters": {
        "operation": "send",
        "toList": "={{$json.customer_email}}",
        "subject": "Your ONC/HIPAA/FDA compliance clocks \u2014 day 0 activation",
        "message": "Welcome to {{$json.company_name}}. Your applicable compliance clocks:\\n\\n{{$json.clocks}}\\n\\nFastest clock in your stack: FDA SaMD Class II correction/removal report = 10 working days (48h operational window) under 21 CFR \u00a7806.10(b). Your n8n incident pipeline is pre-configured for this."
      }
    },
    {
      "id": "slack-1",
      "name": "Slack CSM Notification",
      "type": "n8n-nodes-base.slack",
      "parameters": {
        "channel": "#cs-new-accounts",
        "text": "New {{$json.tier}} customer: {{$json.company_name}} | Flags: {{$json.flags.join(', ')}}"
      }
    },
    {
      "id": "wait3-1",
      "name": "Wait 3 Days",
      "type": "n8n-nodes-base.wait",
      "parameters": {
        "amount": 3,
        "unit": "days"
      }
    },
    {
      "id": "day3-1",
      "name": "Day 3 \u2014 FHIR Integration Guide",
      "type": "n8n-nodes-base.gmail",
      "parameters": {
        "operation": "send",
        "toList": "={{$json.customer_email}}",
        "subject": "Day 3: Connecting your HL7 FHIR R4 API health monitor",
        "message": "Day 3 check-in. The ONC \u00a7170.315(g)(10) uptime requirement means your FHIR API must remain available. The API health monitor workflow fires every 3 minutes and deduplicates alerts using $getWorkflowStaticData \u2014 your on-call team gets one Slack alert per outage, not one per polling cycle. Here is how to configure the endpoint list for your FHIR server."
      }
    },
    {
      "id": "wait4-1",
      "name": "Wait 4 Days",
      "type": "n8n-nodes-base.wait",
      "parameters": {
        "amount": 4,
        "unit": "days"
      }
    },
    {
      "id": "day7-1",
      "name": "Day 7 \u2014 HIPAA Breach Response Drill",
      "type": "n8n-nodes-base.gmail",
      "parameters": {
        "operation": "send",
        "toList": "={{$json.customer_email}}",
        "subject": "Day 7: HIPAA breach response \u2014 60-day clock drill",
        "message": "Day 7: HIPAA \u00a7164.408 requires notification to HHS within 60 days of discovering a breach affecting 500+ individuals. Run the incident pipeline drill now: POST a test FDA_SAMD_CLASS_II_RECALL event to your incident webhook and confirm the Slack alert, CCed counsel email, and Sheets log entry all fire within 60 seconds. Your n8n instance timestamps every event so you can demonstrate the 60-day clock to OCR auditors."
      }
    }
  ],
  "connections": {
    "New Customer Trigger": {
      "main": [
        [
          {
            "node": "Inject Compliance Flags",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Inject Compliance Flags": {
      "main": [
        [
          {
            "node": "Day 0 \u2014 Compliance Clocks Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Day 0 \u2014 Compliance Clocks Email": {
      "main": [
        [
          {
            "node": "Slack CSM Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack CSM Notification": {
      "main": [
        [
          {
            "node": "Wait 3 Days",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 3 Days": {
      "main": [
        [
          {
            "node": "Day 3 \u2014 FHIR Integration Guide",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Day 3 \u2014 FHIR Integration Guide": {
      "main": [
        [
          {
            "node": "Wait 4 Days",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 4 Days": {
      "main": [
        [
          {
            "node": "Day 7 \u2014 HIPAA Breach Response Drill",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Workflow 2: HL7 FHIR & ONC API Health Monitor

What it does: Polls 5 HealthTech endpoints every 3 minutes. $getWorkflowStaticData deduplication ensures one Slack alert per 30-minute outage window, not one alert per polling cycle. Covers FHIR R4 API (ONC certification), HIPAA audit log API (ยง164.312(b)), CMS payer exchange API (Interoperability Rule), FDA Device History Record API (ยง820.184), and EHR integration API (ยง170.315(b)(1)).

The 5 endpoints monitored:

Endpoint Regulation Alert Threshold
fhir_r4_api ONC ยง170.315(g)(10) Non-200 โ†’ information blocking risk
hipaa_audit_log_api HIPAA ยง164.312(b) Downtime = PHI access without logging
cms_payer_exchange_api CMS Interoperability Rule Denial = next-day enforcement trigger
samd_device_history_api FDA ยง820.184 DHR Gap = FDA inspection finding
ehr_integration_api ONC ยง170.315(b)(1) CCD Downtime affects care coordination
{
  "name": "HL7 FHIR & ONC API Health Monitor",
  "nodes": [
    {
      "id": "cron-2",
      "name": "Every 3 Minutes",
      "type": "n8n-nodes-base.scheduleTrigger",
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes",
              "minutesInterval": 3
            }
          ]
        }
      }
    },
    {
      "id": "check-2",
      "name": "Check All HealthTech Endpoints",
      "type": "n8n-nodes-base.code",
      "parameters": {
        "jsCode": "\nconst endpoints = [\n  {name: 'fhir_r4_api', url: 'https://fhir.yourplatform.com/R4/metadata', regulation: 'ONC \u00a7170.315(g)(10) \u2014 FHIR R4 Capability Statement endpoint; downtime = potential information blocking violation'},\n  {name: 'hipaa_audit_log_api', url: 'https://audit.yourplatform.com/health', regulation: 'HIPAA \u00a7164.312(b) \u2014 audit controls must log all access to PHI; audit API downtime means PHI access without logging = HIPAA violation exposure'},\n  {name: 'cms_payer_exchange_api', url: 'https://payer.yourplatform.com/fhir/Patient/$everything', regulation: 'CMS Interoperability Rule \u2014 payer-to-payer FHIR exchange; patient data access denial = CMS enforcement action'},\n  {name: 'samd_device_history_api', url: 'https://dhr.yourplatform.com/health', regulation: 'FDA \u00a7820.184 Device History Record \u2014 SaMD device history must be accessible; API downtime = DHF gap for FDA inspection'},\n  {name: 'ehr_integration_api', url: 'https://ehr-int.yourplatform.com/health', regulation: 'ONC \u00a7170.315(b)(1) \u2014 CCD/CCDA transitions of care; integration downtime may affect care coordination obligations'}\n];\nreturn endpoints.map(e => ({json: e}));\n"
      }
    },
    {
      "id": "http-2",
      "name": "HTTP Health Check",
      "type": "n8n-nodes-base.httpRequest",
      "parameters": {
        "method": "GET",
        "url": "={{$json.url}}",
        "timeout": 10000,
        "continueOnFail": true
      }
    },
    {
      "id": "filter-2",
      "name": "Filter Unhealthy",
      "type": "n8n-nodes-base.code",
      "parameters": {
        "jsCode": "\nconst items = $input.all();\nconst unhealthy = items.filter(i => {\n  const statusCode = i.json.statusCode || i.json.status || 0;\n  return statusCode !== 200;\n});\nif (unhealthy.length === 0) return [];\nreturn unhealthy;\n"
      }
    },
    {
      "id": "dedup-2",
      "name": "Deduplicate Alerts",
      "type": "n8n-nodes-base.code",
      "parameters": {
        "jsCode": "\nconst state = $getWorkflowStaticData('global');\nif (!state.alertedEndpoints) state.alertedEndpoints = {};\nconst now = Date.now();\nconst results = [];\nfor (const item of $input.all()) {\n  const name = item.json.name;\n  const lastAlert = state.alertedEndpoints[name] || 0;\n  if (now - lastAlert > 30 * 60 * 1000) {\n    state.alertedEndpoints[name] = now;\n    results.push(item);\n  }\n}\nreturn results.length > 0 ? results : [{ json: { skip: true } }];\n"
      }
    },
    {
      "id": "slack-2",
      "name": "Alert Slack #platform-ops",
      "type": "n8n-nodes-base.slack",
      "parameters": {
        "channel": "#platform-ops",
        "text": "HEALTHTECH API DOWN: {{$json.name}} | {{$json.url}} | {{$json.regulation}} | Deduplicated \u2014 one alert per 30-minute outage window"
      }
    }
  ],
  "connections": {
    "Every 3 Minutes": {
      "main": [
        [
          {
            "node": "Check All HealthTech Endpoints",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check All HealthTech Endpoints": {
      "main": [
        [
          {
            "node": "HTTP Health Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Health Check": {
      "main": [
        [
          {
            "node": "Filter Unhealthy",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Unhealthy": {
      "main": [
        [
          {
            "node": "Deduplicate Alerts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Deduplicate Alerts": {
      "main": [
        [
          {
            "node": "Alert Slack #platform-ops",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Workflow 3: ONC / CMS / FDA / HIPAA Compliance Deadline Tracker

What it does: Runs weekdays at 8 AM, reads a Google Sheet of compliance deadlines, classifies each as OVERDUE / CRITICAL / URGENT / WARNING / NOTICE, posts to Slack #compliance-deadlines, and emails the deadline owner. Covers 12 deadline types.

The 12 deadline types tracked:

Deadline Window Regulation
FDA_SAMD_CLASS_II_RECALL_CORRECTION 10 working days 21 CFR ยง806.10(b) โ€” correction/removal report to FDA; this is the fastest mandatory reporting clock for HealthTech SaaS vendors
HIPAA_ANNUAL_RISK_ANALYSIS 360 days HIPAA Security Rule 45 CFR ยง164.308(a)(1)(ii)(A) โ€” annual risk analysis is the most commonly cited HIPAA deficiency in OCR investigations
ONC_21ST_CENTURY_CURES_FHIR_CERT Annual renewal ONC 45 CFR ยง170.315(g)(10) โ€” certified EHR technology must maintain active ONC certification; lapse = information blocking violation risk
CMS_PAYER_INTEROP_ATTESTATION Annual CMS deadline CMS Interoperability and Patient Access Rule CMS-9115-F โ€” annual payer attestation; non-attestation = potential CMS enforcement action
FDA_SAMD_MDR_ADVERSE_EVENT 30 calendar days FDA ยง803.50 MDR โ€” malfunction or injury reports must reach FDA within 30 days of becoming aware
HL7_FHIR_R4_CONFORMANCE_TESTING Annual ONC ยง170.315(g)(10) FHIR conformance โ€” annual Inferno test suite run required to maintain certified health IT status
ONC_INFORMATION_BLOCKING_COMPLAINT_RESPONSE 90 days 45 CFR ยง171.300 โ€” OIG information blocking complaint investigation; $1M/day civil penalty exposure; document all API access decisions
CMS_QUALITY_REPORTING_DEADLINE Annual CMS deadline CMS QPP/MIPS annual quality reporting; failure = payment adjustment for EHR vendors supporting eligible clinicians
DEA_TELEMEDICINE_REGISTRATION_RENEWAL Annual per-state DEA 21 USC ยง823 โ€” telemedicine special registration; lapse = prescribing suspension in affected states
SOC2_TYPE2_RENEWAL Annual SOC 2 Type II โ€” customer BAA and enterprise contract requirement
ANNUAL_PENTEST Annual HIPAA ยง164.308(a)(8) evaluation requirement; SOC 2 CC7.1
STATE_TELEHEALTH_LICENSE_RENEWAL Varies 60-90 days State telehealth practice acts vary; multi-state telehealth platforms must track per-state renewal windows
{
  "name": "ONC / CMS / FDA / HIPAA Compliance Deadline Tracker",
  "nodes": [
    {
      "id": "cron-3",
      "name": "Weekdays 8 AM",
      "type": "n8n-nodes-base.scheduleTrigger",
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 8 * * 1-5"
            }
          ]
        }
      }
    },
    {
      "id": "read-3",
      "name": "Read Deadline Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "parameters": {
        "operation": "read",
        "documentId": "your-compliance-deadlines-sheet",
        "sheetName": "Deadlines"
      }
    },
    {
      "id": "classify-3",
      "name": "Classify Urgency",
      "type": "n8n-nodes-base.code",
      "parameters": {
        "jsCode": "\nconst deadlines = $input.first().json.deadlines || [];\nconst today = new Date();\nconst results = [];\nfor (const d of deadlines) {\n  const due = new Date(d.due_date);\n  const daysLeft = Math.ceil((due - today) / (1000 * 60 * 60 * 24));\n  let urgency;\n  if (daysLeft < 0) urgency = 'OVERDUE';\n  else if (daysLeft <= 3) urgency = 'CRITICAL';\n  else if (daysLeft <= 7) urgency = 'URGENT';\n  else if (daysLeft <= 14) urgency = 'WARNING';\n  else if (daysLeft <= 30) urgency = 'NOTICE';\n  else continue;\n  results.push({...d, daysLeft, urgency});\n}\nreturn results.map(r => ({json: r}));\n"
      }
    },
    {
      "id": "slack-3",
      "name": "Slack #compliance-deadlines",
      "type": "n8n-nodes-base.slack",
      "parameters": {
        "channel": "#compliance-deadlines",
        "text": "{{$json.urgency}} | {{$json.deadline_type}} | Due: {{$json.due_date}} ({{$json.daysLeft}}d) | Owner: {{$json.owner}} | {{$json.regulation_note}}"
      }
    },
    {
      "id": "email-3",
      "name": "Email Deadline Owner",
      "type": "n8n-nodes-base.gmail",
      "parameters": {
        "operation": "send",
        "toList": "={{$json.owner_email}}",
        "subject": "{{$json.urgency}}: {{$json.deadline_type}} due in {{$json.daysLeft}} days",
        "message": "Compliance deadline approaching:\\n\\nType: {{$json.deadline_type}}\\nDue: {{$json.due_date}}\\nDays remaining: {{$json.daysLeft}}\\nUrgency: {{$json.urgency}}\\nRegulation: {{$json.regulation_note}}\\n\\nThis deadline is tracked in your n8n compliance workflow. Please confirm status in the Deadline Sheet."
      }
    }
  ],
  "connections": {
    "Weekdays 8 AM": {
      "main": [
        [
          {
            "node": "Read Deadline Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Deadline Sheet": {
      "main": [
        [
          {
            "node": "Classify Urgency",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Classify Urgency": {
      "main": [
        [
          {
            "node": "Slack #compliance-deadlines",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Email Deadline Owner",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Workflow 4: HealthTech Incident & FDA Recall Pipeline

What it does: Webhook-triggered incident pipeline. Classifies 8 HealthTech-specific incident types, assigns the correct regulatory clock, fires Slack alert, logs to Google Sheets, and emails CCO + Counsel. The FDA SaMD Class II recall clock starts the moment the webhook fires.

The 8 incident types handled:

Incident Type Clock Regulation
FDA_SAMD_CLASS_II_RECALL IMMEDIATE โ€” 48h operational window 21 CFR ยง806.10(b) โ€” correction/removal report must reach FDA within 10 working days; counsel CC required on first Slack alert
ONC_INFORMATION_BLOCKING_VIOLATION IMMEDIATE 45 CFR ยง171.300 โ€” OIG information blocking civil monetary penalty up to $1M/day per violation; legal hold triggered
HIPAA_PHI_BREACH_OVER_500 60d ยง164.408 HIPAA โ€” HHS notification + state media notification required within 60 days; HHS Wall of Shame public posting
HIPAA_PHI_BREACH_UNDER_500 60d ยง164.412 HIPAA โ€” annual log to HHS; breach log must be maintained for 6 years ยง164.530(j)
FDA_SAMD_MDR_ADVERSE_EVENT 30d ยง803.50 FDA MDR โ€” malfunction or injury involving SaMD must be reported within 30 calendar days of awareness
CMS_PAYER_DATA_ACCESS_DENIAL 1 business day CMS Interoperability Rule CMS-9115-F โ€” patient data access denial triggers next-day corrective action obligation
HL7_FHIR_API_EXTENDED_DOWNTIME 4h ONC uptime SLA ONC ยง170.315(g)(10) โ€” extended FHIR API downtime may constitute information blocking; document outage timeline immediately
DEA_TELEMEDICINE_AUDIT_REQUEST 5 business days ยง1306.03 DEA โ€” controlled substance prescribing records for telemedicine encounters must be produced within 5 business days of DEA request
{
  "name": "HealthTech Incident & FDA Recall Pipeline",
  "nodes": [
    {
      "id": "webhook-4",
      "name": "Incident Webhook",
      "type": "n8n-nodes-base.webhook",
      "parameters": {
        "path": "healthtech-incident",
        "httpMethod": "POST",
        "responseMode": "onReceived",
        "responseData": "allEntries"
      }
    },
    {
      "id": "classify-4",
      "name": "Classify & Assign Clock",
      "type": "n8n-nodes-base.code",
      "parameters": {
        "jsCode": "\nconst incident = $input.first().json;\nconst type = incident.incident_type || 'UNKNOWN';\nconst urgencyMap = {\n  FDA_SAMD_CLASS_II_RECALL: {level: 'CRITICAL', clock: 'IMMEDIATE \u2014 48h operational window, 10 working days to FDA', action: 'notify_cco_cto_counsel_fda_immediately'},\n  ONC_INFORMATION_BLOCKING_VIOLATION: {level: 'CRITICAL', clock: 'IMMEDIATE \u2014 OIG complaint filed; $1M/day civil penalty exposure', action: 'notify_general_counsel_immediately'},\n  HIPAA_PHI_BREACH_OVER_500: {level: 'CRITICAL', clock: '60-day clock \u00a7164.408 starts NOW \u2014 HHS + media notification required', action: 'notify_privacy_officer_ciso_counsel'},\n  HIPAA_PHI_BREACH_UNDER_500: {level: 'HIGH', clock: '60-day clock \u00a7164.412 \u2014 annual log to HHS', action: 'notify_privacy_officer_ciso'},\n  FDA_SAMD_MDR_ADVERSE_EVENT: {level: 'HIGH', clock: '30-day clock \u00a7803.50 \u2014 MDR to FDA', action: 'notify_vp_regulatory_cto'},\n  CMS_PAYER_DATA_ACCESS_DENIAL: {level: 'HIGH', clock: '1 business day corrective action', action: 'notify_cco_compliance'},\n  HL7_FHIR_API_EXTENDED_DOWNTIME: {level: 'HIGH', clock: '4h ONC uptime SLA \u2014 document start time now', action: 'notify_engineering_cto'},\n  DEA_TELEMEDICINE_AUDIT_REQUEST: {level: 'HIGH', clock: '5 business days to produce records \u00a71306.03', action: 'notify_compliance_legal'},\n};\nconst meta = urgencyMap[type] || {level: 'MEDIUM', clock: 'standard review', action: 'notify_compliance_team'};\nreturn [{json: {...incident, ...meta, logged_at: new Date().toISOString()}}];\n"
      }
    },
    {
      "id": "slack-4",
      "name": "Slack #healthtech-incidents",
      "type": "n8n-nodes-base.slack",
      "parameters": {
        "channel": "#healthtech-incidents",
        "text": "{{$json.level}} HEALTHTECH INCIDENT | Type: {{$json.incident_type}} | Clock: {{$json.clock}} | Action: {{$json.action}} | Logged: {{$json.logged_at}}"
      }
    },
    {
      "id": "sheets-4",
      "name": "Log to Incident Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "parameters": {
        "operation": "appendOrUpdate",
        "documentId": "your-incident-log-sheet",
        "sheetName": "Incidents",
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "incident_type": "={{$json.incident_type}}",
            "level": "={{$json.level}}",
            "clock": "={{$json.clock}}",
            "action": "={{$json.action}}",
            "logged_at": "={{$json.logged_at}}"
          }
        }
      }
    },
    {
      "id": "email-4",
      "name": "Email CCO + Counsel",
      "type": "n8n-nodes-base.gmail",
      "parameters": {
        "operation": "send",
        "toList": "[email protected]",
        "ccList": "[email protected]",
        "subject": "{{$json.level}} INCIDENT: {{$json.incident_type}} \u2014 {{$json.clock}}",
        "message": "A {{$json.level}} compliance incident has been logged.\\n\\nType: {{$json.incident_type}}\\nClock: {{$json.clock}}\\nRequired action: {{$json.action}}\\nLogged at: {{$json.logged_at}}\\n\\nAll details logged to the compliance incident sheet. Review immediately."
      }
    }
  ],
  "connections": {
    "Incident Webhook": {
      "main": [
        [
          {
            "node": "Classify & Assign Clock",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Classify & Assign Clock": {
      "main": [
        [
          {
            "node": "Slack #healthtech-incidents",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack #healthtech-incidents": {
      "main": [
        [
          {
            "node": "Log to Incident Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log to Incident Sheet": {
      "main": [
        [
          {
            "node": "Email CCO + Counsel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Workflow 5: Weekly HealthTech KPI Dashboard

What it does: Monday 8 AM Postgres query across platform metrics. Computes WoW % change using $getWorkflowStaticData for state persistence. Emails CEO + CTO (BCC CIO) with patient counts, MRR, FHIR API call volume, open FDA SaMD incidents, open OBC complaints, open HIPAA breaches, and average compliance score.

{
  "name": "Weekly HealthTech KPI Dashboard",
  "nodes": [
    {
      "id": "cron-5",
      "name": "Monday 8 AM",
      "type": "n8n-nodes-base.scheduleTrigger",
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 8 * * 1"
            }
          ]
        }
      }
    },
    {
      "id": "db-5",
      "name": "Query Platform Metrics",
      "type": "n8n-nodes-base.postgres",
      "parameters": {
        "operation": "executeQuery",
        "query": "\nSELECT\n  COUNT(DISTINCT patient_id) AS active_patients,\n  COUNT(DISTINCT account_id) AS active_accounts,\n  SUM(mrr_usd) AS total_mrr,\n  SUM(fhir_api_calls_7d) AS fhir_api_calls_7d,\n  COUNT(CASE WHEN samd_incidents_open > 0 THEN 1 END) AS accounts_with_open_samd_incidents,\n  COUNT(CASE WHEN obc_complaints_open > 0 THEN 1 END) AS accounts_with_obc_complaints,\n  COUNT(CASE WHEN hipaa_breach_open > 0 THEN 1 END) AS accounts_with_open_hipaa_breaches,\n  AVG(compliance_score) AS avg_compliance_score\nFROM platform_metrics\nWHERE snapshot_date = CURRENT_DATE - 7\n"
      }
    },
    {
      "id": "wow-5",
      "name": "Compute WoW %",
      "type": "n8n-nodes-base.code",
      "parameters": {
        "jsCode": "\nconst curr = $input.first().json;\nconst state = $getWorkflowStaticData('global');\nconst prev = state.prevMetrics || {};\nconst pct = (c, p) => p ? (((c - p) / p) * 100).toFixed(1) + '%' : 'N/A';\nconst report = {\n  active_patients: curr.active_patients,\n  active_accounts: curr.active_accounts,\n  total_mrr: '$' + Number(curr.total_mrr).toLocaleString(),\n  mrr_wow: pct(curr.total_mrr, prev.total_mrr),\n  fhir_api_calls_7d: Number(curr.fhir_api_calls_7d).toLocaleString(),\n  fhir_wow: pct(curr.fhir_api_calls_7d, prev.fhir_api_calls_7d),\n  open_samd_incidents: curr.accounts_with_open_samd_incidents,\n  open_obc_complaints: curr.accounts_with_obc_complaints,\n  open_hipaa_breaches: curr.accounts_with_open_hipaa_breaches,\n  avg_compliance_score: Number(curr.avg_compliance_score).toFixed(1) + '%'\n};\nstate.prevMetrics = curr;\nreturn [{json: report}];\n"
      }
    },
    {
      "id": "email-5",
      "name": "Email CEO + CTO (BCC CIO)",
      "type": "n8n-nodes-base.gmail",
      "parameters": {
        "operation": "send",
        "toList": "[email protected]",
        "ccList": "[email protected]",
        "bccList": "[email protected]",
        "subject": "Weekly HealthTech KPI Report \u2014 {{new Date().toISOString().slice(0,10)}}",
        "message": "Weekly HealthTech Platform Report\\n\\nActive Patients: {{$json.active_patients}}\\nActive Accounts: {{$json.active_accounts}}\\nMRR: {{$json.total_mrr}} (WoW: {{$json.mrr_wow}})\\nFHIR API Calls (7d): {{$json.fhir_api_calls_7d}} (WoW: {{$json.fhir_wow}})\\n\\n--- Compliance Status ---\\nAccounts w/ Open FDA SaMD Incidents: {{$json.open_samd_incidents}}\\nAccounts w/ Open ONC/OBC Complaints: {{$json.open_obc_complaints}}\\nAccounts w/ Open HIPAA Breaches: {{$json.open_hipaa_breaches}}\\nAvg Compliance Score: {{$json.avg_compliance_score}}\\n\\nFull details in compliance dashboard."
      }
    },
    {
      "id": "slack-5",
      "name": "Slack #management one-liner",
      "type": "n8n-nodes-base.slack",
      "parameters": {
        "channel": "#management",
        "text": "Weekly HealthTech KPI | MRR: {{$json.total_mrr}} ({{$json.mrr_wow}} WoW) | FHIR Calls: {{$json.fhir_api_calls_7d}} | SaMD Incidents: {{$json.open_samd_incidents}} | OBC Complaints: {{$json.open_obc_complaints}} | HIPAA Breaches: {{$json.open_hipaa_breaches}} | Compliance Score: {{$json.avg_compliance_score}}"
      }
    }
  ],
  "connections": {
    "Monday 8 AM": {
      "main": [
        [
          {
            "node": "Query Platform Metrics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Query Platform Metrics": {
      "main": [
        [
          {
            "node": "Compute WoW %",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Compute WoW %": {
      "main": [
        [
          {
            "node": "Email CEO + CTO (BCC CIO)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email CEO + CTO (BCC CIO)": {
      "main": [
        [
          {
            "node": "Slack #management one-liner",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Why self-hosted n8n for HealthTech compliance

Reason Detail
HIPAA ยง164.312 perimeter PHI in Zapier/Make workflows = data in third-party infrastructure; requires separate BAA negotiation and audit right per ยง164.308(b)(1)
ONC information blocking 45 CFR ยง171.300 Any third party that could delay, block, or route patient data access becomes an information blocking investigation risk; self-hosted = no third-party in the FHIR response path
FDA SaMD ยง820.180 DHF records Cloud-generated automation logs are not under your Quality Management System control; self-hosted n8n logs live inside your ISO 13485/QSR perimeter
CMS payer-to-payer PHI Patient FHIR bundles transiting cloud iPaaS expand your PHI egress footprint and BAA scope; self-hosted = zero additional subprocessors
SOC 2 CC9.2 vendor risk Adding Zapier/Make as a TPSP requires vendor risk assessment, contract addendum, and annual review; self-hosted n8n = zero additional TPSP scope

Ready-to-use HealthTech n8n workflows

All five workflows above are available as import-ready JSON templates in the FlowKit store:

Import a JSON file, swap your credentials, and your HealthTech compliance pipeline is live in under 10 minutes.

Have a HealthTech compliance automation use case not covered above? Drop it in the comments โ€” I will add it to the next revision.

๐Ÿ“ฐ Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes โ€” full credit and traffic to the original publisher.