CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-superset-ui--generator-superset

Yeoman generator that scaffolds Superset visualization plugins and packages with proper structure and boilerplate code

63

1.21x
Overview
Eval results
Files

task.mdevals/scenario-8/

Interactive Sales Dashboard Creator

Build a Python application that creates and manages interactive sales data visualizations using a business intelligence platform.

Background

You are building a sales analytics application that needs to programmatically create interactive visualizations from sales data stored in a SQLite database. The application should create multiple chart types to analyze sales performance from different perspectives.

Requirements

Your application should:

  1. Create a bar chart visualization that displays total sales by product category, with categories on the x-axis and sales amounts on the y-axis.

  2. Create a line chart visualization that shows sales trends over time (monthly), displaying the progression of total sales across months.

  3. Create a pie chart visualization that represents the percentage distribution of sales across different regions.

  4. Export chart data from one of the created charts to CSV format for external analysis.

All charts should be created programmatically and properly configured with appropriate metadata (chart type, data source, aggregations, etc.).

Implementation

@generates

API

def create_bar_chart(database_id: int, dataset_id: int, chart_name: str) -> int:
    """
    Creates a bar chart showing total sales by product category.

    Args:
        database_id: The ID of the connected database
        dataset_id: The ID of the dataset containing sales data
        chart_name: The name to give the chart

    Returns:
        The ID of the created chart
    """
    pass

def create_line_chart(database_id: int, dataset_id: int, chart_name: str) -> int:
    """
    Creates a line chart showing sales trends over time (monthly).

    Args:
        database_id: The ID of the connected database
        dataset_id: The ID of the dataset containing sales data
        chart_name: The name to give the chart

    Returns:
        The ID of the created chart
    """
    pass

def create_pie_chart(database_id: int, dataset_id: int, chart_name: str) -> int:
    """
    Creates a pie chart showing sales distribution by region.

    Args:
        database_id: The ID of the connected database
        dataset_id: The ID of the dataset containing sales data
        chart_name: The name to give the chart

    Returns:
        The ID of the created chart
    """
    pass

def export_chart_data(chart_id: int, output_path: str) -> None:
    """
    Exports the data from a chart to CSV format.

    Args:
        chart_id: The ID of the chart to export data from
        output_path: The file path where the CSV should be saved
    """
    pass

Test Cases

  • Creating a bar chart returns a valid chart ID @test
  • Creating a line chart returns a valid chart ID @test
  • Creating a pie chart returns a valid chart ID @test
  • Exporting chart data creates a CSV file at the specified path @test

Dependencies { .dependencies }

apache_superset { .dependency }

Provides business intelligence and data visualization capabilities including chart creation, data querying, and export functionality.

Install with Tessl CLI

npx tessl i tessl/npm-superset-ui--generator-superset

tile.json