Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """CLI: seed local DB with eco12m grants for PLAN §13.5 measurable dossier metric. | |
| Usage (from backend/): | |
| python3 scripts/seed_ecosystem_12m_catalog.py | |
| python3 scripts/seed_ecosystem_12m_catalog.py --ready 7 --partial 2 --blind 1 | |
| """ | |
| from __future__ import annotations | |
| import argparse | |
| import json | |
| import os | |
| import sys | |
| # backend on path | |
| sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | |
| from core.subscription.db import SessionLocal, init_models # noqa: E402 | |
| from core.grants.seed_ecosystem_12m_catalog import seed_ecosystem_12m_catalog # noqa: E402 | |
| def main() -> int: | |
| p = argparse.ArgumentParser(description="Seed ecosystem 12m catalog for §13.5") | |
| p.add_argument("--ready", type=int, default=5) | |
| p.add_argument("--partial", type=int, default=2) | |
| p.add_argument("--blind", type=int, default=3) | |
| p.add_argument("--no-commit", action="store_true") | |
| args = p.parse_args() | |
| init_models() | |
| db = SessionLocal() | |
| try: | |
| result = seed_ecosystem_12m_catalog( | |
| db, | |
| ready=args.ready, | |
| partial=args.partial, | |
| blind=args.blind, | |
| commit=not args.no_commit, | |
| ) | |
| print(json.dumps(result, indent=2, default=str)) | |
| ok = bool(result.get("meets_dod_70_not_blind")) | |
| return 0 if ok else 2 | |
| finally: | |
| db.close() | |
| if __name__ == "__main__": | |
| raise SystemExit(main()) | |