Files
Jyotisha/scripts/relationship_event_class_evidence.py
T
Jesse_ChenandCursor 04ad3325d5
Independent Staging Quality Gate / validate (push) Successful in 11m26s
Independent Staging Quality Gate / publish (push) Successful in 13m24s
fix(relationship): freeze marriage event classes and add conditional dashas (BUG-608)
Venus/Jupiter/Moon periods no longer collapse into one marriage-opportunity line. Full reading reports the ten BPHS conditional dasha families; Skill 6.9.16.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 16:04:52 +08:00

103 lines
3.4 KiB
Python

"""Turn analyze_relationship event_class_split into theme-evidence items.
Punarphoo / romantic_activation stay observation-only. Legal-marriage items
are emitted only when MD/AD hits exist; PD hits never promote that class.
"""
from __future__ import annotations
from typing import Any, Callable
CLAIM_BOUNDARY = (
"romantic_activation is observation-only and is not legal marriage. "
"PD hits do not promote an event class. Dasha dates must come from the engine."
)
ThemeEvidence = Callable[..., dict]
def _as_dict(value: Any) -> dict:
return value if isinstance(value, dict) else {}
def _hits(block: dict) -> list:
hits = block.get("hits")
return [item for item in hits] if isinstance(hits, list) else []
def _natal(block: dict) -> list:
natal = block.get("natal_structure")
return [item for item in natal] if isinstance(natal, list) else []
def build_event_class_evidence(relationship: dict, theme_evidence: ThemeEvidence) -> list[dict]:
relationship = relationship if isinstance(relationship, dict) else {}
split = _as_dict(relationship.get("event_class_split"))
if not split:
return []
pd_hits = split.get("pd_hits") if isinstance(split.get("pd_hits"), list) else []
items: list[dict] = []
romantic = _as_dict(split.get("romantic_activation"))
if _hits(romantic) or _natal(romantic):
items.append(
theme_evidence(
"Romantic-activation",
"Dasha",
"心动层(观察):5L / 7宫月亮 / Punarphoo 只说明感情是否被激活,不能写成领证。",
"neutral",
"weak",
source="relationship.event_class_split",
details={
"event_class": "romantic_activation",
"hits": _hits(romantic),
"pd_hits": pd_hits,
"natal_structure": _natal(romantic),
"claim_boundary": CLAIM_BOUNDARY,
},
)
)
formation = _as_dict(split.get("relationship_formation"))
if _hits(formation):
items.append(
theme_evidence(
"Relationship-formation",
"Dasha",
"成对层:7L / DK / UL 结构进入观察,仍不是法律婚。",
"neutral",
"moderate",
source="relationship.event_class_split",
details={
"event_class": "relationship_formation",
"hits": _hits(formation),
"pd_hits": pd_hits,
"claim_boundary": CLAIM_BOUNDARY,
},
)
)
legal = _as_dict(split.get("legal_marriage"))
legal_hits = _hits(legal)
if legal_hits:
items.append(
theme_evidence(
"Legal-marriage",
"Dasha",
"法律婚层:仅 MD/AD 命中 Venus / DK / UL 时列出,PD 命中不升格。",
"neutral",
"moderate",
source="relationship.event_class_split",
details={
"event_class": "legal_marriage",
"hits": legal_hits,
"pd_hits": pd_hits,
"natal_structure": _natal(legal),
"claim_boundary": CLAIM_BOUNDARY,
},
)
)
return items