Files
Jyotisha/scripts/functional_layer.py
T
ClaudeandClaude Opus 5.5 fbbc4c7c21 fix: Narayana N1-N5, KP K1, functional K2/K3 per astrologer round-5 item reply
- seed rath_highest_occupant_dignity_v1 (named convention; equal tier below own sign blocks the seed)
- AD direction profiles rath_p50_md_parity_v1 / rath_stronger_lord_start_parity_v1 (default, pending choice)
- Saturn+Ketu in seed / MD sign blocked; PyJHora Ketu priority only as named reference profile
- 0-year MD rows flagged, never current, skipped on the annual timeline; years profile rath_table8_phalita_dignity_v1
- KP DBA year_days 365.25 default, parent/AD/full/visible fields, boundaries equal main Vimshottari
- functional profile pvr_table30_v1 (aliases), Moon-only blocked without paksha; profile through API,
  cache keys, audit; rectification asserts one profile per run
- 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 15:20:45 +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``. Every product surface,
rectification scoring included (BUG-1759, product 2026-11-08), takes the
default ``pvr_table30_v1`` (alias ``pvr_table_30``); ``bphs_exception_profile`` is a comparison only.
"""
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",
}