Dashboard › institutional-transition-lab › Distillation
61d145e1-4498-4f9c-b30a-866486f95914["lore_tm_v1_NfUxrvMH1J1OXYVpSmUcsSqfgHkSBaJZOqz5PNHpThI","lore_tm_v1_upcQEYiUsat5-0dbj9rfBJiBZn_gMSFHs2b48kgLtqw","lore_tm_v1_K6C0EYaxyRZ9fsxtcfBAqHen6f1L8NZl_LKfoFhSs1g"]
/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py; lines 1–220 define preparation and validation machinery for performance-blinded coding of enriched governance records.governance_coding.py defines RECORD_CLASSES as effective_institutional_change, announced_institutional_change, proposal_only, control_event, no_event, and abstain.governance_coding.py defines EVENT_KINDS as leadership, board_or_steering, control_rights, reorganization, foundation_transfer, license, fork, reunification, strategy, product, and external.governance_coding.py defines RIGHT_KINDS as appoint, remove, elect, vote, delegate, override, approve, merge, write, release, veto, own, license, steward, fund, set_budget, set_strategy, set_policy, set_membership, set_terms, and inform.governance_coding.py defines DIRECTIONS = {"added", "removed", "modified"} and CHANGE_STATUSES = {"effective", "announced", "proposed", "rejected", "unclear"}.governance_coding.py defines BODY_PATCH_RELATIONS as consistent, patch_supersedes_body, body_only, patch_only, conflict, not_applicable, and unclear.governance_coding.py require RESPONSE_KEYS: record_class, event_kind, title, announced_on, effective_on, affected_scope, body_patch_relation, power_changes, confidence, and ambiguity; POWER_KEYS: actor, right_kind, target, direction, change_status, scope, and evidence_refs; and REF_KEYS = {"source_id", "quote"}.MODEL_INPUT_FIELDS in governance_coding.py are ordered as entity_id, publisher, published_on, source_type, sources, and evidence_bounds; CODING_DOCUMENT_KEYS combines record_id, source_url, and all MODEL_INPUT_FIELDS._hash(payload: object) -> str in governance_coding.py serializes JSON with sort_keys=True and separators=(",", ":"), encodes it, and returns its SHA-256 hexadecimal digest via hashlib.sha256(data).hexdigest()._valid_date(value: object) -> bool accepts None; otherwise requires a string whose date.fromisoformat(value).isoformat() exactly equals the supplied value, returning False for non-strings or ValueError._nonempty(value: object) -> bool returns true only for a string containing non-whitespace characters.prepare_coding_bundle(enriched: dict[str, Any], documents_payload: dict[str, Any], *, schema_sha256: str = "unversioned-test-schema") -> dict[str, Any] joins source bodies to an enriched envelope while omitting model-side triage metadata.prepare_coding_bundle() requires enriched["records"] and documents_payload["documents"] to be lists containing only dictionaries, otherwise raising ValueError("enriched payload requires records") or ValueError("documents payload requires documents"); source documents are indexed by str(item.get("document_id")).prepare_coding_bundle() requires a string document_id matching a source document, a nonempty string source text, and a dictionary enrichment; failures raise ValueError messages enriched record has no source document: {record_id}, source document has no text: {record_id}, or record has no enrichment: {record_id}.{"source_id": "body", "kind": "github_body", "filename": None, "text": body}.enrichment["kind"] == "pull_request_state_and_patch", prepare_coding_bundle() creates pr_metadata from state, draft, merged, merged_at, merge_commit_sha, base_sha, head_sha, and changed_files; it adds this as {"source_id": "pr_metadata", "kind": "github_pr_metadata", "filename": None, "text": json.dumps(metadata, sort_keys=True)}.enrichment["relevant_files"] with a string patch becomes a source with source_id patch:{index}, kind github_pr_patch, its filename, and the exact patch text; malformed entries or entries without string patches are skipped.evidence_bounds produced by prepare_coding_bundle() contain Boolean source_text_truncated, Boolean files_listing_complete, Boolean patch_selection_truncated, and patch_unavailable_count, where the count sums truthy patch_unavailable values across dictionary entries in relevant_files.evidence_bounds produced by prepare_coding_bundle() contain Boolean source_text_truncated, files_listing_complete: None, patch_selection_truncated: False, and patch_unavailable_count: 0.record_id, entity_id, publisher, published_on, source_url, source_type, sources, and evidence_bounds, drawing identifying fields from the matched source document.prepare_coding_bundle() begins with schema_version: 1, coding_id: "oss-governance-enriched-coding-v1", coding_schema_sha256: schema_sha256, and design_status: "performance_blinded_model_informed_development"./home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py found 5 matches for the searched institutional-class terms: effective_institutional_change at lines 15 and 305, proposal_only at lines 17 and 307, and control_rights at line 25./home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py found 15 matches related to record_class and power_changes: record_class at lines 70, 245, 246, 247, 304, 313, 429, and 448; power_changes at lines 77, 273, 275, 278, 310, 312, and 381.governance_coding.py: disallowed classes append record_class is not allowed; non-array changes append power_changes must be an array; institutional/proposal records require power_changes; non-institutional records must not contain power_changes; and an abstain response requires non-None ambiguity.