21 lines
791 B
Python
21 lines
791 B
Python
from __future__ import annotations
|
|
|
|
from dataclasses import asdict
|
|
from typing import Iterable
|
|
|
|
from .decision import OpportunityDecision
|
|
from .validators import decision_coherence_flags
|
|
|
|
|
|
def audit_decisions(decisions: Iterable[OpportunityDecision]) -> list[dict[str, object]]:
|
|
"""Return workflow inconsistencies from already computed decisions.
|
|
|
|
This foundation helper is intentionally data-source agnostic. A later admin
|
|
page can feed production opportunities into it and render a coherence panel.
|
|
"""
|
|
findings: list[dict[str, object]] = []
|
|
for index, decision in enumerate(decisions):
|
|
for code in decision_coherence_flags(decision):
|
|
findings.append({"index": index, "code": code, "decision": asdict(decision.next_action)})
|
|
return findings
|