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:
@@ -140,13 +140,21 @@ func (h *IACEHandler) InitializeProject(c *gin.Context) {
|
||||
name = cat
|
||||
}
|
||||
scenario := mp.ScenarioDE
|
||||
hazardType := mp.GeneratedHazardType
|
||||
if hazardType == "" {
|
||||
hazardType = iace.DefaultHazardType
|
||||
}
|
||||
hz, cerr := h.store.CreateHazard(ctx, iace.CreateHazardRequest{
|
||||
ProjectID: projectID,
|
||||
ComponentID: defaultCompID,
|
||||
Name: name,
|
||||
Description: scenario,
|
||||
Category: cat,
|
||||
Scenario: scenario,
|
||||
ProjectID: projectID,
|
||||
ComponentID: defaultCompID,
|
||||
Name: name,
|
||||
Description: scenario,
|
||||
Category: cat,
|
||||
Scenario: scenario,
|
||||
TriggerEvent: mp.TriggerDE,
|
||||
PossibleHarm: mp.HarmDE,
|
||||
AffectedPerson: mp.AffectedDE,
|
||||
HazardousZone: mp.ZoneDE,
|
||||
})
|
||||
if cerr == nil {
|
||||
created++
|
||||
|
||||
Reference in New Issue
Block a user