Files
Jyotisha/scripts/report_render/avastha_terms.py
T
ClaudeandClaude Opus 5.5 6f10cce7ae fix(report): Avastha state names follow the calculator; nakshatra dasha context as in the upstream export (BUG-1661)
- BUG-1661: Avastha states were translated by the general glossary, which had
  Young as 青年期 and Youth as 壮年期 (the calculator says 少年期 / 青年期) and
  left Old, Dina, Sabha and others in English ("Deep 睡眠"). One table taken
  from the calculator's enum comments now names them in the report body, the
  appendix and the frontend fact table. The Python export also uses a comma
  for simultaneous Deeptadi states in English (BUG-1391 fixed only the
  frontend).
- Nakshatra dasha context: natal Moon nakshatra, the current MD and AD lords'
  nakshatras and Taras, and the nakshatra of each AD lord in the MD. Both
  Ashtottari applicability rules are listed; when they disagree the report
  says no ruling has been made.

Frontend: report-fact-tables.test.ts assertions updated with 原值/新值/原因.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyeZrYn6ryNcSe5Y2Y
2026-11-06 18:25:02 +08:00

36 lines
1.6 KiB
Python

"""Chinese names for avastha states (BUG-1661).
Taken from the comments on the state enums in `scripts/avastha_calculator.py`,
so the report says what the calculator means. The general glossary had
Young as 青年期 and Youth as 壮年期, the opposite of the calculator, and left
many states (Old, Dina, Sabha ...) in English.
"""
from __future__ import annotations
AVASTHA_ZH: dict[str, dict[str, str]] = {
"Bala": {"Infant": "婴儿期", "Young": "少年期", "Youth": "青年期", "Old": "老年期", "Dead": "死亡期"},
"Jagrat": {"Awake": "清醒", "Dreaming": "梦境", "Deep Sleep": "深睡"},
"Deeptadi": {
"Deepta": "光辉", "Swastha": "舒适", "Mudita": "快乐", "Shanta": "平静", "Dina": "低落",
"Duhkhita": "困苦", "Vikala": "残缺", "Khala": "负担", "Kopa": "愤怒",
},
"Lajjitadi": {
"Lajjita": "羞耻", "Garvita": "骄傲", "Kshudita": "饥饿", "Trushita": "口渴",
"Mudita": "快乐", "Kshobhita": "激动",
},
"Shayanadi": {
"Shayana": "躺卧", "Upaveshana": "坐着", "Netrapani": "手持武器", "Prakashana": "显现",
"Gamana": "行走", "Agamana": "到来", "Sabha": "集会", "Agama": "学习", "Bhojana": "进食",
"Nrityalipsa": "舞蹈", "Kautuka": "好奇", "Nidra": "睡眠",
},
}
NOT_CLASSIFIED_ZH = "不分类"
def avastha_zh(system: str, state: str) -> str | None:
"""Chinese name of one state in one system, or None when unknown."""
if state == "Not classified":
return NOT_CLASSIFIED_ZH
return AVASTHA_ZH.get(system, {}).get(state)