Files
breakpilot-compliance/ai-compliance-sdk/internal/iace/hazard_patterns_secondary_demo.go
T
Benjamin Admin 16fd406c1a feat(iace): secondary-harm chain model + AllPatterns drift fix
Task #17 — Folgegefahren-Modell as Vorbereitungs-Commit (no DB schema
change yet; persistence via separate [migration-approved] commit).

New:
- secondary_harms.go: SecondaryHarm struct + six canonical categories
  (consumer_safety, product_liability, food_safety, environmental,
  reputation, financial) with DE labels.
- hazard_pattern_types.go: HazardPattern extended with optional
  SecondaryHarms field — pattern library can now attach consequential-
  damage chains.
- hazard_patterns_secondary_demo.go: two worked examples
  - HP2000 Glasbruch carbonated bottling (the "Cola splitter" scenario
    from the IACE strategy discussion) with consumer_safety + food_safety
    + reputation chains
  - HP2001 Pharma fill-finish cross-contamination with consumer_safety
    + product_liability under AMG §84

Bonus fix:
- compliance_crossover.go AllPatterns() was a duplicate enumeration that
  silently drifted from collectAllPatterns() in pattern_registry.go.
  Pre-fix: 1058 patterns visible. Post-fix: 1213 patterns. The 155 invisible
  patterns included CRA, ISO12100 gaps, robot-cell, CNC extended, VDMA,
  textile-agri, GT-bremse — anything added after the original AllPatterns
  was authored. Audit-Suite (cmd/iace-audit) now sees the full set.

Next steps for full secondary-harm rollout:
- DB migration: hazards table + secondary_harms array column
- API: surface secondary_harms in /projects/:id/hazards response
- Frontend: collapsible Folgegefahren-Panel in HazardTable
2026-05-21 23:36:26 +02:00

128 lines
5.2 KiB
Go

