diff --git a/backend-compliance/compliance/api/agent_doc_check_exec_summary.py b/backend-compliance/compliance/api/agent_doc_check_exec_summary.py index 08a90874..8ee634c0 100644 --- a/backend-compliance/compliance/api/agent_doc_check_exec_summary.py +++ b/backend-compliance/compliance/api/agent_doc_check_exec_summary.py @@ -26,6 +26,47 @@ def _fmt_eur_range(low: int, high: int) -> str: return f"{low:,}–{high:,} €".replace(",", ".") +def _build_score_band_block(pct: int, color: str) -> list[str]: + """P34 — eine Zeile unter den KPIs: Score-Einordnung.""" + band, hint = _score_band_explanation(pct) + return [ + f'
' + f'
' + f'{band} ({pct}%) — {hint}' + f'
', + ] + + +def _score_band_explanation(pct: int) -> tuple[str, str]: + """P34 — Was bedeutet der Score: wo MUESSTE man stehen. + + Returns (label, what_to_expect).""" + if pct >= 85: + return ( + "Sehr gut", "Praxis-uebliche DSGVO-Risikolage. " + "Standard-Pflege reicht — jaehrliche Pruefung empfohlen.", + ) + if pct >= 70: + return ( + "Akzeptabel", "Branchen-Median. Verbleibende Findings sind " + "meist Formalia — Empfehlung: einmaliges Aufraeumen, dann " + "Halbjahres-Check.", + ) + if pct >= 50: + return ( + "Handlungsbedarf", "Mehrere wesentliche Themen offen. " + "Empfehlung: priorisierte Abarbeitung der HIGH-Findings " + "binnen 4-8 Wochen mit DSB + Web-Team.", + ) + return ( + "Erhoehtes Risiko", "Mehrere Kern-Pflichten fehlen oder sind " + "veraltet. Empfehlung: kurzfristiger Termin mit DSB / Rechtsabteilung " + "und Web-Team zur Priorisierung.", + ) + + def build_exec_summary_html( scorecard: dict | None, previous_scorecard: dict | None, @@ -117,6 +158,9 @@ def build_exec_summary_html( '', + # P34 — Score-Einordnung "wer wo stehen muss" + *(_build_score_band_block(pct, score_color) if scorecard else []), + # CTAs '
',