owid / owid-grapher

A platform for creating interactive data visualizations
https://ourworldindata.org
MIT License
1.34k stars 227 forks source link

Migrate WP category functionality to Grapher #2325

Closed ikesau closed 3 months ago

ikesau commented 1 year ago

Our site navigation relies on WordPress to generate a hierarchical category structure. These categories are somewhat mirrored in Grapher, but the hierarchy is not.

In order to populate the header with links to GDocs-based topic pages, which are tagged with Grapher tags, we'll need to harmonize these two structures somehow.

renderMenuJson will need to be rewritten to depend on the Grapher version of the hierarchy, and pre-existing WP posts will need to be merged with it.

We will need to make sure that all functionality that depends on WP categories, e.g. getRelatedCharts migrates smoothly as well. I don't yet have an exhaustive list of all the features that we'll need to keep an eye on.

WordPress entry hierarchy

Entries:
- Energy and Environment:
  - Air and Climate
  - Energy
  - Land and Ecosystems
  - Waste and Pollution
  - Water
- Health:
  - Life and Death
  - Infectious Diseases
  - Health Risks
  - Health Institutions and Interventions
- Population and Demographic Change:
  - Population Change
  - Life and Death
  - Distribution of the World Population
- Food and Agriculture:
  - Nutrition
  - Food Production
  - Agricultural Inputs
- Education and Knowledge:
  - Educational Access and Outcomes
  - Inequality in Education
  - Inputs to Education
  - Media
- Innovation and Technological Change:
  - Technological Change
- Poverty and Economic Development:
  - Poverty
  - Poverty and Prosperity
  - Economic Inequality
  - Trade and Migration
  - Labor
  - Public Sector
  - Corruption
- Living Conditions Community and Wellbeing:
  - Happiness and Wellbeing
  - Relationships
  - Time Use
  - Culture
  - Housing
- Human Rights and Democracy:
  - Democracy and Corruption
  - Human Rights
- Violence and War:
  - Violence
  - War and Peace

Grapher entry hierachy

