Load all standards from knowledge repo category files.
(knowledge_root: Path)
| 26 | |
| 27 | |
| 28 | def load_knowledge_standards(knowledge_root: Path) -> dict: |
| 29 | """Load all standards from knowledge repo category files.""" |
| 30 | hs_dir = knowledge_root / "eu_mdr" / "standards" |
| 31 | os_dir = knowledge_root / "eu_mdr" / "other_standards" |
| 32 | |
| 33 | hs_standards = {} |
| 34 | os_standards = {} |
| 35 | |
| 36 | for f in sorted(hs_dir.iterdir()): |
| 37 | if f.name.startswith("standards-") and f.suffix == ".json": |
| 38 | with open(f) as fp: |
| 39 | data = json.load(fp) |
| 40 | for s in data.get("standards", []): |
| 41 | hs_standards[s.get("id", s.get("number", ""))] = s |
| 42 | |
| 43 | for f in sorted(os_dir.iterdir()): |
| 44 | if f.name.startswith("standards-") and f.suffix == ".json": |
| 45 | with open(f) as fp: |
| 46 | data = json.load(fp) |
| 47 | for s in data.get("standards", []): |
| 48 | os_standards[s.get("id", s.get("number", ""))] = s |
| 49 | |
| 50 | return {"harmonised": hs_standards, "other": os_standards} |
| 51 | |
| 52 | |
| 53 | def load_docmcp_standards(docmcp_root: Path) -> list: |