git-subtree-dir: fiscal git-subtree-mainline:d95165fc8fgit-subtree-split:102ba84500
18 lines
717 B
Python
18 lines
717 B
Python
"""Evidence-gated origin resolution; CST digits are never an origin source."""
|
|
|
|
|
|
def resolve_origin(product_id: str, aggregate: dict, kb_facts: dict) -> dict:
|
|
if aggregate.get("conflict_count", 0):
|
|
status = "ORIGIN_CONFLICT"
|
|
elif aggregate.get("strong_evidence") and aggregate.get("value") in {str(i) for i in range(9)}:
|
|
status = "ORIGIN_CONFIRMED"
|
|
else:
|
|
status = "ORIGIN_NEEDS_EVIDENCE"
|
|
return {
|
|
"product_id": product_id,
|
|
"status": status,
|
|
"value": aggregate.get("value") if status == "ORIGIN_CONFIRMED" else None,
|
|
"provenance": aggregate.get("provenance", []),
|
|
"reason": "explicit supplier observations only; CST digit ignored",
|
|
}
|