Library / AI Agents & Assistants
AI Agents & Assistants
Mine pharma complaint trends and trigger CAPA alerts with Claude and Slack
On a schedule, it runs an AI agent with Claude using Slack.
What it does
## Pharma Product Complaint Intelligence Miner Pulls in raw product-quality complaints, uses Claude to extract structured defect signals (product, batch, defect type, severity) from free-text narratives, clusters recurring defect patterns, compares each cluster's volume against its own rolling baseline, and automatically escalates any cluster that is statistically unusual - not just individually severe complaints. ### How it works 1. A scheduled poll fetches newly logged complaints since the last run; a Manual Trigger lets you test on demand. 2. HTTP - Fetch New Complaints pulls raw complaint records. JS - Normalize Complaint Records reshapes them into one schema and drops anything already processed (tracked in workflow static data). 3. If there are no new complaints, the cycle ends immediately - no AI call, no noise. 4. Claude extracts structured fields from each complaint's free-text narrative: product, batch/lot, defect category, and a severity assessment. 5. JS - Cluster by Product & Defect Category groups the structured complaints into defect-pattern clusters for this cycle. 6. JS - Compare Clusters Against Rolling Baseline is a deterministic, non-AI check: each cluster's count is compared against its own historical rolling average (z-score), completely independent of any AI judgment, so a single mis-extraction can never suppress a real statistical spike. 7. A Switch routes statistically unusual clusters to an immediate quality escalation (CAPA-track ticket + Slack alert); ordinary clusters are simply logged to the trend store. 8. The rolling baseline store is updated so next cycle's comparison has fresh history. ### Customization - Adjust the z-score threshold in Set - Config to tune sensitivity to volume spikes vs noise. - Change what counts as a 'cluster key' (currently product + defect category) in JS - Cluster by Product & Defect Category to also split by batch/lot if you need finer-grained trending. - Add a weekly digest of all logged (non-escalated) clusters for periodic quality review.
The steps
- Schedule Trigger - Poll Complaint Source
- Manual Trigger - Test Run
- Set - Config
- HTTP - Fetch New Complaints
- JS - Normalize Complaint Records
- IF - New Complaints Found?
- No Action - End Cycle
- JS - Fan Out Complaints for Extraction
- AI Agent - Extract Structured Complaint Fields
- Anthropic - Complaint Extraction Model
- JS - Parse Extracted Fields
- JS - Cluster by Product & Defect Category
- JS - Compare Clusters Against Rolling Baseline
- JS - Fan Out Clusters for Routing
19 steps in total.
Similar automations
AI Agents & AssistantsMonitor pharma regulatory updates with Anthropic Claude and Slack alerts22 stepsAI Agents & AssistantsAnalyze pharma label change impact with Anthropic Claude and Slack24 stepsWeb Scraping & ResearchAnalyze Amazon and Flipkart reviews weekly with Apify, OpenAI and Google Sheets56 stepsData Sync & ETLMine YouTube buyer objections with Bright Data, OpenAI, Google Sheets and Slack19 steps