{
  "id": "bEGjWC4Q3KcfconYUZHSv",
  "name": "Healthcare Operations Orchestration Agent for Patient Care Continuity",
  "tags": [],
  "nodes": [
    {
      "id": "524f0188-5087-40ca-9cf7-7b04bd22793a",
      "name": "Schedule Patient Operations Check",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        160,
        96
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes",
              "minutesInterval": 15
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "4fcfc9f3-9a3d-4e87-9aa1-5c9f77e78ade",
      "name": "Patient Event Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        160,
        288
      ],
      "parameters": {
        "path": "patient-operations-event",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "lastNode",
        "authentication": "headerAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "0aec5e47-2e2f-4d0d-929c-ce8f040af480",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        608,
        192
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "ehrApiUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__EHR System API Base URL__>"
            },
            {
              "id": "id-2",
              "name": "nursingApiUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Nursing System API Base URL__>"
            },
            {
              "id": "id-3",
              "name": "pharmacyApiUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Pharmacy System API Base URL__>"
            },
            {
              "id": "id-4",
              "name": "caseManagementApiUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Case Management System API Base URL__>"
            },
            {
              "id": "id-5",
              "name": "admissionWorkflowUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Admission Workflow API URL__>"
            },
            {
              "id": "id-6",
              "name": "dischargeWorkflowUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Discharge Workflow API URL__>"
            },
            {
              "id": "id-7",
              "name": "postCareWorkflowUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Post-Care Workflow API URL__>"
            },
            {
              "id": "id-8",
              "name": "auditLogUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Audit Logging System API URL__>"
            },
            {
              "id": "id-9",
              "name": "escalationSlackChannel",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Clinical Staff Slack Channel ID__>"
            },
            {
              "id": "id-10",
              "name": "escalationEmail",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Clinical Staff Email Address__>"
            },
            {
              "id": "id-11",
              "name": "complianceOfficerEmail",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Compliance Officer Email__>"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "edca6b37-f42e-43f8-8c3c-095e3f9cc6ae",
      "name": "Merge Triggers",
      "type": "n8n-nodes-base.merge",
      "position": [
        384,
        192
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "66d4fc43-691d-4f85-ab3a-1b9d03e368f1",
      "name": "Fetch EHR Patient Data",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        816,
        192
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.ehrApiUrl }}/patient/{{ $json.patientId || 'current' }}/operational-status",
        "options": {
          "timeout": 30000
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "<__PLACEHOLDER_VALUE__EHR API Authorization Token__>"
            },
            {
              "name": "X-Request-ID",
              "value": "={{ $execution.id }}"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "8f5f1d45-7de6-4f2a-a11c-5cf2757f6df7",
      "name": "Fetch Pharmacy Readiness",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1056,
        192
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.pharmacyApiUrl }}/patient/{{ $('Fetch EHR Patient Data').first().json.patientId }}/medication-readiness",
        "options": {
          "timeout": 30000
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "<__PLACEHOLDER_VALUE__Pharmacy System API Authorization Token__>"
            },
            {
              "name": "X-Request-ID",
              "value": "={{ $execution.id }}"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "14778ef9-1281-4502-b5e3-24eb196e4789",
      "name": "Fetch Case Management Data",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1296,
        192
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.caseManagementApiUrl }}/patient/={{ $('Fetch EHR Patient Data').first().json.patientId }}/case-status",
        "options": {
          "timeout": 30000
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "<__PLACEHOLDER_VALUE__Case Management API Authorization Token__>"
            },
            {
              "name": "X-Request-ID",
              "value": "={{ $execution.id }}"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "b20a8e36-8e92-4ddb-bf41-659f9fd59b64",
      "name": "Aggregate System Data",
      "type": "n8n-nodes-base.set",
      "position": [
        1568,
        192
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "ehrData",
              "type": "object",
              "value": "={{ $('Fetch EHR Patient Data').first().json }}"
            },
            {
              "id": "id-2",
              "name": "nursingData",
              "type": "object",
              "value": "={{ $('Fetch Nursing Status').first().json }}"
            },
            {
              "id": "id-3",
              "name": "pharmacyData",
              "type": "object",
              "value": "={{ $('Fetch Pharmacy Readiness').first().json }}"
            },
            {
              "id": "id-4",
              "name": "caseManagementData",
              "type": "object",
              "value": "={{ $('Fetch Case Management Data').first().json }}"
            },
            {
              "id": "id-5",
              "name": "aggregatedAt",
              "type": "string",
              "value": "={{ $now.toISO() }}"
            },
            {
              "id": "id-6",
              "name": "executionId",
              "type": "string",
              "value": "={{ $execution.id }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "b9ed5098-eb51-4262-9ed6-6ee7e82f87c1",
      "name": "Validate Data Completeness",
      "type": "n8n-nodes-base.code",
      "position": [
        1792,
        192
      ],
      "parameters": {
        "jsCode": "// Validate Data Completeness from Healthcare Systems\n// Checks EHR, Nursing, Pharmacy, and Case Management data\n\nconst items = $input.all();\nconst validationResults = [];\n\nfor (const item of items) {\n  const data = item.json;\n  const missingFields = [];\n  let isValid = true;\n\n  // Validate EHR Patient Data\n  const ehrRequired = ['patientId', 'firstName', 'lastName', 'dateOfBirth', 'medicalRecordNumber'];\n  if (!data.ehr) {\n    missingFields.push('ehr (entire object)');\n    isValid = false;\n  } else {\n    for (const field of ehrRequired) {\n      if (!data.ehr[field]) {\n        missingFields.push(`ehr.${field}`);\n        isValid = false;\n      }\n    }\n  }\n\n  // Validate Nursing Status Data\n  const nursingRequired = ['assignedNurse', 'vitalSigns', 'lastAssessment', 'careLevel'];\n  if (!data.nursing) {\n    missingFields.push('nursing (entire object)');\n    isValid = false;\n  } else {\n    for (const field of nursingRequired) {\n      if (!data.nursing[field]) {\n        missingFields.push(`nursing.${field}`);\n        isValid = false;\n      }\n    }\n  }\n\n  // Validate Pharmacy Readiness Data\n  const pharmacyRequired = ['medicationList', 'allergies', 'pharmacistReview', 'readyForDispense'];\n  if (!data.pharmacy) {\n    missingFields.push('pharmacy (entire object)');\n    isValid = false;\n  } else {\n    for (const field of pharmacyRequired) {\n      if (!data.pharmacy[field]) {\n        missingFields.push(`pharmacy.${field}`);\n        isValid = false;\n      }\n    }\n  }\n\n  // Validate Case Management Data\n  const caseManagementRequired = ['caseManager', 'dischargeStatus', 'followUpPlan', 'insuranceVerified'];\n  if (!data.caseManagement) {\n    missingFields.push('caseManagement (entire object)');\n    isValid = false;\n  } else {\n    for (const field of caseManagementRequired) {\n      if (!data.caseManagement[field]) {\n        missingFields.push(`caseManagement.${field}`);\n        isValid = false;\n      }\n    }\n  }\n\n  // Build validation result\n  validationResults.push({\n    json: {\n      ...data,\n      validation: {\n        isValid: isValid,\n        missingFields: missingFields,\n        validatedAt: new Date().toISOString(),\n        totalMissingFields: missingFields.length\n      }\n    }\n  });\n}\n\nreturn validationResults;"
      },
      "typeVersion": 2
    },
    {
      "id": "6161a44a-8348-4caa-b733-72c847e768cb",
      "name": "Healthcare Operations Orchestrator",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2016,
        192
      ],
      "parameters": {
        "text": "=Patient Data: {{ JSON.stringify($json) }}",
        "options": {
          "systemMessage": "You are a Healthcare Operations Orchestration Agent responsible for coordinating NON-CLINICAL operational workflows across patient admission, discharge, and post-care continuity.\n\nCRITICAL CONSTRAINTS:\n- You make ZERO clinical judgments or medical decisions\n- You coordinate ONLY operational, administrative, and logistical tasks\n- You validate operational readiness signals from systems\n- You orchestrate cross-system workflows for scheduling, communications, referrals, and documentation\n- You escalate exceptions to human clinical staff immediately\n- You enforce healthcare compliance (HIPAA, data minimization, least-privilege access)\n- You ensure complete auditability of all actions\n\nYOUR RESPONSIBILITIES:\n1. Validate structured operational signals from EHR, nursing, pharmacy, and case management systems\n2. Determine the appropriate operation type: ADMISSION, DISCHARGE, or POST_CARE\n3. Identify operational readiness blockers (missing documentation, incomplete orders, scheduling conflicts)\n4. Orchestrate non-clinical workflows (room assignment, transport scheduling, discharge paperwork, follow-up appointments)\n5. Flag exceptions requiring human clinical review\n6. Generate deterministic, structured JSON output for all workflow actions\n\nDATA HANDLING:\n- Access only minimum necessary patient data (identifiers, operational status, not clinical details)\n- Never expose PHI in logs or outputs beyond operational necessity\n- Validate data completeness before proceeding\n\nEXCEPTION ESCALATION:\nEscalate to human staff if:\n- Clinical data is ambiguous or contradictory\n- Operational readiness cannot be confirmed\n- System data is incomplete or missing\n- Any safety or compliance concern is detected\n\nOUTPUT REQUIREMENTS:\nReturn structured JSON with:\n- operationType: \"ADMISSION\" | \"DISCHARGE\" | \"POST_CARE\"\n- readinessStatus: \"READY\" | \"BLOCKED\" | \"EXCEPTION\"\n- blockers: array of operational blockers\n- workflowActions: array of specific actions to execute\n- requiresHumanReview: boolean\n- escalationReason: string (if requiresHumanReview is true)\n- complianceFlags: array of compliance considerations\n- auditMetadata: execution tracking data"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3.1
    },
    {
      "id": "2b113cc6-2b38-4371-8b12-f9bbb993560b",
      "name": "Claude Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        2032,
        416
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-sonnet-4-5-20250929",
          "cachedResultName": "Claude Sonnet 4.5"
        },
        "options": {
          "temperature": 0.1,
          "maxTokensToSample": 4096
        }
      },
      "credentials": {
        "anthropicApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "d69544ed-4da7-4788-8065-c697e323d30b",
      "name": "Structured Operations Output",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        2160,
        416
      ],
      "parameters": {
        "jsonSchemaExample": "{\n\t\"operationType\": \"admission\",\n\t\"readinessStatus\": \"ready\",\n\t\"blockers\": [\"Missing lab results\", \"Bed assignment pending\"],\n\t\"workflowActions\": [\n\t\t{\n\t\t\t\"actionType\": \"notify_nursing\",\n\t\t\t\"parameters\": {\n\t\t\t\t\"unit\": \"ICU\",\n\t\t\t\t\"priority\": \"high\"\n\t\t\t}\n\t\t}\n\t],\n\t\"requiresHumanReview\": true,\n\t\"escalationReason\": \"Critical medication interaction detected\",\n\t\"complianceFlags\": [\"HIPAA_verified\", \"consent_obtained\"],\n\t\"auditMetadata\": {\n\t\t\"timestamp\": \"2024-01-15T10:30:00Z\",\n\t\t\"executionId\": \"exec_12345\",\n\t\t\"systemsValidated\": [\"EHR\", \"Pharmacy\", \"Nursing\", \"Case Management\"]\n\t}\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "f4fe0131-736a-480d-853b-7557b5fe5f7c",
      "name": "Route by Operation Type",
      "type": "n8n-nodes-base.switch",
      "position": [
        2368,
        160
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Admission",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.output.operationType }}",
                    "rightValue": "ADMISSION"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Discharge",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.output.operationType }}",
                    "rightValue": "DISCHARGE"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Post-Care",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.output.operationType }}",
                    "rightValue": "POST_CARE"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra"
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "b3a0e7b0-86a5-4bf5-ba32-5eea9d2c7a9b",
      "name": "Execute Admission Workflow",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2608,
        160
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.admissionWorkflowUrl }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ { patientId: $json.ehrData?.patientId, workflowActions: $json.output?.workflowActions, executionId: $execution.id, timestamp: $now.toISO() } }}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "<__PLACEHOLDER_VALUE__Workflow System API Token__>"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "f6f0e3fd-70fb-43c4-a78e-4eede46c6339",
      "name": "Execute Discharge Workflow",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2608,
        352
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.dischargeWorkflowUrl }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ { patientId: $json.ehrData?.patientId, workflowActions: $json.output?.workflowActions, executionId: $execution.id, timestamp: $now.toISO() } }}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "<__PLACEHOLDER_VALUE__Workflow System API Token__>"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "b029c0cd-e9bc-476e-8ad1-312fe11b581f",
      "name": "Execute Post-Care Workflow",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2608,
        544
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.postCareWorkflowUrl }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ { patientId: $json.ehrData?.patientId, workflowActions: $json.output?.workflowActions, executionId: $execution.id, timestamp: $now.toISO() } }}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "<__PLACEHOLDER_VALUE__Workflow System API Token__>"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "da8b9447-e047-42d9-9e92-62c37088a8b0",
      "name": "Check Exception Flag",
      "type": "n8n-nodes-base.if",
      "position": [
        2816,
        192
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": false,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "id-1",
              "operator": {
                "type": "boolean",
                "operation": "equals"
              },
              "leftValue": "={{ $json.output.requiresHumanReview }}",
              "rightValue": "true"
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "a6840163-fd2a-494f-9f1b-253e84f9755a",
      "name": "Escalate to Clinical Staff",
      "type": "n8n-nodes-base.slack",
      "position": [
        3040,
        96
      ],
      "parameters": {
        "text": "=\ud83d\udea8 HEALTHCARE OPERATIONS EXCEPTION - Human Review Required\n\n**Operation Type:** {{ $json.output?.operationType }}\n**Patient ID:** {{ $json.ehrData?.patientId }}\n**Readiness Status:** {{ $json.output?.readinessStatus }}\n\n**Escalation Reason:**\n{{ $json.output?.escalationReason }}\n\n**Operational Blockers:**\n{{ $json.output?.blockers?.map(b => '\u2022 ' + b).join('\\n') }}\n\n**Compliance Flags:**\n{{ $json.output?.complianceFlags?.map(f => '\u2022 ' + f).join('\\n') }}\n\n**Execution ID:** {{ $execution.id }}\n**Timestamp:** {{ $now.toISO() }}\n\n\u26a0\ufe0f This requires immediate clinical staff review.",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Workflow Configuration').first().json.escalationSlackChannel }}"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.4
    },
    {
      "id": "b492caaf-27f5-40da-ba7f-976b593b04d0",
      "name": "Send Exception Email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        3040,
        288
      ],
      "parameters": {
        "html": "=<h2>Healthcare Operations Exception Alert</h2>\n<p><strong>Operation Type:</strong> {{ $json.output?.operationType }}</p>\n<p><strong>Patient ID:</strong> {{ $json.ehrData?.patientId }}</p>\n<p><strong>Readiness Status:</strong> {{ $json.output?.readinessStatus }}</p>\n\n<h3>Escalation Reason</h3>\n<p>{{ $json.output?.escalationReason }}</p>\n\n<h3>Operational Blockers</h3>\n<ul>\n{{ $json.output?.blockers?.map(b => '<li>' + b + '</li>').join('') }}\n</ul>\n\n<h3>Compliance Flags</h3>\n<ul>\n{{ $json.output?.complianceFlags?.map(f => '<li>' + f + '</li>').join('') }}\n</ul>\n\n<h3>Audit Information</h3>\n<p><strong>Execution ID:</strong> {{ $execution.id }}</p>\n<p><strong>Timestamp:</strong> {{ $now.toISO() }}</p>\n<p><strong>Systems Validated:</strong> EHR, Nursing, Pharmacy, Case Management</p>\n\n<p><em>This automated alert was generated by the Healthcare Operations Orchestration Agent. Immediate clinical review is required.</em></p>",
        "options": {},
        "subject": "=Healthcare Operations Exception - {{ $json.output?.operationType }} - Patient {{ $json.ehrData?.patientId }}",
        "toEmail": "={{ $('Workflow Configuration').first().json.escalationEmail }}",
        "fromEmail": "={{ $('Workflow Configuration').first().json.complianceOfficerEmail }}"
      },
      "typeVersion": 2.1
    },
    {
      "id": "e0c770aa-12bc-41ed-91f1-c86c164a9e87",
      "name": "Merge Workflow Paths",
      "type": "n8n-nodes-base.merge",
      "position": [
        3264,
        176
      ],
      "parameters": {
        "numberInputs": 3
      },
      "typeVersion": 3.2
    },
    {
      "id": "5e621963-dec1-4bf7-bf0c-7abcf93b3ada",
      "name": "Log Audit Trail",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3488,
        192
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.auditLogUrl }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ { eventType: 'healthcare_operations_orchestration', operationType: $json.output?.operationType, patientId: $json.ehrData?.patientId, readinessStatus: $json.output?.readinessStatus, workflowActions: $json.output?.workflowActions, requiresHumanReview: $json.output?.requiresHumanReview, escalationReason: $json.output?.escalationReason, complianceFlags: $json.output?.complianceFlags, executionId: $execution.id, timestamp: $now.toISO(), systemsValidated: ['EHR', 'Nursing', 'Pharmacy', 'CaseManagement'], dataMinimization: true, hipaaCompliant: true } }}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "<__PLACEHOLDER_VALUE__Audit System API Token__>"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "d529918d-85e0-4276-bea7-90ff7637c7ed",
      "name": "Format Compliance Report",
      "type": "n8n-nodes-base.set",
      "position": [
        3712,
        192
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "complianceReport",
              "type": "object",
              "value": "={{ { executionId: $execution.id, timestamp: $now.toISO(), operationType: $json.output?.operationType, patientId: $json.ehrData?.patientId, readinessStatus: $json.output?.readinessStatus, humanReviewRequired: $json.output?.requiresHumanReview, complianceFlags: $json.output?.complianceFlags, auditLogged: true, dataMinimizationEnforced: true, leastPrivilegeAccess: true, hipaaCompliant: true } }}"
            },
            {
              "id": "id-2",
              "name": "workflowSummary",
              "type": "object",
              "value": "={{ { totalActions: $json.output?.workflowActions?.length || 0, blockers: $json.output?.blockers?.length || 0, systemsValidated: 4, escalated: $json.output?.requiresHumanReview || false } }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "61aa7acb-cba5-485a-a4f2-37eb3a15e1d0",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1440,
        -400
      ],
      "parameters": {
        "color": 5,
        "width": 432,
        "height": 368,
        "content": "## Prerequisites\nNVIDIA API access, Anthropic Claude API key, Google Workspace account (Gmail, Sheets)\n## Use Cases\nEmergency department triage automation, post-operative monitoring for deterioration detection\n## Customization\nModify risk scoring algorithms, add disease-specific assessment criteria\n## Benefits\nReduces clinical response time through automated risk detection"
      },
      "typeVersion": 1
    },
    {
      "id": "78ede027-a990-472c-9234-248d29bc21ab",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        896,
        -304
      ],
      "parameters": {
        "width": 480,
        "height": 272,
        "content": "## Setup Steps\n1. Configure Patient Event Webhook with your EHR system endpoint URL and authentication headers\n2. Add NVIDIA API credentials (API key) in Fetch Patient Data and Structured Generation nodes\n3. Connect Claude Model node with Anthropic API key and configure healthcare risk assessment prompt\n4. Set up Gmail node with sender credentials and configure recipient email addresses for clinical alerts\n5. Enable Google Sheets integration for audit logging and specify spreadsheet ID for execution reports"
      },
      "typeVersion": 1
    },
    {
      "id": "6168b9ec-827e-4b3a-9d89-5d87f11e863c",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        144,
        -304
      ],
      "parameters": {
        "width": 704,
        "height": 272,
        "content": "## How It Works\nThis workflow automates patient risk assessment and clinical alerting for healthcare providers using NVIDIA AI models. Designed for hospitals, clinics, and healthcare organizations, it addresses the critical challenge of timely identification and response to high-risk patients requiring immediate intervention. The system monitors patient data webhooks, enriches records with external EHR data, and analyzes aggregated information through Claude AI for comprehensive risk stratification. Healthcare operations data is fetched and combined with patient metrics to provide contextual risk assessment. NVIDIA's structured generation capabilities ensure standardized clinical outputs, while parallel execution routes enable simultaneous processing: critical cases trigger immediate alerts via email and escalation flags, whereas routine cases follow standard documentation paths. The workflow maintains an audit trail, merges execution results, and generates detailed reports for compliance and quality improvement initiatives."
      },
      "typeVersion": 1
    },
    {
      "id": "e144e381-54be-414a-a46d-dc129419f073",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3424,
        -48
      ],
      "parameters": {
        "color": 7,
        "width": 496,
        "height": 864,
        "content": "## Documentation & Compliance Reporting\n**Why**\nStandardizes documentation, enables real-time clinical response, and maintains regulatory compliance through comprehensive activity logging."
      },
      "typeVersion": 1
    },
    {
      "id": "0b6a5419-dfc9-45de-94bb-1e61c158c2f2",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1936,
        -32
      ],
      "parameters": {
        "color": 7,
        "width": 1456,
        "height": 864,
        "content": "## Intelligent Patient Triage\n**Why**\nEnsures critical patients receive urgent attention while maintaining efficient processing for routine cases without unnecessary clinical burden."
      },
      "typeVersion": 1
    },
    {
      "id": "d3ab4d53-45da-4bf6-adc4-b3b58d3af13b",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        -16
      ],
      "parameters": {
        "color": 7,
        "width": 1808,
        "height": 592,
        "content": "## Data Collection & AI Risk Analysis\n**Why**\nCombines multiple data sources to provide comprehensive patient profiles, enabling accurate risk stratification beyond single-metric assessments."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "dc9b53c2-582a-4f69-9df1-16c3aed30974",
  "connections": {
    "Claude Model": {
      "ai_languageModel": [
        [
          {
            "node": "Healthcare Operations Orchestrator",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Merge Triggers": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Audit Trail": {
      "main": [
        [
          {
            "node": "Format Compliance Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Exception Flag": {
      "main": [
        [
          {
            "node": "Escalate to Clinical Staff",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Exception Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Workflow Paths": {
      "main": [
        [
          {
            "node": "Log Audit Trail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Exception Email": {
      "main": [
        [
          {
            "node": "Merge Workflow Paths",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Aggregate System Data": {
      "main": [
        [
          {
            "node": "Validate Data Completeness",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Patient Event Webhook": {
      "main": [
        [
          {
            "node": "Merge Triggers",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Fetch EHR Patient Data": {
      "main": [
        [
          {
            "node": "Fetch Pharmacy Readiness",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "Fetch EHR Patient Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route by Operation Type": {
      "main": [
        [
          {
            "node": "Execute Admission Workflow",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Execute Discharge Workflow",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Execute Post-Care Workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Pharmacy Readiness": {
      "main": [
        [
          {
            "node": "Fetch Case Management Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Escalate to Clinical Staff": {
      "main": [
        [
          {
            "node": "Merge Workflow Paths",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Admission Workflow": {
      "main": [
        [
          {
            "node": "Check Exception Flag",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Discharge Workflow": {
      "main": [
        [
          {
            "node": "Check Exception Flag",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Post-Care Workflow": {
      "main": [
        [
          {
            "node": "Check Exception Flag",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Case Management Data": {
      "main": [
        [
          {
            "node": "Aggregate System Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Data Completeness": {
      "main": [
        [
          {
            "node": "Healthcare Operations Orchestrator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Operations Output": {
      "ai_outputParser": [
        [
          {
            "node": "Healthcare Operations Orchestrator",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Patient Operations Check": {
      "main": [
        [
          {
            "node": "Merge Triggers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Healthcare Operations Orchestrator": {
      "main": [
        [
          {
            "node": "Route by Operation Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}