Gapminder Concepts And Entities
Concept dictionary and entity (geo) reference tables for joining with per-indicator datasets
@gapminder.metadata
Concept dictionary and entity (geo) reference tables for joining with per-indicator datasets
@gapminder.metadata
Gapminder data is split into two kinds of datasets you combine via simple joins:
@gapminder.metadata ← (this dataset)
@gapminder.metadata.concepts
): one row per indicator, identified by a concept id.@gapminder.metadata.entities_*
): reference tables for codes like geo (countries/areas)entities_geo_country
(key: geo
) — country/area names and attributes. Often includes columns likeworld_4region
, world_6region
, income_groups
, which point to group tables below.entities_geo_world_4region
, entities_geo_world_6region
, entities_geo_income_groups
,entities_geo_income_3groups
, entities_geo_unicef_region
, entities_geo_unhcr_region
,entities_geo_g77_and_oecd_countries
, entities_geo_landlocked
, entities_geo_global
, etc.entities_gender
, and topical vocabularies like entities_tag
.Per-indicator datasets (one per concept in @gapminder.metadata.concepts
)
@gapminder.age_at_1st_marriage_women
,@gapminder.adults_with_hiv_percent_age_15_49
.<concept_id>_by_<dimensions>
(most often <concept_id>_by_geo_time
)─────────────────────────────────────────────────────────────────────────────
Pick an indicator
concept
id.name
, description
(and unit
/format
if present) to confirm it matches your intent.Retrieve the datapoints
<concept_id>_by_geo_time
) to get values by geo
and time
.Add readable labels and groupings
geo
→ @gapminder.metadata.entities_geo_country.geo
name
, name_short
, name_long
, and attributes like world_4region
, income_groups
, etc.world_4region
), then join to the matching region tableworld_4region
) to get region names/colors/shapes.─────────────────────────────────────────────────────────────────────────────
-- Concept metadata (labels/units)
SELECT name, description
FROM @gapminder.metadata.concepts
WHERE concept = '<concept_id>';
-- Country names and region membership
SELECT d.time,
c.name AS country,
c.world_4region AS region_code,
r.name AS region_name,
d.<concept_id> AS value
FROM @gapminder.<concept_id>.<concept_id>_by_geo_time d
JOIN @gapminder.metadata.entities_geo_country c ON d.geo = c.country
LEFT JOIN @gapminder.metadata.entities_geo_world_4region r ON c.world_4region = r.world_4region;
-- Income groups example
SELECT d.time, c.name AS country, ig.name AS income_group, d.<concept_id> AS value
FROM @gapminder.<concept_id>.<concept_id>_by_geo_time d
JOIN @gapminder.metadata.entities_geo_country c ON d.geo = c.country
LEFT JOIN @gapminder.metadata.entities_geo_income_groups ig ON c.income_groups = ig.income_groups;
─────────────────────────────────────────────────────────────────────────────
geo
codes may include aggregates (regions/world); treat aggregates differently from countries.time
(year). Some concepts may use other time forms—check the table schema.TL;DR: Use @gapminder.metadata.concepts to interpret indicators and @gapminder.metadata.entities_*
to label countries and groupings; then query the per-concept datasets (e.g., @gapminder.age_at_1st_marriage_women) for the actual values and join on geo
(and group keys) as shown above.
CREATE TABLE concepts (
"concept" VARCHAR,
"color" VARCHAR,
"concept_type" VARCHAR,
"description" VARCHAR,
"description_long" VARCHAR,
"domain" VARCHAR,
"drill_up" VARCHAR,
"format" VARCHAR,
"indicator_url" VARCHAR,
"name" VARCHAR,
"name_catalog" VARCHAR,
"name_short" VARCHAR,
"scales" VARCHAR,
"source" VARCHAR,
"source_long" VARCHAR,
"source_url" VARCHAR,
"tags" VARCHAR
);
CREATE TABLE entities_gender (
"gender" BIGINT,
"name" VARCHAR
);
CREATE TABLE entities_geo_country (
"country" VARCHAR,
"g77_and_oecd_countries" VARCHAR,
"income_3groups" VARCHAR,
"income_groups" VARCHAR,
"is_country" VARCHAR -- Is--country,
"iso3166_1_alpha2" VARCHAR,
"iso3166_1_alpha3" VARCHAR,
"iso3166_1_numeric" VARCHAR,
"iso3166_2" VARCHAR,
"landlocked" VARCHAR,
"latitude" VARCHAR,
"longitude" VARCHAR,
"main_religion_2008" VARCHAR,
"name" VARCHAR,
"un_sdg_ldc" VARCHAR,
"un_sdg_region" VARCHAR,
"un_state" VARCHAR,
"unhcr_region" VARCHAR,
"unicef_region" VARCHAR,
"unicode_region_subtag" VARCHAR,
"west_and_rest" VARCHAR,
"world_4region" VARCHAR,
"world_6region" VARCHAR
);
CREATE TABLE entities_geo_g77_and_oecd_countries (
"g77_and_oecd_countries" VARCHAR,
"is_g77_and_oecd_countries" VARCHAR -- Is--g77 And Oecd Countries,
"name" VARCHAR,
"rank" BIGINT
);
CREATE TABLE entities_geo_global (
"global" VARCHAR,
"is_global" VARCHAR -- Is--global,
"latitude" BIGINT,
"longitude" BIGINT,
"name" VARCHAR,
"topojson" VARCHAR,
"unicode_region_subtag" BIGINT
);
CREATE TABLE entities_geo_income_3groups (
"income_3groups" VARCHAR,
"is_income_3groups" VARCHAR -- Is--income 3groups,
"name" VARCHAR,
"rank" BIGINT
);
CREATE TABLE entities_geo_income_groups (
"income_groups" VARCHAR,
"is_income_groups" VARCHAR -- Is--income Groups,
"name" VARCHAR,
"rank" BIGINT
);
CREATE TABLE entities_geo_landlocked (
"landlocked" VARCHAR,
"is_landlocked" VARCHAR -- Is--landlocked,
"name" VARCHAR,
"rank" BIGINT
);
CREATE TABLE entities_geo_main_religion_2008 (
"main_religion_2008" VARCHAR,
"is_main_religion_2008" VARCHAR -- Is--main Religion 2008,
"name" VARCHAR,
"rank" BIGINT
);
CREATE TABLE entities_geo_unhcr_region (
"unhcr_region" VARCHAR,
"is_unhcr_region" VARCHAR -- Is--unhcr Region,
"name" VARCHAR
);
CREATE TABLE entities_geo_unicef_region (
"unicef_region" VARCHAR,
"is_unicef_region" VARCHAR -- Is--unicef Region,
"name" VARCHAR
);
CREATE TABLE entities_geo_un_sdg_ldc (
"un_sdg_ldc" VARCHAR,
"is_un_sdg_ldc" VARCHAR -- Is--un Sdg Ldc,
"name" VARCHAR
);
CREATE TABLE entities_geo_un_sdg_region (
"un_sdg_region" VARCHAR,
"color" VARCHAR,
"is_un_sdg_region" VARCHAR -- Is--un Sdg Region,
"name" VARCHAR
);
CREATE TABLE entities_geo_west_and_rest (
"west_and_rest" VARCHAR,
"is_west_and_rest" VARCHAR -- Is--west And Rest,
"name" VARCHAR
);
CREATE TABLE entities_geo_world_4region (
"world_4region" VARCHAR,
"color" VARCHAR,
"description" VARCHAR,
"is_world_4region" VARCHAR -- Is--world 4region,
"latitude" DOUBLE,
"longitude" DOUBLE,
"name" VARCHAR,
"name_long" VARCHAR,
"name_short" VARCHAR,
"rank" BIGINT,
"shape_lores_svg" VARCHAR
);
CREATE TABLE entities_geo_world_6region (
"world_6region" VARCHAR,
"is_world_6region" VARCHAR -- Is--world 6region,
"name" VARCHAR,
"name_long" VARCHAR,
"name_short" VARCHAR,
"rank" BIGINT,
"shape_lores_svg" VARCHAR
);
CREATE TABLE entities_tag (
"tag" VARCHAR,
"name" VARCHAR,
"parent" VARCHAR
);
Anyone who has the link will be able to view this.