feat(report): replace the reader edition with the full-data report

Generate the full-data edition (pl9_personal_long_report.v4) and remove the reader edition. English still contains Han, so the API withholds it (BUG-1272, investigating). This commit is not pushed to staging.
This commit is contained in:
jesse-ux
2026-10-08 22:29:31 +08:00
committed by Jesse_Chen
parent db0134f9db
commit 98c98aa535
32 changed files with 4039 additions and 133 deletions
+26 -15
View File
@@ -8,10 +8,9 @@ rewritten in place (concession 1). Algorithm text is unchanged except ``_bind_en
``render_pl9_parity_markdown`` reads ``SIGNS`` / ``SIGNS_CN`` through ``globals()``, which only
works in the engine module.
Upstream ``_pl9_export_markdown_for_edition`` also serves ``pl9_ai_density``. That branch needs
``_render_pl9_ai_density_raw_data_markdown_en`` and the English density sanitizers, which are
outside the ``reader_main`` closure and are not ported. ``reader_main`` and the reference
default match the upstream branches.
``full_data`` (upstream ``pl9_ai_density``) is rendered by ``scripts/pl9_full_data_export.py``
on top of ``render_pl9_parity_markdown``. The reader edition ``reader_main`` is no longer
dispatched. The reference default is unchanged.
BUG-1028 / 2026-09-25 local reader binding correction: annual lord, Muntha and
annual ascendant are read from their own authoritative pack fields. Upstream
@@ -53,21 +52,18 @@ def _reference_markdown(packet: dict) -> str:
def _pl9_export_markdown_for_edition(packet: dict, edition: str) -> str:
"""Dispatch reader_main vs the reference renderer.
"""Dispatch full_data vs the reference renderer.
Upstream ``23b9609e`` ``scripts/jyotish_engine.py`` lines 13099-13145.
``pl9_ai_density`` is not ported; see the module docstring.
``full_data`` is the upstream ``pl9_ai_density`` branch. ``reader_main`` is removed.
"""
_bind_engine_symbols()
normalized = str(edition or "").strip()
if normalized == "reader_main":
if _pl9_report_language(packet) == 'en':
try:
from scripts.pl9_reader_english import render_pl9_user_markdown_en
except ModuleNotFoundError: # pragma: no cover - direct scripts/ execution
from pl9_reader_english import render_pl9_user_markdown_en
return render_pl9_user_markdown_en(packet)
return _render_pl9_user_markdown(packet)
if normalized == "full_data":
try:
from scripts.pl9_full_data_export import render_full_data_markdown
except ModuleNotFoundError: # pragma: no cover - direct scripts/ execution
from pl9_full_data_export import render_full_data_markdown
return render_full_data_markdown(packet)
if normalized in {"pl9_parity", "pl9_fixed_204"}:
return render_pl9_parity_markdown(packet)
return _reference_markdown(packet)
@@ -1736,6 +1732,21 @@ def render_pl9_parity_markdown(packet: dict) -> str:
f"{_period_end(child) or _cell(child_raw.get('end_date') or child_raw.get('end'))} |"
)
lines.append('')
# BUG-1215 / BUG-1218: the full-data edition keeps the legacy label and the
# Rath table already printed by the reference renderer. Display only.
narayana_packet = _dict(timing.get('narayana_dasha'))
if narayana_packet:
try:
from narayana_legacy_label import rath_report_lines_zh as _rath_lines
except ImportError:
from scripts.narayana_legacy_label import rath_report_lines_zh as _rath_lines
legacy_line = f'- 算法:{LEGACY_NOTE_ZH}'
if legacy_line not in lines:
lines.extend(['### Narayana Dasha', '', legacy_line, ''])
rath_lines = [line for line in _rath_lines(narayana_packet.get('rath')) if line]
if rath_lines and not any(str(line).startswith('- 并列:') for line in lines):
lines.extend(rath_lines)
lines.append('')
source_dasha_pages = _list(source_visible.get('dasha_pages'))
if source_dasha_pages:
source_titles = {