{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "0f1899ac-f784-432b-b08b-c758fc0ae0e9",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2096,
        336
      ],
      "parameters": {
        "width": 400,
        "height": 460,
        "content": "## \ud83c\udfe5 AI HEALTH ASSISTANT\n\n**IMPORTANT DISCLAIMER:**\nThis tool provides general health information only and is NOT a substitute for professional medical advice, diagnosis, or treatment. Always consult qualified healthcare providers for medical concerns.\n\n### \u2728 Features:\n\u2022 Symptom analysis & information\n\u2022 General health guidance\n\u2022 Medicine reminders\n\u2022 Appointment scheduling hints\n\u2022 Emergency detection\n\u2022 Multi-language support\n\u2022 Privacy-first design\n\n### \ud83c\udfaf Use Cases:\n\u2022 Initial symptom research\n\u2022 Health education\n\u2022 Medication tracking\n\u2022 Wellness tips\n\u2022 Pre-appointment preparation"
      },
      "typeVersion": 1
    },
    {
      "id": "deb1ca17-b64b-4e00-a683-b7755da214ed",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2496,
        336
      ],
      "parameters": {
        "width": 320,
        "height": 400,
        "content": "## \u26a0\ufe0f SAFETY PROTOCOLS\n\n**Emergency Detection:**\n\u2022 Chest pain \u2192 Call 911\n\u2022 Breathing difficulty \u2192 Call 911\n\u2022 Stroke symptoms \u2192 Call 911\n\u2022 Severe bleeding \u2192 Call 911\n\u2022 Loss of consciousness \u2192 Call 911\n\n**Auto-Escalation:**\n\u2022 Detects emergency keywords\n\u2022 Provides emergency numbers\n\u2022 Refuses diagnosis\n\u2022 Recommends immediate care\n\n**Privacy:**\n\u2022 No data storage\n\u2022 Anonymous processing\n\u2022 HIPAA considerations\n\u2022 Encrypted transmission"
      },
      "typeVersion": 1
    },
    {
      "id": "b4a70164-b699-437b-b14a-005bd09a9709",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2848,
        336
      ],
      "parameters": {
        "width": 280,
        "height": 420,
        "content": "## \ud83d\udccb SYMPTOM CATEGORIES\n\n**Supported Areas:**\n\n**General:**\n\u2022 Fever & chills\n\u2022 Fatigue\n\u2022 Pain locations\n\u2022 Weight changes\n\n**Respiratory:**\n\u2022 Cough types\n\u2022 Breathing issues\n\u2022 Congestion\n\n**Digestive:**\n\u2022 Stomach pain\n\u2022 Nausea\n\u2022 Changes in habits\n\n**Mental Health:**\n\u2022 Stress levels\n\u2022 Sleep patterns\n\u2022 Mood changes\n\n**Skin:**\n\u2022 Rashes\n\u2022 Changes\n\u2022 Irritations"
      },
      "typeVersion": 1
    },
    {
      "id": "a6b65561-b7a3-4b61-a840-5c03cc76f160",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2096,
        800
      ],
      "parameters": {
        "width": 320,
        "height": 380,
        "content": "## \ud83d\udd27 CONFIGURATION\n\n**Required Setup:**\n- [ ] OpenAI API key\n- [ ] Emergency contacts database\n- [ ] Disclaimer acceptance\n- [ ] Language settings\n\n**Optional:**\n- [ ] Medical database API\n- [ ] Translation service\n- [ ] SMS notifications\n- [ ] Healthcare provider API\n- [ ] Appointment systems\n\n**Compliance:**\n\u2022 Review local regulations\n\u2022 Add required disclaimers\n\u2022 Implement data retention\n\u2022 Audit logging"
      },
      "typeVersion": 1
    },
    {
      "id": "eb928de3-4198-48d8-bd90-1dd1df9b9c92",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3200,
        336
      ],
      "parameters": {
        "width": 350,
        "height": 400,
        "content": "## \ud83d\udcac EXAMPLE INTERACTIONS\n\n**User:** \"I have a headache for 3 days\"\n**Bot:** Provides general info about headaches, when to see doctor, self-care tips\n\n**User:** \"Chest pain can't breathe\"\n**Bot:** EMERGENCY - Call 911 immediately\n\n**User:** \"Remind me medications\"\n**Bot:** Sets up medication schedule\n\n**User:** \"Rash on arm, itchy\"\n**Bot:** General info about rashes, suggests pharmacist/doctor visit\n\n**User:** \"Feeling anxious lately\"\n**Bot:** Mental health resources, coping strategies, professional help info"
      },
      "typeVersion": 1
    },
    {
      "id": "16d6caa7-c116-4c58-a09f-93d341c83839",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3600,
        336
      ],
      "parameters": {
        "width": 300,
        "height": 420,
        "content": "## \ud83d\udcca FEATURES ROADMAP\n\n**Current:**\n\u2705 Symptom information\n\u2705 Emergency detection\n\u2705 General guidance\n\u2705 Multi-language\n\n**Planned:**\n\ud83d\udd04 Medicine interactions\n\ud83d\udd04 Appointment booking\n\ud83d\udd04 Health tracking\n\ud83d\udd04 Family profiles\n\ud83d\udd04 Wearable integration\n\ud83d\udd04 Telemedicine prep\n\ud83d\udd04 Insurance info\n\ud83d\udd04 Prescription reminders\n\n**Future:**\n\ud83d\udd2e AI health predictions\n\ud83d\udd2e Personalized wellness\n\ud83d\udd2e Medical record analysis"
      },
      "typeVersion": 1
    },
    {
      "id": "60230b94-3c91-4c15-8e23-ad5ac561547f",
      "name": "Health Query Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        2400,
        944
      ],
      "parameters": {
        "path": "health-assistant",
        "options": {
          "responseHeaders": {
            "entries": [
              {
                "name": "Access-Control-Allow-Origin",
                "value": "*"
              },
              {
                "name": "X-Content-Type-Options",
                "value": "nosniff"
              }
            ]
          }
        },
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 1.1
    },
    {
      "id": "90fd6c2e-c196-4568-967e-db7f93846241",
      "name": "Safety Check & Categorization",
      "type": "n8n-nodes-base.code",
      "position": [
        2608,
        944
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "deb8c2c8-a395-4bbe-bf7f-da0db5377ce6",
      "name": "Emergency Router",
      "type": "n8n-nodes-base.if",
      "position": [
        2800,
        944
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": false,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "c5528e99-6c2d-469e-aec6-ad5b07d5c8f1",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.isEmergency }}",
              "rightValue": true
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "7b2fd37e-7390-4e9d-b1ef-765f425a77e4",
      "name": "Emergency Response",
      "type": "n8n-nodes-base.set",
      "onError": "continueRegularOutput",
      "position": [
        3008,
        848
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "emergency",
              "name": "response",
              "type": "string",
              "value": "=\ud83d\udea8 EMERGENCY DETECTED \ud83d\udea8\n\n**CALL EMERGENCY SERVICES IMMEDIATELY:**\n\n\ud83c\uddfa\ud83c\uddf8 USA: 911\n\ud83c\uddec\ud83c\udde7 UK: 999\n\ud83c\uddea\ud83c\uddfa EU: 112\n\ud83c\udde6\ud83c\uddfa Australia: 000\n\n**Your message suggests a medical emergency.**\n\nWhile waiting for help:\n1. Stay calm\n2. Don't drive yourself\n3. Unlock doors for paramedics\n4. Have medications list ready\n5. Call someone to be with you\n\n**This is an automated response. Get immediate medical help!**"
            },
            {
              "id": "type",
              "name": "responseType",
              "type": "string",
              "value": "emergency"
            },
            {
              "id": "severity",
              "name": "severity",
              "type": "string",
              "value": "critical"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "3ccc7fbb-5dfa-4172-aaa6-b5a9e03e7f60",
      "name": "Health Information AI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "onError": "continueRegularOutput",
      "position": [
        3008,
        1040
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "options": {
          "maxTokens": 1000,
          "temperature": 0.3
        },
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "=You are a helpful health information assistant. You provide general health information and wellness guidance while being very careful to:\n\n1. NEVER diagnose conditions\n2. NEVER prescribe medications\n3. NEVER replace professional medical advice\n4. ALWAYS recommend consulting healthcare providers for medical concerns\n5. ALWAYS emphasize this is general information only\n\nYour responses should be:\n- Informative but cautious\n- Empathetic and supportive\n- Clear about limitations\n- Focused on general wellness\n- Encouraging professional consultation\n\nFor symptom queries:\n- Provide general information about possible causes\n- Suggest when to see a doctor\n- Offer comfort measures if appropriate\n- Never minimize serious symptoms\n\nFor medication queries:\n- Only provide general information\n- Emphasize consulting pharmacists/doctors\n- Never suggest specific dosages\n- Mention common side effects only generally\n\nAlways end with a disclaimer about seeking professional medical advice."
            },
            {
              "content": "={{ $json.userInput }}\n\nContext:\n- Query Type: {{ $json.queryType }}\n- Language: {{ $json.language }}\n- Age Group: {{ $json.age }}\n\nPlease provide helpful general health information while being clear this is not medical advice."
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3ccf1d16-3c94-47d3-abd3-7cfaa2a28bf4",
      "name": "Check AI Success",
      "type": "n8n-nodes-base.if",
      "position": [
        3216,
        1040
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": false,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "c5528e99-6c2d-469e-aec6-ad5b07d5c8f1",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.error === undefined }}",
              "rightValue": true
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "1e382d1e-cc65-4f18-926c-39292dbe3aec",
      "name": "AI Error Handler",
      "type": "n8n-nodes-base.set",
      "onError": "continueRegularOutput",
      "position": [
        3216,
        1136
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "error_response",
              "name": "response",
              "type": "string",
              "value": "=An unexpected error occurred while processing your health query. Please try again later or consult a healthcare professional directly. We apologize for the inconvenience."
            },
            {
              "id": "error_type",
              "name": "responseType",
              "type": "string",
              "value": "error"
            },
            {
              "id": "error_severity",
              "name": "severity",
              "type": "string",
              "value": "high"
            },
            {
              "id": "error_disclaimer",
              "name": "disclaimer",
              "type": "string",
              "value": "=\u2695\ufe0f **Important Medical Disclaimer:**\nThis information is for educational purposes only and is not a substitute for professional medical advice, diagnosis, or treatment. Always seek the advice of your physician or other qualified health provider with any questions you may have regarding a medical condition."
            },
            {
              "id": "error_resources",
              "name": "resources",
              "type": "string",
              "value": "=\ud83d\udcde **Health Resources:**\n\u2022 Find a doctor: https://doctor.webmd.com/\n\u2022 Symptom checker: https://www.mayoclinic.org/symptom-checker/\n\u2022 Mental health: https://www.samhsa.gov/find-help/national-helpline\n\u2022 Poison control: 1-800-222-1222 (US)"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "5a9771b4-4772-4243-9dde-cd3a3aae6662",
      "name": "Format Health Response",
      "type": "n8n-nodes-base.set",
      "onError": "continueRegularOutput",
      "position": [
        3408,
        1040
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "3d0292bc-0e07-4b55-9b7f-be0b417c2e05",
              "name": "response",
              "type": "string",
              "value": "={{ $json.message.content }}"
            },
            {
              "id": "e4e66a7a-1776-465b-865f-76666c5e3584",
              "name": "responseType",
              "type": "string",
              "value": "={{ $('Safety Check & Categorization').item.json.queryType }}"
            },
            {
              "id": "b2346867-40bb-4321-a3bd-59b948036dca",
              "name": "disclaimer",
              "type": "string",
              "value": "=\u2695\ufe0f **Important Medical Disclaimer:**\nThis information is for educational purposes only and is not a substitute for professional medical advice, diagnosis, or treatment. Always seek the advice of your physician or other qualified health provider with any questions you may have regarding a medical condition."
            },
            {
              "id": "8f30e7de-3dcb-412f-bcd8-d8bbfff087fb",
              "name": "resources",
              "type": "string",
              "value": "=\ud83d\udcde **Health Resources:**\n\u2022 Find a doctor: https://doctor.webmd.com/\n\u2022 Symptom checker: https://www.mayoclinic.org/symptom-checker/\n\u2022 Mental health: https://www.samhsa.gov/find-help/national-helpline\n\u2022 Poison control: 1-800-222-1222 (US)"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "66241fed-f419-4037-81e3-29e80263090b",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        3616,
        944
      ],
      "parameters": {
        "mode": "combine",
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "60a6aee7-0417-4922-9f2b-1c1d0dfc8ffc",
      "name": "Compile Final Response",
      "type": "n8n-nodes-base.code",
      "position": [
        3808,
        944
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "ec634d96-78d8-49f0-baef-e486ba3d1c31",
      "name": "Send Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        4016,
        944
      ],
      "parameters": {
        "options": {
          "responseCode": 200,
          "responseHeaders": {
            "entries": [
              {
                "name": "Content-Type",
                "value": "application/json"
              },
              {
                "name": "X-Health-Disclaimer",
                "value": "This is not medical advice"
              }
            ]
          }
        },
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify($json, null, 2) }}"
      },
      "typeVersion": 1.1
    },
    {
      "id": "b53c438d-9f33-4e89-ae4f-f63159d3db7f",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3600,
        800
      ],
      "parameters": {
        "width": 300,
        "height": 400,
        "content": "## \ud83d\udcf1 INTEGRATION OPTIONS\n\n**Channels:**\n\u2022 Web chat widget\n\u2022 WhatsApp Business\n\u2022 Telegram bot\n\u2022 SMS gateway\n\u2022 Voice assistants\n\u2022 Mobile apps\n\n**Healthcare Systems:**\n\u2022 EHR integration\n\u2022 Appointment APIs\n\u2022 Pharmacy systems\n\u2022 Insurance verification\n\u2022 Telemedicine platforms\n\n**Data Sources:**\n\u2022 Medical databases\n\u2022 Drug interaction APIs\n\u2022 Symptom databases\n\u2022 Provider directories"
      },
      "typeVersion": 1
    },
    {
      "id": "8eb78198-9b5a-4fae-b822-3dff7c3b6db8",
      "name": "Audit Log (Optional)",
      "type": "n8n-nodes-base.airtable",
      "position": [
        3808,
        1136
      ],
      "parameters": {
        "resource": "database"
      },
      "typeVersion": 2
    }
  ],
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Compile Final Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check AI Success": {
      "main": [
        [
          {
            "node": "Format Health Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "AI Error Handler",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Emergency Router": {
      "main": [
        [
          {
            "node": "Emergency Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Health Information AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Emergency Response": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Health Query Webhook": {
      "main": [
        [
          {
            "node": "Safety Check & Categorization",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Health Information AI": {
      "main": [
        [
          {
            "node": "Check AI Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Compile Final Response": {
      "main": [
        [
          {
            "node": "Send Response",
            "type": "main",
            "index": 0
          },
          {
            "node": "Audit Log (Optional)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Health Response": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Safety Check & Categorization": {
      "main": [
        [
          {
            "node": "Emergency Router",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}