feat: IACE deterministic narrative parser + library extensions

Library Extensions:
- 15 new components (C121-C135): knee lever, hydraulic ram, lubrication
  system, extraction system, vibrating plate, die tooling, transfer system,
  hoist, chute, oil drip tray, pressure relief valve, die space, flywheel,
  bin changeover station, inspection scale
- 8 new tags: person_under_load, two_hand_control_required,
  thermal_accumulation, mechanical_transmission, oil_mist_risk,
  rapid_energy_release, gravity_suspended_load, bypass_risk
- 14 new patterns (HP045-HP058): ram drop, die space crushing, oil mist
  inhalation, hot workpiece burns, suspended load, transfer draw-in,
  ejection fall, accumulator pressure release, impact noise, flywheel
  residual energy, guard bypass, two-hand misoperation, oil leakage,
  ergonomic bin changeover

Deterministic Parser (NO LLM):
- keyword_dictionary.go: ~100 entries mapping DE/EN keywords to
  component IDs, energy source IDs, and tags
- narrative_parser.go: ParseNarrative() extracts components, energy
  sources, lifecycle phases, roles, tech specs, and context tags from
  free-text machine descriptions via keyword matching + regex
- Tech spec regex: extracts kN, V, °C, bar, kW, rpm values and
  derives energy sources + severity tags automatically
- iace_handler_parser.go: POST /projects/:id/parse-narrative endpoint
  chains parser → pattern engine → hazard suggestions

