T
Twain
PRD
OverviewComplaintsDeviationsSearchAsk AIDocs
Switch Environment
Roche
OverviewComplaintsDeviationsSearchAsk AIDocs

AI Pipeline Documentation

Prompts, admissible outputs, and classification rules for each GenAI workflow

Risk LabelRoche RelatedProcess RelevanceDocument NERProduct NERQE RelationshipsAsk AI (Chat)

Risk Label

Risk classification for complaints and deviations

Complaints & Deviations
AI Role: Clinical risk manager

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

LabelDescriptionSelection Criteria
Patient SafetyPotential 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.
ComplianceRegulatory, 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 QualityIssues 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 ContinuityAnything that might disrupt product availability, logistics, or distribution.Record explicitly mentions shortage, batch hold/reject, stop-ship, supply interruption, or distribution impact.
ReputationRisk 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/AInsufficient 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 + confidence
  • secondary_risk (optional) \u2014 label + confidence, only if clearly supported and different from primary
  • risk_role \u2014 "primary" or "secondary"

Confidence Levels

LevelDescription
highExplicit, direct, clear evidence
mediumLikely/indirect, but with limited evidence
lowAmbiguous or weak evidence

Priority order (tie-breaker): Patient Safety > Compliance > Product Quality > Supply Continuity > Reputation > N/A

Roche Related Label

Technical product quality relevance & manufacturing division

Complaints & Deviations
AI Role: Specialized classification assistant for technical product health monitoring

Determine whether the record pertains to the intrinsic technical quality of a Roche product (relevant for manufacturing quality control). If related, assign the most appropriate manufacturing division.

Classification Output

Related to Roche

ValueMeaning
trueIssue pertains to intrinsic technical quality of a Roche product
falseIssue unrelated to product technical integrity

Manufacturing Division

DivisionScope
DS ManufacturingDrug Substance — formulation, contamination issues
DP ManufacturingDrug Product — filling, stability, dosage issues
Device ManufacturingPhysical device components — injectors, instruments, sensors
UnknownCannot confidently assign to any division
N/AInsufficient data to establish any manufacturing division

Process Relevance Label

Two-level process classification (category \u2192 subcategory)

Complaints & Deviations
AI Role: Text analysis assistant for a pharmaceutical company

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

Complaints & Deviations
AI Role: Named Entity Recognition (NER) system for 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

SOPWISRDGDSAMSPMSPCDIRPOLSSDTECREFENGSPSHESPTVAL

Output Fields

FieldDescription
extractionNormalized document name (PREFIX-NUMBERS, e.g. SOP-12345)
specificationsNormalized version/qualifier (e.g. "REV A V1.2 ANNEX 3") or "None"
confidencehigh | medium | low
context"deviated" (protocol not followed) or "referenced" (just cited)

Admissible Context Values

ContextWhen to use
deviatedThe document defines a protocol/procedure/standard that was NOT followed or violated
referencedThe document is cited, mentioned, or referenced without deviation

Product NER

Named entity extraction of Roche pharmaceutical products

Complaints & Deviations
AI Role: Named Entity Recognition (NER) system for 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

FieldDescription
extractionFull combined form "active substance / product name" for matched products, or literal name for unmatched
confidencehigh | medium | low
matchedtrue if found in the Roche Product List, false otherwise
impactedtrue if directly affected (deviation, CAPA, rejection, recall, batch issue), false if only mentioned

QE Relationship NER

Named entity extraction of Quality Event cross-references

Complaints & Deviations
AI Role: Named Entity Recognition (NER) system for Quality Event 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

root cause ofduplicate ofrelated tolinked tocaused byassociated withtriggered by

Output Fields

FieldDescription
extractionNormalized QE reference (e.g. "QE-12345")
confidencehigh | medium | low
matchedtrue for valid QE-prefix references, false for inferred/malformed
relationshipOne 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

AI Role: Quality data analyst assistant for Roche Pharma Technical Operations

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

ToolDescription
query_twainExecute SQL against the Twain AI extractions database (NER, risk labels, process relevance, products, QE relationships, Roche-relatedness)
query_oneqmsExecute SQL against the OneQMS quality management database (quality_event, complaint, capa, action_items, assessments)

Chart Types

TypeUse Case
barHorizontal bar chart for comparisons
pieDonut/pie chart for distributions
lineLine chart for trends over time
stackedStacked 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).