Last active
June 5, 2022 20:09
-
-
Save caseydm/82eecd7468c0d09a30808427f30d4f3a to your computer and use it in GitHub Desktop.
global south stats from openalex api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from iso3166 import countries | |
GLOBAL_SOUTH_COUNTRIES = [ | |
# source https://meta.wikimedia.org/wiki/List_of_countries_by_regional_classification | |
"Afghanistan", | |
"Algeria", | |
"American Samoa", | |
"Angola", | |
"Anguilla", | |
"Antarctica", | |
"Antigua and Barbuda", | |
"Argentina", | |
"Aruba", | |
"Bahamas", | |
"Bahrain", | |
"Bangladesh", | |
"Barbados", | |
"Belize", | |
"Benin", | |
"Bermuda", | |
"Bhutan", | |
"Bolivia, Plurinational State Of", | |
"Botswana", | |
"Bouvet Island", | |
"Brazil", | |
"British Indian Ocean Territory", | |
"Brunei Darussalam", | |
"Burkina Faso", | |
"Burundi", | |
"Cambodia", | |
"Cameroon", | |
"Cabo Verde", | |
"Cayman Islands", | |
"Central African Republic", | |
"Chad", | |
"Chile", | |
"China", | |
"Christmas Island", | |
"Cocos (Keeling) Islands", | |
"Colombia", | |
"Comoros", | |
"Congo", | |
"Congo, Democratic Republic of the", | |
"Cook Islands", | |
"Costa Rica", | |
"Côte D'Ivoire", | |
"Cuba", | |
"Djibouti", | |
"Dominica", | |
"Dominican Republic", | |
"Ecuador", | |
"Egypt", | |
"El Salvador", | |
"Equatorial Guinea", | |
"Eritrea", | |
"Eswatini", | |
"Ethiopia", | |
"Falkland Islands (Malvinas)", | |
"Fiji", | |
"French Guiana", | |
"French Polynesia", | |
"French Southern Territories", | |
"Gabon", | |
"Gambia", | |
"Ghana", | |
"Grenada", | |
"Guadeloupe", | |
"Guam", | |
"Guatemala", | |
"Guinea", | |
"Guinea-Bissau", | |
"Guyana", | |
"Haiti", | |
"Heard Island and McDonald Islands", | |
"Honduras", | |
"Hong Kong", | |
"India", | |
"Indonesia", | |
"Iran, Islamic Republic of", | |
"Iraq", | |
"Jamaica", | |
"Jordan", | |
"Kenya", | |
"Kiribati", | |
"Korea, Democratic People's Republic of", | |
"Kuwait", | |
"Kyrgyzstan", | |
"Lao People's Democratic Republic", | |
"Lebanon", | |
"Lesotho", | |
"Liberia", | |
"Libya", | |
"Macao", | |
"Madagascar", | |
"Malawi", | |
"Malaysia", | |
"Maldives", | |
"Mali", | |
"Marshall Islands", | |
"Martinique", | |
"Mauritania", | |
"Mauritius", | |
"Mayotte", | |
"Mexico", | |
"Micronesia, Federated States of", | |
"Mongolia", | |
"Montserrat", | |
"Morocco", | |
"Mozambique", | |
"Myanmar", | |
"Namibia", | |
"Nauru", | |
"Nepal", | |
"Netherlands", | |
"New Caledonia", | |
"Nicaragua", | |
"Niger", | |
"Nigeria", | |
"Niue", | |
"Norfolk Island", | |
"Northern Mariana Islands", | |
"Oman", | |
"Pakistan", | |
"Palau", | |
"Palestine, State of", | |
"Panama", | |
"Papua New Guinea", | |
"Paraguay", | |
"Peru", | |
"Philippines", | |
"Pitcairn", | |
"Puerto Rico", | |
"Qatar", | |
"Réunion", | |
"Rwanda", | |
"Saint Barthélemy", | |
"Saint Helena, Ascension and Tristan da Cunha", | |
"Saint Kitts and Nevis", | |
"Saint Lucia", | |
"Saint Martin (French Part)", | |
"Saint Vincent and the Grenadines", | |
"Samoa", | |
"Sao Tome and Principe", | |
"Saudi Arabia", | |
"Senegal", | |
"Seychelles", | |
"Sierra Leone", | |
"Solomon Islands", | |
"Somalia", | |
"South Africa", | |
"South Georgia and the South Sandwich Islands", | |
"South Sudan", | |
"Sri Lanka", | |
"Sudan", | |
"Suriname", | |
"Syrian Arab Republic", | |
"Tajikistan", | |
"Tanzania, United Republic of", | |
"Thailand", | |
"Timor-Leste", | |
"Togo", | |
"Tokelau", | |
"Tonga", | |
"Trinidad and Tobago", | |
"Tunisia", | |
"Turkmenistan", | |
"Turks and Caicos Islands", | |
"Tuvalu", | |
"Uganda", | |
"United Arab Emirates", | |
"United States Minor Outlying Islands", | |
"Uruguay", | |
"Uzbekistan", | |
"Vanuatu", | |
"Venezuela, Bolivarian Republic of", | |
"Viet nam", | |
"Virgin Islands, British", | |
"Virgin Islands, U.S.", | |
"Wallis and Futuna", | |
"Western Sahara", | |
"Yemen", | |
"Zambia", | |
"Zimbabwe", | |
] | |
def institutions_in_global_south(): | |
total = 0 | |
for country in GLOBAL_SOUTH_COUNTRIES: | |
country_code = countries.get(country).alpha2 | |
r = requests.get( | |
f"https://api.openalex.org/institutions?filter=country_code:{country_code}&mailto=jason@ourresearch.org" | |
) | |
institution_count = r.json()["meta"]["count"] | |
print( | |
f"{institution_count} institutions in {countries.get(country).name} ({country_code})" | |
) | |
total = total + institution_count | |
return total | |
def works_from_global_south(): | |
total = 0 | |
for country in GLOBAL_SOUTH_COUNTRIES: | |
country_code = countries.get(country).alpha2 | |
r = requests.get( | |
f"https://api.openalex.org/works?filter=authorships.institutions.country_code:{country_code}&mailto=jason@ourresearch.org" | |
) | |
works_count = r.json()["meta"]["count"] | |
print( | |
f"{works_count} works from {countries.get(country).name} ({country_code})" | |
) | |
total = total + works_count | |
return total | |
def authors_from_global_south(): | |
total = 0 | |
for country in GLOBAL_SOUTH_COUNTRIES: | |
country_code = countries.get(country).alpha2 | |
r = requests.get( | |
f"https://api.openalex.org/authors?filter=last_known_institution.country_code:{country_code}&mailto=jason@ourresearch.org" | |
) | |
authors_count = r.json()["meta"]["count"] | |
print( | |
f"{authors_count} from {countries.get(country).name} ({country_code})" | |
) | |
total = total + authors_count | |
return total | |
if __name__ == "__main__": | |
institutions_count = institutions_in_global_south() | |
print(f"{institutions_count:,} institutions in the Global South") | |
# 22,073 institutions in the Global South | |
works_count = works_from_global_south() | |
print(f"{works_count:,} works from the Global South") | |
# 22,978,980 works from the Global South | |
authors_count = authors_from_global_south() | |
print(f"{authors_count:,} authors with last known affiliation in Global South") | |
# 21,076,110 authors with last known affiliation in Global South |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment