Files
Jyotisha/scripts/kp_monthly_vimshottari.py
T
Jesse_Chen bab0718700
Independent Staging Quality Gate / validate (push) Failing after 9m41s
Independent Staging Quality Gate / publish (push) Has been skipped
feat(report): ship full-mode longform appendix beside the five-chapter report
Web export now calls the same full pack as the long skill report and caches an owner-only Markdown download. Appendix failure stays unavailable and does not change the main report status.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-05 11:10:44 +08:00

49 lines
1.8 KiB
Python
Executable File

#!/usr/bin/env python3
"""Monthly five-level Vimshottari snapshots for the KP monthly report."""
from __future__ import annotations
from datetime import datetime
try: # pragma: no cover - import path differs under CLI vs pytest
from dasha_calculator_enhanced import calculate_five_level_dasha
from domain_calculation_service import compute_vimshottari_timeline
except ImportError: # pragma: no cover
from scripts.dasha_calculator_enhanced import calculate_five_level_dasha
from scripts.domain_calculation_service import compute_vimshottari_timeline
def build_monthly_vimshottari_snapshot(
*, birth_dt: datetime, moon_lon: float, anchor_dt: datetime
) -> dict:
timeline = compute_vimshottari_timeline(
birth_dt=birth_dt,
moon_lon=moon_lon,
current_date=anchor_dt,
)
current = timeline.get("current_dasha") or {}
start_text = current.get("start")
if start_text:
current_start = datetime.strptime(start_text, "%Y-%m-%d")
elapsed_years = max((anchor_dt - current_start).days / 365.25, 0.0)
else:
elapsed_years = 0.0
md_lord = current.get("lord") or timeline.get("birth_balance", {}).get("lord")
levels = calculate_five_level_dasha(md_lord, elapsed_years)
return {
"anchor_date": anchor_dt.strftime("%Y-%m-%d"),
"timeline": {
"current_dasha": current,
"birth_balance": timeline.get("birth_balance"),
},
"levels": {
"mahadasha": levels.get("mahadasha"),
"antardasha": levels.get("bhukti"),
"pratyantardasha": levels.get("pratyantar"),
"sookshma": levels.get("sookshma"),
"prana": levels.get("prana"),
},
"status": "parameter_sensitive",
"must_not_claim": ["exact_event_timing", "specific_event_prediction"],
}