Files
Jyotisha/scripts/research/refresh_density_fixture_ashtakavarga.py
T
Jesse_ChenandClaude Opus 5.5 ea78804b78 feat(ashtakavarga): standard Sodhita chain on reports and cards, raw values beside (T7, BUG-1209)
Astrologer ruling 乙8. New scripts/ashtakavarga_shodhana.py: per BAV row Trikona then
Ekadhipatya (the two existing ashtakavarga functions, previously only called by
tests), Sodhita SAV = sum of reduced rows; occupied signs = seven grahas. Removed
calc_sodhita_av (Sun/Mars/Saturn contribution removal labelled 'BPHS标准').
Wired into /api/ashtakavarga (result.sodhita, house_scores[*].sav_sodhita) and the
full reading. Reader: SAV table 'Sodhita SAV | Raw SAV', house table gains
Sodhita column, Sodhita BAV table before raw BAV; reference edition section
rewritten. Card: sav_sodhita before sav_score plus sav_columns label. Personal
report facts: score = Sodhita, rawScore/savRawTotal beside (optional schema
fields). Fact tables: Sodhita column and Sodhita BAV subtable. Transit scoring
unchanged (raw bindus).

Golden: report-density-fictional-engine.json leaf worksheets.strengths_and_scores
.ashtakavarga recaptured from the real engine (scripts/research/refresh_density_
fixture_ashtakavarga.py); bav/sav identical, every other leaf byte-equal.
Changed assertions (three columns in PROGRESS): BUG-1200 house-table tests,
report-fact-tables ashtakavarga columns/subtables, run_all t1/t57.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N4f2nya58RoRu4yEmJgRGE
2026-10-03 12:41:26 +08:00

47 lines
2.0 KiB
Python

"""Refresh one leaf of the report density fixture from the real engine (BUG-1209).
`frontend/tests/fixtures/report-density-fictional-engine.json` is a 2026-09-23
real-engine snapshot without a capture script. The Ashtakavarga reduction moved
to the standard Trikona -> Ekadhipatya chain, so only
`worksheets.strengths_and_scores.ashtakavarga` is recaptured here, from the
fixture's own recorded input (fictional, 2000-01-01 12:00 UT, 0/0); every other
leaf stays byte-identical.
PYTHONHASHSEED=0 python3 scripts/research/refresh_density_fixture_ashtakavarga.py
"""
from __future__ import annotations
import json
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
sys.path[:0] = [str(ROOT), str(ROOT / "scripts")]
from scripts.jyotish_engine import build_professional_report_reference_packet, cmd_full_reading # noqa: E402
from scripts.professional_report_reference import _export_args # noqa: E402
FIXTURE = ROOT / "frontend/tests/fixtures/report-density-fictional-engine.json"
def main() -> int:
text = FIXTURE.read_text(encoding="utf-8")
fixture = json.loads(text)
case = dict(fixture["fixtureProvenance"]["input"])
case.setdefault("age", int(case["target_year"]) - int(case["year"]))
packet = build_professional_report_reference_packet(cmd_full_reading(type("Args", (), dict(case))()), _export_args(dict(case)), [])
fixture["worksheets"]["strengths_and_scores"]["ashtakavarga"] = packet["worksheets"]["strengths_and_scores"]["ashtakavarga"]
fixture["fixtureProvenance"]["refreshed"] = {
"leaf": "worksheets.strengths_and_scores.ashtakavarga",
"reason": "BUG-1209 standard Sodhita chain (TASK-astrologer-rulings-batch1-20261003 T7)",
"generator": "scripts/research/refresh_density_fixture_ashtakavarga.py",
}
indent = 2 if text.startswith("{\n ") else None
FIXTURE.write_text(json.dumps(fixture, ensure_ascii=False, indent=indent) + ("\n" if text.endswith("\n") else ""), encoding="utf-8")
return 0
if __name__ == "__main__":
raise SystemExit(main())