/api/chart, /api/dasha and the analysis layer, daily guidance and the KP monthly packet used compute_vimshottari_timeline, which hands build_dasha_timeline only the birth date, so periods started at midnight; cmd_dasha (reports) starts from the birth clock and lays antardashas from the full parent with float days. scripts/chart_dasha/birth_moment.py reproduces cmd_dasha; 60 standard charts: MD and AD 60/60 equal (old chart path 9/60), 51 charts move by at most one day. Frozen scoring files are untouched, so rectification probes keep the day start (left for a product decision). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
49 lines
1.9 KiB
Python
Executable File
49 lines
1.9 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 chart_dasha.birth_moment import compute_vimshottari_timeline # issue #137: same start as the report
|
|
except ImportError: # pragma: no cover
|
|
from scripts.dasha_calculator_enhanced import calculate_five_level_dasha
|
|
from scripts.chart_dasha.birth_moment 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"],
|
|
}
|