fix(rectification): ask finance and health, show Bhava and Pranapada

Interviews skipped D2/D11 and D30 unless the user volunteered them, so those scoring layers almost never ran. Ask them after family, keep relocation out of rotation, and display Bhava/Pranapada transitions without delaying adopt.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jesse_Chen
2026-08-20 11:49:27 +08:00
parent c1bd09351b
commit 1b93afc594
28 changed files with 860 additions and 51 deletions
+17 -4
View File
@@ -368,13 +368,21 @@ def _fine_minute_indices(
lat: float,
lon: float,
tz: float,
sun_degree: float | None,
moon_degree: float | None,
) -> dict[str, int]:
wrapped = float(ascendant_longitude) % 360.0
indices: dict[str, int] = {"pada_index": _pada_index(ascendant_longitude)}
calculator = special_lagnas.SpecialLagnasCalculator()
if isinstance(sun_degree, (int, float)) and isinstance(moon_degree, (int, float)):
try:
bhava = calculator.calculate_bhava_lagna(wrapped, float(sun_degree), float(moon_degree))
indices["bhava_sign_index"] = int(float(bhava["degree"]) // 30.0) % 12
except (TypeError, ValueError, KeyError, OverflowError):
pass
sunrise = _sunrise_local_naive(candidate_at.date().isoformat(), lat, lon, tz)
if sunrise is None:
return indices
calculator = special_lagnas.SpecialLagnasCalculator()
wrapped = float(ascendant_longitude) % 360.0
try:
hora = calculator.calculate_hora_lagna(wrapped, 0.0, candidate_at, sunrise)
ghati = calculator.calculate_ghati_lagna(wrapped, candidate_at, sunrise)
@@ -382,8 +390,11 @@ def _fine_minute_indices(
ghati_degree = float(ghati["degree"])
except (TypeError, ValueError, KeyError, OverflowError):
return indices
indices["hora_sign_index"] = int(hora_degree // 30.0) % 12
indices["ghati_sign_index"] = int(ghati_degree // 30.0) % 12
hora_index = int(hora_degree // 30.0) % 12
ghati_index = int(ghati_degree // 30.0) % 12
indices["hora_sign_index"] = hora_index
indices["ghati_sign_index"] = ghati_index
indices["pranapada_sign_index"] = (hora_index + ghati_index) % 12
return indices
@@ -470,6 +481,8 @@ def build_candidate_static_context(
lat=float(request["lat"]),
lon=float(request["lon"]),
tz=float(request["tz"]),
sun_degree=planet_longitudes.get("Sun") if isinstance(planet_longitudes.get("Sun"), (int, float)) else None,
moon_degree=planet_longitudes.get("Moon") if isinstance(planet_longitudes.get("Moon"), (int, float)) else None,
),
"varga_ascendants": varga_ascendants,
"arudha_signs": arudha_signs,
+13 -1
View File
@@ -122,9 +122,14 @@ _LAYER_LABEL = {
"d7": "D7",
"d12": "D12",
"d24": "D24",
"d2": "D2",
"d11": "D11",
"d30": "D30",
"pada": "Nakshatra pada",
"hora": "Hora Lagna",
"ghati": "Ghati Lagna",
"bhava": "Bhava Lagna",
"pranapada": "Pranapada Lagna",
}
@@ -139,15 +144,20 @@ def _scan_layer_value(feature: dict[str, Any], layer: str) -> int | None:
"d7": vargas.get("D7"),
"d12": vargas.get("D12"),
"d24": vargas.get("D24"),
"d2": vargas.get("D2"),
"d11": vargas.get("D11"),
"d30": vargas.get("D30"),
"pada": feature.get("pada_index"),
"hora": feature.get("hora_sign_index"),
"ghati": feature.get("ghati_sign_index"),
"bhava": feature.get("bhava_sign_index"),
"pranapada": feature.get("pranapada_sign_index"),
}.get(layer)
return raw if isinstance(raw, int) else None
def window_scan(built: dict[str, Any]) -> dict[str, Any]:
"""D1/D9/D10/D4/D5/D7/D12/D24 plus display-only pada/Hora/Ghati. Indices only; never sign names."""
"""D1/D9/D10/D4/D5/D7/D12/D24/D2/D11/D30 plus display-only pada/Hora/Ghati/Bhava/Pranapada."""
counts: dict[str, set[int]] = {layer: set() for layer in _LAYER_LABEL}
transitions: list[dict[str, Any]] = []
previous: dict[str, int | None] | None = None
@@ -404,6 +414,8 @@ def oos_blind_prompts(request: dict[str, Any]) -> list[dict[str, Any]]:
("career", "校时还没用过事业这条线。有没有一件没提过、但记得大概时间的工作变化?"),
("family", "校时还没用过家人这条线。有没有一件没提过、但记得大概时间的家人变化?"),
("education", "校时还没用过学习这条线。有没有一件没提过、但记得大概时间的学业变化?"),
("finance", "校时还没用过财务这条线。有没有一件没提过、但记得大概时间的收入或资产变化?"),
("health_pressure", "校时还没用过健康压力这条线。有没有一件没提过、但记得大概时间的身体或压力变化?"),
)
prompts = [
{"domain": domain, "user_meaning": meaning, "used_for_scoring": False}
+4
View File
@@ -189,6 +189,10 @@ def public_technique_layers(domain: str, rule_ids: Sequence[str]) -> list[str]:
layers.update({"d1-rashi", "d24-chaturvimshamsha", "d5-panchamsha"})
elif domain == "relocation":
layers.update({"d1-rashi", "d4-chaturthamsha"})
elif domain == "finance":
layers.update({"d1-rashi", "d2-hora", "d11-labhamsha"})
elif domain == "health_pressure":
layers.update({"d1-rashi", "d30-trimshamsha"})
elif domain in {"appearance", "marks"}:
layers.add("d1-rashi")
return sorted(layers)