Entries:
  - Abstract:
    - Geographic
  - Culture, Values & Society:
    - Marriage & Relationships
    - Optimism & Pessimism
    - Personality Traits & Social Preferences
    - Quantitative View of the World
    - Sports
    - Teenage Pregnancy
    - Trust
    - Values
  - Economic Development, Work & Standard of Living:
    - Capital Formation
    - Child Labor
    - Consumption Baskets
    - Female Labor Supply
    - Happiness and Life Satisfaction
    - Homelessness
    - Housing
    - Human Development Index (HDI)
    - Industrialization
    - Informal Sector
    - Labor Force Participation & Employment
    - Labor Market Policies
    - Light
    - Quality of Life
    - Slavery
    - Start-Ups & Entrepreneurialism
    - Unemployment
    - Urbanization
    - Work Conditions & Safety
    - Working Hours
  - Education & Knowledge:
    - Educational Mobility & Inequality
    - Global Rise of Education
    - Intelligence
    - Literacy
    - Pre-Primary Education
    - Primary Education
    - Projections of Future Education
    - Quality of Education
    - Returns to Education
    - Science & Research
    - Secondary Education
    - Teachers & Professors
    - Tertiary Education
  - Environmental Change:
    - Air Pollution
    - Biodiversity
    - Climate Change
    - CO2 and Greenhouse Gas Emissions
    - Environmental Protection & Regulation
    - Fish and overfishing
    - Forests
    - Indoor Air Pollution
    - Irrigation
    - Land Use
    - Natural Disasters
    - Oil Spills
    - Ozone Layer
    - Plastic Pollution
    - Sanitation
    - Waste
    - Water Quality in Rivers and Oceans
    - Water Use
  - Food & Agriculture:
    - Agricultural Employment
    - Agricultural Production
    - Agricultural Regulation & Policy
    - Crop Yields
    - Diet Compositions
    - Environmental impacts of food production
    - Famines
    - Farm Size
    - Fertilizers
    - Food per Person
    - Food Prices & Expenditure
    - Food Trade
    - Food Waste
    - Human Height
    - Hunger & Undernourishment
    - Land Use and Yields in Agriculture
    - Meat and Seafood Production & Consumption
    - Micronutrient Deficiency
    - Non-food Crops
    - Obesity & BMI
    - Pesticides
    - Soil
  - Global Interconnections:
    - Foreign Aid
    - Foreign Direct Investment
    - Human Trafficking
    - Intergovernmental Organizations & Diplomacy
    - International Trade
    - Migration
    - Political Asylum & Refugees
    - Remittances
    - Tourism
  - Growth & Distribution of Prosperity:
    - Consumer Credit, Debt & Saving
    - Consumption Inequality
    - Economic Complexity
    - Economic Growth
    - Economic Inequality
    - Economic Inequality by Gender
    - Financial Inclusion
    - Financial Markets, Banks & Financial Institutions
    - Global Economic Inequality
    - Global Extreme Poverty
    - Incomes across the Distribution
    - Interest Rates & Credit Market
    - Labor & Capital Share
    - Multidimensional Poverty
    - Poverty
    - Poverty Relative to Poverty Lines Higher than the International Poverty Line
    - Prices
    - Productivity
    - Risk and Insurance
    - Wages
    - Wealth Inequality
  - Health:
    - Alcohol Consumption
    - Antibiotics
    - Burden of Disease
    - Cancer
    - Cardiovascular Diseases
    - Causes of Death
    - Child Health
    - Contraception & Abortion
    - Coronavirus disease [COVID-19]
    - Diarrheal Diseases
    - Doctors & Health Workers
    - Eradication of Diseases
    - Health Inequality
    - Healthcare capacity
    - HIV / AIDS
    - Hygiene
    - Infectious Diseases
    - Influenza
    - Lead Pollution
    - Malaria
    - Maternal Health
    - Measles
    - Medical Research & Innovation
    - Meningitis
    - Mental Health
    - Neglected Tropical Diseases
    - Neurological Disorders
    - Non-communicable Diseases
    - Polio
    - Respiratory Diseases
    - Smallpox
    - Smoking
    - Substance Use
    - Suicide
    - Tetanus
    - Trials
    - Tuberculosis
    - Vaccination
  - Media:
    - Books
    - News
    - Social Media
  - Political Regime:
    - Accountability & Transparency
    - Colonialism
    - Democracy
    - Franchise, Voting Rights & Electoral Systems
    - Political Engagement
    - Political Regimes
    - Press Freedom
    - Prisons
    - Quality of Institutions
    - Trust in Political Regime & Institutions
    - Voter Turnout
    - Women in Politics
  - Population Growth & Vital Statistics:
    - Age Structure
    - Child Mortality
    - Fertility Rate
    - Future Population Growth
    - Gender Ratio
    - Infant Mortality
    - Life Expectancy
    - Mortality by Age
    - Population Growth
  - Resources & Energy:
    - Access to Energy
    - Electricity
    - Emission Intensity
    - Energy
    - Energy Efficiency
    - Energy Prices
    - Energy Trade
    - Fossil Fuels
    - Metals & Minerals
    - Nuclear Energy
    - Renewable Energy
  - Technology & Infrastructure:
    - Artificial Intelligence
    - Communication Technology
    - Infrastructure Projects
    - Internet
    - Medical & Biotechnologies
    - Patents
    - Productivity of Technologies
    - Research & Development
    - Space Travel & Satellites
    - Technological Progress
    - Transport
    - Transport Safety & Accidents
    - Transportation Infrastructure
    - Transportation Technologies
  - The Public Sector & Economic System:
    - Business Environment
    - Corruption
    - Economic Freedom
    - Financing Education
    - Financing Healthcare
    - Government Revenue
    - Government Spending
    - Income Tax
    - Property Rights
    - Public Sector Employment
    - Redistribution
    - Social Spending
    - Taxation
  - Violence & Rights:
    - Animal Rights
    - Crime
    - Ethnographic and Archaeological Evidence on Violent Deaths
    - Homicides
    - Human Rights
    - LGBT+ Rights
    - Rights of Marginalized Ethnic Groups
    - Violence against & Rights for Children
    - Women’s Rights
  - War & Peace:
    - Biological & Chemical Weapons
    - Civil Wars
    - Genocides
    - Military Personnel
    - Military Spending
    - Nuclear Weapons
    - Peacekeeping
    - Terrorism
    - War and Peace
    - Weapons
ikesau commented 11 months ago

Here are the header entries that don't currently have a matching Grapher tag.

If we want to convert one of these old-style entries/WP topic pages to use Gdocs, we'll be blocked until this issue is fixed.

Biological and Chemical Weapons
Child and Infant Mortality
Clean Water
Clean Water and Sanitation
Co₂ and Greenhouse Gas Emissions
Coronavirus Pandemic (covid-19)
Education Spending
Employment In Agriculture
Farm Size and Productivity
Food Prices
Food Supply
Forests and Deforestation
Global Education
Global Health
Healthcare Spending
Hunger and Undernourishment
Light At Night
Loneliness and Social Connections
Marriages and Divorces
Maternal Mortality
Meat and Dairy Production
Military Personnel and Spending
Mpox (monkeypox)
Obesity
Opioids, Cocaine, Cannabis and Other Illicit Drugs
Outdoor Air Pollution
Pneumonia
Primary and Secondary Education
Research and Development
Space Exploration and Satellites
Suicides
Teachers and Professors
Technological Change
Time Use
Trade and Globalization
Violence Against Children and Children’s Rights
Water Use and Stress
Women’s Employment
World Population Growth
JoeHasell commented 10 months ago

To get a sense of the mismatch I looked through each of these now.

There are four cases I think:

Topic pages/old-style entries without matching grapher tags (taken from Ike's list above)

edomt commented 10 months ago

There are some very low-hanging fruit cases where the page is currently not tagged (so no 'All charts' block shows on the page), but a very obvious matching grapher tag exists. For example Obesity. cc @edomt – see below for these cases. To my mind we should just tag these pages now with the relevant tags, but maybe I am missing something.

I agree with you, I don't see any reason not to do this. Though we should make sure that all charts embedded in the topic page are correctly tagged (charts embedded in the page may be untagged given that the all-charts block isn't currently used).

danyx23 commented 3 months ago

We have since done this