auto-sync: tudo-para-ia-mais-humana 2026-05-04 14:23:42
This commit is contained in:
@@ -67,6 +67,18 @@ class HumanPolicyPanel:
|
||||
summary: dict[str, int]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class HumanEvidenceGap:
|
||||
decision_id: str
|
||||
status: str
|
||||
expected_evidence: tuple[str, ...]
|
||||
present_evidence: tuple[str, ...]
|
||||
missing_evidence: tuple[str, ...]
|
||||
visible_to_profile: str
|
||||
human_impact: str
|
||||
next_question: str
|
||||
|
||||
|
||||
def _impact(profile_id: str, expectation: str, signal: str, risk: str, question: str) -> HumanImpact:
|
||||
return HumanImpact(
|
||||
profile_id=profile_id,
|
||||
@@ -435,3 +447,50 @@ def export_human_policy_readiness_panel(
|
||||
"summary": panel.summary,
|
||||
"signals": [asdict(signal) for signal in panel.signals],
|
||||
}
|
||||
|
||||
|
||||
def build_human_institutional_evidence_gap_analysis(
|
||||
available_evidence: dict[str, tuple[str, ...]] | None = None,
|
||||
) -> dict[str, object]:
|
||||
evidence_by_decision = available_evidence or {
|
||||
decision.decision_id: decision.expected_mcp_evidence
|
||||
for decision in INSTITUTIONAL_DECISIONS
|
||||
}
|
||||
gaps: list[HumanEvidenceGap] = []
|
||||
for decision in INSTITUTIONAL_DECISIONS:
|
||||
expected = tuple(decision.expected_mcp_evidence)
|
||||
present = tuple(evidence_by_decision.get(decision.decision_id, ()))
|
||||
present_set = set(present)
|
||||
missing = tuple(field for field in expected if field not in present_set)
|
||||
status = "ready" if not missing else "partial" if present else "blocked"
|
||||
profile = decision.affected_profiles[0]
|
||||
gaps.append(
|
||||
HumanEvidenceGap(
|
||||
decision_id=decision.decision_id,
|
||||
status=status,
|
||||
expected_evidence=expected,
|
||||
present_evidence=present,
|
||||
missing_evidence=missing,
|
||||
visible_to_profile=profile.profile_id,
|
||||
human_impact=profile.risk_if_missing if missing else profile.visible_signal,
|
||||
next_question=profile.next_human_question,
|
||||
)
|
||||
)
|
||||
summary = {
|
||||
"ready": sum(1 for gap in gaps if gap.status == "ready"),
|
||||
"partial": sum(1 for gap in gaps if gap.status == "partial"),
|
||||
"blocked": sum(1 for gap in gaps if gap.status == "blocked"),
|
||||
"missing_evidence": sum(len(gap.missing_evidence) for gap in gaps),
|
||||
"total": len(gaps),
|
||||
}
|
||||
return {
|
||||
"ok": summary["partial"] == 0 and summary["blocked"] == 0,
|
||||
"policy_version": POLICY_VERSION,
|
||||
"generated_at": "2026-05-04T00:00:00.000Z",
|
||||
"gaps": [asdict(gap) for gap in gaps],
|
||||
"summary": summary,
|
||||
"human_boundary": (
|
||||
"Mais Humana avalia confianca e pergunta humana; MCP/Docs continuam donos da prova "
|
||||
"e a UI continua responsavel por renderizar a mesma fonte."
|
||||
),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user