Files
breakpilot-compliance/ai-compliance-sdk/internal/iace/hazard_patterns_iso12100_gaps.go
Benjamin Admin afb3f83f30 feat(iace): cross-domain precision overhaul + component review + schema reconcile
Engine precision (stop foreign-machine patterns leaking into a project):
- Wire project.MachineType into the engine machine-type gate (empty input no
  longer fires every machine class — press/cnc/excavator/crane/medical...).
- Capability-domain gating extended by 7 domains (outdoor, ventilation,
  machining, bulk, palletizer, playground, fitness) so domain-specific hazards
  only fire when the narrative names that domain; emitted via keyword_dictionary.
- Relevance backstop moved into iace (single gating contract, testable), and its
  dominant false-anchor class removed (a long pattern word no longer matches a
  short common token; prepositions/leitung added to the generic stoplist).
- New guard tests: TestCrossDomainPrecision (full pipeline, 0 foreign per GT) and
  TestPatternReachability now asserts 0 dead patterns. Both GTs keep coverage 1.0.

Reachability fix: the 51 dead patterns required electrical/pneumatic/hydraulic
tags nothing produced — renamed to the canonical electrical_energy/
pneumatic_pressure/hydraulic_pressure/hydraulic_part.

Component review (negation is best-effort + expert-correctable):
- Parser surfaces negated components (ComponentMatch.Negated) instead of dropping
  them; negated contribute no tags/energy → no phantom hazards.
- presence_status (vorhanden|nicht_vorhanden|geloescht) + ce_marked on components;
  only `vorhanden` feed matching. CE+safety-relevant flags the PL/SIL obligation.
- Force re-seed preserves the expert's component decisions instead of wiping them.
- Tag-based component→hazard assignment (was: all on the first component).
- Negation-aware narrative parsing ("keine Pneumatik" no longer extracts it).

Local-dev DB: ai-sdk sets search_path=compliance,core,public; reconcile migrations
152-156 bring the consolidated local iace tables to the current schema + add the
presence_status/ce_marked columns. Machine-type vocabulary endpoint for the form.

[migration-approved]

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-10 17:15:55 +02:00

