File size: 989 Bytes
e76888b
d763be0
 
 
 
 
e76888b
d763be0
a596e6e
423d67b
d763be0
e76888b
d763be0
 
423d67b
d763be0
 
 
 
 
423d67b
d763be0
 
 
 
 
 
 
 
423d67b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# 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)}