Import ClientFlow production v4928.1.5.132.4
This commit is contained in:
20
app/domain/opportunity_flow/audit.py
Normal file
20
app/domain/opportunity_flow/audit.py
Normal file
@@ -0,0 +1,20 @@
|
||||
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
|
||||
Reference in New Issue
Block a user