Files
Jyotisha/scripts/kp_monthly_transits.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

48 lines
1.6 KiB
Python
Executable File

#!/usr/bin/env python3
"""Monthly transit snapshots for the KP three-year report."""
from __future__ import annotations
try: # pragma: no cover - import path differs under CLI vs pytest
from domain_calculation_service import compute_chart
except ImportError: # pragma: no cover
from scripts.domain_calculation_service import compute_chart
def build_monthly_transit_snapshot(
*, year: int, month: int, lat: float, lon: float, tz: float
) -> dict:
chart = compute_chart(
{
"year": year,
"month": month,
"day": 1,
"hour": 12,
"minute": 0,
"second": 0,
"lat": lat,
"lon": lon,
"tz": tz,
"ayanamsa": "kp",
"node_mode": "mean",
"position_mode": "apparent",
}
)
planets = chart.get("planets") if isinstance(chart.get("planets"), dict) else {}
snapshot = {}
for name in ("Sun", "Moon", "Mars", "Mercury", "Jupiter", "Venus", "Saturn", "Rahu", "Ketu"):
row = planets.get(name) if isinstance(planets.get(name), dict) else {}
snapshot[name] = {
"sign": row.get("sign"),
"longitude": row.get("degree_raw", row.get("degree")),
"retrograde": bool(row.get("retrograde")),
"speed": row.get("speed"),
}
return {
"month": f"{year:04d}-{month:02d}",
"anchor_local": f"{year:04d}-{month:02d}-01T12:00:00",
"planets": snapshot,
"status": "parameter_sensitive",
"source": "local_kp_month_anchor_chart",
}