Files
Jyotisha/scripts/generic_varga_research_audit.py
T
ClaudeandClaude Opus 5.5 67335ce827 feat(report): run the astrologer's skill in the report reading and keep the audit in the export
产品 2026-11-07 占星师方案 (item 4/5/6/8/10): the report reading and the export follow her skill.

- reading_facts v2 contract: birth parameters (no name/coordinates), 12 houses with KP cusps,
  functional roles and natural-vs-functional conflicts, per-domain vargas (wealth D2+D11+D10,
  A2/A11/A10; career D10+A10, AK/AmK; marriage D9+UL, A7/DK), special points, Jaimini, yogas as
  candidates with conditions, Vimshottari to PD + Narayana with dates (birth date + age) and the
  legacy variant, every dasha family's current period/status, transits from four reference points,
  Sade Sati, double transit, strengths, KP, annual, technique audit, evidence paths, method
  differences, blocked / parameter_sensitive / withheld states
- consult card facts: multi-varga domains, A2/A11/A10/AK/A7 participation, D1 varga resolves,
  yoga path fixed, Narayana ages; KP is conditional (参数敏感) instead of 不参与
- report writer: professional prompt (evidence first, A/B/C, dual-track timing, status labels),
  ninth section 依据与边界 (stored reading v2; v1 still reads), Latin allowed, longer limits
- export: technique audit chapter (Functional Benefic/Malefic, MEVG / Global Web Evidence,
  Real Case Calibration rows), parameter/method differences, dasha system status, evidence
  boundaries and the D1–D60 ledger (20 formal + 40 research D-N); upstream
  varga_evidence_matrix / generic_varga_research_audit + registries ported so the ledger is no
  longer blocked
- ordinary projection no longer deletes technique audit / MEVG / 参数敏感; parameter_sensitive
  is relabelled 参数敏感
- quality gate: upstream technique_audit_table check restored, plus required-row check

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
2026-11-07 14:57:58 +08:00

79 lines
2.9 KiB
Python

"""Validate research-only evidence status for non-formal divisional charts."""
from __future__ import annotations
import copy
import json
from pathlib import Path
from typing import Any
ROOT = Path(__file__).resolve().parents[1]
REGISTRY_PATH = ROOT / "references/oracle/d1_d60_generic_research_registry_2026_07_24.json"
DOSSIER_PATH = ROOT / "references/oracle/d1_d60_generic_research_dossier_2026_07_24.json"
REQUIRED_GATES = (
"tradition",
"formula_variant",
"use",
"external_numeric",
"public_case",
"negative_control",
)
def _load_dossier() -> dict[str, Any]:
return json.loads(DOSSIER_PATH.read_text(encoding="utf-8"))
def _validate_dossier(registry: dict[str, Any], dossier: dict[str, Any]) -> dict[str, dict[str, Any]]:
expected = {item["division"] for item in registry["rows"]}
rows = {item["division"]: item for item in dossier["rows"]}
if set(rows) != expected:
raise ValueError("dossier divisions do not match generic registry")
catalog = dossier["evidence_catalog"]
default_gates = dossier["default_gates"]
if set(default_gates) != set(REQUIRED_GATES):
raise ValueError("dossier has missing research gates")
for division, row in rows.items():
gates = row.get("gates", default_gates)
if set(gates) != set(REQUIRED_GATES):
raise ValueError(f"{division} has missing research gates")
for gate in gates.values():
if gate.get("status") not in {"closed", "open", "blocked"}:
raise ValueError(f"{division} has invalid gate status")
unknown = set(gate.get("evidence_ids", ())) - set(catalog)
if unknown:
raise ValueError(f"{division} has unknown evidence: {sorted(unknown)}")
if row.get("promotion_allowed") and any(
gate["status"] != "closed" or not gate.get("evidence_ids")
for gate in gates.values()
):
raise ValueError(f"{division} cannot promote with incomplete research gates")
return rows
def build_generic_varga_audit() -> dict[str, Any]:
registry = json.loads(REGISTRY_PATH.read_text(encoding="utf-8"))
dossier = _load_dossier()
dossier_rows = _validate_dossier(registry, dossier)
rows = {
item["division"]: {
"division": item["division"],
"gates": copy.deepcopy(item.get("gates", dossier["default_gates"])),
"claim_status": item.get("claim_status", "research_only_blocked"),
"promotion_allowed": item.get("promotion_allowed", False),
"research_note": item["research_note"],
}
for item in dossier_rows.values()
}
return {
"scope": "generic_varga_research_audit",
"evidence_catalog": dossier["evidence_catalog"],
"rows": rows,
"summary": {
"division_count": len(rows),
"promotion_allowed_count": 0,
},
}