feat(iace): add missing measures (EMV, Potentialausgleich, KSS) + norm caps

Measures: M410-M420 (Potentialausgleich, Ableitstroeme, Kriechstrecken,
EMV-Installation, EMV-Pruefung, KSS-Leitungssicherheit)
Norms: per-type caps (A:5, B1:8, B2:10, C:10) for ~33 max suggestions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-05-13 10:19:45 +02:00
parent b2c1f0ae84
commit 7a5301064c
2 changed files with 45 additions and 6 deletions
@@ -142,7 +142,17 @@ func matchNorm(norm NormReference, machineType string, hazardSet, tagSet map[str
}
}
// groupByType sorts suggestions by confidence and groups them by norm type.
// Per-type caps for norm suggestions to avoid overwhelming the user.
// A professional typically references 3-5 A-norms, 5-10 B-norms, and 3-8 C-norms.
const (
maxANorms = 5
maxB1Norms = 8
maxB2Norms = 10
maxCNorms = 10
)
// groupByType sorts suggestions by confidence, groups them by norm type,
// and applies per-type caps to keep the list manageable.
func groupByType(suggestions []NormSuggestion) *NormSuggestionResult {
sort.Slice(suggestions, func(i, j int) bool {
return suggestions[i].Confidence > suggestions[j].Confidence
@@ -158,17 +168,25 @@ func groupByType(suggestions []NormSuggestion) *NormSuggestionResult {
for _, s := range suggestions {
switch s.Norm.NormType {
case "A":
result.ANorms = append(result.ANorms, s)
if len(result.ANorms) < maxANorms {
result.ANorms = append(result.ANorms, s)
}
case "B1":
result.B1Norms = append(result.B1Norms, s)
if len(result.B1Norms) < maxB1Norms {
result.B1Norms = append(result.B1Norms, s)
}
case "B2":
result.B2Norms = append(result.B2Norms, s)
if len(result.B2Norms) < maxB2Norms {
result.B2Norms = append(result.B2Norms, s)
}
case "C":
result.CNorms = append(result.CNorms, s)
if len(result.CNorms) < maxCNorms {
result.CNorms = append(result.CNorms, s)
}
}
}
result.Total = len(suggestions)
result.Total = len(result.ANorms) + len(result.B1Norms) + len(result.B2Norms) + len(result.CNorms)
return result
}