From d0d1b38f5c0ec87f95ed7caf0d4435fc6c0837a6 Mon Sep 17 00:00:00 2001 From: Benjamin Admin Date: Wed, 13 May 2026 11:41:26 +0200 Subject: [PATCH] fix(iace): coarser block grouping by category+component only Co-Authored-By: Claude Opus 4.6 (1M context) --- .../internal/iace/hazard_blocks.go | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/ai-compliance-sdk/internal/iace/hazard_blocks.go b/ai-compliance-sdk/internal/iace/hazard_blocks.go index 1047573..20c0cef 100644 --- a/ai-compliance-sdk/internal/iace/hazard_blocks.go +++ b/ai-compliance-sdk/internal/iace/hazard_blocks.go @@ -2,7 +2,6 @@ package iace import ( "sort" - "strings" "github.com/google/uuid" ) @@ -108,22 +107,10 @@ func ComputeHazardBlocks( } func buildBlockKey(h Hazard) string { - comp := h.ComponentID.String() - zone := NormalizeDEPublic(h.HazardousZone) - // Use first 3 significant words of zone for grouping - words := strings.Fields(zone) - var sig []string - for _, w := range words { - w = strings.Trim(w, ".,;:!?()/-") - if len(w) >= 4 { - sig = append(sig, w) - } - if len(sig) >= 2 { - break - } - } - zoneKey := strings.Join(sig, "_") - return h.Category + ":" + comp + ":" + zoneKey + // Group by category + component. Hazards at the same component in the + // same category form one block — the zone is typically different but the + // protective measures (e.g. Schutzzaun, Sicherheitszuhaltung) are shared. + return h.Category + ":" + h.ComponentID.String() } func sortByRiskDesc(entries []HazardBlockEntry, assessMap map[uuid.UUID]*RiskAssessment) {