mgbam's picture
Update genesis/funding.py
b70d3fd verified
raw
history blame
1.57 kB
# genesis/funding.py
"""
Global Funding Intelligence for GENESIS-AI
Fetches worldwide biotech & synthetic biology grant opportunities.
"""
import requests
NIH_FUNDING_API = "https://api.reporter.nih.gov/v2/projects/search"
EU_CORDIS_API = "https://cordis.europa.eu/api/project" # Horizon Europe
WELLCOME_TRUST_API = "https://api.wellcome.org/grants" # Example placeholder
def get_nih_funding(query="synthetic biology"):
"""Fetch NIH funding opportunities."""
payload = {"criteria": {"textCriteria": {"searchText": query}}, "offset": 0, "limit": 10}
try:
r = requests.post(NIH_FUNDING_API, json=payload)
r.raise_for_status()
return r.json()
except Exception as e:
return {"error": str(e)}
def get_eu_funding(query="synthetic biology"):
"""Fetch Horizon Europe / EU CORDIS funding calls."""
try:
r = requests.get(f"{EU_CORDIS_API}?q={query}&num=10")
r.raise_for_status()
return r.json()
except Exception as e:
return {"error": str(e)}
def get_wellcome_funding(query="synthetic biology"):
"""Fetch Wellcome Trust grants."""
try:
r = requests.get(f"{WELLCOME_TRUST_API}?query={query}")
r.raise_for_status()
return r.json()
except Exception as e:
return {"error": str(e)}
def get_global_funding(query="synthetic biology"):
"""Aggregate funding from all major sources."""
return {
"NIH": get_nih_funding(query),
"EU_CORDIS": get_eu_funding(query),
"Wellcome_Trust": get_wellcome_funding(query)
}