aminghadersohi opened a new pull request, #44148:
URL: https://github.com/apache/superset/pull/44148
### SUMMARY
Add end-to-end typed geographic chart generation to MCP so migration and
chart-building clients can discover and create native maps instead of
substituting unrelated charts.
**Public contract**
`generate_chart`, `update_chart`, and `generate_explore_link` share three
new config discriminators: `country_map`, `world_map`, and `deck_scatter`.
Separate types match native visualization keys and existing runtime capability
probes. `get_chart_type_schema` returns closed, bounded schemas and examples
for each; no consuming-skill changes are needed.
```json
{"chart_type":"country_map","country":"usa","region_format":"abbreviation","entity":{"name":"state"},"metric":{"name":"sales","aggregate":"SUM"},"filters":[{"column":"country","op":"IN","value":["USA"]}]}
```
```json
{"chart_type":"world_map","country_format":"cca2","entity":{"name":"country"},"metric":{"name":"sales","aggregate":"SUM"},"show_bubbles":true,"secondary_metric":{"name":"population","aggregate":"SUM"}}
```
```json
{"chart_type":"deck_scatter","latitude":{"name":"latitude"},"longitude":{"name":"longitude"},"radius_metric":{"name":"orders","aggregate":"COUNT"},"point_unit":"square_m"}
```
Pass one of these objects **inside `config`**, alongside the tool's
dataset/chart identifier.
**Behavior and validation**
- Country maps explicitly select a boundary set (`usa`, `canada`,
`australia`, `japan`, `uk`) and value format (`name`, `abbreviation`,
`iso_3166_2`). Resolution uses the actual bundled GeoJSON identifiers: exact
matches first, then only unique case/diacritic-insensitive matches. There is no
fuzzy geocoding. Compact backend/frontend lookups have geometry-parity tests.
- Unrecognized or ambiguous regions, duplicate groups resolving to one
boundary, invalid aliases, nonfinite metrics, and invalid coordinates return
structured errors. No returned geographic rows silently disappear. Source
values remain intact for export and country-map cross-filter/drill actions.
- World choropleth and bubble metrics, deduplication, and ordering follow
the native plugin. Geographic points use native longitude/latitude query order,
spatial null filters, radius units, and a keyless MapLibre basemap.
- Compilation checks the configured result, bounded at 10,000 rows, rather
than a two-row sample. This does not audit rows excluded by filters or limits.
- Saved/unsaved generation, updates, cached previews, dataset rebinding,
query-context form-data seeding, data/export, and Explore paths use the
contract. Omitted controls survive same-type updates; explicit nullable
roles/empty filters clear them. Rebinding requires a complete typed config and
removes old dataset roles/filter state.
- ASCII/table previews are explicitly data-only. Vega previews return
`UnsupportedGeographicPreview`, never a misleading bar chart or invented map
geometry.
**Compatibility**
Existing non-geographic types retain their behavior, including raw Gauge
data exports. Legacy native maps retain their existing behavior unless the
explicit regional format or typed MCP contract is selected. Boundary coverage
is deliberately bounded and is not a complete ISO registry. Point basemap
requests still depend on browser network access and deployment policy.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before: these geographic MCP config discriminators were unavailable.
After: clients discover real schemas and generate native maps. A Jest
rendering test runs the real D3 projection against USA GeoJSON, verifies a
shaded California path, and verifies cross-filtering on the original `CA` value.
No live deployment/browser screenshot verification was performed. The local
UI health endpoint was unavailable; the rendering evidence above is
initialized, in-process coverage, not a claim that a saved chart was visually
inspected in a live deployment.
### TESTING INSTRUCTIONS
Automated validation:
- 4,131 MCP unit tests passed, 1 skipped (including initialized FastMCP/ASGI
smoke tests). The exact final geographic suite separately passes all 167 tests.
- 119 frontend tests across 14 country-map, world-map, and Scatter suites;
additional exact-head rerun of the real-boundary rendering test.
- Focused geographic tests cover required/closed schemas, aliases, filters,
all public generation entry points (saved and unsaved), cached updates, all
three data/export paths, result validation, ambiguity handling, update
clearing/rebinding, native query order, form-data seeding, and unsupported
geometry previews.
- Pre-commit: MyPy, Ruff/format, Pylint, frontend type checks,
formatting/lint, and remaining applicable hooks pass.
- Python compile and `git diff --check` pass. Native plugin TypeScript
project builds pass.
- Local test setup used the repository's normal `setup.py` version-metadata
generation; without generated version metadata, an unrelated health-check smoke
failure reproduced on untouched upstream master.
Manual verification:
1. Probe each type with `get_chart_type_schema`, then create a saved chart
using the returned schema.
2. For a USA map, verify `California`, `CA`, and `US-CA` with their
respective formats. Verify a non-USA value such as `BC` fails clearly instead
of leaving a blank map; selecting Canada resolves `BC`.
3. Exercise Australian names/abbreviations, Japanese names, and UK region
names against the appropriate boundary set. Check that clicking a normalized
region filters on its original source value.
4. Compare world choropleth color and bubble size with their separate
metrics. Verify point locations, sizing units, and automatic viewport fitting
in Explore.
5. Update a metric while omitting presentation controls, explicitly clear
optional roles/filters, and rebind with a complete config for another dataset.
Confirm old query roles and filters do not leak.
6. Inspect saved and cached data through JSON/CSV/Excel. Confirm original
identifiers are preserved and invalid geographic results return errors. Confirm
Vega preview reports its explicit limitation.
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [x] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [x] Introduces new feature or API
- [ ] Removes existing feature or API
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]