Design prototype · Built on Stockurai
Deviation triage for QA
Prepared for Jane Doe · Pharmaceutical manufacturing · December 3, 2026
Sample data for illustration.DecisionHow to handle each new deviation: close, investigate or escalate
OptionsEscalate · Investigate · Close
Data sourcesQMS, Batch record system export, Equipment and EM data
PolicyCritical needs Head of QA; investigations per 21 CFR 211.192, 30-day SOP target
STEP 01
Targets
Targets are what the system watches. Here, they are the deviations logged in the QMS, each with its area, batch and how many days it has been open.
| Target | Area | Batch | Days open | Status |
|---|---|---|---|---|
| DEV-2026-0412 | Fill-Finish | B24-1187 | 1 | Active |
| DEV-2026-0415 | Granulation | B24-1192 | 1 | Active |
| DEV-2026-0418 | Packaging | B24-1175 | 2 | Active |
| DEV-2026-0409 | QC Lab | B24-1180 | 4 | Watching |
STEP 02
Target detail
Where the feeds meet: the QMS (the deviation, prior investigations and CAPAs), batch records (what was made and where it is) and monitoring (equipment and environmental readings). Every signal is weighed against all three.
Room 214 Grade B counts (7 days)
| Date | Location | CFU/plate | Limit | Result |
|---|---|---|---|---|
| Nov 20 | Room 214 floor | 7 | 5 | Excursion |
| Nov 19 | Room 214 floor | 3 | 5 | Pass |
| Nov 18 | Room 214 floor | 2 | 5 | Pass |
| Nov 17 | Room 214 floor | 1 | 5 | Pass |
| Nov 16 | Room 214 floor | 0 | 5 | Pass |
| Nov 15 | Room 214 floor | 1 | 5 | Pass |
| Nov 14 | Room 214 floor | 0 | 5 | Pass |
Deviation context
BatchB24-1187 · filled Nov 19, in quarantine
Prior history2 similar deviations in 12 months
Open CAPACAPA-2026-031 on filler RABS
Investigation dueDec 20, 2026 (day 30)
Feeds
QMSDeviations, CAPAs and prior investigation history · Every 15 minutes
BatchesBatch status, steps run and release holds · Daily
MonitoringEquipment alarms and environmental counts · Hourly
STEP 03
Alerts: what the system watches for
Alerts are code-free. Pick a field, an operator and a value. Each alert watches one thing, such as a count over its action limit or a repeat of an earlier deviation, and fires when it happens.
Edit alert
Grade B count above action limit
CFU per plate
Above
Action limit (5 CFU per plate)
1 Day
PreviewCFU per plate above action limit
Configured alerts
Count above action limitMonitoring
Equipment alarm during batchMonitoring
Batch filled or releasedBatches
Same issue in last 12 monthsQMS
Open CAPA on same equipmentQMS
Investigation past day 25 of 30QMS
STEP 04
Decision logic: alerts, conditions, plays and rules
Alerts evaluate data in real time. Conditions add triggered alerts up to a score, and plays organize the conditions. Rules turn a play’s score into a real-time recommendation on the live feed. The policy gate stops any recommendation the procedures don't allow: critical classifications wait for the head of QA, and every investigation carries its 30-day clock. Rules drive the recommendations, not AI.
Play: Classify each new deviation by risk
+15Product quality at risk
- Count above action limit
- Equipment alarm during batch
+10Batch already filled
- Batch filled or released
+10Repeat issue
- Same issue in last 12 months
- Open CAPA on same equipment
Rules
Score ≥ 30ESCALATE
Score 15–29INVESTIGATE
Score < 15CLOSE
Policy gate
Critical classHead of QA approves
InvestigationPer 21 CFR 211.192
Close within30 days unless extended
ExtensionQA manager sign-off
STEP 05
Live feed
This is the screen the decision team watches. Each card is a proposed classification for one deviation, printed the moment its rule is met, with the score and time it fired.
Escalate (1)
DEV-2026-0412 Score 35 · Major + CAPA
Grade B count 7 CFU, batch filled, repeat issue; open CAPA
Grade B count 7 CFU, batch filled, repeat issue; open CAPA
Close (1)
DEV-2026-0418 Score 0 · Minor
Label roll change logged late; no batch impact, no repeat
Label roll change logged late; no batch impact, no repeat
Investigate (2)
DEV-2026-0415 Score 15 · Full investigation
Granulator alarm mid-batch; no repeat; batch still in process
Granulator alarm mid-batch; no repeat; batch still in process
DEV-2026-0409 Score 15 · Full investigation
HPLC alarm during assay run; no repeat; day 4 of 30
HPLC alarm during assay run; no repeat; day 4 of 30
STEP 06
Audit trail: one recommendation, start to finish
Every recommendation is logged and traceable. Anyone can see which records and readings arrived, which conditions were met, who approved the classification and how it compared with a manual classification.
DEV-2026-0412 — Audit trail
Data received
QMS feedDEV-2026-0412 logged 2026-11-20 08:30; 2 similar in 12 months
Monitoring feedRoom 214 floor plate 7 CFU, action limit 5
Batches feedB24-1187 filled Nov 19, in quarantine
Play evaluated → rule fired
✓ Product quality at risk (+15)
✓ Batch already filled (+10)
✓ Repeat issue (+10)
Score35 → ESCALATE
Policy gatePassed: major class, 30-day clock set
Decision
ActionEscalated as major, CAPA opened
Approved byHead of QA, 10:12
Outcome
Similar past case, manual classificationMinor, reopened as major on day 9
ResultRight tier on day 1, not day 9
STEP 07
Daily flags
A short daily list of things worth a look, separate from the live feed. Investigations nearing day 30, adverse trends in monitoring data, clusters of similar deviations and batches held up by open deviations.
QMS3 investigations past day 25 of 30
Extension or closure needed before day 30
MonitoringRoom 214 counts up 3 days running
Floor plates 2, 3, then 7 CFU; action limit is 5
QMS4 Fill-Finish deviations in 30 days
Usual rate is 1 a month; repeat condition armed
BatchesB24-1187 awaiting release review
Open deviation blocks batch disposition
STEP 08
ROI scoring and baseline
The optimization engine scores every decision. Every classification is measured against the specialist's manual classification, and against the tier confirmed after full review, closure and any repeat. The gap is the ROI you can measure.
| Target | Decisions | Right tier first time (%) | Baseline | Best possible | Captured | Result vs baseline |
|---|---|---|---|---|---|---|
| Fill-Finish | 42 | 91 | 82 | 100 | 50% | +9 pts |
| Granulation | 36 | 88 | 81 | 100 | 37% | +7 pts |
| Packaging | 58 | 94 | 90 | 100 | 40% | +4 pts |
| QC Lab | 27 | 85 | 74 | 100 | 42% | +11 pts |
Baseline: Specialist's manual classification. Best possible: Tier confirmed after full review. Sample figures; in a live installation, these come from the organization’s own decisions and data.
STEP 09
Fit and next steps
What we’d check first
Why
- A daily, repeated classification with structured QMS, batch and monitoring data and clear tiers
To verify
- Whether QMS data can be exported or read by API
- How the SOP defines minor, major and critical
- Validation and audit-trail needs for a regulated system
Extend with AI
- Reading deviation narratives to suggest root causes and similar past cases
Next step: a formal proposal
ScopeThe decision, targets and data feeds
RulesRules and policy gate, written out
ROIHow ROI is measured against the current process
TermsSetup estimate, timeline and license terms
Where it runsThe organization’s own AWS account
For IT and data teams: an AI data pipeline
Stockurai is licensed to researchers and institutions for real-time analysis of equity markets, with AI and machine learning built into the process. The same AI data pipeline can be built for this decision.
- It runs entirely in the organization’s own AWS account, and all data stays there.
- Every recommendation is stored with the full data behind it: labeled records data teams can use to train and test models.
- Built with AI in mind, making maintenance and extension simple for a single technical resource.
Design prototype prepared by Stockurai · Sample data for illustration only · stockurai.com