95 lines
6.2 KiB
Go
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package iace
// GetISO12100GapPatterns returns hazard patterns for sources/effects from
// ISO 12100 Annex B (Tabelle B.1) that were missing in the previous IACE
// library: Vakuum, elastische Elemente (Federn), raue/rutschige Oberflaeche,
// Hochdruckinjektion und Ersticken. All entries reference the relevant
// ISO 12100 section identifier (no norm text reproduced — only the section
// number, which is a fact, not a copyrighted work).
//
// HP range: HP1900-HP1909.
func GetISO12100GapPatterns() []HazardPattern {
return []HazardPattern{
{
ID: "HP1900", NameDE: "Verletzung durch Vakuum (Vakuumgreifer / Saug-Anlage)", NameEN: "Vacuum injury (suction/vacuum equipment)",
RequiredComponentTags: []string{"clamping_part"},
RequiredEnergyTags: []string{"pneumatic_pressure"},
GeneratedHazardCats: []string{"mechanical_hazard"},
SuggestedMeasureIDs: []string{"M061", "M002", "M141"},
Priority: 90,
ApplicableLifecycles: []string{"normal_operation", "setup", "maintenance"},
ScenarioDE: "Vakuum-Werkzeug (Greifer, Saugplatte) erzeugt im Versagensfall Sog auf menschliches Gewebe (Hand, Haut). Auch nach Abschalten kann Restvakuum gefaehrlich sein.",
TriggerDE: "Hand am Sauger waehrend Aktivierung, Anlauf des Vakuums ohne Sicht­kontakt, fehlende Vakuum-Schnellentlueftung.",
HarmDE: "Quetschende Saugverletzung an Haut/Hand, Haematom, im Extremfall Avulsion oberflaechlichen Gewebes.",
AffectedDE: "Bedienpersonal, Wartungspersonal",
ZoneDE: "Vakuumgreifer, Saugnaepfe, Sauganlagen-Auslass",
ISO12100Section: "6.3.5.5",
DefaultSeverity: 3, DefaultExposure: 2,
},
{
ID: "HP1901", NameDE: "Freisetzung gespeicherter Federenergie (elastische Elemente)", NameEN: "Release of stored spring energy (elastic elements)",
RequiredComponentTags: []string{"stored_energy"},
GeneratedHazardCats: []string{"mechanical_hazard"},
SuggestedMeasureIDs: []string{"M046", "M047", "M061", "M141"},
Priority: 92,
ApplicableLifecycles: []string{"maintenance", "fault_clearing", "changeover"},
ScenarioDE: "Vorgespannte Federn, Gasdruckfedern oder elastische Elemente entladen ihre Energie unerwartet bei Demontage oder Loesen einer Arretierung.",
TriggerDE: "Loesen einer Schraube/Arretierung ohne vorherige Entlastung; Materialermuedung der Feder; Verschleiss der Halterung.",
HarmDE: "Schlag oder Wegschleudern durch entladende Feder; Augen-, Prell- und Schnittverletzungen.",
AffectedDE: "Wartungspersonal, Einrichter",
ZoneDE: "Federmechanismen, Gasdruckfedern, vorgespannte Riemen",
ISO12100Section: "6.2.10",
DefaultSeverity: 3, DefaultExposure: 2,
},
{
ID: "HP1902", NameDE: "Ausrutschen/Stolpern auf rauer oder rutschiger Oberflaeche", NameEN: "Slipping/tripping on rough or slippery surface",
RequiredComponentTags: []string{"structural_part"},
GeneratedHazardCats: []string{"mechanical_hazard"},
SuggestedMeasureIDs: []string{"M141", "M538"},
Priority: 80,
ApplicableLifecycles: []string{"normal_operation", "setup", "cleaning", "maintenance"},
ScenarioDE: "Bediener rutscht aus oder stolpert auf einer Oberflaeche im Anlagenbereich (rutschig durch KSS, Oel oder Wasser; uneben durch Kabel, Schwellen, raue Bodenstrukturen).",
TriggerDE: "Fluessigkeits-Leckage, unregelmaessige Bodengeometrie, lose Verlegung von Kabeln/Schlaeuchen.",
HarmDE: "Prellungen, Knochenbrueche, Kopfverletzungen bei Sturz; Aufprall an Anlagenkanten.",
AffectedDE: "Bedienpersonal, Reinigungspersonal, Wartungspersonal",
ZoneDE: "Verkehrswege im Maschinenbereich, Anlagenboden, Wartungspodeste",
ISO12100Section: "6.3.5.6",
DefaultSeverity: 3, DefaultExposure: 4,
},
{
ID: "HP1903", NameDE: "Hochdruckinjektion durch austretendes Medium", NameEN: "High-pressure injection injury",
RequiredComponentTags: []string{"high_pressure"},
GeneratedHazardCats: []string{"pneumatic_hydraulic"},
SuggestedMeasureIDs: []string{"M483", "M484", "M141"},
Priority: 96,
ApplicableLifecycles: []string{"normal_operation", "maintenance", "fault_clearing"},
ScenarioDE: "Unter Druck stehendes Medium (Hydraulikoel, KSS, Druckluft, Wasserstrahl) tritt aus undichten Verschraubungen oder geplatzten Leitungen aus und dringt unmerklich in menschliches Gewebe ein.",
TriggerDE: "Pinhole-Leckage in Druckleitung; Annaehern der Hand zum Lokalisieren der Leckage; bestes Risiko bei Druecken > 7 bar / 100 psi.",
HarmDE: "Hochdruckinjektionsverletzung — initial wie kleiner Stich, fuehrt aber innerhalb von Stunden zu Gewebenekrose. Sofortige chirurgische Behandlung erforderlich.",
AffectedDE: "Wartungspersonal, Einrichter, Reinigungspersonal",
ZoneDE: "Druckleitungen, Verschraubungen, Schlauchverbindungen, Hochdruckduesen",
ISO12100Section: "6.3.5.4",
ClarificationQuestionsDE: []string{
"Sind alle Hochdruckleitungen druckdicht nach EN ISO 4413/4414 ausgelegt und periodisch geprueft?",
"Wird das Wartungspersonal explizit zur Hochdruckinjektionsgefahr unterwiesen (kein Lokalisieren der Leckage mit der Hand)?",
},
DefaultSeverity: 5, DefaultExposure: 2,
},
{
ID: "HP1904", NameDE: "Ersticken durch Quetschung des Brustkorbs / Einschluss", NameEN: "Asphyxiation by chest compression or entrapment",
RequiredComponentTags: []string{"moving_part", "guard"},
GeneratedHazardCats: []string{"mechanical_hazard"},
SuggestedMeasureIDs: []string{"M061", "M489", "M488", "M141"},
Priority: 96,
ApplicableLifecycles: []string{"normal_operation", "maintenance", "fault_clearing"},
ScenarioDE: "Person wird zwischen bewegtem und feststehendem Anlagenteil so eingeklemmt, dass der Brustkorb komprimiert wird (kompressive Asphyxie). Oder Person wird in einem geschlossenen Maschinen­bereich eingeschlossen und kann nicht mehr atmen.",
TriggerDE: "Roboterarm presst Person gegen Wand; Schutztuer schliesst auf Person; Person rutscht in engen Maschinenraum ohne Selbstrettungsmoeglichkeit.",
HarmDE: "Kompressive Asphyxie (Atemstillstand durch Brustkorbkompression), Todesfolge innerhalb weniger Minuten.",
AffectedDE: "Wartungspersonal, Reinigungspersonal",
ZoneDE: "Schwenkbereich Roboterarm, geschlossene Bearbeitungsraeume, schmale Wartungsoeffnungen",
ISO12100Section: "6.3.5.2",
DefaultSeverity: 5, DefaultExposure: 1,
},
}
}