{"id":"7Q2WdUsE3Acwho6D","meta":{"instanceId":"b91e510ebae4127f953fd2f5f8d40d58ca1e71c746d4500c12ae86aad04c1502"},"name":"Hospital Patient Interaction State-Driven Automation Agent","tags":[],"nodes":[{"id":"52567a22-dcf7-4f45-af46-13cadfb5271d","name":"Patient Chat Interface","type":"@n8n/n8n-nodes-langchain.chatTrigger","position":[-2544,440],"webhookId":"e59431bf-43ab-43dc-a6aa-3c332d13e7be","parameters":{"public":true,"options":{"loadPreviousSession":"memory"}},"typeVersion":1.4},{"id":"037366e6-4628-44e4-87c5-7de3beef4e5a","name":"Hospital Triage Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[-2072,440],"parameters":{"options":{"systemMessage":"You are a hospital patient interaction AI agent operating within a state-driven, auditable workflow system.\n\nYour core responsibilities:\n1. INTENT DISAMBIGUATION: Accurately identify patient intent from their message (appointment_request, appointment_cancel, appointment_reschedule, medication_inquiry, general_question, emergency_indicator, consent_verification, identity_verification)\n2. ENTITY EXTRACTION: Extract and normalize entities (patient_name, date_time, department, doctor_name, symptoms, medication_name, appointment_id)\n3. CONTEXT MAINTENANCE: Use conversation history to resolve ambiguous references and maintain state\n4. TIME REASONING: Parse natural language time expressions (\"next Tuesday\", \"in 3 days\") into ISO 8601 format\n5. CONSTRAINT ENFORCEMENT: Apply hospital rules (business hours, department availability, consent requirements)\n6. EXCEPTION DETECTION: Identify escalation conditions (emergency keywords, repeated failures, consent violations)\n7. TONE PERSONALIZATION: Adapt communication style based on patient sentiment and urgency\n\nSTRICT PROHIBITIONS:\n- NEVER provide medical diagnosis or treatment advice\n- NEVER make medical decisions\n- NEVER access or request protected health information beyond what is volunteered\n- NEVER bypass consent or identity verification requirements\n\nYou MUST output structured JSON only. Your response will be parsed by downstream automation nodes."},"hasOutputParser":true},"typeVersion":3.1},{"id":"4a2e7736-fc41-4fd5-8221-b4078489945e","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-2192,640],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4.1-mini"},"options":{},"builtInTools":{}},"credentials":{"openAiApi":{"id":"mv2ECvRtbAK63G2g","name":"OpenAi account"}},"typeVersion":1.3},{"id":"5cb66d96-c4df-4d7a-8804-00f7bcdcba08","name":"Conversation Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[-2472,664],"parameters":{},"typeVersion":1.3},{"id":"102c4636-0665-42dd-9d02-4497d70d4d4d","name":"Structured JSON Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[-1728,656],"parameters":{"schemaType":"manual","inputSchema":"{\n  \"type\": \"object\",\n  \"properties\": {\n    \"workflow_state\": {\n      \"type\": \"string\",\n      \"enum\": [\"initial_contact\", \"intent_identified\", \"entity_collection\", \"validation_pending\", \"action_authorized\", \"action_blocked\", \"escalation_required\", \"completed\"],\n      \"description\": \"Current state in the workflow state machine\"\n    },\n    \"intent\": {\n      \"type\": \"string\",\n      \"enum\": [\"appointment_request\", \"appointment_cancel\", \"appointment_reschedule\", \"medication_inquiry\", \"general_question\", \"emergency_indicator\", \"consent_verification\", \"identity_verification\", \"unknown\"],\n      \"description\": \"Identified patient intent\"\n    },\n    \"entities\": {\n      \"type\": \"object\",\n      \"properties\": {\n        \"patient_name\": {\"type\": \"string\"},\n        \"date_time\": {\"type\": \"string\", \"format\": \"date-time\"},\n        \"department\": {\"type\": \"string\"},\n        \"doctor_name\": {\"type\": \"string\"},\n        \"appointment_id\": {\"type\": \"string\"},\n        \"symptoms\": {\"type\": \"array\", \"items\": {\"type\": \"string\"}},\n        \"medication_name\": {\"type\": \"string\"}\n      }\n    },\n    \"action_required\": {\n      \"type\": \"string\",\n      \"enum\": [\"schedule_appointment\", \"cancel_appointment\", \"reschedule_appointment\", \"send_reminder\", \"escalate_to_human\", \"request_consent\", \"verify_identity\", \"none\"],\n      \"description\": \"Action to be executed by downstream nodes\"\n    },\n    \"action_authorized\": {\n      \"type\": \"boolean\",\n      \"description\": \"Whether the action is authorized based on rules and constraints\"\n    },\n    \"authorization_rationale\": {\n      \"type\": \"string\",\n      \"description\": \"Clear explanation for authorization decision\"\n    },\n    \"message_to_patient\": {\n      \"type\": \"string\",\n      \"description\": \"Natural language response to send to the patient\"\n    },\n    \"audit_metadata\": {\n      \"type\": \"object\",\n      \"properties\": {\n        \"timestamp\": {\"type\": \"string\", \"format\": \"date-time\"},\n        \"session_id\": {\"type\": \"string\"},\n        \"rules_applied\": {\"type\": \"array\", \"items\": {\"type\": \"string\"}},\n        \"exceptions_detected\": {\"type\": \"array\", \"items\": {\"type\": \"string\"}}\n      }\n    },\n    \"confidence_level\": {\n      \"type\": \"number\",\n      \"minimum\": 0,\n      \"maximum\": 1,\n      \"description\": \"Confidence score for intent and entity extraction\"\n    }\n  },\n  \"required\": [\"workflow_state\", \"intent\", \"action_required\", \"action_authorized\", \"message_to_patient\", \"confidence_level\"]\n}"},"typeVersion":1.3},{"id":"9fc5ee3d-3dd8-46ac-969a-5b954665d1b8","name":"Check Action Required","type":"n8n-nodes-base.if","position":[-256,472],"parameters":{"options":{},"conditions":{"options":{"leftValue":"","caseSensitive":false,"typeValidation":"loose"},"combinator":"and","conditions":[{"id":"id-1","operator":{"type":"string","operation":"notEquals"},"leftValue":"={{ $json.action_required }}","rightValue":"none"},{"id":"id-2","operator":{"type":"boolean","operation":"equals"},"leftValue":"={{ $json.action_authorized }}","rightValue":true}]}},"typeVersion":2.3},{"id":"806c8ec0-f110-4024-ac18-173fce2616e5","name":"Execute Appointment Action","type":"n8n-nodes-base.httpRequest","position":[-32,400],"parameters":{"url":"<__PLACEHOLDER_VALUE__Hospital appointment system API endpoint__>","method":"POST","options":{},"jsonBody":"={\n  \"action\": {{ $json.action_required }},\n  \"patient_name\": {{ $json.entities.patient_name }},\n  \"date_time\": {{ $json.entities.date_time }},\n  \"department\": {{ $json.entities.department }},\n  \"doctor_name\": {{ $json.entities.doctor_name }},\n  \"appointment_id\": {{ $json.entities.appointment_id }},\n  \"session_id\": {{ $json.audit_metadata.session_id }}\n}","sendBody":true,"sendHeaders":true,"specifyBody":"json","headerParameters":{"parameters":[{"name":"Content-Type","value":"application/json"},{"name":"Authorization","value":"<__PLACEHOLDER_VALUE__API authentication token__>"}]}},"typeVersion":4.3},{"id":"0a225977-e5ac-4f29-bfe7-ef3b8006bd4c","name":"Send Notification","type":"n8n-nodes-base.httpRequest","position":[192,400],"parameters":{"url":"<__PLACEHOLDER_VALUE__Hospital notification system API endpoint__>","method":"POST","options":{},"jsonBody":"={\n  \"recipient\": {{ $json.entities.patient_name }},\n  \"message\": {{ $json.message_to_patient }},\n  \"notification_type\": \"appointment_confirmation\",\n  \"metadata\": {\n    \"appointment_id\": {{ $json.entities.appointment_id }},\n    \"timestamp\": {{ $json.audit_metadata.timestamp }}\n  }\n}","sendBody":true,"sendHeaders":true,"specifyBody":"json","headerParameters":{"parameters":[{"name":"Content-Type","value":"application/json"},{"name":"Authorization","value":"<__PLACEHOLDER_VALUE__API authentication token__>"}]}},"typeVersion":4.3},{"id":"95d2795e-2307-413a-bf2d-22d17b14c36c","name":"Format Response to Patient","type":"n8n-nodes-base.set","position":[416,544],"parameters":{"options":{},"assignments":{"assignments":[{"id":"id-1","name":"output","type":"string","value":"={{ $json.message_to_patient }}"}]},"includeOtherFields":true},"typeVersion":3.4},{"id":"ef757065-a9a2-477c-a4c1-6a289e7f40b5","name":"Route by Intent Type","type":"n8n-nodes-base.switch","position":[640,496],"parameters":{"rules":{"values":[{"outputKey":"appointment","conditions":{"options":{"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"operator":{"type":"string","operation":"contains"},"leftValue":"={{ $json.intent }}","rightValue":"appointment"}]},"renameOutput":true},{"outputKey":"emergency","conditions":{"options":{"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.intent }}","rightValue":"emergency_indicator"}]},"renameOutput":true},{"outputKey":"medication","conditions":{"options":{"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.intent }}","rightValue":"medication_inquiry"}]},"renameOutput":true},{"outputKey":"verification","conditions":{"options":{"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"operator":{"type":"string","operation":"contains"},"leftValue":"={{ $json.intent }}","rightValue":"verification"}]},"renameOutput":true}]},"options":{"fallbackOutput":"extra","renameFallbackOutput":"general"}},"typeVersion":3.4},{"id":"33b463ec-fdf8-4b1e-aeb4-e28afa518c83","name":"Log Interaction to Audit DB","type":"n8n-nodes-base.postgres","position":[976,480],"parameters":{"table":{"__rl":true,"mode":"name","value":"interaction_audit_log"},"schema":{"__rl":true,"mode":"list","value":"public"},"columns":{"value":{"intent":"={{ $json.intent }}","timestamp":"={{ $json.audit_metadata.timestamp }}","session_id":"={{ $json.audit_metadata.session_id }}","action_taken":"={{ $json.action_required }}","patient_name":"={{ $json.entities.patient_name }}","priority_score":"={{ $json.priority_score }}","workflow_state":"={{ $json.workflow_state }}","confidence_level":"={{ $json.confidence_level }}","authorization_status":"={{ $json.action_authorized }}"},"schema":[{"id":"session_id","type":"string","display":true,"required":false,"displayName":"session_id","defaultMatch":true,"canBeUsedToMatch":true},{"id":"intent","type":"string","display":true,"required":false,"displayName":"intent","defaultMatch":true,"canBeUsedToMatch":true},{"id":"workflow_state","type":"string","display":true,"required":false,"displayName":"workflow_state","defaultMatch":true,"canBeUsedToMatch":true},{"id":"confidence_level","type":"number","display":true,"required":false,"displayName":"confidence_level","defaultMatch":true,"canBeUsedToMatch":true},{"id":"priority_score","type":"number","display":true,"required":false,"displayName":"priority_score","defaultMatch":true,"canBeUsedToMatch":true},{"id":"timestamp","type":"string","display":true,"required":false,"displayName":"timestamp","defaultMatch":true,"canBeUsedToMatch":true},{"id":"patient_name","type":"string","display":true,"required":false,"displayName":"patient_name","defaultMatch":true,"canBeUsedToMatch":true},{"id":"action_taken","type":"string","display":true,"required":false,"displayName":"action_taken","defaultMatch":true,"canBeUsedToMatch":true},{"id":"authorization_status","type":"boolean","display":true,"required":false,"displayName":"authorization_status","defaultMatch":true,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["session_id","intent","workflow_state","confidence_level","priority_score","timestamp","patient_name","action_taken","authorization_status"]},"options":{}},"typeVersion":2.6},{"id":"831a8468-820c-44c5-af50-418d9d829db6","name":"Check Patient Eligibility","type":"n8n-nodes-base.postgres","position":[-704,472],"parameters":{"query":"SELECT eligibility_status, insurance_active, consent_on_file FROM patient_eligibility WHERE patient_name = $1","options":{"queryReplacement":"={{ $json.entities.patient_name }}"},"operation":"executeQuery"},"typeVersion":2.6},{"id":"e2631759-4fba-4b51-8ed2-316c698abb52","name":"Retrieve Patient History","type":"n8n-nodes-base.postgres","position":[-1376,472],"parameters":{"query":"SELECT * FROM patient_history WHERE patient_name = $1 ORDER BY visit_date DESC LIMIT 10","options":{"queryReplacement":"={{ $json.entities.patient_name }}"},"operation":"executeQuery"},"typeVersion":2.6},{"id":"6ada8fb5-cdf9-4073-b889-57b22a1cec5b","name":"Calculate Priority Score","type":"n8n-nodes-base.code","position":[-480,472],"parameters":{"mode":"runOnceForEachItem","jsCode":"const intent = $input.item.json.intent;\nconst riskLevel = $input.item.json.patient_risk_level || 'low';\nconst confidenceLevel = $input.item.json.confidence_level;\nconst exceptionsDetected = $input.item.json.audit_metadata?.exceptions_detected || [];\n\n// Priority scoring algorithm\nlet priorityScore = 50; // Base score\n\n// Intent-based priority\nconst intentPriority = {\n  'emergency_indicator': 100,\n  'appointment_request': 30,\n  'appointment_reschedule': 20,\n  'appointment_cancel': 10,\n  'medication_inquiry': 40,\n  'consent_verification': 50,\n  'identity_verification': 50\n};\n\npriorityScore += (intentPriority[intent] || 0);\n\n// Risk level adjustment\nconst riskMultiplier = {\n  'critical': 2.0,\n  'high': 1.5,\n  'medium': 1.0,\n  'low': 0.8\n};\n\npriorityScore *= (riskMultiplier[riskLevel] || 1.0);\n\n// Confidence penalty\nif (confidenceLevel < 0.75) {\n  priorityScore *= 0.7;\n}\n\n// Exception escalation\nif (exceptionsDetected.length > 0) {\n  priorityScore += (exceptionsDetected.length * 15);\n}\n\nreturn {\n  ...($input.item.json),\n  priority_score: Math.round(priorityScore),\n  priority_tier: priorityScore >= 100 ? 'urgent' : priorityScore >= 60 ? 'high' : priorityScore >= 30 ? 'medium' : 'low'\n};"},"typeVersion":2},{"id":"1c44a703-f381-428a-8cfb-a75552378bf3","name":"Validate Business Rules","type":"n8n-nodes-base.code","position":[-928,472],"parameters":{"mode":"runOnceForEachItem","jsCode":"const intent = $input.item.json.intent;\nconst dateTime = $input.item.json.entities.date_time;\nconst department = $input.item.json.entities.department;\n\n// Business hours validation\nconst appointmentDate = new Date(dateTime);\nconst hour = appointmentDate.getHours();\nconst day = appointmentDate.getDay();\n\nlet violations = [];\n\n// Rule 1: Business hours (8 AM - 6 PM)\nif (hour < 8 || hour >= 18) {\n  violations.push('appointment_outside_business_hours');\n}\n\n// Rule 2: No weekend appointments\nif (day === 0 || day === 6) {\n  violations.push('weekend_appointment_not_allowed');\n}\n\n// Rule 3: Department-specific rules\nconst emergencyDepts = ['emergency', 'trauma', 'urgent_care'];\nif (emergencyDepts.includes(department?.toLowerCase()) && intent !== 'emergency_indicator') {\n  violations.push('emergency_dept_requires_emergency_intent');\n}\n\nreturn {\n  ...($input.item.json),\n  business_rules_validation: {\n    passed: violations.length === 0,\n    violations: violations,\n    validated_at: new Date().toISOString()\n  }\n};"},"typeVersion":2},{"id":"03007106-8bae-4192-b988-6dc69f5e9896","name":"Department Availability Checker Tool","type":"@n8n/n8n-nodes-langchain.toolCode","position":[-2064,664],"parameters":{"jsCode":"const department = $input.params.department;\nconst requestedDateTime = $input.params.date_time;\n\n// Simulated availability check (replace with actual API call)\nconst availableSlots = {\n  'cardiology': ['2024-02-15T09:00:00Z', '2024-02-15T14:00:00Z'],\n  'orthopedics': ['2024-02-16T10:00:00Z', '2024-02-16T15:00:00Z'],\n  'neurology': ['2024-02-17T11:00:00Z']\n};\n\nconst isAvailable = availableSlots[department?.toLowerCase()]?.includes(requestedDateTime);\n\nreturn {\n  department: department,\n  requested_time: requestedDateTime,\n  is_available: isAvailable,\n  next_available_slots: availableSlots[department?.toLowerCase()] || [],\n  checked_at: new Date().toISOString()\n};","description":"Checks if a specific hospital department has available appointment slots for a given date and time. Returns availability status and next available slot if requested time is unavailable."},"typeVersion":1.3},{"id":"43b5a0f0-8064-4cc0-80ad-824d7dd2cde6","name":"Patient Consent Validator Tool","type":"@n8n/n8n-nodes-langchain.toolCode","position":[-1888,672],"parameters":{"jsCode":"const patientName = $input.params.patient_name;\nconst actionType = $input.params.action_type;\n\n// Simulated consent validation (replace with actual database query)\nconst consentRecords = {\n  'John Doe': {\n    consent_on_file: true,\n    consent_types: ['appointment_scheduling', 'data_sharing'],\n    expiration_date: '2025-12-31',\n    last_updated: '2024-01-15'\n  }\n};\n\nconst patientConsent = consentRecords[patientName];\nconst hasValidConsent = patientConsent?.consent_on_file && \n                        patientConsent?.consent_types?.includes(actionType) &&\n                        new Date(patientConsent?.expiration_date) > new Date();\n\nreturn {\n  patient_name: patientName,\n  action_type: actionType,\n  consent_valid: hasValidConsent,\n  consent_types_on_file: patientConsent?.consent_types || [],\n  expiration_date: patientConsent?.expiration_date,\n  requires_renewal: !hasValidConsent,\n  validated_at: new Date().toISOString()\n};","description":"Validates whether a patient has provided necessary consent for the requested action. Checks consent status, expiration dates, and scope of consent."},"typeVersion":1.3},{"id":"5dd16f89-ed14-45f9-9086-ee8a1cb000d7","name":"Check Confidence Threshold","type":"n8n-nodes-base.if","position":[-1568,560],"parameters":{"options":{},"conditions":{"options":{"leftValue":"","caseSensitive":false,"typeValidation":"loose"},"combinator":"and","conditions":[{"id":"id-1","operator":{"type":"number","operation":"gte"},"leftValue":"={{ $json.confidence_level }}","rightValue":"0.75"}]}},"typeVersion":2.3},{"id":"ff21d9c1-3e1d-49af-8b88-66ab86f60c48","name":"Enrich with Patient Context","type":"n8n-nodes-base.set","position":[-1152,472],"parameters":{"options":{},"assignments":{"assignments":[{"id":"id-1","name":"previous_visits","type":"array","value":"={{ $('Retrieve Patient History').all() }}"},{"id":"id-2","name":"patient_risk_level","type":"string","value":"={{ $('Retrieve Patient History').first().json.risk_level }}"}]},"includeOtherFields":true},"typeVersion":3.4},{"id":"ed3a2c66-996d-45d7-8f11-6424d6540a5a","name":"Prepare Escalation Data","type":"n8n-nodes-base.set","position":[192,688],"parameters":{"options":{},"assignments":{"assignments":[{"id":"id-1","name":"escalation_reason","type":"string","value":"Low confidence score - requires human review"},{"id":"id-2","name":"escalation_priority","type":"string","value":"high"},{"id":"id-3","name":"original_confidence","type":"number","value":"={{ $json.confidence_level }}"}]},"includeOtherFields":true},"typeVersion":3.4},{"id":"039f7794-c651-42b6-98f4-62a83c7080fa","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-1584,-32],"parameters":{"color":4,"width":688,"height":304,"content":"## Prerequisites\nActive OpenAI API account, hospital system API access for appointments and notifications\n## Use Cases\nEmergency department patient intake, urgent care prioritization, virtual triage for telehealth\n## Customization\nModify triage agent prompts to reflect your clinical protocols, adjust priority scoring algorithms\n## Benefits\nAccelerates triage processing by 60%, ensures standardized clinical assessment"},"typeVersion":1},{"id":"32b560ff-ee49-4eb9-9342-fcf4cdb945a9","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-2112,-16],"parameters":{"width":480,"height":288,"content":"\n## Setup Steps\n1. Configure OpenAI credentials with API key for AI agent access\n2. Set up Hospital Triage Agent node with your clinical triage protocols\n3. Configure Patient Consent and Structured JSON checkers with validation rules\n4. Connect notification endpoints for Execute Appointment and Send Notification nodes\n5. Set up audit logging system integration in Log Interactions node\n6. Customize business rule validation parameters for your facility's triage categories"},"typeVersion":1},{"id":"86b3d08b-6ce4-46b5-88e3-fbb27cfd73c6","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-2720,-64],"parameters":{"width":592,"height":336,"content":"## How It Works\nThis workflow automates hospital emergency department triage by intelligently processing patient intake information through multiple AI-powered assessment stages. Designed for emergency departments, urgent care centers, and hospital admission teams, it solves the critical challenge of rapid, accurate patient prioritization during high-volume periods. The system captures initial patient data through a chat interface, uses specialized AI agents to analyze medical history and current symptoms, validates business rules for priority assignment, performs stability checks, calculates priority scores, and determines required actions. It then routes patients to appropriate care pathways while sending notifications to relevant medical teams and logging all interactions for audit compliance. The workflow leverages OpenAI models and structured JSON parsing to ensure consistent, protocol-driven triage decisions."},"typeVersion":1},{"id":"6943f600-7e88-42c0-924b-e5d47ba0b66a","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-528,320],"parameters":{"color":7,"width":1712,"height":528,"content":"## Priority Calculation and Care Routing\n**Why:** Computes urgency scores based on assessment data, determines appropriate care pathways (immediate, urgent, standard), triggers notifications to assigned medical teams, and creates audit logs for quality assurance and regulatory compliance."},"typeVersion":1},{"id":"4ed9945f-c53f-45ef-a05e-3af7ad1f6fc5","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[-2224,304],"parameters":{"color":7,"width":1664,"height":560,"content":"## Multi-Agent AI Medical Assessment\n**Why:** Analyzes patient data through specialized AI models including OpenAI for symptom interpretation, structured JSON checkers for protocol validation, and stability assessment to ensure systematic evaluation aligned with clinical guidelines."},"typeVersion":1},{"id":"f2185f43-a8b1-46db-a525-2999bf87722b","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[-2736,304],"parameters":{"color":7,"width":496,"height":544,"content":"## Patient Data Collection via Chat Interface\n**Why:** Captures initial symptoms, medical history, and vital signs through conversational interface, reducing intake time while gathering comprehensive information needed for accurate triage assessment."},"typeVersion":1}],"active":false,"pinData":{},"settings":{"availableInMCP":false,"executionOrder":"v1"},"versionId":"b43c1197-2a97-429a-a9c8-360769270528","connections":{"OpenAI Chat Model":{"ai_languageModel":[[{"node":"Hospital Triage Agent","type":"ai_languageModel","index":0}]]},"Send Notification":{"main":[[{"node":"Format Response to Patient","type":"main","index":0}]]},"Conversation Memory":{"ai_memory":[[{"node":"Hospital Triage Agent","type":"ai_memory","index":0},{"node":"Patient Chat Interface","type":"ai_memory","index":0}]]},"Route by Intent Type":{"main":[[{"node":"Log Interaction to Audit DB","type":"main","index":0}]]},"Check Action Required":{"main":[[{"node":"Execute Appointment Action","type":"main","index":0}],[{"node":"Format Response to Patient","type":"main","index":0}]]},"Hospital Triage Agent":{"main":[[{"node":"Check Confidence Threshold","type":"main","index":0}]]},"Patient Chat Interface":{"main":[[{"node":"Hospital Triage Agent","type":"main","index":0}]]},"Prepare Escalation Data":{"main":[[{"node":"Format Response to Patient","type":"main","index":0}]]},"Validate Business Rules":{"main":[[{"node":"Check Patient Eligibility","type":"main","index":0}]]},"Calculate Priority Score":{"main":[[{"node":"Check Action Required","type":"main","index":0}]]},"Retrieve Patient History":{"main":[[{"node":"Enrich with Patient Context","type":"main","index":0}]]},"Check Patient Eligibility":{"main":[[{"node":"Calculate Priority Score","type":"main","index":0}]]},"Check Confidence Threshold":{"main":[[{"node":"Retrieve Patient History","type":"main","index":0}],[{"node":"Prepare Escalation Data","type":"main","index":0}]]},"Execute Appointment Action":{"main":[[{"node":"Send Notification","type":"main","index":0}]]},"Format Response to Patient":{"main":[[{"node":"Route by Intent Type","type":"main","index":0}]]},"Enrich with Patient Context":{"main":[[{"node":"Validate Business Rules","type":"main","index":0}]]},"Structured JSON Output Parser":{"ai_outputParser":[[{"node":"Hospital Triage Agent","type":"ai_outputParser","index":0}]]},"Patient Consent Validator Tool":{"ai_tool":[[{"node":"Hospital Triage Agent","type":"ai_tool","index":0}]]},"Department Availability Checker Tool":{"ai_tool":[[{"node":"Hospital Triage Agent","type":"ai_tool","index":0}]]}}}