Commit Graph

11 Commits

Author SHA1 Message Date
Superset Dev
adbf5bcff8 feat(plugin-chart-country-map): ship all 33 NE worldviews at Admin 0
Previously the build only emitted the ukr (Ukraine) worldview, so the
worldview dropdown had a single option even though it claimed otherwise.
Build now produces Admin 0 GeoJSON for every NE-published editorial:
default, arg, bdg, bra, chn, deu, egy, esp, fra, gbr, grc, idn, ind, iso,
isr, ita, jpn, kor, mar, nep, nld, pak, pol, prt, pse, rus, sau, swe, tur,
twn, ukr, usa, vnm (33 total).

NE does not publish per-worldview Admin 1 variants, so subdivisions within
a country come from a single shared file. The frontend now always points
Admin 1, regional aggregation, and composite URLs at the ukr-prefixed
shared outputs regardless of the selected worldview — the worldview
control only affects the world (Admin 0) map.

- build.py: expand WORLDVIEWS_ADMIN_0 to 33 worldviews; main() builds
  Admin 0 for all of them, Admin 1 only for ukr
- transformProps.ts: introduce SHARED_ADMIN1_WORLDVIEW = 'ukr'; pin all
  non-Admin-0 URLs to it
- controlPanel.tsx: WORLDVIEW_LABELS now covers all 33 codes; unrecognized
  codes still fall back to raw code for forward-compat
- transformProps.test.ts: cover shared-Admin1 contract (admin1+chn still
  resolves to ukr_admin1_*)
- pre-commit: exclude .geo.json from check-added-large-files (existing
  rule only excluded .geojson and would block these ~2MB worldview files)
- README + SIP: document the worldview model and check off Phase 1 item

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 09:10:04 -07:00
Evan Rusackas
9fd7fd441a fix(country-map): CI failures — license headers, lockfile sync, reproducible build
Three coordinated fixes for the 25 CI failures on the initial PR push:

1. **Lockfile sync.** Added @superset-ui/plugin-chart-country-map as
   a workspace dep in the previous commit but didn't update
   package-lock.json. CI's `npm ci` failed across frontend-build,
   cypress (12 jobs), playwright (4 jobs), docker (2 jobs), and
   frontend-check-translations. Re-ran `npm install --package-lock-only`
   to add the new workspace's 71 lock entries.

2. **License headers added** to 13 new files flagged by License Check:
   - 5 markdown READMEs / SIP_DRAFT (HTML-comment headers)
   - 5 YAML config files (`# Licensed ...`)
   - 2 Python files (`# Licensed ...`)
   - 1 shell script (preserves shebang)

3. **Reproducible build outputs.** The regen workflow detected drift
   on manifest.json + ukr_admin1_CAN.geo.json. Two root causes:
   - `build_timestamp_utc` field made manifest non-deterministic →
     dropped from the schema
   - Floating mapshaper version (`npx --yes mapshaper`) caused subtle
     simplification differences across runners → pinned to
     `mapshaper@0.7.15` via `npx --yes mapshaper@<version>`

Verified locally: rebuild from clean cache reproduces every output
byte-identically except the manifest (which now also matches once
the timestamp is gone).

Files changed:
  .gitignore                           — re-include rule for static dir
  superset-frontend/package-lock.json  — +71 lines for new workspace
  13 new files                         — ASF headers
  build.py                             — pin mapshaper, drop timestamp
  manifest.json (× 2)                  — regenerate w/o timestamp
  README.md (in static dir)            — header

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 22:32:51 -07:00
Evan Rusackas
cfdc7dce8e docs(country-map): SIP — phases 2/3/5 substantially done
Mark Phase 2 (plugin scaffolding) substantially complete: hosting
path wired, click-to-zoom ported. Phase 3 (controls) fully done with
manifest-driven choices replacing hardcoded tables. Phase 5
substantially done: 41 tests across 4 test files, CI workflow,
UPDATING.md entry.

