Files
Jyotisha/scripts/functional_layer.py
T
ClaudeandClaude Opus 5.5 5d64f71b81 fix: astrologer round-5 rulings 2/3/4/5/10/13 (BUG-1746..1752)
- Functional default = PVR Table 30 (functional_profile=pvr_table_30); the former
  product table is bphs_exception_profile, scored only when named (rectification
  names it, scores unchanged). profile_divergence shows both roles side by side;
  movable-lagna Moon by the table's paksha note; dual-lordship note; prior rulings
  BUG-1570/1590/#166 Q4 checked against Table 30.
- Shadbala: six open items labelled parameter_sensitive; every option combination
  computed; only planets whose pass/fail flips get minimum_check=parameter_sensitive.
- Vimshottari AD/PD rows carry parent_period_start / visible_period_start; the
  consult card cuts the balance MD from its full parent and clips at birth.
- KP DBA: full first parent, clipped at birth (no balance rescale).
- Mudda: balance fields + balance_method (angle default, time comparison apart),
  nominal_year_days, her crossing wording; Harsha combined blocked reason lists items.
- D30 _meta describes the unequal parts (as her r40).
- Golden recaptured with TTL=0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
2026-11-08 11:57:22 +08:00

57 lines
2.2 KiB
Python

"""One functional benefic/malefic snapshot for the engine, API, and MCP.
This module is not ``functional_benefics.py``. That file is in the
rectification identity; rectification scoring names ``bphs_exception_profile``
explicitly, every product surface takes the default ``pvr_table_30``.
"""
from __future__ import annotations
from typing import Any
def functional_layer_for_ascendant(
ascendant: Any,
planets: Any = None,
*,
functional_profile: str | None = None,
) -> dict[str, Any]:
"""Return the functional layer for an ascendant payload.
A dict uses its ``sign``. Anything else is a missing sign and follows
the normal ``derive_functional_benefic_malefic`` blocked result.
Import or calculation failures return the engine's blocked shape.
The exception text stays inside ``effect_on_confidence`` because that
field already did; callers must not write this dict to a log.
占星师 2026-11-08 第五轮裁定 3: the default profile is PVR Table 30
(``functional_benefics.DEFAULT_FUNCTIONAL_PROFILE``). ``planets`` (Sun and
Moon longitudes) gives the Moon's paksha, which Table 30's note needs for
Aries / Libra / Capricorn lagnas.
"""
try:
try:
import functional_benefics as fb
except ModuleNotFoundError:
from scripts import functional_benefics as fb
sign = ascendant.get("sign") if isinstance(ascendant, dict) else None
return fb.derive_functional_benefic_malefic(
sign,
functional_profile=functional_profile or fb.DEFAULT_FUNCTIONAL_PROFILE,
moon_paksha=fb.moon_paksha_from_planets(planets),
)
except Exception as exc:
sign = ascendant.get("sign") if isinstance(ascendant, dict) else None
return {
"status": "blocked",
"ascendant": sign,
"functional_benefics": [],
"functional_malefics": [],
"functional_neutrals": [],
"yogakarakas": [],
"owned_houses": {},
"effect_on_confidence": f"未完成功能性吉凶星判定,需降低高严谨结论置信度: {exc}",
"source": "strict_functional_benefic_malefic_v2",
}