package iace
// Demonstration patterns showing how the SecondaryHarms field carries
// downstream-consequence information through the IACE engine.
//
// Two real-world scenarios are encoded:
//
// HP2000 — Glass-shard injection in carbonated-beverage bottling
// (the "Cola splitter" example from the IACE strategy
// discussion). Primary harm is the operator hit by flying
// shards; the secondary chain is product-liability towards
// supermarket end-customers.
//
// HP2001 — Cross-contamination in pharma fill-finish lines.
// Primary harm is operator exposure; secondary chain is
// patient harm + recall under §74a AMG.
//
// These two patterns are sufficient as a contract test for the
// SecondaryHarms field. Library coverage of more scenarios is a
// follow-up task once the persistence layer (DB migration) lands.
func GetSecondaryHarmDemoPatterns() []HazardPattern {
return []HazardPattern{
{
ID: "HP2000",
NameDE: "Glasbruch in Karbonisierungs-Abfueller (Hochdruck)",
NameEN: "Glass shatter in carbonated bottling line",
RequiredComponentTags: []string{"crush_point", "high_pressure"},
RequiredEnergyTags: []string{"pneumatic_pressure"},
GeneratedHazardCats: []string{"mechanical_hazard"},
Priority: 90,
MachineTypes: []string{"bottling", "food_processing", "packaging"},
ScenarioDE: "Glasflasche platzt unter CO2-Druck waehrend der Abfuellung. " +
"Splitter erreichen den Bediener und koennen ferner in nachfolgende " +
"Flaschen eingetragen werden.",
TriggerDE: "Materialfehler, ueberhoehter Innendruck, Foerderstoss",
HarmDE: "Schnittverletzung Auge/Hand des Bedieners",
AffectedDE: "Abfueller, Mitarbeiter Linie",
ZoneDE: "Karussell, Schutzkapsel, Foerderband-Auslauf",
DefaultSeverity: 4,
DefaultExposure: 3,
ISO12100Section: "6.4.5.5 Schleudernde Teile",
SecondaryHarms: []SecondaryHarm{
{
Type: SecondaryHarmConsumerSafety,
Description: "Restsplitter in der Folgeflasche erreichen ueber den Handel " +
"den Endkunden. Verletzungsrisiko Mund/Speiseroehre.",
LegalBasis: "ProdHaftG §1, VO (EU) Nr. 178/2002 Art. 14",
SuggestedMitigations: []string{
"Spueltunnel nach Abfuellung",
"Inline-Kamera mit Glasbrucherkennung",
"Sperrzone fuer 2 Folgeflaschen bei Bruchereignis",
"Glasbruchsensor an Karussell mit Linie-Stopp",
},
Owner: "product_safety",
},
{
Type: SecondaryHarmFoodSafety,
Description: "Rueckruf- und Meldepflicht bei Inverkehrbringen unsicherer " +
"Lebensmittel; Rueckverfolgbarkeit Chargen-genau erforderlich.",
LegalBasis: "VO (EU) 178/2002 Art. 18, 19; LFGB §40",
SuggestedMitigations: []string{
"Chargen-Tracking bis Endhaendler",
"Schnellwarnsystem RASFF aktiviert halten",
"Rueckruf-SOP getestet",
},
Owner: "qm",
},
{
Type: SecondaryHarmReputation,
Description: "Pressemitteilung und Aktienkurs-Reaktion bei Verbraucher-" +
"verletzungen / behoerdlichem Rueckruf.",
LegalBasis: "ISO 31000 Unternehmensrisiko",
SuggestedMitigations: []string{
"Krisenkommunikations-Plan",
"PR-Bereitschaft 24/7",
},
Owner: "enterprise_risk",
},
},
},
{
ID: "HP2001",
NameDE: "Kreuzkontamination Pharma Fill-Finish",
NameEN: "Cross-contamination pharma fill-finish",
RequiredComponentTags: []string{"chemical_risk"},
RequiredEnergyTags: []string{"pneumatic_pressure"},
GeneratedHazardCats: []string{"chemical_hazard"},
Priority: 92,
MachineTypes: []string{"pharmaceutical", "food_processing"},
ScenarioDE: "Wirkstoff-Rueckstand aus Vorcharge im Linienzwischenraum kontaminiert " +
"die Folgecharge.",
TriggerDE: "Mangelhaftes CIP, Spuelvolumen unterhalb Validierung",
HarmDE: "Bedienerexposition bei Probennahme",
AffectedDE: "Anlagenbediener, Probenehmer",
ZoneDE: "Abfuelllinie zwischen Vorlage und Filler",
DefaultSeverity: 4,
DefaultExposure: 2,
ISO12100Section: "6.4.4 Chemische und biologische Gefaehrdungen",
SecondaryHarms: []SecondaryHarm{
{
Type: SecondaryHarmConsumerSafety,
Description: "Patient erhaelt Arzneimittel mit unzulaessiger Beimischung; " +
"Wirkungsbeeintraechtigung oder unerwuenschte Wirkung moeglich.",
LegalBasis: "AMG §5 (Verkehrsfaehigkeit), §74a (Stufenplan)",
SuggestedMitigations: []string{
"CIP-Validierung mit TOC- und Conductivity-Limits",
"Dedizierte Linien fuer Hochpotente Wirkstoffe",
"Stufenplan-Meldung bei Verdacht",
},
Owner: "qm",
},
{
Type: SecondaryHarmProductLiability,
Description: "Haftung des Inverkehrbringers nach AMG §84 (Gefaehrdungshaftung " +
"bei Arzneimittelschaeden, verschuldensunabhaengig).",
LegalBasis: "AMG §84",
SuggestedMitigations: []string{
"Deckung Produkthaftpflicht ueber gesetzliches Minimum",
"Chargen-Rueckhaltemuster 12 Monate ueber MHD hinaus",
},
Owner: "legal",
},
},
},
}
}