Compare how countries contribute to the UN Sustainable Development Goals and find who leads each one
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.
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.
[ {"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}]
This script compares any two countries’ SDG profiles side by side:
Copy
import requestsBASE = "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 countriescountry_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.