Architecture
Internacia is a data-as-code pipeline: curated YAML is validated, then exported
to interchangeable artifacts. Do not hand-edit data/datasets/.
Current source scale (must match manifests; intblocks rounded down to the hundred): 256 countries, 1700+ intblocks, 83 blocktypes.
Layers
- Source YAML — one file per country or intblock. Edit these.
- Validation — JSON Schema, completeness gates, cross-dataset rules
(
scripts/validate_*.py→internacia_builder.validate). - Build —
internacia_builder.buildflattens, writes exports, embeds_meta. - Consumers — DuckDB/Parquet preferred; CSV/lite for spreadsheets and LLM context; Python SDK or self-hosted internacia-api for apps.
Export field coverage
Nested membership is available on every consumer path:
| Path | Departure dates (left) |
|---|---|
| Source YAML / JSONL / JSON | includes[].left |
Parquet / DuckDB intblocks.includes | left is part of the struct |
memberships table / memberships.parquet / memberships.csv.zst | column left |
Prefer memberships for roster analytics (no UNNEST). Lite Parquet/CSV omit nested
rosters — join back to full tables on code / id.
Every release writes migration.vX.Y.Z.json, comparing recursive source and
export contracts with the identified previous release. schema_hash describes
the exported Arrow schema; source-only constraint changes can leave it unchanged.
See versioning-policy.md.
Enrichment
Optional Wikidata/World Bank enrichment lives in scripts/enrich_*.py. Scheduled
freshness checks: .github/workflows/enrichment-check.yml (may open a review PR).
Country provenance and intblock last_verified share a 12-month advisory SLA
(enrichment.md); tier-1 organizations (data/watch/rosters.yaml) have a 6-month
window. New or changed intblocks must carry last_verified, and roster changes must refresh it.
The never-verified and overdue counts are in dataquality/last_verified_kpi.json, the CI job
summary, and scripts/last_verified_report.py.
Governance
- OpenSpec (
openspec/) for schema and breaking export changes. After a change ships, archive it (openspec archive <id> --yes) soopenspec liststays current. Completed-but-unarchived folders underopenspec/changes/are process debt, not open product work. - Quality analyzer (
builder.py analyze-quality) and the CLI validators run the same rules frominternacia_builder/validate/registry.py, which lists each rule once with its validator severity; add new rules there. CI fails on CRITICAL/IMPORTANT, and validator errors map to those priorities. - docs/history/improvement-plan.md and docs/strategy-and-user-needs.md are historical planning snapshots — do not treat their gap lists as current.