The UN Sustainable Development Goals give a shared framework for classifying research by societal impact. OpenAlex tags works with SDGs automatically, so you can map the global landscape with a handful of group_by calls. We’ll compare India and Brazil to show how national research priorities diverge.
Step 1: See the global distribution
Group all works by SDG to see where the world’s research effort goes:
https://api.openalex.org/works?group_by=sustainable_development_goals.id&per_page=5
[
{"key": "https://openalex.org/sdgs/3", "key_display_name": "Good health and well-being", "count": 22709013},
{"key": "https://openalex.org/sdgs/2", "key_display_name": "Zero hunger", "count": 13933476},
{"key": "https://openalex.org/sdgs/4", "key_display_name": "Quality education", "count": 11897329},
{"key": "https://openalex.org/sdgs/7", "key_display_name": "Affordable and clean energy", "count": 11005161},
{"key": "https://openalex.org/sdgs/10", "key_display_name": "Reduced inequalities", "count": 9476374}
]
Health dominates globally — SDG 3 accounts for more tagged works than the next two combined.
Step 2: Compare two countries
Filter by country code and group by SDG. Run one call per country:
# India
https://api.openalex.org/works?filter=authorships.institutions.country_code:IN&group_by=sustainable_development_goals.id&per_page=10
# Brazil
https://api.openalex.org/works?filter=authorships.institutions.country_code:BR&group_by=sustainable_development_goals.id&per_page=10
Each call returns the same shape — SDGs ranked by output. The rankings reveal different national priorities:
| # | India | Brazil |
|---|
| 1 | Good health and well-being | Good health and well-being |
| 2 | Affordable and clean energy | Quality education |
| 3 | Zero hunger | Zero hunger |
| 4 | Clean water and sanitation | Life on land |
| 5 | Life on land | Peace, justice, and strong institutions |
Both countries lead with health and food security, but India’s #2 is energy while Brazil’s is education. Brazil’s emphasis on “Life on land” (#4) reflects its Amazon-related research.
Step 3: Track a specific SDG over time
Pick an SDG and group by year to see growth trends. Here’s SDG 13 (Climate Action):
https://api.openalex.org/works?filter=sustainable_development_goals.id:https://metadata.un.org/sdg/13,publication_year:2015-2025&group_by=publication_year
[
{"key": "2015", "key_display_name": "2015", "count": 163264},
{"key": "2018", "key_display_name": "2018", "count": 179558},
{"key": "2021", "key_display_name": "2021", "count": 156949},
{"key": "2024", "key_display_name": "2024", "count": 208595}
]
Climate research output grew steadily from 2015 to 2019, dipped briefly, then surged to a new high in 2024.
Step 4: Find leading institutions
Group by institution within an SDG to find who’s producing the most research:
https://api.openalex.org/works?filter=sustainable_development_goals.id:https://metadata.un.org/sdg/13&group_by=authorships.institutions.id&per_page=5
[
{"key": "https://openalex.org/I19820366", "key_display_name": "Chinese Academy of Sciences", "count": 34901},
{"key": "https://openalex.org/I1294671590", "key_display_name": "Centre National de la Recherche Scientifique", "count": 24791},
{"key": "https://openalex.org/I4210165038", "key_display_name": "University of Chinese Academy of Sciences", "count": 11505},
{"key": "https://openalex.org/I74801974", "key_display_name": "The University of Tokyo", "count": 9228},
{"key": "https://openalex.org/I4210164339", "key_display_name": "Oldham Council", "count": 8833}
]
Full script
This script compares any two countries’ SDG profiles side by side:
import requests
BASE = "https://api.openalex.org"
def api(endpoint, params):
return requests.get(f"{BASE}/{endpoint}", params=params).json()
def sdg_profile(country_code):
"""Get a country's SDG distribution as {sdg_name: count}."""
data = api("works", {
"filter": f"authorships.institutions.country_code:{country_code}",
"group_by": "sustainable_development_goals.id",
"per_page": 17,
})
return {g["key_display_name"]: g["count"] for g in data["group_by"]}
# Compare two countries
country_a, country_b = "IN", "BR"
profile_a = sdg_profile(country_a)
profile_b = sdg_profile(country_b)
all_sdgs = sorted(set(profile_a) | set(profile_b),
key=lambda s: profile_a.get(s, 0) + profile_b.get(s, 0),
reverse=True)
total_a = sum(profile_a.values())
total_b = sum(profile_b.values())
print(f"{'SDG':<45} {country_a:>8} {country_b:>8}")
print("-" * 63)
for sdg in all_sdgs:
share_a = profile_a.get(sdg, 0) / total_a
share_b = profile_b.get(sdg, 0) / total_b
print(f" {sdg:<43} {share_a:>7.1%} {share_b:>7.1%}")
Works can be tagged with multiple SDGs, so percentages across all goals will sum to more than 100%. The shares still show relative emphasis — a country with 15% in energy vs. 5% is investing proportionally more research effort there.