Files
Jyotisha/scripts/book_rule_lineage.py
T
ClaudeandClaude Opus 5.5 8ed5b5f3c9 feat(engine): port upstream skill calculation fixes into the engine (BUG-1699)
- affliction_evidence / career_semantic_profile / career_analysis (functional
  roles, affliction signals, user-industry gate)
- sade_sati.build_saturn_cycle_timeline with bisected ingress moments
  (FLG_SIDEREAL frame, BUG-1275)
- Chesta profile candidates and PL9 AV cell profile as sidecars
  (shadbala.py / ashtakavarga.py stay frozen, ERR-110)
- Raman Sahams in the annual pack; book rule packets + admission gate
- consultation_native_layers: affliction_evidence, career_analysis,
  sade_sati_timeline, shadbala_chesta_profiles, book_rules,
  annual_tajika.raman_sahams

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
2026-11-07 14:42:54 +08:00

56 lines
2.5 KiB
Python

#!/usr/bin/env python3
"""Query the non-verbatim book -> rule -> technique lineage map."""
from __future__ import annotations
import argparse, json
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
DEFAULT_PARASHARI_BASELINE = (
"d1_rashi", "d9_navamsa", "d2_hora", "d10_dasamsa", "d11_labhamsha",
"varga_dignity", "vargottama", "vimshottari_dasha", "dasha_sandhi",
"transit_trigger", "shadbala", "bhava_bala", "ashtakavarga", "raj_yoga",
"dhana_yoga", "neechabhanga", "solar_lunar_yogas", "moolatrikona",
"combustion", "graha_yuddha", "dispositor_chain", "functional_benefic_malefic",
"nakshatra_advanced", "shodasavarga",
)
def load(path: str | None = None) -> dict:
p = Path(path) if path else ROOT / "references/book_rule_technique_lineage.json"
return json.loads(p.read_text(encoding="utf-8"))
def query(data: dict, *, technique: str | None = None, profile: str | None = None) -> list[dict]:
rows = data.get("rows", [])
return [r for r in rows if (not technique or technique in r.get("techniques", [])) and (not profile or r.get("tradition_profile") == profile)]
def audit_baseline(data: dict) -> list[dict]:
rows = data.get("rows", [])
result = []
for technique in DEFAULT_PARASHARI_BASELINE:
matches = [r for r in rows if technique in r.get("techniques", []) and r.get("tradition_profile") == "parashari_core"]
kinds = {"web_reference" if str(r.get("source_id", "")).startswith("web:") else "local_book" for r in matches}
result.append({
"technique": technique,
"source_status": ("web_reference" if kinds == {"web_reference"} else "mapped") if matches else "unmapped",
"source_count": len(matches),
"runtime_statuses": sorted({str(r.get("runtime_status")) for r in matches}),
"next_action": ("review_rule_packet_and_runtime_receipt" if matches else "locate_book_chapter_or_add_candidate_packet"),
})
return result
def main() -> None:
ap = argparse.ArgumentParser()
ap.add_argument("--technique")
ap.add_argument("--tradition-profile")
ap.add_argument("--format", choices=["json", "count"], default="json")
ap.add_argument("--audit-baseline", action="store_true")
args = ap.parse_args()
data = load()
if args.audit_baseline:
rows = audit_baseline(data)
else:
rows = query(data, technique=args.technique, profile=args.tradition_profile)
print(len(rows) if args.format == "count" else json.dumps(rows, ensure_ascii=False, indent=2))
if __name__ == "__main__":
main()