aminghadersohi opened a new pull request, #38403:
URL: https://github.com/apache/superset/pull/38403
### SUMMARY
Add support for creating Big Number charts via the MCP service. This enables
AI assistants to create single-metric display charts with two variants:
- **big_number_total**: A standalone big number display showing a single
metric value
- **big_number** (with trendline): A big number with a time-series trendline
below it
The implementation includes:
- `BigNumberChartConfig` Pydantic schema with validators for metric
aggregates and trendline requirements
- `map_big_number_config()` for converting simplified config to Superset's
form_data format
- `_resolve_viz_type()` helper for centralized viz_type resolution across
chart types
- Pre-validation in `SchemaValidator` with user-friendly error messages and
codes
- Updated MCP instructions to document the new chart type
Supported features:
- Metric with required aggregate function (SUM, COUNT, AVG, MIN, MAX)
- Optional trendline with temporal column and time grain
- Subheader text, number formatting (y_axis_format), and period comparison
(compare_lag)
- Filter support
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A - Backend MCP service changes only
### TESTING INSTRUCTIONS
1. Run the new test suite:
```bash
pytest tests/unit_tests/mcp_service/chart/test_big_number_chart.py -v
```
2. Run the full MCP service test suite to verify no regressions:
```bash
pytest tests/unit_tests/mcp_service/ -x -q
```
3. Test via MCP client:
- Create a big number total: `generate_chart(dataset_id=1,
config={"chart_type": "big_number", "metric": {"name": "revenue", "aggregate":
"SUM"}})`
- Create a big number with trendline: `generate_chart(dataset_id=1,
config={"chart_type": "big_number", "metric": {"name": "revenue", "aggregate":
"SUM"}, "temporal_column": "ds", "show_trendline": true})`
### ADDITIONAL INFORMATION
- [x] Introduces new feature or API
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration
- [ ] 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]