MCPcopy Create free account
hub / github.com/RASAAS/docmcp-knowledge / _load_all

Method _load_all

scripts/fetch_updates.py:483–528  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

481 return {}
482
483 def _load_all(self):
484 mdcg = self._load_json(self.root / "eu_mdr" / "mdcg" / "_index.json")
485 for entry in mdcg.get("entries", []):
486 eid = entry.get("id", "")
487 self.mdcg_ids.add(eid)
488 for lang in ("zh", "en"):
489 t = (entry.get("title") or {}).get(lang, "")
490 if t:
491 self.mdcg_titles.add(t.strip().lower())
492 self._mdcg_entries = mdcg.get("entries", [])
493 self.db_stats["eu_mdr/mdcg"] = {"count": len(self.mdcg_ids)}
494
495 stds = self._load_json(self.root / "eu_mdr" / "standards" / "_index.json")
496 self.standards_latest_amendment = stds.get("latest_amendment", "")
497 self.db_stats["eu_mdr/standards"] = {
498 "count": stds.get("total_standards", 0),
499 "latest_amendment": self.standards_latest_amendment,
500 }
501
502 regs = self._load_json(self.root / "eu_mdr" / "regulations" / "_index.json")
503 for doc in regs.get("documents", []):
504 self.eu_reg_ids.add(doc.get("id", ""))
505 self.db_stats["eu_mdr/regulations"] = {"count": len(self.eu_reg_ids)}
506
507 nmpa_reg = self._load_json(self.root / "nmpa" / "regulations" / "_index.json")
508 for entry in nmpa_reg.get("entries", []):
509 t = (entry.get("title") or {}).get("zh", "")
510 if t:
511 self.nmpa_reg_titles.add(t.strip())
512 self.db_stats["nmpa/regulations"] = {"count": len(self.nmpa_reg_titles)}
513
514 nmpa_guide = self._load_json(self.root / "nmpa" / "guidance" / "_index.json")
515 for entry in nmpa_guide.get("entries", []):
516 t = (entry.get("title") or {}).get("zh", "")
517 if t:
518 self.nmpa_guidance_titles.add(t.strip())
519 self.db_stats["nmpa/guidance"] = {"count": len(self.nmpa_guidance_titles)}
520
521 vreg = self._load_json(self.root / "scripts" / "version_registry.json")
522 for doc_id, doc in vreg.get("documents", {}).items():
523 cur = doc.get("current", {})
524 title = cur.get("title", "")
525 if title and "fda" in doc_id.lower():
526 self.fda_guidance_titles.add(title.strip().lower())
527 self.fda_guidance_ids.add(doc_id)
528 self.db_stats["fda/guidance"] = {"count": len(self.fda_guidance_titles)}
529
530 def classify(self, category: str, title: str, link: str = "", date: str = "") -> tuple[str, str]:
531 """Classify a detection against the database.

Callers 1

__init__Method · 0.95

Calls 2

_load_jsonMethod · 0.95
getMethod · 0.80

Tested by

no test coverage detected