feat(skill): advance tajika annual oracle closure
This commit is contained in:
@@ -33,6 +33,8 @@ def _run_json(command: list[str]) -> dict[str, Any]:
|
||||
def build_dashboard(oracle_file: str) -> dict[str, Any]:
|
||||
queue = _run_json([PYTHON, "scripts/tajika_annual_oracle_queue.py", "--oracle-file", oracle_file, "--format", "json"])
|
||||
summary = queue["summary"]
|
||||
next_task = next((task for task in queue["tasks"] if not task["ready_for_calibration"]), None)
|
||||
next_case = next_task["case_id"] if next_task else None
|
||||
can_claim_closure = bool(summary["production_tuning_allowed"] and summary["ready_for_calibration"] == summary["total_tasks"])
|
||||
remaining_gap = (
|
||||
"Solar return exact time, Varsha Lagna, Muntha, Year Lord, Mudda Dasha first lord, "
|
||||
@@ -58,8 +60,13 @@ def build_dashboard(oracle_file: str) -> dict[str, Any]:
|
||||
),
|
||||
},
|
||||
"remaining_gap": remaining_gap,
|
||||
"first_priority": next_task,
|
||||
"next_actions": [
|
||||
"Fill one Steve Jobs annual evidence packet from JHora or PyJHora.",
|
||||
(
|
||||
f"Fill the next annual evidence packet from JHora or PyJHora: {next_case}."
|
||||
if next_case
|
||||
else "All annual evidence packets are filled; review tolerance checks before any production tuning."
|
||||
),
|
||||
"Add solar return datetime and Varsha Lagna tolerance checks after the first external row exists.",
|
||||
"Add Saham-specific tolerance checks for Punya, Rajya and Vivah Saham.",
|
||||
"Expand the annual benchmark with at least one printed Varshaphala example.",
|
||||
|
||||
@@ -131,7 +131,9 @@ def _validate_command(oracle_file: str) -> str:
|
||||
def build_status(oracle_file: str) -> dict[str, Any]:
|
||||
queue = _run_json([PYTHON, "scripts/tajika_annual_oracle_queue.py", "--oracle-file", oracle_file, "--format", "json"])
|
||||
annual_tasks = queue.get("tasks", [])
|
||||
priority = next((task for task in annual_tasks if task.get("case_id") == FIRST_PRIORITY_CASE_ID), None)
|
||||
priority = next((task for task in annual_tasks if not task.get("ready_for_calibration")), None)
|
||||
if priority is None:
|
||||
priority = next((task for task in annual_tasks if task.get("case_id") == FIRST_PRIORITY_CASE_ID), None)
|
||||
if priority is None and annual_tasks:
|
||||
priority = annual_tasks[0]
|
||||
if priority is None:
|
||||
@@ -141,7 +143,11 @@ def build_status(oracle_file: str) -> dict[str, Any]:
|
||||
capture_id = queue_packet["capture_id"]
|
||||
packet_path = f"references/oracle/artifacts/pending_packets/{capture_id}.json"
|
||||
template_path = FIRST_PRIORITY_TEMPLATE_PATH if priority["case_id"] == FIRST_PRIORITY_CASE_ID else packet_path
|
||||
packet = json.loads((ROOT / template_path).read_text(encoding="utf-8"))
|
||||
template_file = ROOT / template_path
|
||||
if template_file.exists():
|
||||
packet = json.loads(template_file.read_text(encoding="utf-8"))
|
||||
else:
|
||||
packet = queue_packet
|
||||
missing_fields = _metadata_missing(packet) + _target_missing(packet)
|
||||
missing_groups = _group_missing_fields(missing_fields)
|
||||
external_verified = [
|
||||
|
||||
@@ -69,6 +69,8 @@ def _write_json(path: str, value: dict[str, Any]) -> None:
|
||||
|
||||
|
||||
def _target_fields(value: Any, prefix: str = "target") -> list[str]:
|
||||
if prefix == "target.tajika_yogas":
|
||||
return [prefix]
|
||||
if prefix == "target" and isinstance(value, dict):
|
||||
fields: list[str] = []
|
||||
for key, child in value.items():
|
||||
@@ -93,6 +95,10 @@ def _target_value(target: dict[str, Any], field: str) -> Any:
|
||||
|
||||
def _missing_target_fields(value: Any, prefix: str = "target") -> list[str]:
|
||||
missing: list[str] = []
|
||||
if prefix == "target.tajika_yogas":
|
||||
if value is None or value == "" or value == {}:
|
||||
return [prefix]
|
||||
return []
|
||||
if isinstance(value, dict):
|
||||
for key, child in value.items():
|
||||
missing.extend(_missing_target_fields(child, f"{prefix}.{key}"))
|
||||
@@ -117,9 +123,13 @@ def _evidence_packet(case: dict[str, Any], target_fields: list[str]) -> dict[str
|
||||
"target_year": settings.get("target_year", ""),
|
||||
"operator_note": "",
|
||||
}
|
||||
existing = case.get("evidence_packet", {})
|
||||
existing_metadata = existing.get("metadata", {}) if isinstance(existing, dict) else {}
|
||||
if isinstance(existing_metadata, dict):
|
||||
metadata.update(existing_metadata)
|
||||
return {
|
||||
"capture_id": f"external_{case_id}",
|
||||
"status": "draft",
|
||||
"capture_id": existing.get("capture_id") or f"external_{case_id}" if isinstance(existing, dict) else f"external_{case_id}",
|
||||
"status": existing.get("status", "draft") if isinstance(existing, dict) else "draft",
|
||||
"case_id": case_id,
|
||||
"birth": case.get("birth", {}),
|
||||
"settings": settings,
|
||||
|
||||
Reference in New Issue
Block a user