or run

npx @tessl/cli init
Log in

Version

Files

docs

chart-components.mdchart-plugins.mddata-transformation.mdform-data.mdindex.mdquery-building.md
tile.json

task.mdevals/scenario-7/

Interactive Data Explorer

Build a data exploration tool that allows users to query and analyze a dataset through a simple programmatic interface. The tool should enable non-technical users to explore data without writing SQL.

Requirements

Dataset Connection

The application should connect to a sample sales dataset with the following columns:

  • date (datetime): Transaction date
  • product (string): Product name
  • region (string): Sales region
  • revenue (number): Revenue amount
  • quantity (number): Units sold

Users should be able to retrieve metadata about available columns.

Query Building

Users should be able to build queries by:

  • Selecting which columns to include in results
  • Adding aggregation metrics (e.g., SUM of revenue, AVG of quantity)
  • Applying simple filters (e.g., region equals 'US', revenue greater than 1000)
  • Setting time ranges (e.g., "last 7 days", or between two specific dates)

Query Execution

Execute the configured query and return results as an array of objects, where each object represents a row with the requested columns.

Result Export

Export the query results to CSV format for use in other tools.

Test Cases

  • Calling getColumns() returns an array with all dataset columns and their types. @test
  • Selecting columns ['product', 'revenue'] and executing returns data with only those columns. @test
  • Adding a SUM metric on revenue and executing the query returns the correct total. @test
  • Adding a filter region = 'US' and executing returns only US region rows. @test
  • Setting time range to "last 7 days" and executing returns only recent data. @test
  • Exporting results to CSV produces a valid CSV string with headers and data. @test

Implementation

@generates

API

/**
 * DataExplorer class for querying datasets without SQL
 */
class DataExplorer {
  /**
   * Initialize with dataset configuration
   * @param {Object} config - Configuration object with dataset details
   */
  constructor(config) {}

  /**
   * Get available columns from the dataset
   * @returns {Promise<Array<{name: string, type: string}>>} Column metadata
   */
  async getColumns() {}

  /**
   * Select columns to include in query results
   * @param {Array<string>} columns - Column names to include
   */
  selectColumns(columns) {}

  /**
   * Add an aggregation metric to the query
   * @param {Object} metric - Metric configuration
   * @param {string} metric.aggregate - Aggregation function: 'SUM', 'AVG', 'COUNT', 'MIN', 'MAX'
   * @param {string} metric.column - Column to aggregate
   * @param {string} [metric.label] - Optional display label
   */
  addMetric(metric) {}

  /**
   * Add a filter condition to the query
   * @param {Object} filter - Filter configuration
   * @param {string} filter.column - Column to filter
   * @param {string} filter.operator - Operator: '=', '!=', '>', '<', '>=', '<=', 'IN'
   * @param {*} filter.value - Value to compare against
   */
  addFilter(filter) {}

  /**
   * Set time range for date-based filtering
   * @param {Object} range - Time range configuration
   * @param {string} range.type - 'relative' or 'absolute'
   * @param {string|Date} range.start - Start date (for absolute) or relative period (e.g., 'last 7 days')
   * @param {string|Date} [range.end] - End date (for absolute ranges)
   */
  setTimeRange(range) {}

  /**
   * Execute the configured query
   * @returns {Promise<Array<Object>>} Array of result rows
   */
  async execute() {}

  /**
   * Export query results to CSV format
   * @returns {Promise<string>} CSV formatted string
   */
  async exportCSV() {}
}

module.exports = { DataExplorer };

Dependencies { .dependencies }

apache-superset { .dependency }

Provides data exploration and visualization capabilities for building interactive data analysis interfaces.