Load existing standards.json into a dict keyed by standard number.
()
| 227 | } |
| 228 | |
| 229 | |
| 230 | def filter_active_only(rows: list[dict]) -> list[dict]: |
| 231 | return [r for r in rows if r.get("status") in ("active", "upcoming")] |
| 232 | |
| 233 | |
| 234 | def _load_existing() -> dict[str, dict]: |
| 235 | """Load existing standards.json into a dict keyed by standard number.""" |
| 236 | out_path = OUT_DIR / "standards.json" |
| 237 | if not out_path.exists(): |
| 238 | return {} |
| 239 | try: |
| 240 | with open(out_path, "r", encoding="utf-8") as f: |
| 241 | items = json.load(f) |
| 242 | return {r["number"]: r for r in items if isinstance(r, dict) and "number" in r} |
| 243 | except Exception as e: |