Dashboard › institutional-transition-lab › Distillation
b66012d3-9d52-4172-8b10-abfebf8c3522["lore_tm_v1_u168xgqARXxAZibOhV5xEOOLl0fxH0M53TTOMR4V18w","lore_tm_v1_w70adAvda-If4D0f3qVZKPbN36S0oOiBPyf9lS5tLYI"]
src/institution_lab/governance_coding.py:241-315: validate_response(response: dict[str, Any], document: dict[str, Any]) -> list[str] requires the response key set to equal RESPONSE_KEYS, validates record_class against RECORD_CLASSES, permits event_kind=None or a value in EVENT_KINDS, requires non-null title, affected_scope, and ambiguity values to be non-empty strings, validates announced_on and effective_on with _valid_date(), and validates body_patch_relation against BODY_PATCH_RELATIONS.validate_response() rejects confidence when it is a bool, is not an int | float, is non-finite under math.isfinite(float(confidence)), or lies outside the inclusive range 0 <= confidence <= 1; the emitted error is confidence must be between zero and one.validate_response() builds source_map from each dictionary in document["sources"], mapping source_id to text; power_changes must be a list, and a non-list value produces power_changes must be an array before validation continues with an empty list.power_changes[index] must be a dictionary whose exact key set equals POWER_KEYS; actor, target, and scope must be non-empty, while right_kind, direction, and change_status must belong to RIGHT_KINDS, DIRECTIONS, and CHANGE_STATUSES, respectively.evidence_refs must be a non-empty list. Every reference must be a dictionary with exactly REF_KEYS, and grounding requires a valid string source text, a non-empty quote, and that quote to occur literally in the referenced source text; malformed and ungrounded references receive index-specific errors.validate_response() treats effective_institutional_change, announced_institutional_change, and proposal_only as institutional classes: these require non-empty power_changes; all other classes must not contain power changes. A response with record_class == "abstain" additionally requires non-null ambiguity.