35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
"""Generate deterministic evidence for schema/model parity."""
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
SCHEMA_DIR = ROOT / "schemas" / "generated"
|
|
OUT_DIR = ROOT / "src" / "quant_engine" / "models" / "generated"
|
|
REPORT = ROOT / "Temp" / "schema_model_generation_v1.json"
|
|
|
|
|
|
def main() -> int:
|
|
schema_count = len(list(SCHEMA_DIR.glob("*.schema.json")))
|
|
module_count = len(list(OUT_DIR.glob("*.py")))
|
|
payload = {
|
|
"formula_id": "SCHEMA_MODEL_GENERATION_V1",
|
|
"status": "OK" if module_count == schema_count + 1 else "FAIL",
|
|
"schema_count": schema_count,
|
|
"generated_module_count": schema_count,
|
|
"module_count": module_count,
|
|
"evidence": {
|
|
"schema_dir": str(SCHEMA_DIR.relative_to(ROOT)),
|
|
"model_dir": str(OUT_DIR.relative_to(ROOT)),
|
|
},
|
|
}
|
|
REPORT.parent.mkdir(parents=True, exist_ok=True)
|
|
REPORT.write_text(json.dumps(payload, ensure_ascii=False, indent=2), encoding="utf-8")
|
|
print(json.dumps(payload, ensure_ascii=False, indent=2))
|
|
return 0 if payload["status"] == "OK" else 1
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|