Add VedAstro strength oracle packet

This commit is contained in:
732642856
2026-07-17 00:40:00 +08:00
parent a58a14c854
commit 825a9ea5f1
2 changed files with 123 additions and 0 deletions
@@ -0,0 +1,84 @@
#!/usr/bin/env python3
"""Build VedAstro Shadbala/Ashtakavarga oracle request packets.
This packet is secondary evidence only. It does not execute prediction,
change local scores, or promote final labels.
"""
from __future__ import annotations
import argparse
import json
from pathlib import Path
from typing import Any
ADJUDICATOR_POLICY = {
"role": "external_technique_evidence",
"can_change_score": False,
"can_set_dominant_label": False,
"can_set_payout_label": False,
"allowed_destinations": ["secondary_context", "technique_audit"],
}
STRENGTH_METHODS = [
{
"technique": "VedAstro Shadbala Oracle",
"method": "CalculateShadbala",
"api_endpoint": "Calculate/Shadbala",
},
{
"technique": "VedAstro Ashtakavarga Oracle",
"method": "CalculateAshtakavarga",
"api_endpoint": "Calculate/Ashtakavarga",
},
]
def build_strength_oracle_packet(domain: str = "career") -> dict[str, Any]:
requests = [
{
"operation": "calculation_method",
"role": "external_technique_evidence",
"domain": domain,
"method": item["method"],
"api_endpoint": item["api_endpoint"],
"status": "preview",
}
for item in STRENGTH_METHODS
]
audit_rows = [
{
"technique": item["technique"],
"status": "preview",
"role": "external_strength_evidence",
"effect": "secondary_context_only_no_score_or_label_lift",
}
for item in STRENGTH_METHODS
]
return {
"scope": "vedastro_strength_oracle_packet",
"status": "preview",
"domain": domain,
"adjudicator_policy": dict(ADJUDICATOR_POLICY),
"requests": requests,
"technique_audit_rows": audit_rows,
}
def main() -> int:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--domain", default="career")
parser.add_argument("--output", type=Path)
args = parser.parse_args()
packet = build_strength_oracle_packet(args.domain)
text = json.dumps(packet, ensure_ascii=False, indent=2, sort_keys=True)
if args.output:
args.output.parent.mkdir(parents=True, exist_ok=True)
args.output.write_text(text + "\n", encoding="utf-8")
print(text)
return 0
if __name__ == "__main__":
raise SystemExit(main())
@@ -0,0 +1,39 @@
from __future__ import annotations
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
SCRIPTS = ROOT / "scripts"
if str(SCRIPTS) not in sys.path:
sys.path.insert(0, str(SCRIPTS))
import vedastro_strength_oracle_packet # noqa: E402
def test_strength_packet_declares_shadbala_and_ashtakavarga_as_secondary_evidence() -> None:
packet = vedastro_strength_oracle_packet.build_strength_oracle_packet("career")
assert packet["scope"] == "vedastro_strength_oracle_packet"
assert packet["domain"] == "career"
assert packet["adjudicator_policy"]["can_change_score"] is False
assert packet["adjudicator_policy"]["can_set_dominant_label"] is False
assert packet["adjudicator_policy"]["can_set_payout_label"] is False
assert [item["method"] for item in packet["requests"]] == ["CalculateShadbala", "CalculateAshtakavarga"]
assert all(item["role"] == "external_technique_evidence" for item in packet["requests"])
assert packet["technique_audit_rows"] == [
{
"technique": "VedAstro Shadbala Oracle",
"status": "preview",
"role": "external_strength_evidence",
"effect": "secondary_context_only_no_score_or_label_lift",
},
{
"technique": "VedAstro Ashtakavarga Oracle",
"status": "preview",
"role": "external_strength_evidence",
"effect": "secondary_context_only_no_score_or_label_lift",
},
]