AI Pipeline Documentation
Prompts, admissible outputs, and classification rules for each GenAI workflow
Risk Label
Risk classification for complaints and deviations
Analyze the record to surface the highest-level risks that Roche leadership should be aware of. Return a primary risk (mandatory) and optional secondary risk, each with a label from the fixed Risk Reference List and a confidence score.
Admissible Risk Labels
| Label | Description | Selection Criteria |
|---|---|---|
| Patient Safety | Potential for patient injury, harm, loss of function, or delivery of incorrect treatment. | Record explicitly mentions patient harm, adverse events, injury, incorrect dose, contamination exposure, or a clear patient safety impact. |
| Compliance | Regulatory, reporting, or legal exposures (e.g., deviations from laws, standards, or approvals). | Record explicitly mentions regulatory reportability, inspection findings, legal exposure, field action, recall, or mandated reporting requirements. |
| Product Quality | Issues that could affect product integrity, stability, or consistency for current lots. | Record explicitly confirms a product defect, nonconformance, OOS/OOT, or a quality issue affecting product integrity. |
| Supply Continuity | Anything that might disrupt product availability, logistics, or distribution. | Record explicitly mentions shortage, batch hold/reject, stop-ship, supply interruption, or distribution impact. |
| Reputation | Risk to Roche's public standing, market perception, or customer trust (even if no physical harm occurred). | Record explicitly mentions reputational impact, public/media attention, or customer trust impact. |
| N/A | Insufficient data to establish any risk label. Text is too vague, incomplete, or lacks enough context. | None of the above are explicitly supported, or the text is vague/insufficient. |
Output Schema
Each record produces one object with:
primary_risk(mandatory) \u2014 label + confidencesecondary_risk(optional) \u2014 label + confidence, only if clearly supported and different from primaryrisk_role\u2014 "primary" or "secondary"
Confidence Levels
| Level | Description |
|---|---|
| high | Explicit, direct, clear evidence |
| medium | Likely/indirect, but with limited evidence |
| low | Ambiguous or weak evidence |
Priority order (tie-breaker): Patient Safety > Compliance > Product Quality > Supply Continuity > Reputation > N/A
Process Relevance Label
Two-level process classification (category \u2192 subcategory)
Two-step classification: first assign the record to a high-level process category, then drill down to the most relevant subcategory. Uses separate prompts for category and subcategory classification.
Complaints \u2014 Categories & Subcategories (7 categories)
Deviations \u2014 Categories & Subcategories (7 categories)
Special values: "Other" (no subcategory match) and "N/A" (insufficient data) are valid outputs for both category and subcategory levels.
Document NER
Named entity extraction of document references
Extract and normalize document references from quality records. Only extract documents starting with known prefixes. Normalize format, classify context (deviated vs. referenced), and assign confidence.
Admissible Document Prefixes
Output Fields
| Field | Description |
|---|---|
| extraction | Normalized document name (PREFIX-NUMBERS, e.g. SOP-12345) |
| specifications | Normalized version/qualifier (e.g. "REV A V1.2 ANNEX 3") or "None" |
| confidence | high | medium | low |
| context | "deviated" (protocol not followed) or "referenced" (just cited) |
Admissible Context Values
| Context | When to use |
|---|---|
| deviated | The document defines a protocol/procedure/standard that was NOT followed or violated |
| referenced | The document is cited, mentioned, or referenced without deviation |
Product NER
Named entity extraction of Roche pharmaceutical products
Extract Roche product names from quality records using exact matches against the Roche Product List. Determine if each product is matched (in the list) or unmatched, and whether it is impacted or simply mentioned.
Output Fields
| Field | Description |
|---|---|
| extraction | Full combined form "active substance / product name" for matched products, or literal name for unmatched |
| confidence | high | medium | low |
| matched | true if found in the Roche Product List, false otherwise |
| impacted | true if directly affected (deviation, CAPA, rejection, recall, batch issue), false if only mentioned |
QE Relationship NER
Named entity extraction of Quality Event cross-references
Extract and classify Quality Event (QE) references from quality records. Normalize QE IDs, determine relationship type to the current record, and assign confidence.
Admissible Relationship Types
Output Fields
| Field | Description |
|---|---|
| extraction | Normalized QE reference (e.g. "QE-12345") |
| confidence | high | medium | low |
| matched | true for valid QE-prefix references, false for inferred/malformed |
| relationship | One of the admissible types above, or "None" if unclear |
Note: The self-reference QE (the record being analyzed) is never extracted. Only cross-references to other Quality Events are captured.
Ask AI (Chat Assistant)
Interactive quality data analyst powered by Claude on AWS Bedrock
Interactive AI assistant that helps users explore and analyze quality data. Has tool access to query both the Twain AI extractions database and the OneQMS quality management database via Athena SQL.
Available Tools
| Tool | Description |
|---|---|
| query_twain | Execute SQL against the Twain AI extractions database (NER, risk labels, process relevance, products, QE relationships, Roche-relatedness) |
| query_oneqms | Execute SQL against the OneQMS quality management database (quality_event, complaint, capa, action_items, assessments) |
Chart Types
| Type | Use Case |
|---|---|
| bar | Horizontal bar chart for comparisons |
| pie | Donut/pie chart for distributions |
| line | Line chart for trends over time |
| stacked | Stacked bar chart for multi-dimensional breakdowns |
Limits: Max 200 rows for detail queries. Up to 10 tool-use rounds per question. Scoped to the current environment (PRD/DEV).