Files
superset2/superset-frontend/plugins/plugin-chart-country-map/scripts/config/regional_aggregations.yaml
Evan Rusackas 1eb48e94fc feat(country-map): scaffold scripts/ dir with YAML config schemas
First-pass schemas for the build pipeline's declarative config layer.
Each schema is documented inline + populated with concrete entries
ported from the legacy notebook's audited touchups (those that the
obsolescence check determined still need to ship).

scripts/
├── README.md                 — pipeline overview, layout, workflow
├── config/
│   ├── name_overrides.yaml         — France typos, ISO codes; PHL renames
│   ├── flying_islands.yaml         — USA/NOR/PRT/ESP/FRA repositions; NLD/GBR drops
│   ├── territory_assignments.yaml  — China + SARs; Finland + Åland
│   ├── regional_aggregations.yaml  — Turkey NUTS-1; FRA/ITA/PHL regions
│   └── composite_maps.yaml         — France-with-Overseas
└── procedural/
    └── README.md             — escape-hatch rules + skeleton (currently empty)

All five YAML files parse cleanly (validated with PyYAML).

Schema design choices:
- Every entry has a `description:` field. Forces honest documentation
  of why each fix exists; reviewers can scan rationale at a glance.
- Match semantics: simple AND-of-conditions; supports `{ in: [...] }`
  for value-set matching.
- composite_maps and territory_assignments share the "pull feature
  from sibling Admin 0" primitive; build script can implement once.
- composite_maps.yaml has a TODO marker for SPM offsets — notebook
  cell 63 was truncated in the audit; will backfill during build
  script implementation.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 15:56:04 -07:00

95 lines
4.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Dissolve Admin 1 features into coarser administrative regions.
#
# Some countries have a meaningful intermediate level between Admin 0
# (country) and Admin 1 (provinces/states/departments). Examples:
# - Turkey: NUTS-1 statistical regions (12 regions from 81 provinces)
# - France: 18 administrative regions dissolved from 101 departments
# - Italy: 20 regions dissolved from 110 provinces
# - Philippines: 17 regions dissolved from 118 provinces+cities
#
# For each defined region set, the build script:
# 1. Loads the country's Admin 1 features
# 2. Dissolves features by the mapping below
# 3. Outputs a new GeoJSON keyed by `<country>_<set_name>`
# 4. Plugin exposes it as a third "admin level" option in the UI:
# "Admin 0 (countries) / Admin 1 (subdivisions) / Aggregated regions"
#
# Schema:
# countries:
# <ISO3>:
# region_sets:
# <set_name>: # arbitrary identifier
# description: human-readable
# display_name: text shown in UI dropdown
# grouping_field: <field> # field on Admin 1 features used to group
# # OR
# explicit_mapping: # explicit ISO → region_code dict
# <region_code>:
# name: <display name>
# members: [<iso_3166_2>, ...]
countries:
# -------------------------------------------------------------------
# Turkey — NUTS-1 statistical regions
# Hand-coded mapping of 81 cities → 12 regions per Eurostat NUTS-1
# classification adapted for Türkiye.
# -------------------------------------------------------------------
TUR:
region_sets:
nuts_1:
description: Eurostat NUTS-1 statistical regions for Türkiye
display_name: "Türkiye (NUTS-1 regions)"
explicit_mapping:
TR1: { name: "İstanbul", members: [TR-34] }
TR2: { name: "Batı Marmara", members: [TR-59, TR-22, TR-39, TR-10, TR-17] }
TR3: { name: "Ege", members: [TR-35, TR-09, TR-20, TR-48, TR-45, TR-03, TR-43, TR-64] }
TR4: { name: "Doğu Marmara", members: [TR-16, TR-26, TR-11, TR-41, TR-54, TR-81, TR-14, TR-77] }
TR5: { name: "Batı Anadolu", members: [TR-06, TR-42, TR-70] }
TR6: { name: "Akdeniz", members: [TR-07, TR-32, TR-15, TR-01, TR-33, TR-31, TR-46, TR-80] }
TR7: { name: "Orta Anadolu", members: [TR-71, TR-68, TR-51, TR-50, TR-40, TR-38, TR-58, TR-66] }
TR8: { name: "Batı Karadeniz", members: [TR-67, TR-78, TR-74, TR-37, TR-18, TR-57, TR-55, TR-60, TR-19, TR-05] }
TR9: { name: "Doğu Karadeniz", members: [TR-61, TR-52, TR-28, TR-53, TR-08, TR-29] }
TRA: { name: "Kuzeydoğu Anadolu", members: [TR-25, TR-24, TR-69, TR-04, TR-36, TR-76, TR-75] }
TRB: { name: "Ortadoğu Anadolu", members: [TR-44, TR-23, TR-12, TR-62, TR-65, TR-49, TR-13, TR-30] }
TRC: { name: "Güneydoğu Anadolu", members: [TR-27, TR-02, TR-79, TR-63, TR-21, TR-47, TR-72, TR-73, TR-56] }
# -------------------------------------------------------------------
# France — 18 administrative regions (since 2016 reform)
# Use NE's `region_cod` field to group departments. After name fixes
# in name_overrides.yaml, the codes should align with the 2016 reform.
# -------------------------------------------------------------------
FRA:
region_sets:
regions:
description: French administrative regions (post-2016 reform)
display_name: "France (regions)"
grouping_field: region_cod
# -------------------------------------------------------------------
# Italy — 20 regions
# -------------------------------------------------------------------
ITA:
region_sets:
regions:
description: Italian administrative regions
display_name: "Italy (regions)"
grouping_field: region_cod
# -------------------------------------------------------------------
# Philippines — 17 regions (after Caraga / BARMM renames)
# -------------------------------------------------------------------
PHL:
region_sets:
regions:
description: Philippine administrative regions
display_name: "Philippines (regions)"
grouping_field: region
# -------------------------------------------------------------------
# Future candidates (not yet enabled — verify NE field availability):
# - DEU: Bundesländer aggregation if NE provides Kreise as Admin 1
# - GBR: NUTS-1 regions (England + Wales + Scotland + NI subdivisions)
# - USA: BEA regions, Census divisions
# -------------------------------------------------------------------