File size: 1,570 Bytes
8c94afd
b70d3fd
 
 
 
8c94afd
b70d3fd
8c94afd
b70d3fd
 
 
8c94afd
b70d3fd
 
 
 
 
 
 
 
 
8c94afd
b70d3fd
 
 
 
 
 
 
 
8c94afd
b70d3fd
 
8c94afd
b70d3fd
8c94afd
b70d3fd
8c94afd
b70d3fd
8c94afd
b70d3fd
 
 
 
 
 
 
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# 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)
    }