Recast KP cusps for active rectification
This commit is contained in:
@@ -66,11 +66,15 @@ def _candidate_scan(
|
||||
sample.update(recast)
|
||||
samples.append(sample)
|
||||
has_true_recast = all("varga_lagna" in sample for sample in samples)
|
||||
has_kp_recast = all("kp_cusps" in sample for sample in samples)
|
||||
computed_layers = ["time_range", "candidate_cluster", "question_sensitivity_map"]
|
||||
blocked_layers = ["true_varga_recast", "true_kp_cusp_recast", "true_arudha_recast"]
|
||||
if has_true_recast:
|
||||
computed_layers.extend(["true_varga_recast", "true_arudha_recast"])
|
||||
blocked_layers = ["true_kp_cusp_recast"]
|
||||
if has_kp_recast:
|
||||
computed_layers.append("true_kp_cusp_recast")
|
||||
blocked_layers = [layer for layer in blocked_layers if layer != "true_kp_cusp_recast"]
|
||||
return {
|
||||
"start": start.strftime("%Y-%m-%d %H:%M"),
|
||||
"end": end.strftime("%Y-%m-%d %H:%M"),
|
||||
@@ -83,7 +87,7 @@ def _candidate_scan(
|
||||
"high_value_layers": ["D9", "D10", "D24", "D30", "D60", "UL", "A7", "A10", "KP_cusp"],
|
||||
"computed_layers": computed_layers,
|
||||
"blocked_layers": blocked_layers,
|
||||
"boundary": "KP cusp recast remains blocked until a validated KP cusp engine is wired into this workflow.",
|
||||
"boundary": "Candidate Varga, Arudha and KP cusp recasts are computed from the local domain chart; external oracle parity remains a separate gate.",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -109,6 +113,7 @@ def _candidate_recast(
|
||||
return None
|
||||
import domain_calculation_service
|
||||
import jaimini
|
||||
import kp_system
|
||||
import varga
|
||||
|
||||
chart = domain_calculation_service.compute_chart({
|
||||
@@ -148,9 +153,32 @@ def _candidate_recast(
|
||||
"A10": padas.get("A10", {}),
|
||||
"UL": upapada,
|
||||
},
|
||||
"kp_cusps": _kp_cusp_snapshot(chart),
|
||||
}
|
||||
|
||||
|
||||
def _kp_cusp_snapshot(chart: dict[str, Any]) -> dict[str, Any]:
|
||||
import kp_system
|
||||
|
||||
snapshot = {}
|
||||
for house_key in ("house_1", "house_4", "house_7", "house_10"):
|
||||
house = chart.get("houses", {}).get(house_key, {})
|
||||
degree = house.get("cusp_degree")
|
||||
if degree is None:
|
||||
continue
|
||||
lords = kp_system.get_kp_lords(float(degree))
|
||||
snapshot[house_key] = {
|
||||
"cusp_degree": round(float(degree) % 360, 6),
|
||||
"sign": lords.get("sign"),
|
||||
"rasi_lord": lords.get("rasi_lord"),
|
||||
"nakshatra": lords.get("nakshatra"),
|
||||
"nakshatra_lord": lords.get("nakshatra_lord"),
|
||||
"sub_lord": lords.get("sub_lord"),
|
||||
"sub_sub_lord": lords.get("sub_sub_lord"),
|
||||
}
|
||||
return snapshot
|
||||
|
||||
|
||||
def build_questionnaire(
|
||||
birth_time: str,
|
||||
uncertainty_minutes: int = 30,
|
||||
|
||||
@@ -50,7 +50,9 @@ def test_active_rectification_questions_api_accepts_location_for_true_recast() -
|
||||
summary = result["candidate_scan"]["sensitivity_summary"]
|
||||
assert "true_varga_recast" in summary["computed_layers"]
|
||||
assert "true_arudha_recast" in summary["computed_layers"]
|
||||
assert "true_kp_cusp_recast" in summary["computed_layers"]
|
||||
assert "true_varga_recast" not in summary["blocked_layers"]
|
||||
assert "true_kp_cusp_recast" not in summary["blocked_layers"]
|
||||
|
||||
|
||||
def test_active_rectification_score_api_returns_rankings_and_next_questions() -> None:
|
||||
|
||||
@@ -57,11 +57,14 @@ def test_active_rectification_recasts_candidate_vargas_when_location_is_availabl
|
||||
summary = report["candidate_scan"]["sensitivity_summary"]
|
||||
assert "true_varga_recast" in summary["computed_layers"]
|
||||
assert "true_arudha_recast" in summary["computed_layers"]
|
||||
assert "true_kp_cusp_recast" in summary["blocked_layers"]
|
||||
assert "true_kp_cusp_recast" in summary["computed_layers"]
|
||||
assert "true_varga_recast" not in summary["blocked_layers"]
|
||||
assert "true_kp_cusp_recast" not in summary["blocked_layers"]
|
||||
sample = report["candidate_scan"]["samples"][1]
|
||||
assert sample["varga_lagna"]["D9_Navamsa"]["sign"]
|
||||
assert sample["varga_lagna"]["D10_Dasamsa"]["sign"]
|
||||
assert sample["arudha"]["A7"]["sign"]
|
||||
assert sample["arudha"]["A10"]["sign"]
|
||||
assert sample["arudha"]["UL"]["sign"]
|
||||
assert sample["kp_cusps"]["house_7"]["sub_lord"]
|
||||
assert sample["kp_cusps"]["house_10"]["sub_sub_lord"]
|
||||
|
||||
Reference in New Issue
Block a user