Test: Paste Kniehebelpresse description → should detect 10+ components,
15+ hazards, all deterministically without LLM.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-05-05 00:29:18 +02:00
parent 47ec792acf
commit d4b7943d54
7 changed files with 676 additions and 0 deletions
@@ -454,5 +454,136 @@ func GetBuiltinHazardPatterns() []HazardPattern {
SuggestedEvidenceIDs: []string{"E01", "E15"},
Priority: 80,
},
// ================================================================
// Press/Forming Machine Patterns (HP045-HP058)
// ================================================================
{
ID: "HP045", NameDE: "Stoesselabsturz durch Druckverlust", NameEN: "Ram drop due to pressure loss",
RequiredComponentTags: []string{"hydraulic_part", "gravity_risk", "high_force"},
RequiredEnergyTags: []string{},
GeneratedHazardCats: []string{"mechanical_hazard", "pneumatic_hydraulic"},
SuggestedMeasureIDs: []string{"M001", "M051", "M054", "M131"},
SuggestedEvidenceIDs: []string{"E01", "E08", "E20"},
Priority: 98,
},
{
ID: "HP046", NameDE: "Quetschen im Werkzeugeinbauraum", NameEN: "Crushing in die space",
RequiredComponentTags: []string{"crush_point", "high_force"},
RequiredEnergyTags: []string{},
GeneratedHazardCats: []string{"mechanical_hazard"},
SuggestedMeasureIDs: []string{"M001", "M005", "M051", "M106"},
SuggestedEvidenceIDs: []string{"E01", "E08"},
Priority: 97,
},
{
ID: "HP047", NameDE: "Oelnebelexposition Atemwege", NameEN: "Oil mist inhalation exposure",
RequiredComponentTags: []string{"hydraulic_part", "oil_mist_risk"},
RequiredEnergyTags: []string{},
GeneratedHazardCats: []string{"material_environmental"},
SuggestedMeasureIDs: []string{"M124", "M141"},
SuggestedEvidenceIDs: []string{"E20"},
Priority: 80,
},
{
ID: "HP048", NameDE: "Verbrennung durch heisse Werkstuecke", NameEN: "Burns from hot workpieces",
RequiredComponentTags: []string{"moving_part"},
RequiredEnergyTags: []string{"thermal"},
GeneratedHazardCats: []string{"thermal_hazard"},
SuggestedMeasureIDs: []string{"M054", "M141"},
SuggestedEvidenceIDs: []string{"E08"},
Priority: 85,
},
{
ID: "HP049", NameDE: "Schwebende Last (Hubwerk/Aufzug)", NameEN: "Suspended load (hoist/elevator)",
RequiredComponentTags: []string{"gravity_risk", "person_under_load"},
RequiredEnergyTags: []string{},
GeneratedHazardCats: []string{"mechanical_hazard"},
SuggestedMeasureIDs: []string{"M001", "M005", "M051"},
SuggestedEvidenceIDs: []string{"E01", "E08"},
Priority: 95,
},
{
ID: "HP050", NameDE: "Einziehen/Scheren Transfersystem", NameEN: "Draw-in/shearing at transfer system",
RequiredComponentTags: []string{"moving_part", "shear_risk"},
RequiredEnergyTags: []string{},
GeneratedHazardCats: []string{"mechanical_hazard"},
SuggestedMeasureIDs: []string{"M001", "M005", "M051"},
SuggestedEvidenceIDs: []string{"E01", "E08"},
Priority: 90,
},
{
ID: "HP051", NameDE: "Sturzgefahr Auswurfbereich", NameEN: "Fall hazard at ejection area",
RequiredComponentTags: []string{"gravity_risk"},
RequiredEnergyTags: []string{},
ExcludedComponentTags: []string{"safety_device"},
GeneratedHazardCats: []string{"mechanical_hazard"},
SuggestedMeasureIDs: []string{"M051", "M141"},
SuggestedEvidenceIDs: []string{"E20"},
Priority: 75,
},
{
ID: "HP052", NameDE: "Druckfreisetzung Hydraulikspeicher", NameEN: "Pressure release from hydraulic accumulator",
RequiredComponentTags: []string{"hydraulic_part", "high_pressure"},
RequiredEnergyTags: []string{"stored_energy"},
GeneratedHazardCats: []string{"pneumatic_hydraulic"},
SuggestedMeasureIDs: []string{"M051", "M131"},
SuggestedEvidenceIDs: []string{"E01", "E08"},
Priority: 92,
},
{
ID: "HP053", NameDE: "Impulslaerm Pressvorgang", NameEN: "Impact noise during press operation",
RequiredComponentTags: []string{"noise_source", "high_force"},
RequiredEnergyTags: []string{},
GeneratedHazardCats: []string{"noise_vibration"},
SuggestedMeasureIDs: []string{"M141"},
SuggestedEvidenceIDs: []string{"E20"},
Priority: 70,
},
{
ID: "HP054", NameDE: "Schwungrad-Restenergie nach Abschaltung", NameEN: "Flywheel residual energy after shutdown",
RequiredComponentTags: []string{"rotating_part", "stored_energy"},
RequiredEnergyTags: []string{},
GeneratedHazardCats: []string{"mechanical_hazard"},
SuggestedMeasureIDs: []string{"M001", "M054"},
SuggestedEvidenceIDs: []string{"E01", "E08"},
Priority: 88,
},
{
ID: "HP055", NameDE: "Umgehung Schutzeinrichtung (Pressentuer)", NameEN: "Bypass of safety guard (press door)",
RequiredComponentTags: []string{"interlocked", "crush_point"},
RequiredEnergyTags: []string{},
GeneratedHazardCats: []string{"safety_function_failure"},
SuggestedMeasureIDs: []string{"M005", "M106"},
SuggestedEvidenceIDs: []string{"E01", "E08"},
Priority: 96,
},
{
ID: "HP056", NameDE: "Fehlbedienung Zweihandschaltung", NameEN: "Two-hand control misoperation",
RequiredComponentTags: []string{"two_hand_control_required"},
RequiredEnergyTags: []string{},
GeneratedHazardCats: []string{"safety_function_failure"},
SuggestedMeasureIDs: []string{"M106"},
SuggestedEvidenceIDs: []string{"E01"},
Priority: 90,
},
{
ID: "HP057", NameDE: "Hydraulikoelleckage + Rutschgefahr", NameEN: "Hydraulic oil leakage + slip hazard",
RequiredComponentTags: []string{"hydraulic_part", "chemical_risk"},
RequiredEnergyTags: []string{},
GeneratedHazardCats: []string{"material_environmental"},
SuggestedMeasureIDs: []string{"M141"},
SuggestedEvidenceIDs: []string{"E20"},
Priority: 65,
},
{
ID: "HP058", NameDE: "Ergonomische Belastung Kistenwechsel", NameEN: "Ergonomic strain during bin changeover",
RequiredComponentTags: []string{"ergonomic", "moving_part"},
RequiredEnergyTags: []string{},
GeneratedHazardCats: []string{"ergonomic"},
SuggestedMeasureIDs: []string{"M141"},
SuggestedEvidenceIDs: []string{"E20"},
Priority: 55,
},
}
}