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

Function main

scripts/fetch_updates.py:3019–3089  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3017# ---------------------------------------------------------------------------
3018
3019def main():
3020 parser = argparse.ArgumentParser(
3021 description="Regulatory update checker (3-layer anti-scraping bypass)"
3022 )
3023 parser.add_argument("--check-all", action="store_true", help="Check all regulation groups")
3024 parser.add_argument("--check", metavar="GROUP",
3025 help="Check specific group: eu_mdr / fda / nmpa / shared")
3026 parser.add_argument("--analyze-versions", action="store_true",
3027 help="Run LLM version analysis on detected updates")
3028 parser.add_argument("--report", action="store_true",
3029 help="Output JSON report (for GitHub Actions)")
3030 parser.add_argument("--output", metavar="FILE", help="Save report to file")
3031 parser.add_argument("--seed-news", action="store_true",
3032 help="Seed mode: treat first run as news (not just baseline)")
3033 args = parser.parse_args()
3034
3035 if not args.check_all and not args.check:
3036 parser.print_help()
3037 sys.exit(0)
3038
3039 checker = UpdateChecker(seed_mode=args.seed_news)
3040
3041 updates = []
3042 if args.check_all:
3043 updates = checker.check_all()
3044 elif args.check == "tier1_west":
3045 for grp in ("uk_mhra", "canada", "australia_tga"):
3046 updates.extend(checker.check_regulation(grp))
3047 elif args.check == "tier1_east":
3048 for grp in ("japan_pmda", "korea_mfds"):
3049 updates.extend(checker.check_regulation(grp))
3050 elif args.check == "tier2":
3051 for grp in ("switzerland", "brazil_anvisa", "saudi_sfda", "singapore_hsa", "india_cdsco"):
3052 updates.extend(checker.check_regulation(grp))
3053 elif args.check == "tier3":
3054 for grp in ("mexico_cofepris", "argentina_anmat", "taiwan_tfda",
3055 "newzealand_medsafe", "indonesia_bpom", "malaysia_mda",
3056 "thailand_fda", "israel_moh", "hongkong_mdco"):
3057 updates.extend(checker.check_regulation(grp))
3058 else:
3059 updates = checker.check_regulation(args.check)
3060
3061 if args.analyze_versions:
3062 updates = checker.analyze_versions(updates)
3063
3064 checker._save_state()
3065 checker.registry.save()
3066
3067 report = checker.generate_report(updates)
3068
3069 if args.report or args.output:
3070 report_json = json.dumps(report, indent=2, ensure_ascii=False)
3071 if args.output:
3072 with open(args.output, "w", encoding="utf-8") as f:
3073 f.write(report_json)
3074 print(f"\nReport saved to: {args.output}")
3075 else:
3076 print("\n" + report_json)

Callers 1

fetch_updates.pyFile · 0.70

Calls 8

check_allMethod · 0.95
check_regulationMethod · 0.95
analyze_versionsMethod · 0.95
_save_stateMethod · 0.95
generate_reportMethod · 0.95
UpdateCheckerClass · 0.85
saveMethod · 0.80
getMethod · 0.80

Tested by

no test coverage detected