Skip to content

feat(world-map): migrate world_map chart to v1 chart data API - #41720

Merged
rusackas merged 3 commits into
remove-legacy-viz-pipelinefrom
legacy-viz-t1-world-map
Jul 3, 2026
Merged

feat(world-map): migrate world_map chart to v1 chart data API#41720
rusackas merged 3 commits into
remove-legacy-viz-pipelinefrom
legacy-viz-t1-world-map

Conversation

@rusackas

@rusackas rusackas commented Jul 3, 2026

Copy link
Copy Markdown
Member

SUMMARY

Tier 1 of #41714 (targets remove-legacy-viz-pipeline): migrate the World Map (world_map) off explore_json onto /api/v1/chart/data.

  • New buildQuery.ts mirroring the legacy WorldMapViz.query_obj: entity → groupby, main metric plus the secondary bubble metric when distinct, metric-descending orderby under sort_by_metric.
  • The country/m1/m2 reshape and the country-metadata join (cca3 code, lat/lng, display name) that viz.py performed against superset.examples.countries now happen in the frontend: the lookup table is bundled as a generated countries.ts (247 entries, name/cca2/cca3/cioc keys, case-insensitive, generated from the same backend source). Unmatched countries fall back to XXX exactly as before.
  • Guarded rename: only rows carrying both the entity and metric labels are treated as v1 records, so pre-shaped legacy payloads (and entity columns literally named country) behave correctly.
  • useLegacyApi: true removed (and the "Legacy" tag dropped).
  • No DB migration: viz_type unchanged; legacy granularity_sqla/time_range handled by extractExtras (covered by test).

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

No visual change — same renderer, same data shape, different endpoint.

TESTING INSTRUCTIONS

  • npm run test -- plugins/legacy-plugin-chart-world-map — 10 new Jest tests (query shape incl. secondary-metric dedup, country join by cca2/cca3/full name, case-insensitivity, XXX fallback, m2 mirroring); 21 total pass.
  • Manual: open a saved World Map; network tab shows POST /api/v1/chart/data; choropleth colors, bubbles, tooltips and cross-filters identical.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
  • Introduces new feature or API
  • Removes existing feature or API

🤖 Generated with Claude Code

Adds a buildQuery mirroring the legacy WorldMapViz.query_obj (entity
as the groupby column, main metric plus distinct secondary bubble
metric, metric-descending order under sort_by_metric) and ports the
country/m1/m2 reshape plus the country-metadata join from the backend
get_data into the frontend. The cca3/lat/lng/name lookup that lived in
superset.examples.countries is bundled as a generated countries.ts so
unmatched rows still fall back to XXX exactly as before. Pre-shaped
legacy payloads pass through untouched.

No DB migration needed: viz_type is unchanged and legacy
granularity_sqla/time_range form data flows through extractExtras.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dosubot dosubot Bot added api:charts Related to the REST endpoints of charts change:frontend Requires changing the frontend viz:charts:map Related to Map charts labels Jul 3, 2026
@bito-code-review

bito-code-review Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Bito Automatic Review Skipped - Branch Excluded

Bito didn't auto-review because the source or target branch is excluded from automatic reviews.
No action is needed if you didn't intend for the agent to review it. Otherwise, to manually trigger a review, type /review in a comment and save.
You can change the branch exclusion settings here, or contact your Bito workspace admin at evan@preset.io.

@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.07692% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 64.64%. Comparing base (c6242a6) to head (ae2e5a3).
⚠️ Report is 6 commits behind head on remove-legacy-viz-pipeline.

Files with missing lines Patch % Lines
...plugins/legacy-plugin-chart-world-map/src/index.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                      Coverage Diff                       @@
##           remove-legacy-viz-pipeline   #41720      +/-   ##
==============================================================
+ Coverage                       64.62%   64.64%   +0.01%     
==============================================================
  Files                            2684     2687       +3     
  Lines                          148431   148482      +51     
  Branches                        34249    34272      +23     
==============================================================
+ Hits                            95930    95989      +59     
+ Misses                          50739    50731       -8     
  Partials                         1762     1762              
Flag Coverage Δ
javascript 69.43% <98.07%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

claude added 2 commits July 2, 2026 22:27
ChartProps camelizes form data before transformProps runs, so the
country_fieldtype/secondary_metric lookups never matched and every row
degraded to XXX. transformData takes an explicit camelCase options
object, covered by a transformProps-level test against real ChartProps.
Also guards the secondary-metric dedupe in buildQuery against a missing
primary metric.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@rusackas
rusackas merged commit 3751fa3 into remove-legacy-viz-pipeline Jul 3, 2026
57 checks passed
@rusackas
rusackas deleted the legacy-viz-t1-world-map branch July 3, 2026 06:00
rusackas added a commit that referenced this pull request Jul 7, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 7, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 8, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 10, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 13, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 14, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 15, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 15, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 16, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 17, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 20, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 20, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 20, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 21, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 21, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 23, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 27, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api:charts Related to the REST endpoints of charts change:frontend Requires changing the frontend plugins size/XXL viz:charts:map Related to Map charts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants