BUG-2392 writes formation_note_zh / formation_note_en on formed Raja rows whose lords also rule 6, 8 or 12. The report now prints that note after the status in the body yoga table, after the formation line on the yoga page, and in the appendix table's formation cell. Also updates a stale assertion from BUG-2367 (the PD-only cell in the house-lord column). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXp3RzgZVEpT1PXxkwHj
48 lines
2.3 KiB
Python
48 lines
2.3 KiB
Python
"""Cached full-data reports for the repository's public chart fixtures."""
|
|
|
|
from copy import deepcopy
|
|
from functools import lru_cache
|
|
|
|
from scripts.jyotish_engine import build_professional_report_reference_packet, cmd_full_reading
|
|
from scripts.pl9_full_data_export import REPORT_VERSION_FULL
|
|
from scripts.pl9_reader_export import _pl9_export_markdown_for_edition
|
|
from scripts.professional_report_reference import _export_args
|
|
from scripts.report_render.annual_motion import attach_annual_motion
|
|
from scripts.report_render.expression_paths_wiring import attach_engine_expression_paths
|
|
from tests.test_consult_card_full_source import _public_body
|
|
|
|
|
|
PUBLIC_REPORT_CASES = ("steve_jobs_1955_aa", "barack_obama_1961_aa")
|
|
|
|
|
|
@lru_cache(maxsize=len(PUBLIC_REPORT_CASES))
|
|
def public_chart_reports(case_id: str) -> tuple[dict, str, str]:
|
|
args = _export_args({**_public_body(case_id), "today": "2026-11-11", "target_year": 2026})
|
|
reading = cmd_full_reading(args)
|
|
packet = dict(build_professional_report_reference_packet(reading, args, []))
|
|
packet["report_version"] = REPORT_VERSION_FULL
|
|
# BUG-2315: as the report API does (professional_report_reference._attach_annual_motion).
|
|
attach_annual_motion(packet)
|
|
# BUG-2296: as the report API does (professional_report_reference.build_professional_report_reference).
|
|
attach_engine_expression_paths(reading, packet)
|
|
chinese = _pl9_export_markdown_for_edition(packet, "full_data")
|
|
english_packet = deepcopy(packet)
|
|
english_packet["report_language"] = "en"
|
|
english = _pl9_export_markdown_for_edition(english_packet, "full_data")
|
|
return packet, chinese, english
|
|
|
|
|
|
def without_appendix_yoga_sources(markdown: str) -> str:
|
|
"""The report minus the appendix yoga table (「瑜伽条目」 / "Canonical Yoga Rows").
|
|
|
|
Owner 2026-11-24 (density handoff rule 3): a yoga's book source may appear only in the appendix data
|
|
chapters; that table carries 条件出处 / 含义出处 (BUG-2377). Everything else stays book-free (BUG-2129).
|
|
"""
|
|
for heading in ("\n### 瑜伽条目\n", "\n### Canonical Yoga Rows\n"):
|
|
start = markdown.find(heading)
|
|
if start < 0:
|
|
continue
|
|
ends = [index for index in (markdown.find("\n## ", start + 1), markdown.find("\n### ", start + 1)) if index > 0]
|
|
markdown = markdown[:start] + (markdown[min(ends):] if ends else "")
|
|
return markdown
|