{"workflow":{"id":10493,"name":"Process ADR intake and PV cases with Claude AI and Google Sheets","views":15,"recentViews":0,"totalViews":15,"createdAt":"2025-11-04T10:58:18.416Z","description":"This workflow automates end-to-end pharmacovigilance (PV) case processing. It ingests ADR reports from web forms or emails, extracts and classifies events using Claude AI against MedDRA terminology, enriches with historical signal data, persists to a PV database, and triggers expedited regulatory alerts for serious/unexpected events.\n\n### How it works\n\n1. **Ingest ADR Report** - Webhook receives ADR submission from patient/HCP portal or email parser\n2. **Validate & Normalize** - Checks ICH E2B(R3) required fields, assigns case ID, classifies reporter\n3. **Wait — Deduplication Window** - 10-minute hold to catch duplicate submissions from the same reporter\n4. **Claude AI Medical Coding** - Extracts MedDRA PTs, classifies seriousness, causality, and expectedness\n5. **Signal Detection Enrichment** - Queries historical PV database for disproportionality signals (PRR/ROR)\n6. **Wait — Regulatory Clock** - Holds until expedited report window (7-day/15-day) deadline check\n7. **Persist PV Case Record** - Writes structured E2B-compliant case to Google Sheets PV database\n8. **Expedited Alert & Reporting** - Notifies PV team, triggers regulatory submission for serious/unexpected cases\n9. **Audit & Compliance Log** - Full chain of custody for EMA/FDA inspection readiness\n\n### Setup Steps\n\n1. Import workflow into n8n\n2. Configure credentials:\n   - **Anthropic API** - Claude AI for medical coding and causality assessment\n   - **Google Sheets** - PV case database and audit log\n   - **SMTP / Gmail** - Alerts to PV team and regulatory affairs\n3. Set your product name, MAH name, and regulatory contact email\n4. Configure signal detection thresholds (PRR, ROR) in enrichment node\n5. Activate workflow\n\n### Sample ADR Payload\n```json\n{\n  \"productName\": \"DrugX 50mg\",\n  \"reporterType\": \"physician\",\n  \"reporterEmail\": \"dr.smith@hospital.com\",\n  \"patientAge\": 54,\n  \"patientSex\": \"female\",\n  \"adverseEvent\": \"severe chest pain and shortness of breath\",\n  \"eventOnsetDate\": \"2025-02-20\",\n  \"drugStartDate\": \"2025-01-10\",\n  \"doseStrength\": \"50mg\",\n  \"dosageFrequency\": \"once daily\",\n  \"outcome\": \"hospitalized\",\n  \"dechallenge\": true,\n  \"rechallenge\": false\n}\n```\n\n### Regulatory Framework\n- **ICH E2B(R3)** — Electronic transmission of ICSRs\n- **ICH E2A** — Expedited reporting (7-day fatal/life-threatening, 15-day serious unexpected)\n- **FDA 21 CFR 314.81** — NDA post-marketing reporting\n- **EMA GVP Module VI** — Management and reporting of adverse reactions\n\n**Explore More LinkedIn & Social Automation:**  \n[Contact us](https://www.oneclickitsolution.com/contact-us/) to design AI-powered lead nurturing, content engagement, and multi-platform reply workflows tailored to your growth strategy.","workflow":{"id":"X4Zr9hLvkG7Ni3SB","meta":{"instanceId":"dd69efaf8212c74ad206700d104739d3329588a6f3f8381a46a481f34c9cc281","templateCredsSetupCompleted":true},"name":"Adverse Drug Event (ADR) Intake and PV Case Processing with Signal Detection and Claude AI","tags":[],"nodes":[{"id":"5f98098a-a599-4669-99a2-8b3a36043e3c","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-112,-112],"parameters":{"width":780,"height":1292,"content":"## Adverse Drug Event (ADR) Intake & PV Case Processing with Claude AI\n\nThis workflow automates end-to-end pharmacovigilance (PV) case processing. It ingests ADR reports from web forms or emails, extracts and classifies events using Claude AI against MedDRA terminology, enriches with historical signal data, persists to a PV database, and triggers expedited regulatory alerts for serious/unexpected events.\n\n### How it works\n\n1. **Ingest ADR Report** - Webhook receives ADR submission from patient/HCP portal or email parser\n2. **Validate & Normalize** - Checks ICH E2B(R3) required fields, assigns case ID, classifies reporter\n3. **Wait — Deduplication Window** - 10-minute hold to catch duplicate submissions from the same reporter\n4. **Claude AI Medical Coding** - Extracts MedDRA PTs, classifies seriousness, causality, and expectedness\n5. **Signal Detection Enrichment** - Queries historical PV database for disproportionality signals (PRR/ROR)\n6. **Wait — Regulatory Clock** - Holds until expedited report window (7-day/15-day) deadline check\n7. **Persist PV Case Record** - Writes structured E2B-compliant case to Google Sheets PV database\n8. **Expedited Alert & Reporting** - Notifies PV team, triggers regulatory submission for serious/unexpected cases\n9. **Audit & Compliance Log** - Full chain of custody for EMA/FDA inspection readiness\n\n### Setup Steps\n\n1. Import workflow into n8n\n2. Configure credentials:\n   - **Anthropic API** - Claude AI for medical coding and causality assessment\n   - **Google Sheets** - PV case database and audit log\n   - **SMTP / Gmail** - Alerts to PV team and regulatory affairs\n3. Set your product name, MAH name, and regulatory contact email\n4. Configure signal detection thresholds (PRR, ROR) in enrichment node\n5. Activate workflow\n\n### Sample ADR Payload\n```json\n{\n  \"productName\": \"DrugX 50mg\",\n  \"reporterType\": \"physician\",\n  \"reporterEmail\": \"dr.smith@hospital.com\",\n  \"patientAge\": 54,\n  \"patientSex\": \"female\",\n  \"adverseEvent\": \"severe chest pain and shortness of breath\",\n  \"eventOnsetDate\": \"2025-02-20\",\n  \"drugStartDate\": \"2025-01-10\",\n  \"doseStrength\": \"50mg\",\n  \"dosageFrequency\": \"once daily\",\n  \"outcome\": \"hospitalized\",\n  \"dechallenge\": true,\n  \"rechallenge\": false\n}\n```\n\n### Regulatory Framework\n- **ICH E2B(R3)** — Electronic transmission of ICSRs\n- **ICH E2A** — Expedited reporting (7-day fatal/life-threatening, 15-day serious unexpected)\n- **FDA 21 CFR 314.81** — NDA post-marketing reporting\n- **EMA GVP Module VI** — Management and reporting of adverse reactions"},"typeVersion":1},{"id":"85f9d189-69e8-4ba7-ad91-13732aec9337","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[788,408],"parameters":{"color":6,"width":440,"height":328,"content":"## 1. ADR Ingestion & Validation"},"typeVersion":1},{"id":"9c2612f2-28d4-4957-8e03-5a7c37520fa7","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[1258,260],"parameters":{"color":6,"width":956,"height":684,"content":"## 2. Dedup Wait + AI Medical Coding"},"typeVersion":1},{"id":"c1bbc8d2-7927-44a4-aa7f-56940b20d61d","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[2272,368],"parameters":{"color":6,"width":816,"height":460,"content":"## 3. Signal Enrichment + Regulatory Clock Wait"},"typeVersion":1},{"id":"d05a9b20-6f0e-4f44-a774-bb098e8ed836","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[3124,244],"parameters":{"color":6,"width":1192,"height":716,"content":"## 4. Persist, Alert, Expedited Report & Audit"},"typeVersion":1},{"id":"9178d557-c81b-4588-86a7-0164dbba9a46","name":"Receive ADR Report","type":"n8n-nodes-base.webhook","position":[848,576],"webhookId":"adr-intake-webhook","parameters":{"path":"adr-intake","options":{},"httpMethod":"POST","responseMode":"responseNode"},"typeVersion":2},{"id":"b2b71541-dbc9-4506-af7e-5371b9e34c78","name":"Validate and Normalize ADR Intake","type":"n8n-nodes-base.code","position":[1072,576],"parameters":{"mode":"runOnceForEachItem","jsCode":"// Extract ADR report from request body\nconst body = $input.item.json.body || $input.item.json;\n\n// --- ICH E2B(R3) minimum required fields ---\nconst required = ['productName', 'reporterType', 'adverseEvent'];\nconst missing = required.filter(f => !body[f]);\nif (missing.length > 0) {\n  throw new Error(`ICH E2B Validation Failure — Missing required fields: ${missing.join(', ')}`);\n}\n\n// Validate reporter type against E2B allowed values\nconst validReporterTypes = ['physician', 'pharmacist', 'other_healthcare_professional', 'lawyer', 'consumer', 'patient', 'other'];\nconst reporterType = body.reporterType?.toLowerCase().replace(/ /g, '_') || 'other';\nif (!validReporterTypes.includes(reporterType)) {\n  throw new Error(`Invalid reporterType '${body.reporterType}'. Must be one of: ${validReporterTypes.join(', ')}`);\n}\n\n// Validate dates if provided\nconst parseDate = (d) => d ? new Date(d) : null;\nconst eventOnsetDate = parseDate(body.eventOnsetDate);\nconst drugStartDate = parseDate(body.drugStartDate);\nconst drugStopDate = parseDate(body.drugStopDate);\n\nif (eventOnsetDate && isNaN(eventOnsetDate.getTime())) {\n  throw new Error(`Invalid eventOnsetDate: ${body.eventOnsetDate}`);\n}\nif (drugStartDate && eventOnsetDate && drugStartDate > eventOnsetDate) {\n  throw new Error('Drug start date cannot be after event onset date');\n}\n\n// Calculate time-to-onset (days)\nconst timeToOnsetDays = (drugStartDate && eventOnsetDate)\n  ? Math.round((eventOnsetDate - drugStartDate) / (1000 * 60 * 60 * 24))\n  : null;\n\n// Reporter classification (ICH E2B A.1.4)\nconst isHealthcareProfessional = ['physician', 'pharmacist', 'other_healthcare_professional'].includes(reporterType);\n\n// Generate unique ICSR case ID\nconst caseId = `ICSR-${Date.now()}-${Math.random().toString(36).substr(2, 8).toUpperCase()}`;\n\n// Build normalized PV case\nconst pvCase = {\n  // Case identifiers\n  caseId,\n  localCaseNumber: body.localCaseNumber || caseId,\n  mahName: body.mahName || 'YOUR_COMPANY_NAME',\n  productName: body.productName.trim(),\n  activeSubstance: body.activeSubstance || null,\n  batchNumber: body.batchNumber || null,\n\n  // Reporter (E2B Section A)\n  reporterType,\n  isHealthcareProfessional,\n  reporterName: body.reporterName || null,\n  reporterEmail: body.reporterEmail || null,\n  reporterCountry: body.reporterCountry || 'US',\n  reporterOrganization: body.reporterOrganization || null,\n\n  // Patient (E2B Section B)\n  patientInitials: body.patientInitials || body.patientName?.charAt(0) || 'N/A',\n  patientAge: body.patientAge ? parseInt(body.patientAge) : null,\n  patientSex: body.patientSex || 'unknown',\n  patientWeight: body.patientWeight ? parseFloat(body.patientWeight) : null,\n  patientHeight: body.patientHeight ? parseFloat(body.patientHeight) : null,\n  medicalHistory: body.medicalHistory || [],\n  concomitantMedications: body.concomitantMedications || [],\n\n  // Adverse event (E2B Section D)\n  adverseEventNarrative: body.adverseEvent.trim(),\n  eventOnsetDate: eventOnsetDate ? eventOnsetDate.toISOString() : null,\n  eventEndDate: parseDate(body.eventEndDate)?.toISOString() || null,\n  outcome: body.outcome || 'unknown',\n  dechallenge: body.dechallenge === true || body.dechallenge === 'yes',\n  rechallenge: body.rechallenge === true || body.rechallenge === 'yes',\n\n  // Drug information (E2B Section C)\n  drugStartDate: drugStartDate ? drugStartDate.toISOString() : null,\n  drugStopDate: drugStopDate ? drugStopDate.toISOString() : null,\n  doseStrength: body.doseStrength || null,\n  dosageFrequency: body.dosageFrequency || null,\n  routeOfAdministration: body.routeOfAdministration || 'unknown',\n  indicationForUse: body.indicationForUse || null,\n  timeToOnsetDays,\n\n  // Calculated fields\n  receivedDate: new Date().toISOString(),\n  reportSource: body.reportSource || 'spontaneous',\n  countryOfOccurrence: body.countryOfOccurrence || body.reporterCountry || 'US',\n  status: 'PENDING_DEDUPLICATION',\n  processingStage: 'INTAKE'\n};\n\nreturn { json: { pvCase } };"},"typeVersion":2},{"id":"faf1a413-7d4f-48a1-b2c0-3ae3395671f1","name":"Wait — Deduplication Window (10 min)","type":"n8n-nodes-base.wait","position":[1296,576],"webhookId":"wait-dedup-window","parameters":{"unit":"minutes","amount":10},"typeVersion":1.1},{"id":"b92d6830-cae8-4340-b1d0-37ec7fd2d00e","name":"Check for Duplicate ADR Submission","type":"n8n-nodes-base.googleSheets","position":[1520,504],"parameters":{"options":{},"sheetName":{"__rl":true,"mode":"id","value":"="},"documentId":{"__rl":true,"mode":"id","value":"="}},"credentials":{"googleSheetsOAuth2Api":{"id":"sldw2qK7iVusK0rY","name":"Google Sheets account"}},"typeVersion":4.5,"continueOnFail":true},{"id":"b14c4048-5c91-4435-b35b-2d1d0149160f","name":"Is Duplicate — Skip or Proceed","type":"n8n-nodes-base.if","position":[1744,576],"parameters":{"options":{},"conditions":{"options":{"leftValue":"","caseSensitive":false,"typeValidation":"loose"},"combinator":"and","conditions":[{"operator":{"type":"number","operation":"equals"},"leftValue":"={{ $json.length || 0 }}","rightValue":0}]}},"typeVersion":2},{"id":"cd852ee1-e866-4b83-96cb-4dd208417232","name":"Claude AI Medical Coding and Causality Assessment","type":"@n8n/n8n-nodes-langchain.agent","position":[1968,576],"parameters":{"text":"=You are a senior pharmacovigilance physician and MedDRA coding specialist with expertise in ICH E2A, E2B(R3), FDA 21 CFR 314.81, and EMA GVP Module VI.\n\nAnalyze this adverse drug reaction (ADR) report and provide a structured PV case assessment.\n\n**Product Information:**\n- Product Name: {{ $json.pvCase.productName }}\n- Active Substance: {{ $json.pvCase.activeSubstance || 'Not specified' }}\n- Dose / Frequency: {{ $json.pvCase.doseStrength || 'N/A' }} / {{ $json.pvCase.dosageFrequency || 'N/A' }}\n- Route of Administration: {{ $json.pvCase.routeOfAdministration }}\n- Indication for Use: {{ $json.pvCase.indicationForUse || 'Not specified' }}\n\n**Patient Details:**\n- Age: {{ $json.pvCase.patientAge || 'Unknown' }}, Sex: {{ $json.pvCase.patientSex }}\n- Weight: {{ $json.pvCase.patientWeight || 'N/A' }} kg\n- Medical History: {{ JSON.stringify($json.pvCase.medicalHistory) }}\n- Concomitant Medications: {{ JSON.stringify($json.pvCase.concomitantMedications) }}\n\n**Adverse Event:**\n- Narrative: {{ $json.pvCase.adverseEventNarrative }}\n- Onset Date: {{ $json.pvCase.eventOnsetDate || 'Not specified' }}\n- Time to Onset: {{ $json.pvCase.timeToOnsetDays !== null ? $json.pvCase.timeToOnsetDays + ' days' : 'Not calculable' }}\n- Outcome: {{ $json.pvCase.outcome }}\n- Dechallenge (stopped drug, event improved): {{ $json.pvCase.dechallenge }}\n- Rechallenge (restarted drug, event recurred): {{ $json.pvCase.rechallenge }}\n\n**Reporter:**\n- Type: {{ $json.pvCase.reporterType }}\n- Healthcare Professional: {{ $json.pvCase.isHealthcareProfessional }}\n- Country: {{ $json.pvCase.reporterCountry }}\n\n**Assessment Task:**\n1. Code the adverse event to MedDRA LLT, PT, HLT, HLGT, and SOC\n2. Assess seriousness per ICH E2A criteria (death, life-threatening, hospitalization, disability, congenital anomaly, medically significant)\n3. Assess causality using WHO-UMC criteria (certain, probable/likely, possible, unlikely, unassessable)\n4. Determine expectedness (expected/listed vs unexpected/unlisted in reference safety information)\n5. Calculate regulatory reporting timelines\n6. Identify any signal flags or risk factors\n\n**Response Format (JSON only, no markdown):**\n{\n  \"meddraLLT\": \"Lowest Level Term from MedDRA\",\n  \"meddraPT\": \"Preferred Term\",\n  \"meddraHLT\": \"High Level Term\",\n  \"meddraHLGT\": \"High Level Group Term\",\n  \"meddraSOC\": \"System Organ Class\",\n  \"meddraVersion\": \"27.0\",\n  \"seriousness\": {\n    \"isSerious\": true,\n    \"criteria\": [\"hospitalization\"],\n    \"isFatal\": false,\n    \"isLifeThreatening\": false,\n    \"causedHospitalization\": true,\n    \"causedDisability\": false,\n    \"isCongenitalAnomaly\": false,\n    \"isMedicallySignificant\": false\n  },\n  \"causality\": {\n    \"whoUmcAssessment\": \"probable/likely\",\n    \"causalityRationale\": \"Brief rationale for causality assessment\",\n    \"dechallengePositive\": true,\n    \"rechallengePositive\": false\n  },\n  \"expectedness\": \"unexpected\",\n  \"expectednessRationale\": \"Brief explanation\",\n  \"regulatoryReporting\": {\n    \"requiresExpeditedReport\": true,\n    \"reportingTimelineDays\": 15,\n    \"reportingDeadline\": \"ISO date string\",\n    \"regulatoryBasis\": \"ICH E2A Section III — Serious unexpected ADR\",\n    \"targetAgencies\": [\"FDA\", \"EMA\"]\n  },\n  \"severityGrade\": \"SEVERE\",\n  \"signalFlags\": [\"known drug class effect\", \"potential cardiac signal\"],\n  \"riskFactors\": [\"age > 50\", \"pre-existing cardiac condition\"],\n  \"additionalWorkup\": [\"ECG recommended\", \"cardiac enzyme monitoring\"],\n  \"narrativeSummary\": \"Brief medically worded case summary for the ICSR\",\n  \"pvRecommendation\": \"EXPEDITED_REPORT | PERIODIC_REPORT | CLOSE_MONITOR | NO_ACTION\",\n  \"confidenceLevel\": \"HIGH | MEDIUM | LOW\"\n}","options":{"systemMessage":"You are a senior pharmacovigilance physician and MedDRA coding specialist. Respond with valid JSON only — no markdown, no code blocks, no preamble. Your assessments must strictly adhere to ICH E2A, E2B(R3), MedDRA v27.0, and WHO-UMC causality criteria."},"promptType":"define"},"typeVersion":1.6},{"id":"eb0c0f94-ede3-469b-b6aa-4e8839585b1c","name":"Claude AI Model","type":"@n8n/n8n-nodes-langchain.lmChatAnthropic","position":[2040,800],"parameters":{"model":"=claude-sonnet-4-20250514","options":{"temperature":0.1}},"credentials":{"anthropicApi":{"id":"fK55jZdb6CaYNukq","name":"Anthropic account - test"}},"typeVersion":1},{"id":"4e9d5cd9-64bc-4bcb-a99a-d8e99a046413","name":"Parse AI Medical Coding Output","type":"n8n-nodes-base.code","position":[2320,576],"parameters":{"mode":"runOnceForEachItem","jsCode":"const aiResponse = $input.item.json;\nlet aiText = aiResponse.response || aiResponse.output || aiResponse.text || '';\n\n// Handle Anthropic content array format\nif (aiResponse.content && Array.isArray(aiResponse.content)) {\n  aiText = aiResponse.content[0]?.text || '';\n}\n\n// Strip markdown code blocks\nconst cleanText = aiText\n  .replace(/```json\\s*/g, '')\n  .replace(/```\\s*/g, '')\n  .trim();\n\nlet medicalCoding;\ntry {\n  medicalCoding = JSON.parse(cleanText);\n} catch (error) {\n  throw new Error(`Failed to parse Claude AI medical coding: ${error.message}. Raw: ${cleanText.substring(0, 200)}`);\n}\n\n// Pull the PV case from upstream\nconst pvCase = $('Validate and Normalize ADR Intake').item.json.pvCase;\n\n// Merge medical coding into PV case\npvCase.status = 'CODED';\npvCase.processingStage = 'MEDICAL_CODING';\npvCase.codedAt = new Date().toISOString();\npvCase.codedBy = 'Claude AI PV Engine v1 (ICH E2B R3)';\n\nreturn {\n  json: {\n    pvCase,\n    medicalCoding,\n    isSerious: medicalCoding.seriousness?.isSerious || false,\n    requiresExpeditedReport: medicalCoding.regulatoryReporting?.requiresExpeditedReport || false,\n    reportingDeadlineDays: medicalCoding.regulatoryReporting?.reportingTimelineDays || 15\n  }\n};"},"typeVersion":2},{"id":"b6a6a676-c42f-44db-a000-1469c53b7d5f","name":"Signal Detection — Query Historical PV Database","type":"n8n-nodes-base.googleSheets","position":[2544,512],"parameters":{"options":{},"sheetName":{"__rl":true,"mode":"id","value":"="},"documentId":{"__rl":true,"mode":"id","value":"="},"authentication":"serviceAccount"},"credentials":{"googleApi":{"id":"ScSS2KxGQULuPtdy","name":"Google Sheets- test"}},"typeVersion":4.5,"continueOnFail":true},{"id":"a75daf25-7175-458b-a176-1f005a512d55","name":"Compute Disproportionality Signal (PRR/ROR)","type":"n8n-nodes-base.code","position":[2768,576],"parameters":{"mode":"runOnceForEachItem","jsCode":"// Pull all historical cases for this product+PT combination\nconst historicalCases = $('Signal Detection — Query Historical PV Database').all().map(i => i.json);\nconst currentData = $('Parse AI Medical Coding Output').item.json;\n\n// --- Proportional Reporting Ratio (PRR) and Reporting Odds Ratio (ROR) ---\n// Using simplified 2x2 contingency table approach\n// a = reports of drug+event, b = reports of drug+other events\n// c = reports of other drugs+event, d = reports of other drugs+other events\n\nconst totalHistoricalCases = historicalCases.length;\nconst casesWithSamePT = historicalCases.filter(\n  c => c.meddraPT === currentData.medicalCoding.meddraPT\n).length;\nconst casesWithSameProduct = historicalCases.filter(\n  c => c.productName === currentData.pvCase.productName\n).length;\n\n// Signal thresholds (EMA standard: PRR >= 2, chi-squared >= 4, n >= 3)\nconst PRR_THRESHOLD = 2.0;\nconst ROR_THRESHOLD = 2.0;\nconst MIN_CASES_FOR_SIGNAL = 3;\n\n// Simplified PRR calculation\nlet prr = null;\nlet ror = null;\nlet signalDetected = false;\nlet signalStrength = 'NONE';\n\nif (totalHistoricalCases >= MIN_CASES_FOR_SIGNAL && casesWithSamePT > 0) {\n  const a = casesWithSamePT; // drug + event\n  const b = casesWithSameProduct - casesWithSamePT; // drug + other events\n  const c = totalHistoricalCases - casesWithSameProduct; // other drugs + event (proxy)\n  const d = totalHistoricalCases - a - b - c;\n\n  // PRR = (a / (a+b)) / (c / (c+d))\n  if (b > 0 && c > 0 && d > 0) {\n    prr = parseFloat(((a / (a + b)) / (c / (c + d))).toFixed(2));\n    // ROR = (a/b) / (c/d) = (a*d) / (b*c)\n    ror = parseFloat(((a * d) / (b * c)).toFixed(2));\n  }\n\n  if (prr && prr >= PRR_THRESHOLD && a >= MIN_CASES_FOR_SIGNAL) {\n    signalDetected = true;\n    signalStrength = prr >= 5 ? 'STRONG' : prr >= 3 ? 'MODERATE' : 'WEAK';\n  }\n}\n\n// Cumulative case count for this product+PT\nconst cumulativeCaseCount = casesWithSamePT + 1; // +1 for current case\n\n// Time trend: cases in last 90 days\nconst ninetyDaysAgo = new Date(Date.now() - 90 * 24 * 60 * 60 * 1000);\nconst recentCases = historicalCases.filter(c => {\n  const d = new Date(c.receivedDate);\n  return d > ninetyDaysAgo && c.meddraPT === currentData.medicalCoding.meddraPT;\n}).length;\n\nreturn {\n  json: {\n    pvCase: currentData.pvCase,\n    medicalCoding: currentData.medicalCoding,\n    isSerious: currentData.isSerious,\n    requiresExpeditedReport: currentData.requiresExpeditedReport,\n    reportingDeadlineDays: currentData.reportingDeadlineDays,\n    signalAnalysis: {\n      prr,\n      ror,\n      signalDetected,\n      signalStrength,\n      cumulativeCaseCount,\n      recentCases90Days: recentCases,\n      totalHistoricalCases,\n      analysisMethod: 'PRR/ROR Disproportionality Analysis',\n      analysisThresholds: { prrThreshold: PRR_THRESHOLD, rorThreshold: ROR_THRESHOLD, minCases: MIN_CASES_FOR_SIGNAL },\n      signalNotes: signalDetected\n        ? `Signal detected: PRR=${prr}, ROR=${ror} (${signalStrength}). ${cumulativeCaseCount} cumulative cases for ${currentData.medicalCoding.meddraPT} with ${currentData.pvCase.productName}.`\n        : `No signal threshold crossed. ${cumulativeCaseCount} cumulative case(s) on file.`\n    }\n  }\n};"},"typeVersion":2},{"id":"f9772a5b-1e12-4521-93f2-f6dc2c90327d","name":"Wait — Regulatory Clock Confirmation (30 min)","type":"n8n-nodes-base.wait","position":[2992,576],"webhookId":"wait-regulatory-clock","parameters":{"unit":"minutes","amount":30},"typeVersion":1.1},{"id":"203d1777-3620-431d-8446-552585d40f92","name":"Persist PV Case to Database","type":"n8n-nodes-base.googleSheets","position":[3440,384],"parameters":{"columns":{"value":{},"schema":[],"mappingMode":"autoMapInputData","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"append","sheetName":{"__rl":true,"mode":"id","value":"="},"documentId":{"__rl":true,"mode":"id","value":"="},"authentication":"serviceAccount"},"credentials":{"googleApi":{"id":"ScSS2KxGQULuPtdy","name":"Google Sheets- test"}},"typeVersion":4.5,"continueOnFail":true},{"id":"0bc1d177-06a4-4299-9ae4-37dba3db27eb","name":"Expedited Report Required?","type":"n8n-nodes-base.if","position":[3216,672],"parameters":{"options":{},"conditions":{"options":{"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"or","conditions":[{"operator":{"type":"boolean","operation":"true"},"leftValue":"={{ $json.requiresExpeditedReport }}"},{"operator":{"type":"boolean","operation":"true"},"leftValue":"={{ $json.signalAnalysis.signalDetected }}"}]}},"typeVersion":2},{"id":"5bcd3293-4cb6-42c8-a370-88d963701dce","name":"Alert PV Team — Expedited Report Required","type":"n8n-nodes-base.emailSend","position":[3440,576],"webhookId":"5bfff65f-1b4d-4daa-8832-1b73fa994fa0","parameters":{"options":{},"subject":"=[{{ $json.medicalCoding.seriousness.isFatal ? 'FATAL — 7-DAY' : 'SERIOUS — 15-DAY' }} EXPEDITED] ADR Case {{ $json.pvCase.caseId }} | {{ $json.pvCase.productName }}","toEmail":"=","fromEmail":"="},"credentials":{"smtp":{"id":"3QSx1pWoS0BZcK4c","name":"SMTP account"}},"typeVersion":2.1,"continueOnFail":true},{"id":"919d867a-081c-4470-9e8e-049cf889ef44","name":"Acknowledge ADR Report to Reporter","type":"n8n-nodes-base.emailSend","position":[3440,768],"webhookId":"19475569-5bc5-41e7-8252-6772f6bacab8","parameters":{"options":{},"subject":"=ADR Report Received — Case Reference {{ $json.pvCase.caseId }}","toEmail":"=","fromEmail":"="},"credentials":{"smtp":{"id":"G1kyF8cSWTZ4vouN","name":"SMTP -test"}},"typeVersion":2.1,"continueOnFail":true},{"id":"0eea15a5-9552-4366-b709-971c2b467c84","name":"Build Final PV Case Response","type":"n8n-nodes-base.code","position":[3664,576],"parameters":{"mode":"runOnceForEachItem","jsCode":"const data = $('Compute Disproportionality Signal (PRR/ROR)').item.json;\n\nreturn {\n  json: {\n    success: true,\n    caseId: data.pvCase.caseId,\n    productName: data.pvCase.productName,\n    receivedDate: data.pvCase.receivedDate,\n    processingStatus: 'PROCESSED',\n    medicalCoding: {\n      meddraPT: data.medicalCoding.meddraPT,\n      meddraSOC: data.medicalCoding.meddraSOC,\n      meddraLLT: data.medicalCoding.meddraLLT,\n      severityGrade: data.medicalCoding.severityGrade,\n      causality: data.medicalCoding.causality?.whoUmcAssessment,\n      expectedness: data.medicalCoding.expectedness\n    },\n    seriousness: data.medicalCoding.seriousness,\n    regulatoryReporting: data.medicalCoding.regulatoryReporting,\n    signalAnalysis: data.signalAnalysis,\n    pvRecommendation: data.medicalCoding.pvRecommendation,\n    confidenceLevel: data.medicalCoding.confidenceLevel,\n    processedAt: new Date().toISOString()\n  }\n};"},"typeVersion":2},{"id":"d1458a47-e34b-4cf3-a1aa-b933a7185627","name":"Write to Regulatory Audit Log","type":"n8n-nodes-base.googleSheets","position":[3888,576],"parameters":{"columns":{"value":{},"schema":[],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"append","sheetName":{"__rl":true,"mode":"id","value":"="},"documentId":{"__rl":true,"mode":"id","value":"="},"authentication":"serviceAccount"},"credentials":{"googleApi":{"id":"ScSS2KxGQULuPtdy","name":"Google Sheets- test"}},"typeVersion":4.5,"continueOnFail":true},{"id":"7d238f97-6a2a-4849-875a-8a617e382edf","name":"Send PV Case Intake Response","type":"n8n-nodes-base.respondToWebhook","position":[4112,576],"parameters":{"options":{"responseHeaders":{"entries":[{"name":"Content-Type","value":"application/json"}]}},"respondWith":"json","responseBody":"={{ JSON.stringify($json, null, 2) }}"},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"01cbc67a-ac16-4e4b-b69b-00aef6211ba9","connections":{"Claude AI Model":{"ai_languageModel":[[{"node":"Claude AI Medical Coding and Causality Assessment","type":"ai_languageModel","index":0}]]},"Receive ADR Report":{"main":[[{"node":"Validate and Normalize ADR Intake","type":"main","index":0}]]},"Expedited Report Required?":{"main":[[{"node":"Alert PV Team — Expedited Report Required","type":"main","index":0},{"node":"Acknowledge ADR Report to Reporter","type":"main","index":0}],[{"node":"Acknowledge ADR Report to Reporter","type":"main","index":0}]]},"Persist PV Case to Database":{"main":[[{"node":"Build Final PV Case Response","type":"main","index":0}]]},"Build Final PV Case Response":{"main":[[{"node":"Write to Regulatory Audit Log","type":"main","index":0}]]},"Write to Regulatory Audit Log":{"main":[[{"node":"Send PV Case Intake Response","type":"main","index":0}]]},"Parse AI Medical Coding Output":{"main":[[{"node":"Signal Detection — Query Historical PV Database","type":"main","index":0},{"node":"Compute Disproportionality Signal (PRR/ROR)","type":"main","index":0}]]},"Is Duplicate — Skip or Proceed":{"main":[[{"node":"Claude AI Medical Coding and Causality Assessment","type":"main","index":0}]]},"Validate and Normalize ADR Intake":{"main":[[{"node":"Wait — Deduplication Window (10 min)","type":"main","index":0}]]},"Acknowledge ADR Report to Reporter":{"main":[[{"node":"Build Final PV Case Response","type":"main","index":0}]]},"Check for Duplicate ADR Submission":{"main":[[{"node":"Is Duplicate — Skip or Proceed","type":"main","index":0}]]},"Wait — Deduplication Window (10 min)":{"main":[[{"node":"Check for Duplicate ADR Submission","type":"main","index":0},{"node":"Is Duplicate — Skip or Proceed","type":"main","index":0}]]},"Alert PV Team — Expedited Report Required":{"main":[[{"node":"Build Final PV Case Response","type":"main","index":0}]]},"Compute Disproportionality Signal (PRR/ROR)":{"main":[[{"node":"Wait — Regulatory Clock Confirmation (30 min)","type":"main","index":0}]]},"Wait — Regulatory Clock Confirmation (30 min)":{"main":[[{"node":"Persist PV Case to Database","type":"main","index":0},{"node":"Expedited Report Required?","type":"main","index":0}]]},"Claude AI Medical Coding and Causality Assessment":{"main":[[{"node":"Parse AI Medical Coding Output","type":"main","index":0}]]},"Signal Detection — Query Historical PV Database":{"main":[[{"node":"Compute Disproportionality Signal (PRR/ROR)","type":"main","index":0}]]}}},"lastUpdatedBy":1,"workflowInfo":{"nodeCount":23,"nodeTypes":{"n8n-nodes-base.if":{"count":2},"n8n-nodes-base.code":{"count":4},"n8n-nodes-base.wait":{"count":2},"n8n-nodes-base.webhook":{"count":1},"n8n-nodes-base.emailSend":{"count":2},"n8n-nodes-base.stickyNote":{"count":5},"n8n-nodes-base.googleSheets":{"count":4},"@n8n/n8n-nodes-langchain.agent":{"count":1},"n8n-nodes-base.respondToWebhook":{"count":1},"@n8n/n8n-nodes-langchain.lmChatAnthropic":{"count":1}}},"status":"published","readyToDemo":null,"user":{"name":"Oneclick AI Squad","username":"oneclick-ai","bio":"The AI Squad Initiative is a pioneering effort to build, automate and scale AI-powered workflows using n8n.io. Our mission is to help individuals and businesses integrate AI agents seamlessly into their daily operations  from automating tasks and enhancing productivity to creating innovative, intelligent solutions. We design modular, reusable AI workflow templates that empower creators, developers and teams to supercharge their automation with minimal effort and maximum impact.","verified":true,"links":["https://www.oneclickitsolution.com/"],"avatar":"https://gravatar.com/avatar/848fca91367142f65f9e5c55d64e5c9952b160d7b060d103b52aa343c6bc7b3d?r=pg&d=retro&size=200"},"nodes":[{"id":11,"icon":"fa:envelope","name":"n8n-nodes-base.emailSend","codex":{"data":{"alias":["SMTP","email","human","form","wait","hitl","approval"],"resources":{"generic":[{"url":"https://n8n.io/blog/2021-the-year-to-automate-the-new-you-with-n8n/","icon":"☀️","label":"2021: The Year to Automate the New You with n8n"},{"url":"https://n8n.io/blog/build-your-own-virtual-assistant-with-n8n-a-step-by-step-guide/","icon":"👦","label":"Build your own virtual assistant with n8n: A step by step guide"}],"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.sendemail/"}],"credentialDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/credentials/sendemail/"}]},"categories":["Communication","HITL","Core Nodes"],"nodeVersion":"1.0","codexVersion":"1.0","subcategories":{"HITL":["Human in the Loop"]}}},"group":"[\"output\"]","defaults":{"name":"Send Email","color":"#00bb88"},"iconData":{"icon":"envelope","type":"icon"},"displayName":"Send Email","typeVersion":2,"nodeCategories":[{"id":6,"name":"Communication"},{"id":9,"name":"Core Nodes"},{"id":28,"name":"HITL"}]},{"id":18,"icon":"file:googleSheets.svg","name":"n8n-nodes-base.googleSheets","codex":{"data":{"alias":["CSV","Sheet","Spreadsheet","GS"],"resources":{"generic":[{"url":"https://n8n.io/blog/love-at-first-sight-ricardos-n8n-journey/","icon":"❤️","label":"Love at first sight: Ricardo’s n8n journey"},{"url":"https://n8n.io/blog/why-business-process-automation-with-n8n-can-change-your-daily-life/","icon":"🧬","label":"Why business process automation with n8n can change your daily life"},{"url":"https://n8n.io/blog/automatically-adding-expense-receipts-to-google-sheets-with-telegram-mindee-twilio-and-n8n/","icon":"🧾","label":"Automatically Adding Expense Receipts to Google Sheets with Telegram, Mindee, Twilio, and n8n"},{"url":"https://n8n.io/blog/supercharging-your-conference-registration-process-with-n8n/","icon":"🎫","label":"Supercharging your conference registration process with n8n"},{"url":"https://n8n.io/blog/creating-triggers-for-n8n-workflows-using-polling/","icon":"⏲","label":"Creating triggers for n8n workflows using polling"},{"url":"https://n8n.io/blog/no-code-ecommerce-workflow-automations/","icon":"store","label":"6 e-commerce workflows to power up your Shopify s"},{"url":"https://n8n.io/blog/migrating-community-metrics-to-orbit-using-n8n/","icon":"📈","label":"Migrating Community Metrics to Orbit using n8n"},{"url":"https://n8n.io/blog/automate-google-apps-for-productivity/","icon":"💡","label":"15 Google apps you can combine and automate to increase productivity"},{"url":"https://n8n.io/blog/your-business-doesnt-need-you-to-operate/","icon":" 🖥️","label":"Hey founders! Your business doesn't need you to operate"},{"url":"https://n8n.io/blog/how-honest-burgers-use-automation-to-save-100k-per-year/","icon":"🍔","label":"How Honest Burgers Use Automation to Save $100k per year"},{"url":"https://n8n.io/blog/how-a-digital-strategist-uses-n8n-for-online-marketing/","icon":"💻","label":"How a digital strategist uses n8n for online marketing"},{"url":"https://n8n.io/blog/why-this-product-manager-loves-workflow-automation-with-n8n/","icon":"🧠","label":"Why this Product Manager loves workflow automation with n8n"},{"url":"https://n8n.io/blog/sending-automated-congratulations-with-google-sheets-twilio-and-n8n/","icon":"🙌","label":"Sending Automated Congratulations with Google Sheets, Twilio, and n8n "},{"url":"https://n8n.io/blog/how-a-membership-development-manager-automates-his-work-and-investments/","icon":"📈","label":"How a Membership Development Manager automates his work and investments"},{"url":"https://n8n.io/blog/aws-workflow-automation/","label":"7 no-code workflow automations for Amazon Web Services"}],"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets/"}],"credentialDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/credentials/google/oauth-single-service/"}]},"categories":["Data & Storage","Productivity"],"nodeVersion":"1.0","codexVersion":"1.0"}},"group":"[\"input\",\"output\"]","defaults":{"name":"Google Sheets"},"iconData":{"type":"file","fileBuffer":"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2MCIgaGVpZ2h0PSI2MCI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjxwYXRoIGZpbGw9IiMyOEI0NDYiIGQ9Ik0zNS42OSAxIDUyIDE3LjIyNXYzOS4wODdhMy42NyAzLjY3IDAgMCAxLTEuMDg0IDIuNjFBMy43IDMuNyAwIDAgMSA0OC4yOTMgNjBIMTIuNzA3YTMuNyAzLjcgMCAwIDEtMi42MjMtMS4wNzhBMy42NyAzLjY3IDAgMCAxIDkgNTYuMzEyVjQuNjg4YTMuNjcgMy42NyAwIDAgMSAxLjA4NC0yLjYxQTMuNyAzLjcgMCAwIDEgMTIuNzA3IDF6Ii8+PHBhdGggZmlsbD0iIzZBQ0U3QyIgZD0iTTM1LjY5IDEgNTIgMTcuMjI1SDM5LjM5N2MtMi4wNTQgMC0zLjcwNy0xLjgyOS0zLjcwNy0zLjg3MnoiLz48cGF0aCBmaWxsPSIjMjE5QjM4IiBkPSJNMzkuM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Ljk3NWMwLS44MTcuNjYyLTEuNDc1IDEuNDgzLTEuNDc1aDE3Ljc5NGMuODIxIDAgMS40ODIuNjU4IDEuNDgyIDEuNDc1djE1LjQ4N2MwIC44MTgtLjY2MSAxLjQ3NS0xLjQ4MiAxLjQ3NUgyMC42MDNhMS40NzYgMS40NzYgMCAwIDEtMS40ODItMS40NzRWMzAuOTc0em0yLjIyNSAxLjQ3NWg2LjY3MnYyLjIxMmgtNi42NzJ6bTAgNS4xNjJoNi42NzJ2Mi4yMTNoLTYuNjcyem0wIDUuMTYzaDYuNjcydjIuMjEyaC02LjY3MnptOS42MzgtMTAuMzI1aDYuNjcydjIuMjEyaC02LjY3MnptMCA1LjE2Mmg2LjY3MnYyLjIxM2gtNi42NzJ6bTAgNS4xNjNoNi42NzJ2Mi4yMTJoLTYuNjcyeiIvPjwvZz48L3N2Zz4="},"displayName":"Google Sheets","typeVersion":5,"nodeCategories":[{"id":3,"name":"Data & Storage"},{"id":4,"name":"Productivity"}]},{"id":20,"icon":"fa:map-signs","name":"n8n-nodes-base.if","codex":{"data":{"alias":["Router","Filter","Condition","Logic","Boolean","Branch"],"details":"The IF node can be used to implement binary conditional logic in your workflow. You can set up one-to-many conditions to evaluate each item of data being inputted into the node. That data will either evaluate to TRUE or FALSE and route out of the node accordingly.\n\nThis node has multiple types of conditions: Bool, String, Number, and Date & Time.","resources":{"generic":[{"url":"https://n8n.io/blog/learn-to-automate-your-factorys-incident-reporting-a-step-by-step-guide/","icon":"🏭","label":"Learn to Automate Your Factory's Incident Reporting: A Step by Step Guide"},{"url":"https://n8n.io/blog/2021-the-year-to-automate-the-new-you-with-n8n/","icon":"☀️","label":"2021: The Year to Automate the New You with n8n"},{"url":"https://n8n.io/blog/why-business-process-automation-with-n8n-can-change-your-daily-life/","icon":"🧬","label":"Why business process automation with n8n can change your daily life"},{"url":"https://n8n.io/blog/create-a-toxic-language-detector-for-telegram/","icon":"🤬","label":"Create a toxic language detector for Telegram in 4 step"},{"url":"https://n8n.io/blog/no-code-ecommerce-workflow-automations/","icon":"store","label":"6 e-commerce workflows to power up your Shopify s"},{"url":"https://n8n.io/blog/how-to-build-a-low-code-self-hosted-url-shortener/","icon":"🔗","label":"How to build a low-code, self-hosted URL shortener in 3 steps"},{"url":"https://n8n.io/blog/automate-your-data-processing-pipeline-in-9-steps-with-n8n/","icon":"⚙️","label":"Automate your data processing pipeline in 9 steps"},{"url":"https://n8n.io/blog/how-to-get-started-with-crm-automation-and-no-code-workflow-ideas/","icon":"👥","label":"How to get started with CRM automation (with 3 no-code workflow ideas"},{"url":"https://n8n.io/blog/5-tasks-you-can-automate-with-notion-api/","icon":"⚡️","label":"5 tasks you can automate with the new Notion API "},{"url":"https://n8n.io/blog/automate-google-apps-for-productivity/","icon":"💡","label":"15 Google apps you can combine and automate to increase productivity"},{"url":"https://n8n.io/blog/automation-for-maintainers-of-open-source-projects/","icon":"🏷️","label":"How to automatically manage contributions to open-source projects"},{"url":"https://n8n.io/blog/how-uproc-scraped-a-multi-page-website-with-a-low-code-workflow/","icon":" 🕸️","label":"How uProc scraped a multi-page website with a low-code workflow"},{"url":"https://n8n.io/blog/5-workflow-automations-for-mattermost-that-we-love-at-n8n/","icon":"🤖","label":"5 workflow automations for Mattermost that we love at n8n"},{"url":"https://n8n.io/blog/why-this-product-manager-loves-workflow-automation-with-n8n/","icon":"🧠","label":"Why this Product Manager loves workflow automation with n8n"},{"url":"https://n8n.io/blog/sending-automated-congratulations-with-google-sheets-twilio-and-n8n/","icon":"🙌","label":"Sending Automated Congratulations with Google Sheets, Twilio, and n8n "},{"url":"https://n8n.io/blog/how-to-set-up-a-ci-cd-pipeline-with-no-code/","icon":"🎡","label":"How to set up a no-code CI/CD pipeline with GitHub and TravisCI"},{"url":"https://n8n.io/blog/benefits-of-automation-and-n8n-an-interview-with-hubspots-hugh-durkin/","icon":"🎖","label":"Benefits of automation and n8n: An interview with HubSpot's Hugh Durkin"},{"url":"https://n8n.io/blog/aws-workflow-automation/","label":"7 no-code workflow automations for Amazon Web Services"}],"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.if/"}]},"categories":["Core Nodes"],"nodeVersion":"1.0","codexVersion":"1.0","subcategories":{"Core Nodes":["Flow"]}}},"group":"[\"transform\"]","defaults":{"name":"If","color":"#408000"},"iconData":{"icon":"map-signs","type":"icon"},"displayName":"If","typeVersion":2,"nodeCategories":[{"id":9,"name":"Core Nodes"}]},{"id":47,"icon":"file:webhook.svg","name":"n8n-nodes-base.webhook","codex":{"data":{"alias":["HTTP","API","Build","WH"],"resources":{"generic":[{"url":"https://n8n.io/blog/learn-how-to-automatically-cross-post-your-content-with-n8n/","icon":"✍️","label":"Learn how to automatically cross-post your content with n8n"},{"url":"https://n8n.io/blog/running-n8n-on-ships-an-interview-with-maranics/","icon":"🛳","label":"Running n8n on ships: An interview with Maranics"},{"url":"https://n8n.io/blog/how-to-build-a-low-code-self-hosted-url-shortener/","icon":"🔗","label":"How to build a low-code, self-hosted URL shortener in 3 steps"},{"url":"https://n8n.io/blog/what-are-apis-how-to-use-them-with-no-code/","icon":" 🪢","label":"What are APIs and how to use them with no code"},{"url":"https://n8n.io/blog/5-tasks-you-can-automate-with-notion-api/","icon":"⚡️","label":"5 tasks you can automate with the new Notion API "},{"url":"https://n8n.io/blog/how-a-digital-strategist-uses-n8n-for-online-marketing/","icon":"💻","label":"How a digital strategist uses n8n for online marketing"},{"url":"https://n8n.io/blog/the-ultimate-guide-to-automate-your-video-collaboration-with-whereby-mattermost-and-n8n/","icon":"📹","label":"The ultimate guide to automate your video collaboration with Whereby, Mattermost, and n8n"},{"url":"https://n8n.io/blog/how-to-automatically-give-kudos-to-contributors-with-github-slack-and-n8n/","icon":"👏","label":"How to automatically give kudos to contributors with GitHub, Slack, and n8n"},{"url":"https://n8n.io/blog/5-workflow-automations-for-mattermost-that-we-love-at-n8n/","icon":"🤖","label":"5 workflow automations for Mattermost that we love at n8n"},{"url":"https://n8n.io/blog/why-this-product-manager-loves-workflow-automation-with-n8n/","icon":"🧠","label":"Why this Product Manager loves workflow automation with n8n"},{"url":"https://n8n.io/blog/creating-custom-incident-response-workflows-with-n8n/","label":"How to automate every step of an incident response workflow"},{"url":"https://n8n.io/blog/learn-to-build-powerful-api-endpoints-using-webhooks/","icon":"🧰","label":"Learn to Build Powerful API Endpoints Using Webhooks"},{"url":"https://n8n.io/blog/learn-how-to-use-webhooks-with-mattermost-slash-commands/","icon":"🦄","label":"Learn how to use webhooks with Mattermost slash commands"},{"url":"https://n8n.io/blog/how-goomer-automated-their-operations-with-over-200-n8n-workflows/","icon":"🛵","label":"How Goomer automated their operations with over 200 n8n workflows"}],"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.webhook/"}]},"categories":["Development","Core Nodes"],"nodeVersion":"1.0","codexVersion":"1.0","subcategories":{"Core Nodes":["Helpers"]}}},"group":"[\"trigger\"]","defaults":{"name":"Webhook"},"iconData":{"type":"file","fileBuffer":"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0OCIgaGVpZ2h0PSI0OCI+PHBhdGggZmlsbD0iIzM3NDc0ZiIgZD0iTTM1IDM3Yy0yLjIgMC00LTEuOC00LTRzMS44LTQgNC00IDQgMS44IDQgNC0xLjggNC00IDQiLz48cGF0aCBmaWxsPSIjMzc0NzRmIiBkPSJNMzUgNDNjLTMgMC01LjktMS40LTcuOC0zLjdsMy4xLTIuNWMxLjEgMS40IDIuOSAyLjMgNC43IDIuMyAzLjMgMCA2LTIuNyA2LTZzLTIuNy02LTYtNmMtMSAwLTIgLjMtMi45LjdsLTEuNyAxTDIzLjMgMTZsMy41LTEuOSA1LjMgOS40YzEtLjMgMi0uNSAzLS41IDUuNSAwIDEwIDQuNSAxMCAxMFM0MC41IDQzIDM1IDQzIi8+PHBhdGggZmlsbD0iIzM3NDc0ZiIgZD0iTTE0IDQzQzguNSA0MyA0IDM4LjUgNCAzM2MwLTQuNiAzLjEtOC41IDcuNS05LjdsMSAzLjlDOS45IDI3LjkgOCAzMC4zIDggMzNjMCAzLjMgMi43IDYgNiA2czYtMi43IDYtNnYtMmgxNXY0SDIzLjhjLS45IDQuNi01IDgtOS44IDgiLz48cGF0aCBmaWxsPSIjZTkxZTYzIiBkPSJNMTQgMzdjLTIuMiAwLTQtMS44LTQtNHMxLjgtNCA0LTQgNCAxLjggNCA0LTEuOCA0LTQgNCIvPjxwYXRoIGZpbGw9IiMzNzQ3NGYiIGQ9Ik0yNSAxOWMtMi4yIDAtNC0xLjgtNC00czEuOC00IDQtNCA0IDEuOCA0IDQtMS44IDQtNCA0Ii8+PHBhdGggZmlsbD0iI2U5MWU2MyIgZD0ibTE1LjcgMzQtMy40LTIgNS45LTkuN2MtMi0xLjktMy4yLTQuNS0zLjItNy4zIDAtNS41IDQuNS0xMCAxMC0xMHMxMCA0LjUgMTAgMTBjMCAuOS0uMSAxLjctLjMgMi41bC0zLjktMWMuMS0uNS4yLTEgLjItMS41IDAtMy4zLTIuNy02LTYtNnMtNiAyLjctNiA2YzAgMi4xIDEuMSA0IDIuOSA1LjFsMS43IDF6Ii8+PC9zdmc+"},"displayName":"Webhook","typeVersion":2,"nodeCategories":[{"id":5,"name":"Development"},{"id":9,"name":"Core Nodes"}]},{"id":514,"icon":"fa:pause-circle","name":"n8n-nodes-base.wait","codex":{"data":{"alias":["pause","sleep","delay","timeout"],"resources":{"generic":[{"url":"https://n8n.io/blog/how-to-get-started-with-crm-automation-and-no-code-workflow-ideas/","icon":"👥","label":"How to get started with CRM automation (with 3 no-code workflow ideas"},{"url":"https://n8n.io/blog/aws-workflow-automation/","label":"7 no-code workflow automations for Amazon Web Services"}],"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.wait/"}]},"categories":["Core Nodes"],"nodeVersion":"1.0","codexVersion":"1.0","subcategories":{"Core Nodes":["Helpers","Flow"]}}},"group":"[\"organization\"]","defaults":{"name":"Wait","color":"#804050"},"iconData":{"icon":"pause-circle","type":"icon"},"displayName":"Wait","typeVersion":1,"nodeCategories":[{"id":9,"name":"Core Nodes"}]},{"id":535,"icon":"file:webhook.svg","name":"n8n-nodes-base.respondToWebhook","codex":{"data":{"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.respondtowebhook/"}]},"categories":["Core Nodes","Utility"],"nodeVersion":"1.0","codexVersion":"1.0","subcategories":{"Core Nodes":["Helpers"]}}},"group":"[\"transform\"]","defaults":{"name":"Respond to Webhook"},"iconData":{"type":"file","fileBuffer":"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0OCIgaGVpZ2h0PSI0OCI+PHBhdGggZmlsbD0iIzM3NDc0ZiIgZD0iTTM1IDM3Yy0yLjIgMC00LTEuOC00LTRzMS44LTQgNC00IDQgMS44IDQgNC0xLjggNC00IDQiLz48cGF0aCBmaWxsPSIjMzc0NzRmIiBkPSJNMzUgNDNjLTMgMC01LjktMS40LTcuOC0zLjdsMy4xLTIuNWMxLjEgMS40IDIuOSAyLjMgNC43IDIuMyAzLjMgMCA2LTIuNyA2LTZzLTIuNy02LTYtNmMtMSAwLTIgLjMtMi45LjdsLTEuNyAxTDIzLjMgMTZsMy41LTEuOSA1LjMgOS40YzEtLjMgMi0uNSAzLS41IDUuNSAwIDEwIDQuNSAxMCAxMFM0MC41IDQzIDM1IDQzIi8+PHBhdGggZmlsbD0iIzM3NDc0ZiIgZD0iTTE0IDQzQzguNSA0MyA0IDM4LjUgNCAzM2MwLTQuNiAzLjEtOC41IDcuNS05LjdsMSAzLjlDOS45IDI3LjkgOCAzMC4zIDggMzNjMCAzLjMgMi43IDYgNiA2czYtMi43IDYtNnYtMmgxNXY0SDIzLjhjLS45IDQuNi01IDgtOS44IDgiLz48cGF0aCBmaWxsPSIjZTkxZTYzIiBkPSJNMTQgMzdjLTIuMiAwLTQtMS44LTQtNHMxLjgtNCA0LTQgNCAxLjggNCA0LTEuOCA0LTQgNCIvPjxwYXRoIGZpbGw9IiMzNzQ3NGYiIGQ9Ik0yNSAxOWMtMi4yIDAtNC0xLjgtNC00czEuOC00IDQtNCA0IDEuOCA0IDQtMS44IDQtNCA0Ii8+PHBhdGggZmlsbD0iI2U5MWU2MyIgZD0ibTE1LjcgMzQtMy40LTIgNS45LTkuN2MtMi0xLjktMy4yLTQuNS0zLjItNy4zIDAtNS41IDQuNS0xMCAxMC0xMHMxMCA0LjUgMTAgMTBjMCAuOS0uMSAxLjctLjMgMi41bC0zLjktMWMuMS0uNS4yLTEgLjItMS41IDAtMy4zLTIuNy02LTYtNnMtNiAyLjctNiA2YzAgMi4xIDEuMSA0IDIuOSA1LjFsMS43IDF6Ii8+PC9zdmc+"},"displayName":"Respond to Webhook","typeVersion":2,"nodeCategories":[{"id":7,"name":"Utility"},{"id":9,"name":"Core Nodes"}]},{"id":565,"icon":"fa:sticky-note","name":"n8n-nodes-base.stickyNote","codex":{"data":{"alias":["Comments","Notes","Sticky"],"categories":["Core Nodes"],"nodeVersion":"1.0","codexVersion":"1.0","subcategories":{"Core Nodes":["Helpers"]}}},"group":"[\"input\"]","defaults":{"name":"Sticky Note","color":"#FFD233"},"iconData":{"icon":"sticky-note","type":"icon"},"displayName":"Sticky Note","typeVersion":1,"nodeCategories":[{"id":9,"name":"Core Nodes"}]},{"id":834,"icon":"file:code.svg","name":"n8n-nodes-base.code","codex":{"data":{"alias":["cpde","Javascript","JS","Python","Script","Custom Code","Function"],"details":"The Code node allows you to execute JavaScript in your workflow.","resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.code/"}]},"categories":["Development","Core Nodes"],"nodeVersion":"1.0","codexVersion":"1.0","subcategories":{"Core Nodes":["Helpers","Data Transformation"]}}},"group":"[\"transform\"]","defaults":{"name":"Code"},"iconData":{"type":"file","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iIGhlaWdodD0iNTEyIiBmaWxsPSJ3aGl0ZSIvPgo8L2NsaXBQYXRoPgo8L2RlZnM+Cjwvc3ZnPgo="},"displayName":"Code","typeVersion":2,"nodeCategories":[{"id":5,"name":"Development"},{"id":9,"name":"Core Nodes"}]},{"id":1119,"icon":"fa:robot","name":"@n8n/n8n-nodes-langchain.agent","codex":{"data":{"alias":["LangChain","Chat","Conversational","Plan and Execute","ReAct","Tools"],"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/"}]},"categories":["AI","Langchain"],"subcategories":{"AI":["Agents","Root Nodes"]}}},"group":"[\"transform\"]","defaults":{"name":"AI Agent","color":"#404040"},"iconData":{"icon":"robot","type":"icon"},"displayName":"AI Agent","typeVersion":3,"nodeCategories":[{"id":25,"name":"AI"},{"id":26,"name":"Langchain"}]},{"id":1145,"icon":"file:anthropic.svg","name":"@n8n/n8n-nodes-langchain.lmChatAnthropic","codex":{"data":{"alias":["claude","sonnet","opus"],"resources":{"primaryDocumentation":[{"url":"https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.lmchatanthropic/"}]},"categories":["AI","Langchain"],"subcategories":{"AI":["Language Models","Root Nodes"],"Language Models":["Chat Models (Recommended)"]}}},"group":"[\"transform\"]","defaults":{"name":"Anthropic Chat Model"},"iconData":{"type":"file","fileBuffer":"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0NiIgaGVpZ2h0PSIzMiIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzdEN0Q4NyIgZD0iTTMyLjczIDBoLTYuOTQ1TDM4LjQ1IDMyaDYuOTQ1ek0xMi42NjUgMCAwIDMyaDcuMDgybDIuNTktNi43MmgxMy4yNWwyLjU5IDYuNzJoNy4wODJMMTkuOTI5IDB6bS0uNzAyIDE5LjMzNyA0LjMzNC0xMS4yNDYgNC4zMzQgMTEuMjQ2eiIvPjwvc3ZnPg=="},"displayName":"Anthropic Chat Model","typeVersion":1,"nodeCategories":[{"id":25,"name":"AI"},{"id":26,"name":"Langchain"}]}],"categories":[{"id":35,"name":"Document Extraction"},{"id":49,"name":"AI Summarization"}],"image":[]}}