$ ⌘K

Load Country-Code Crosswalk — register + derive observations

step_count: 5· runtime: 5 seconds

Registers the bundled country_codes.csv as a DuckDB-queryable table and derives construct observations for each of the four code types (COW, Polity, G&W, ISO3). Entity IDs are the country_name strings (lowercased for consistency with Praxis conventions). Each row in country_codes.csv becomes one observation per non-null code column. NULL Polity/G&W values (meaning "same as COW") are NOT emitted as separate observations — the COW observation is the fallback.

// pipeline
5 steps· DAG
01

register_crosswalk

action register_dataset
config (3 keys)
{
  "dataset_id": "country_codes_crosswalk",
  "format": "csv",
  "unit_of_analysis": "other"
}
02

derive_cow_codes

action derive_observationsregister_crosswalk
config (2 keys)
{
  "dataset_id": "country_codes_crosswalk",
  "sql": "SELECT\n  'country_code_cow'        AS construct_id,\n  LOWER(country_name)       AS entity_id,\n  NULL                      AS time_value,\n  CAST(ccode_cow AS DOUBLE) AS value_numeric,\n  country_name              AS value_text,\n  'other'                   AS unit_of_analysis\nFROM dataset\nWHERE ccode_cow IS NOT NULL\n"
}
03

derive_polity_codes

action derive_observationsregister_crosswalk
config (2 keys)
{
  "dataset_id": "country_codes_crosswalk",
  "sql": "SELECT\n  'country_code_polity'           AS construct_id,\n  LOWER(country_name)             AS entity_id,\n  NULL                            AS time_value,\n  CAST(ccode_polity AS DOUBLE)    AS value_numeric,\n  country_name                    AS value_text,\n  'other'                         AS unit_of_analysis\nFROM dataset\nWHERE ccode_polity IS NOT NULL\n  AND TRIM(CAST(ccode_polity AS VARCHAR)) \u003c\u003e ''\n"
}
04

derive_gw_codes

action derive_observationsregister_crosswalk
config (2 keys)
{
  "dataset_id": "country_codes_crosswalk",
  "sql": "SELECT\n  'country_code_gw'             AS construct_id,\n  LOWER(country_name)           AS entity_id,\n  NULL                          AS time_value,\n  CAST(ccode_gw AS DOUBLE)      AS value_numeric,\n  country_name                  AS value_text,\n  'other'                       AS unit_of_analysis\nFROM dataset\nWHERE ccode_gw IS NOT NULL\n  AND TRIM(CAST(ccode_gw AS VARCHAR)) \u003c\u003e ''\n"
}
05

derive_iso3_codes

action derive_observationsregister_crosswalk
config (2 keys)
{
  "dataset_id": "country_codes_crosswalk",
  "sql": "SELECT\n  'country_code_iso3'   AS construct_id,\n  LOWER(country_name)   AS entity_id,\n  NULL                  AS time_value,\n  NULL                  AS value_numeric,\n  iso3                  AS value_text,\n  'other'               AS unit_of_analysis\nFROM dataset\nWHERE iso3 IS NOT NULL\n  AND TRIM(iso3) \u003c\u003e ''\n"
}
// from pax
// note
step bodies extracted from the .pax archive at build time. download the parent pax for the full yaml.
[ download infrastructure-country-codes-crosswalk.pax.tar.gz ]