feat(iace): Sprint 4B — ISO 12100 Hazard/Situation/Harm Trennung

ISO 12100 trennt: Hazard (Quelle) → Hazardous Situation (Person exponiert) → Harm (Verletzung).
Bisher war alles in einem Hazard-Record vermischt.

Implementierung als abgeleitetes Feld (keine DB-Migration noetig):
- HazardType Feld auf Hazard Entity ("hazard"|"hazardous_situation"|"harm")
- DeriveHazardType() berechnet Typ aus Scenario/PossibleHarm/Category
- Explizites Override moeglich (HazardType direkt setzen)
- GeneratedHazardType auf HazardPattern fuer Pattern-gesteuerte Zuweisung
- Store: GetHazard/ListHazards setzen HazardType automatisch
- Init-Handler: Fuellt jetzt TriggerEvent, PossibleHarm, AffectedPerson, HazardousZone
  aus Pattern-Match-Daten (vorher leer gelassen)

6 neue Tests: ScenarioAndHarm, HarmOnly, CategoryOnly, ExplicitOverride,
EmptyFallback, PatternMatchField

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-05-10 20:55:26 +02:00
parent 6e995b52d1
commit d339d1edc7
7 changed files with 119 additions and 10 deletions
@@ -95,6 +95,7 @@ func (s *Store) GetHazard(ctx context.Context, id uuid.UUID) (*Hazard, error) {
h.Status = HazardStatus(status)
h.ReviewStatus = ReviewStatus(reviewStatus)
h.HazardType = DeriveHazardType(&h)
return &h, nil
}
@@ -133,6 +134,7 @@ func (s *Store) ListHazards(ctx context.Context, projectID uuid.UUID) ([]Hazard,
h.Status = HazardStatus(status)
h.ReviewStatus = ReviewStatus(reviewStatus)
h.HazardType = DeriveHazardType(&h)
hazards = append(hazards, h)
}