Remaining items, all non-blocking for SIP filing:
- "Switch to new Country Map" button on legacy plugin renderer
- Cross-filter integration via setDataMask
- Composite projection support (geoAlbersUsa for USA)
- Real example images (need actual rendering capture)
- Update Superset docs site

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 17:39:15 -07:00
Evan Rusackas
1817e37b06 feat(country-map): wire build outputs to Flask static path + commit them
Move build pipeline outputs from a sibling `output/` directory into
Superset's Flask-served `superset/static/assets/country-maps/` so the
plugin can fetch them at runtime without webpack involvement (Flask
serves the tree at `/static/...` directly).

Commit the 220 generated GeoJSONs + manifest.json so a fresh
ephemeral environment can render the chart immediately, no build
step required at deploy time. Trade-off: ~17 MB of generated files
in-tree. (For comparison the legacy plugin commits ~34 MB of
GeoJSON; net change is -17 MB once we remove the legacy plugin in a
future major version.)

Files committed:
  superset/static/assets/country-maps/
    README.md                                         (humans, not data)
    manifest.json
    ukr_admin0.geo.json                          2.1 MB
    ukr_admin1_<adm0_a3>.geo.json    × 214      ~50 KB - 662 KB each
    regional_<country>_<set>_ukr.geo.json × 4   ~30 KB each
    composite_france_overseas_ukr.geo.json       322 KB

Build script changes:
- OUTPUT_DIR computed via SCRIPT_DIR.parents[3] / "superset" /
  "static" / "assets" / "country-maps"
- mkdir(parents=True) so a fresh checkout works first run
- Stale `output/` entry kept in scripts/.gitignore for safety
  (some local checkouts may have it from earlier iterations)

.gitignore: add re-include lines so superset/static/assets/country-maps/**
gets committed despite the broader superset/static/* exclusion.

SIP_DRAFT updated with the hosting-decision rationale.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 17:26:39 -07:00
Evan Rusackas
baf33093c2 docs(country-map): SIP — sync impl plan with renderer + controls + viz_type wiring
Mark Phase 2 substantially done (renderer ported, transformProps wired,
fit-to-selection works), Phase 3 done (full control panel committed),
Phase 4 mostly done (viz_type registered, legacy marked deprecated;
"switch to new" button still TODO), and Phase 5 partially done
(manifest + transformProps/buildQuery tests).

Remaining items for full POC: GeoJSON hosting path, click-to-zoom,
cross-filter, composite-projection render support, manifest-driven
controls, "Switch to new chart" button, CI workflow, example images,
UPDATING.md entry.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 17:10:54 -07:00
Evan Rusackas
2165b95a08 docs(country-map): SIP — add test plan section for maintainer validation
Captures things the maintainer should manually verify before merge,
organized by category:
- Build pipeline (data correctness)
- Visual/cartographic quality (in-chart rendering)
- Controls UX
- Backward compatibility
- Per-deployment customization (config)
- Performance + ops

Items get added/checked off as the implementation progresses.
Includes specific spot-checks the agent can't validate alone:
Crimea-as-Ukrainian visual, Russia Chukchi connectedness, India
J&K under _ukr worldview, French composite layout, etc.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 16:57:03 -07:00
Evan Rusackas
fb31a5160d docs(country-map): SIP — sync implementation plan with current progress
Mark Phase 1 substantially complete (5/5 transforms working,
220 outputs verified, all schemas in place) and Phase 2 partially
complete (modern plugin scaffold compiles end-to-end, real renderer +
controls still TODO).

Add a "Current PR state" section showing the build script's actual
output so reviewers reading the SIP can see at a glance what the POC
produces today.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 16:45:49 -07:00
Evan Rusackas
1fffd9d832 docs(country-map): SIP — add procedural/ escape hatch for edge cases
Most touchups fit declarative YAML cleanly (typos, ISO codes,
repositions, dissolves, composites). A few don't — e.g., the
France-with-Overseas notebook drops a specific sub-polygon by index
to avoid visual conflict with Corsica.

Add a `procedural/` directory of small, named, single-purpose Python
scripts as an escape hatch. Build orchestrator runs YAML transforms
first, then iterates procedural/*.py in numeric order.

Why this is much better than the notebook for the same content:
- Each fix is a separate file → conflicts localize to one fix at a
  time, not "the whole notebook touched the same cell"
- No kernel state, no output churn, pure functions on data
- Naming forces documentation; reviewers see add/remove at a glance
- Bounded growth: a 50-file procedural/ dir is annoying enough to
  signal "push back into YAML or upstream"; the notebook had no
  such signal and just bloated

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 15:50:05 -07:00
Evan Rusackas
1e349d26a4 docs(country-map): SIP — obsolescence check vs current NE 5.x
Verified each notebook touchup against current Natural Earth Admin 1
data. Headline wins:

OBSOLETE (NE caught up or worldview handles it):
- Vietnam diacritics: NE has correct values in name_vi field; manual
  rewrites collapse to zero by exposing name_language=vi
- Crimea/Sevastopol: handled by _ukr worldview (already confirmed)
- India Kashmir/Ladakh geometry: NE has UTs with correct ISO codes;
  worldview selection adjusts northern boundary
- Russia Chukchi antimeridian: NE has split geometry into properly-
  bounded polygons (x range [-180, 180]); D3 projection should handle
- Latvia third-party file: NE has 119 fine-grained admin1 features
- Philippines third-party file: NE has 118 admin1 features
- external_overrides.yaml DROPPED from the design

STILL NEEDED (NE still wrong / no upstream support):
- France typos (Seien-et-Marne, Haute-Rhin still in NE)
- France ISO codes (FR-75 → FR-75C, FR-GP → FR-971, etc. — 6 features)
- Philippines admin renames (Dinagat→Caraga, ARMM→BARMM, 11 features)
- China + SARs (Taiwan/HK/Macau still separate Admin 0 in NE)
- Finland + Åland (missing from FIN admin 1 in NE)
- Regional aggregations (Turkey NUTS-1, France/Italy/PHL regions)
- France-with-Overseas composite
- Flying-island repositions (USA, Norway, Portugal, Spain, France DOM)

Net: design surface shrinks, no third-party data dependencies in-tree,
config files stable enough that ongoing maintenance is small.

Two follow-up verifications still pending: Russia Chukchi renders
correctly under D3, India J&K geometry matches current Indian
boundary expectations under _ukr worldview.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 15:43:36 -07:00
Evan Rusackas
b12044cec7 docs(country-map): SIP — audit notebook touchups, enumerate config surface
Read all 96 cells of the legacy notebook; categorized every kind of
work it does into 14 buckets and mapped each to either:
-  already covered by the proposed design
- 🟡 covered but requires a YAML config we'll need to port
- 🟠 needs a NEW config file or pipeline feature beyond what was sketched
-  might be obsolete in current NE — verify per case

Surfaced four NEW config-driven build features beyond the original
sketch:
- territory_assignments.yaml (China + SARs, Finland + Åland)
- regional_aggregations.yaml (Turkey NUTS-1, France/Italy/Philippines
  regions; new "Aggregated regions" admin level)
- composite_maps.yaml (France-with-Overseas multi-country composite)
- external_overrides.yaml (India/Latvia/Philippines third-party
  GeoJSON; verify whether still needed against current NE)

Plus extended flying_islands.yaml with drop|reposition action modes
to subsume the bounds-clipping pattern (Netherlands, UK).

Updated open questions, smoke-test fixtures (now 5 cases that
exercise the full surface), and Phase 1 of the implementation plan
with the obsolescence check + external-GeoJSON check as concrete
follow-ups.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 15:33:54 -07:00
Evan Rusackas
a4b1ecafd1 docs(country-map): SIP draft for Country Map plugin redesign
Living document tracking the design for the Country Map rework. Will
be filed as a proper SIP issue when the POC matures; this file is
working scratch in the meantime.

Captured so far:
- Motivation: disputed-borders flashpoints, Jupyter notebook pain,
  legacy explore_json endpoint
- Goals: configurable worldview, Admin 0 + Admin 1, per-deployment
  + per-chart customization, mapshaper-based reproducible build
  pipeline, modern chart/data endpoint
- Spike findings: NE UA worldview vs Default — confirms Crimea-as-
  Ukrainian + several other commonly-expected positions (Kosovo,
  Western Sahara, Palestine, Cyprus, Kashmir)
- Deprecation plan: in-UI "switch to new Country Map" button + banner
  on legacy, modeled on existing deprecated-chart pattern

Open questions tracked inline; implementation phases sketched.

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