feat(world-map): migrate world_map chart to v1 chart data API - #41720
Conversation
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>
|
Bito Automatic Review Skipped - Branch Excluded |
Codecov Report❌ Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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>
Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
SUMMARY
Tier 1 of #41714 (targets
remove-legacy-viz-pipeline): migrate the World Map (world_map) offexplore_jsononto/api/v1/chart/data.buildQuery.tsmirroring the legacyWorldMapViz.query_obj:entity→ groupby, main metric plus the secondary bubble metric when distinct, metric-descendingorderbyundersort_by_metric.country/m1/m2reshape and the country-metadata join (cca3 code, lat/lng, display name) thatviz.pyperformed againstsuperset.examples.countriesnow happen in the frontend: the lookup table is bundled as a generatedcountries.ts(247 entries, name/cca2/cca3/cioc keys, case-insensitive, generated from the same backend source). Unmatched countries fall back toXXXexactly as before.country) behave correctly.useLegacyApi: trueremoved (and the "Legacy" tag dropped).viz_typeunchanged; legacygranularity_sqla/time_rangehandled byextractExtras(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.POST /api/v1/chart/data; choropleth colors, bubbles, tooltips and cross-filters identical.ADDITIONAL INFORMATION
🤖 Generated with Claude Code