Synthetic_Biology / genesis /biosecurity.py
mgbam's picture
Update genesis/biosecurity.py
d763be0 verified
raw
history blame
989 Bytes
# genesis/biosecurity.py
"""
Biosecurity intelligence module for GENESIS-AI
Fetches latest biosecurity guidelines, laws, and alerts globally.
"""
import requests
import os
BIOPORTAL_API_KEY = os.getenv("BIOPORTAL_API_KEY")
WHO_BIOSECURITY_FEED = "https://www.who.int/feeds/entity/csr/don/en/rss.xml" # Example WHO disease outbreak feed
def get_who_biosecurity_updates():
"""Fetch latest biosecurity updates from WHO RSS."""
try:
r = requests.get(WHO_BIOSECURITY_FEED)
r.raise_for_status()
return r.text # Can parse XML later in app.py for display
except Exception as e:
return {"error": str(e)}
def search_biosecurity_terms(term):
"""Search BioPortal for biosecurity-related ontology terms."""
try:
url = f"https://data.bioontology.org/search?q={term}&apikey={BIOPORTAL_API_KEY}"
r = requests.get(url)
r.raise_for_status()
return r.json()
except Exception as e:
return {"error": str(e)}