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

Class ANMATChecker

scripts/tier2_checkers.py:1166–1267  ·  view source on GitHub ↗

Parse ANMAT (Argentina) alertas page for medical device safety alerts. Parses the main alertas page which lists alerts with dates. Filters for 'producto medico' (medical device) alerts specifically. Falls back to the dedicated /alertas/productos-medicos subpage if available.

Source from the content-addressed store, hash-verified

1164
1165
1166class ANMATChecker:
1167 """Parse ANMAT (Argentina) alertas page for medical device safety alerts.
1168
1169 Parses the main alertas page which lists alerts with dates.
1170 Filters for 'producto medico' (medical device) alerts specifically.
1171 Falls back to the dedicated /alertas/productos-medicos subpage if available.
1172 """
1173
1174 MONTH_MAP_ES = {
1175 "enero": "01", "febrero": "02", "marzo": "03", "abril": "04",
1176 "mayo": "05", "junio": "06", "julio": "07", "agosto": "08",
1177 "septiembre": "09", "octubre": "10", "noviembre": "11", "diciembre": "12",
1178 }
1179
1180 DEVICE_KW = re.compile(
1181 r"(?i)(producto\s+m[eé]dico|dispositivo|equipo|implant|"
1182 r"pr[oó]tesis|reactivo|diagn[oó]stico|medical|device|"
1183 r"instrumental|material\s+descartable|esteriliz)"
1184 )
1185
1186 def __init__(self, session, state: dict, seed_mode: bool = False):
1187 self.session = session
1188 self.state = state
1189 self.seed_mode = seed_mode
1190
1191 def check(self, source_id: str, source: dict) -> Optional[dict]:
1192 url = source["url"]
1193 try:
1194 from bs4 import BeautifulSoup
1195 resp = self.session.get(url, timeout=30)
1196 resp.raise_for_status()
1197 resp.encoding = resp.apparent_encoding or "utf-8"
1198 soup = BeautifulSoup(resp.text, "html.parser")
1199
1200 prev = self.state.get(source_id, {})
1201 prev_titles = set(prev.get("seen_titles", []))
1202 new_items = []
1203 all_titles = list(prev_titles)
1204
1205 for a_tag in soup.find_all("a", href=True):
1206 text = a_tag.get_text(strip=True)[:200]
1207 if not text or len(text) < 20:
1208 continue
1209 href = a_tag["href"]
1210 if not href.startswith("http"):
1211 href = "https://www.argentina.gob.ar" + href
1212
1213 if not self.DEVICE_KW.search(text):
1214 continue
1215
1216 if text in prev_titles:
1217 continue
1218 all_titles.append(text)
1219
1220 dm = re.search(
1221 r"(\d{1,2})\s+de\s+(\w+)\s+de\s+(\d{4})", text)
1222 pub_date = ""
1223 if dm:

Callers 1

__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected