Skip to content

About

Public registry of the intergovernmental organizations, country groups and countries. Available as JSONl, Parquet, YAML and DuckDB database datasets

Topics

Resources

Contributing

Stars

13 stars

Watchers

0 watching

Forks

Latest commit

 

History

960 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Internacia Datasets

Validate datasets DOI

Comprehensive reference datasets of countries, intergovernmental organizations, treaties, trade agreements, and country groups. Source YAML files in data/countries/, data/intblocks/, and data/blocktypes/ are validated, enriched, and exported to multiple formats in data/datasets/. Internacia is part of the Dateno open-source project and a data source for the Dateno search engine.

Distribution

  • GitHub Releases — complete dataset bundle on each v* tag, including CSV, metadata, aliases, and schema migration reports
  • Zenodo — concept DOI 10.5281/zenodo.20706176; each GitHub Release is archived as a new version by the Zenodo GitHub integration
  • Hugging Face Datasets — optional Parquet mirror datenoio/internacia with one config per table, a matching descriptor, and all four tables' metadata (publishing guide)

Features

  • Multi-format export: JSONL, YAML, Parquet, and DuckDB (Zstandard compression, level 22)
  • Countries quality pipeline: schema validation, completeness gates, entity status policy, and field-level provenance
  • Intblocks quality pipeline: schema validation, blocktype and six-value scope_category taxonomy checks, duplicate detection, and completeness gates; formal records require a scope category
  • Profile enrichment: population, area, gini, timezones, and native names from World Bank, Wikidata, and IANA tzdata
  • Data-quality analyzer: 50+ rules (referential integrity, temporal consistency, geographic plausibility, provenance depth, naming) reported under dataquality/; runs in CI and fails on CRITICAL/IMPORTANT findings
  • Build metadata: manifests and .meta.json sidecars for countries, intblocks, blocktypes, and memberships, with version, commit, row count, and export schema hash — all sharing a single frozen build identity
  • Artifact consistency guard: check_generated_artifacts.py checks source projections, values, keys, membership edges, schemas, and metadata before CI rebuilds exports
  • CI validation: tests and lint on Python 3.11–3.13, documentation checks, website build/typecheck, weekly link validation, and validation of the final tagged-release bundle
  • CLI tools: Typer-based scripts with tqdm progress bars; console entry points internacia-build, internacia-analyze-quality, internacia-validate-countries, internacia-validate-intblocks

AI agents and LLMs

Installation

Requires Python 3.11+ (CI runs 3.11, 3.12, and 3.13). Dependencies are pinned for reproducible builds.

pip install -r requirements.txt        # runtime
pip install -r requirements-dev.txt    # development (adds pytest, ruff, pre-commit)

Quick start

# Inspect data sources
python3 scripts/builder.py info

# Validate country YAML (no build)
python3 scripts/validate_countries.py
# or: internacia-validate-countries   (after pip install -e .)

# Validate intblock YAML (no build)
python3 scripts/validate_intblocks.py
# or: internacia-validate-intblocks

# Build all datasets
python3 scripts/builder.py build

# Build specific formats for local analysis in a separate directory
python3 scripts/builder.py build --formats parquet,duckdb --output-dir .local-datasets

After editing source data, run the full build. Build manifests, datapackage.json and the binary and bulk exports are build outputs that git ignores; commit the descriptors git still tracks in data/datasets/ when the build changes them. CI rebuilds, checks that the committed descriptors match, and checks that two builds are identical.

Output files

Generated exports are not committed (only contract.json, the dataset card, the alias JSON, border_status.json and attribute_intblock_migrations.json are; build manifests and datapackage.json are build outputs). Run python scripts/builder.py build once to create data/datasets/internacia.duckdb and the other files locally, or download them from the latest release.

Each build writes to data/datasets/:

File Description
countries.jsonl Countries (plain JSONL)
countries.json.zst Countries (JSON array, zstd)
countries.csv.zst Countries (flattened CSV, zstd)
countries-lite.csv.zst / countries-lite.parquet Countries lite (identifier + classification columns only)
countries.jsonl.zst Countries (JSONL, zstd)
countries.yaml.zst Countries (YAML, zstd)
countries.parquet Countries (Parquet, zstd)
countries.manifest.json Build metadata (version, commit, row count, schema hash, data license)
countries.meta.json Version metadata sidecar for Parquet consumers
intblocks.manifest.json Build metadata (version, commit, row count, schema hash, data license)
intblocks.meta.json Version metadata sidecar for Parquet consumers
intblocks.jsonl International blocks (plain JSONL)
intblocks.json.zst International blocks (JSON array, zstd)
intblocks.csv.zst International blocks (flattened CSV, zstd)
intblocks-lite.csv.zst / intblocks-lite.parquet Intblocks lite (identifier + scope columns only)
intblocks.jsonl.zst International blocks (JSONL, zstd)
intblocks.yaml.zst International blocks (YAML, zstd)
intblocks.parquet International blocks (Parquet, zstd)
intblocks_aliases.json Retired/renamed intblock id → current id map
countries_aliases.json Retired/renamed country code → current code map
attribute_intblock_migrations.json Retired attribute-partition intblock → country field predicate
datapackage.json Frictionless Data Package descriptor listing all resources
intblocks_aliases.parquet Alias map (Parquet, zstd)
blocktypes.manifest.json Build metadata (version, commit, row count, schema hash, data license)
blocktypes.yaml Block types (plain YAML copy of source, regenerated on build)
blocktypes.jsonl Block types (plain JSONL)
blocktypes.jsonl.zst Block types (JSONL, zstd)
blocktypes.yaml.zst Block types (YAML, zstd)
blocktypes.parquet Block types (Parquet, zstd)
blocktypes.meta.json Version metadata sidecar for Parquet consumers
memberships.parquet Flattened country↔intblock includes edges (intblock_id, country_code, include_type, status, joined, left); not all edges are legal memberships
memberships.csv.zst The same includes edge table (CSV, zstd)
memberships.manifest.json Build metadata (version, commit, row count, schema hash, data license)
memberships.meta.json Version metadata sidecar for Parquet consumers
internacia.duckdb DuckDB database (countries, intblocks, blocktypes, memberships, and _meta tables)

Current row counts: 256 countries, 1600+ intblocks, 83 blocktypes.

The retired IDs COMMLEARN, ABCZNZ, and USAN resolve to COL, ABCANZ, and UNASUR through intblocks_aliases.json. Use status IN ('member', 'founding_member') for full membership; retain former_member edges and left dates for history. For example, ECOWAS has 12 current members and retains the three 2025 departures.

scope_category identifies what an intblock is, independently of its blocktype or lifecycle status: igo, treaty_body, policy_forum, reference_enumeration, intergovernmental_body, or non_state_organization. Every status: formal intblock must set it; 72 non-formal records remain unlabeled in the 2026-09-30 snapshot while their identity or eligibility is reviewed. A reference_enumeration is a named set, not necessarily an organization. Its includes[].status: member entries must not be interpreted as proof of legal membership without checking the entity and its source. See the inclusion policy and consumer contract.

Format policy: JSONL is shipped both plain and zstd-compressed; YAML exports are zstd-only (the plain blocktypes.yaml is a regenerated copy of the small source taxonomy, kept for convenience). Flattened CSV and JSON-array exports are zstd-only (.csv.zst, .json.zst). Use Parquet or DuckDB for analytics.

Validation and quality

The builder runs both validate_countries.py and validate_intblocks.py before export. Validation covers:

  • JSON Schema conformance (data/schemas/countries.schema.json, data/schemas/intblocks.schema.json)
  • ISO identifier formats and duplicate detection (country codes and intblock ids)
  • Completeness thresholds (data/schemas/countries_completeness.yaml, data/schemas/intblocks_completeness.yaml)
  • Entity status policy (entity_type, code_status)
  • Blocktype and scope_category taxonomy, required formal scope, and partof reference checks for intblocks
  • Intblock cross-references (current-country includes resolve to country sources; known historical identifiers such as SU use the explicit historical-entity registry; includes[].status values come from data/schemas/includes_status.yaml)
  • Referential integrity (borders, predecessor/successor/suborganizations, headquarters countries, duplicate wikidata_id) plus temporal, geographic-plausibility, provenance depth, and naming rules — shared between the validators and the quality analyzer (internacia_builder/validate/*_rules.py)
# Full validation with JSON reports
python3 scripts/validate_countries.py --report completeness-report.json
python3 scripts/validate_intblocks.py --report intblocks-report.json

# Enrich profile fields from external sources
python3 scripts/enrich_countries.py enrich
python3 scripts/enrich_countries.py backfill-provenance

# Enrich intblocks from Wikidata (wikidata_id, descriptions, multilingual names)
python3 scripts/enrich_intblocks.py enrich --dry-run
python3 scripts/enrich_intblocks.py enrich
python3 scripts/enrich_intblocks.py backfill-structural   # headquarters + founded

# Generate the data-quality report (dataquality/ — by rule, priority, country)
python3 scripts/builder.py analyze-quality


# Compare manifests to main branch baseline
python3 scripts/diff_countries_baseline.py

# Verify a local build matches sources and each other; check doc links
python3 scripts/check_generated_artifacts.py
python3 scripts/check_markdown_links.py

# Run tests and lint
pytest tests/
ruff check internacia_builder/ scripts/ tests/

Country code policy (ISO vs user-assigned, filtering examples): docs/country-code-policy.md

Consumer migration

Current schema and semantic changes (see CHANGELOG.md):

  • Population / area / gini: structured as {value, year, source, source_id} — use .value for the numeric field. year is null when the source year is unknown (never 0).
  • Borders: land neighbors as ISO alpha-3 codes (e.g. CAN, MEX), not alpha-2.
  • Entity filter: code_status == 'official_iso3166_1' returns 249 current ISO-style records.
  • Kosovo: code is XK / XKX (not KV / KSV); remap via countries_aliases.json.
  • Attribute partitions: traffic hand, DVD region, scripts, etc. are country fields — not intblocks; see attribute_intblock_migrations.json.
  • Country crosswalks: geonames_id, ioc_code, fifa_code, and fips_code are optional external identifiers with field-level provenance. Coverage is source-specific (GeoNames: 249 current ISO records; IOC: 206 mapped NOCs; FIFA: 207 mapped associations); FIPS is legacy-only, not a current completeness gate.
  • Intblock scope: closed-enum parsers must recognize intergovernmental_body and non_state_organization in addition to the four earlier values. Formal records require scope_category; do not infer an IGO from blocktype or count all status: member edges as formal institutional membership, especially for World Bank and other reference enumerations.
  • Entity/roster migration: AFDF now represents the Fund's 29 State Participants rather than its former mixed 82-country list. TAR is the railway network; the 22-party treaty is TARAGREEMENT. CIF is a two-fund partnership without a country-member roster. TELESUR was retired with a reason: retired alias and a null target (no replacement); see retired IDs.
  • Build metadata: compare countries.manifest.json schema_hash when upgrading downstream pipelines.

Pandas example (structured population — .struct requires the Arrow dtype backend):

import pandas as pd

df = pd.read_parquet("data/datasets/countries.parquet", dtype_backend="pyarrow")
pop = df["population"].struct.field("value")

Polars example (same struct field; structs load natively from Parquet):

import polars as pl

countries = pl.read_parquet("data/datasets/countries.parquet")
pop = countries.select(pl.col("population").struct.field("value").alias("pop"))

Full Polars recipes: docs/query-examples-polars.md.

R / dplyr example (same struct field via Arrow):

library(arrow)
library(dplyr)

countries <- read_parquet("data/datasets/countries.parquet")
pop <- countries |>
  transmute(code, name, pop = population$value) |>
  collect()

Full R recipes: docs/query-examples-r.md. Observable / Plot recipes: docs/query-examples-observable.md.

DuckDB example (nested intblock multilingual names):

import duckdb

con = duckdb.connect("data/datasets/internacia.duckdb")
con.execute("""
    SELECT id, name, t.name AS english_name
    FROM intblocks, UNNEST(other_names) AS t
    WHERE t.id = 'en'
    LIMIT 5
""").fetchall()

Versioning and identifier stability

Datasets are self-describing. The DuckDB file carries a _meta table and each Parquet file has a <dataset>.meta.json sidecar, both mirroring the manifest fields (version, build_date, git_commit, row_count, schema_hash, data_license, contract_version). Tables, keys, enum values and versioning rules are in contract.json, and SHA256SUMS lists checksums for every file (data contract):

import duckdb

con = duckdb.connect("data/datasets/internacia.duckdb")
con.execute("SELECT dataset, version, schema_hash FROM _meta").fetchall()

Identifier stability. Country code and intblock id are stable join keys. When an intblock id is renamed, merged, or its acronym is reassigned to a different entity, the old id is recorded in intblocks_aliases.json (and .parquet) so downstream joins can remap:

import json

aliases = {a["alias"]: a["target"] for a in json.load(open("data/datasets/intblocks_aliases.json"))}
current_id = aliases.get("ASF", "ASF")  # -> "FSA"

A reason of disambiguated means the old id still exists but now refers to a different entity (e.g. ASF is now the African Standby Force; the African Solidarity Fund moved to FSA).

Attribute-partition intblocks (traffic hand, DVD region, scripts, etc.) were retired in favor of country fields. Remap those ids with attribute_intblock_migrations.json (e.g. RHTRAFFIC → car_side = 'right'), not intblocks_aliases.json.

Countries schema

256 country and territory records. Key fields:

Field Type Description
code String ISO 3166-1 alpha-2 code (e.g. US)
entity_type String sovereign_state, dependent_territory, historical_entity, etc.
code_status String official_iso3166_1, user_assigned, obsolete, exceptionally_reserved
recognition_status Struct Optional recognition/dispute metadata
parent_entity Struct Parent state {code, name} for dependent territories
name String Common name
iso3code String ISO 3166-1 alpha-3 code
capital_city Struct {name, lng, lat}
centroid Struct Geographic centroid {lat, lng}
region Struct World Bank region {id, value}
adminregion Struct World Bank admin region {id, value}
incomeLevel Struct World Bank income level {id, value}
lendingType Struct World Bank lending type {id, value}
numeric_code String ISO 3166-1 numeric code
wikidata_id String Wikidata item ID
official_name String Official full name
languages List[Struct] {code, name}; official is optional in the schema but not populated in the current dataset — do not infer legal language status
currencies List[Struct] {code, name, symbol}
un_member Boolean UN member (193 true; aligns with the UN intblock roster)
un_status String member, observer (PS, VA), or non_member
independent Boolean Independent state (non-UN independents: VA only)
subregion String UN subregion
continents List[String] Continents
borders List[String] Land borders as ISO alpha-3 codes
landlocked Boolean Landlocked
tld String Top-level domain
calling_codes List[String] Telephone codes
flag_emoji String Flag emoji
car_side String Driving side (left / right)
writing_directions List Writing direction ids (ltr, rtl, ttb)
writing_systems List Script ids (e.g. latin, arabic)
dvd_region Integer DVD region 1–6 when assigned
broadcast_systems List TV/broadcast standard ids (e.g. atsc, dvbt)
legal_systems List Legal tradition ids (e.g. common_law)
rail_gauges List Rail gauge ids with optional gauge_mm
start_of_week String Start of week
demonyms Struct {female, male}
m49_code String UN M49 code
population Struct {value, year, source, source_id}
area Struct Land area sq km {value, year, source, source_id}
gini Struct Gini index {value, year, source, source_id}
timezones List[String] IANA timezone identifiers
timezone_status String not_applicable when no zones apply
native_names Map Names in the entity's own languages: lang code → {official, common} (either may be absent); exonyms are in other_names
other_names List[Struct] Translations {id, name}
common_names List[String] Aliases and common names
geonames_id / ioc_code / fifa_code / fips_code String Optional external crosswalk identifiers; FIPS is historical
provenance List[Struct] Field sourcing {field, source, retrieved_at, url, license}

Seven non-standard codes are retained with explicit status (see docs/country-code-policy.md): AN (obsolete, Netherlands Antilles), JG (user-assigned grouping, Channel Islands), XK (user-assigned, Kosovo; former KV in countries_aliases.json), XA (user-assigned, Abkhazia), XS (user-assigned, South Ossetia), XT (user-assigned, Transnistria), XN (user-assigned, Nagorno-Karabakh). All carry explicit un_member, un_status, independent, and landlocked values.

International blocks schema

Field Type Description
id String Unique identifier
blocktype List[String] Block types
scope_category String Entity kind: igo, treaty_body, policy_forum, reference_enumeration, intergovernmental_body, or non_state_organization (required for formal records)
status String Current status
name String Name
languages List[String] Official languages
links List[Struct] {url, type}
other_names List[Struct] {id, name} translations
founded String Foundation date
geographic_scope String Scope
regions List[String] Regions covered
includes List[Struct] Members {id, name, type, status, joined, left, role, note} — id is authoritative; for type: country the export sets name to the country's name; not every link is legal membership
membership_count Integer Reported or legacy count; on reference sets it may count elements, not institutional members
membership_count_type String Unit of the reported headcount, when non-country-based
active_period Struct {start, end}
last_verified String Explicit roster verification date
wikidata_id String Wikidata item ID
legal_status String Legal status
description String Description
tags List[String] Tags
topics List[Struct] {key, name}
headquarters Struct {city, country, coordinates}
acronyms List[Struct] {lang, value}
partof List[String] Parent organizations
dissolved String Dissolution date
predecessor String Predecessor
successor String Successor

The table above lists exported columns. Source YAML may carry additional curation fields that are validated but omitted from columnar exports (membership_applicability, founding_members, suborganizations, secretariat, notes, previous_names, official_documents, social_media, recognition_status); these remain available in full JSON/YAML exports. The generated data dictionary lists columnar field availability; see data/schemas/intblocks.schema.json for the full source contract. Valid includes[].status values are cataloged in data/schemas/includes_status.yaml. The exported membership_count and includes are retained on some reference sets for compatibility; their member value does not by itself establish institutional membership. Use scope_category and record-specific provenance when constructing membership queries.

Data sources

YAML sources

  • data/countries/*.yaml — 256 country/territory records
  • data/intblocks/<category>/*.yaml — international block records across domain categories (intorg, fta, human_rights, legal, environment, geographic, aviation, health, climate, etc.)

External enrichment

  • World Bank — population, area, gini, income classifications
  • Wikidata — entity linking, native names, fallbacks
  • IANA tzdata — timezone mapping (scripts/data/zone1970.tab)

Intblock catalogues searched (UN Treaty Collection, WTO RTA-IS / PTA, UNCTAD IIA Navigator, Wikipedia .int) and the roster authorities used to compile membership are listed in docs/intblock-sources.md and ATTRIBUTION.md. How to search and improve records: docs/discovery.md.

Scripts

Script Purpose
internacia_builder/ Installable package (pip install -e .): build/export, quality analyzer, validation rule modules, shared paths/HTTP helpers
scripts/builder.py Shim → internacia_builder.build / internacia_builder.quality (build, info, analyze-quality)
scripts/validate_countries.py Shim → internacia_builder.validate.countries
scripts/validate_intblocks.py Shim → internacia_builder.validate.intblocks
scripts/validate_links.py Intblock URL and Wikidata validation (run weekly in CI)
scripts/enrich_countries.py Enrich country profiles; backfill-provenance subcommand
scripts/enrich_intblocks.py Enrich intblocks from Wikidata (wikidata_id, descriptions, multilingual names); backfill-structural fills headquarters and founded dates
scripts/diff_countries_baseline.py Manifest diff vs git baseline (countries, intblocks, blocktypes)
scripts/check_generated_artifacts.py Source/export values, projections, keys, membership edges, schema hashes, and build metadata
scripts/check_markdown_links.py Internal Markdown link checker
scripts/check_doc_counts.py Consumer-facing docs vs manifest row_count
scripts/generate_data_dictionary.py Regenerate docs/data-dictionary.md from JSON Schemas
scripts/generate_schema_migration.py Compare recursive source/export contracts against a named previous release
scripts/check_release_bundle.py Validate descriptor paths and optional release tag/version consistency
scripts/check_quality_report.py Apply the shared CRITICAL/IMPORTANT quality gate

One-off migration scripts live in scripts/oneoff/ (see its README) and are not part of the maintained pipeline. Research notes: dev/research/.

Releases

Tagged releases (vX.Y.Z) build into .release-datasets, check the committed descriptors against it, test and validate that final bundle, compare source/export contracts with the previous release, and attach the bundle as GitHub Release assets. The tag must match the version in CHANGELOG.md, pyproject.toml, internacia_builder/__init__.py, and the generated manifests. schema_hash identifies a table's exported columns (name, logical type, nullability; see data contract); source-only constraints are covered by the migration report.

Consumers can clone the repository or download versioned Release assets. See release distribution, the Hugging Face publishing guide, and versioning policy for publication and upgrade details.

Notes

  • All text files use UTF-8 encoding; generated outputs overwrite existing files.
  • Decompress zstd files: zstd -d data/datasets/countries.jsonl.zst
  • Gap analysis research: dev/research/countries_gaps_manus_20260528.md
  • Historical reviews and plans: docs/history/.

License

Internacia is part of the Dateno open-source project.

  • Code (scripts/, internacia_builder/, tests/, build tooling, and website/) — MIT, see LICENSE.
  • Data and documentation (curated sources under data/, generated artifacts in data/datasets/, and docs under docs/, README, and related guides) — Creative Commons Attribution 4.0 (CC BY 4.0), see DATA_LICENSE.

Upstream sources (World Bank, Wikidata, IANA tzdata) and citation guidance are documented in ATTRIBUTION.md. Machine-readable citation metadata is in CITATION.cff; concept DOI 10.5281/zenodo.20706176. The data license SPDX identifier is recorded in each build manifest and in the _meta/*.meta.json metadata.

Contributing

See CONTRIBUTING.md for the YAML authoring guide, validation workflow, and PR checklist.

Related projects

  • internacia-api — REST API (in development; self-host only, no public hosted instance, no installable release yet)
  • internacia-python — Python SDK (internacia 0.2.x on PyPI predates data v3; see SDK status)

Roadmap

  • Python SDK — internacia-python (0.3.0 with data v3 support in progress)
  • REST API — internacia-api (in development; self-host only, not a hosted service)

About

Public registry of the intergovernmental organizations, country groups and countries. Available as JSONl, Parquet, YAML and DuckDB database datasets

Topics

Resources

Contributing

Stars

13 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages