SPB Git forge
38commits 1branches 0releases
338.7 MBsize
maindefault branch
3 h agolast push
HTML 53.9% TypeScript 44.5% JavaScript 0.6% SQL 0.5%
3.9 KB · 52 lines markdown
Rendered Raw Blame History
1# worldbank — World Bank Indicators API23| | |4|---|---|5| id / implementation | `worldbank` (`apps/worker/src/connectors/datasets/worldbank.ts`) |6| kind / mode / priority | dataset / api / 2 |7| source | https://api.worldbank.org/v2 (World Development Indicators) |8| entities | `NormalizedCountryStat` (one per ISO-2 country, key = iso2) |9| schedule | `dataset: monthly` (WDI is refreshed a few times a year; `lastupdated` was 2026-07-13 on 2026-09-11) |10| requests per run | 6 (country list, 4 indicator series with `mrnev=1`, 1 population time series) |11| license | **CC BY 4.0** |12| attribution | "Source: World Bank, World Development Indicators (CC BY 4.0)" |1314## License (verified 2026-09-11)1516From https://datacatalog.worldbank.org/public-licenses (World Bank Data Catalog → Public licenses):1718> "Creative Commons Attribution 4.0 (CC-BY 4.0) — The Creative Commons Attribution 4.0 International license allows users to copy, modify and distribute data in any format for any purpose, including commercial use. Users are only obligated to give appropriate credit (attribution) and indicate if they have made any changes, including translations. CC-BY 4.0, with the additional terms below, is the default license for all Datasets produced by the World Bank itself and distributed as open data."1920The "additional terms" concern dispute settlement (UNCITRAL arbitration) and the World Bank's privileges and immunities; they do not restrict use. `api.worldbank.org/robots.txt` returns 404 (no robots restrictions).2122## What is fetched2324| field | indicator | note |25|---|---|---|26| `population` | `SP.POP.TOTL` | most recent non-empty value (`mrnev=1`), 2025 for all 264 rows on 2026-09-11 |27| `gdpUsd` | `NY.GDP.MKTP.CD` | GDP, current US$ (2025 for 233 economies, older for 28) |28| `renewableShare` | `EG.ELC.RNEW.ZS` | **percent of total electricity output (0–100)**, latest year is 2021 for almost every country |29| `electricityTwh` | derived | `EG.USE.ELEC.KH.PC` (kWh per capita, 2023/2024) × `SP.POP.TOTL` **of the same year** / 1e9. Flagged in provenance (`method: …+derived-estimate:electricityTwh`, note explains the formula). Only 193 economies have the per-capita figure. |30| `year` | max of the indicator years | the per-indicator years are listed in `provenance.note` |3132Aggregates are dropped using the country list (`/v2/country?per_page=400`: `region.value == "Aggregates"`, 78 entries such as `1W` World, `ZH` Africa Eastern and Southern, `EU`…), plus anything whose `iso2Code` is not two letters. 295 entries → 217 countries/economies (includes territories such as `HK`, `PR`, `XK` Kosovo).3334`NormalizedCountryStat` has no per-field `facts` channel, so per-indicator provenance (URL, year) is carried in the entity provenance `note`; the entity provenance URL is the country-list document. If per-field provenance becomes needed, add `facts?: Fact[]` to `NormalizedCountryStat` in core and the connector will emit them (the data is already available in `extract`).3536## Verified live (2026-09-11)3738```39node node_modules/tsx/dist/cli.mjs scripts/try-connector.ts config/connectors/worldbank.yaml --limit 3 --json /tmp/worldbank.json40→ 1 document, 6 fetches, 217 records → 217 entities, 217 valid, 0 rejected, 0 warnings, 8.8 s41```4243Samples: `AL` population 2 349 580, GDP 30.5 G$, renewableShare 98.6 %, electricityTwh 6.974 (derived, 2023 kWh/capita × 2023 population);44`DZ` population 47 435 312, electricityTwh 84.386, renewableShare 0.91 %; `AF` has no per-capita electricity figure → `electricityTwh: null`.4546## Quirks4748- `per_page=20000` fits every series in one page; the connector logs a warning if `pages > 1`.49- The population time series uses `date=<now-15>:<now>` (`params.populationYears`) so the derived TWh figure never mixes years.50- World Bank lists some economies that are not sovereign states (Hong Kong, Macao, Puerto Rico, West Bank and Gaza `PS`, Kosovo `XK`). They are kept as-is; `countries.iso2` must accept them.51- Taiwan is absent from WDI.52