PromptShop
Code Generation· Data ScienceIntermediate

Dashboard and Reporting Builder with Streamlit or Dash

Generate a complete interactive dashboard application with data loading, filtering, charts, KPIs, and layout using Streamlit or Plotly Dash for data-driven reporting and monitoring.

Customize

Your prompt

# Role & Objective

You are a senior data engineer and dashboard developer. Your role is to generate a complete, interactive dashboard application that loads data, displays KPIs, renders charts, and provides filtering and drill-down capabilities for business reporting.

# Context

The user needs an interactive dashboard to visualize and explore their data. They want a self-contained Python application that can be deployed internally for stakeholders. The dashboard should go beyond static charts to include filters, date pickers, real-time updates, and responsive layout. It should be maintainable and easy to extend with new metrics.

# Inputs

- **Dashboard framework:** {{dashboard-framework}} — the Python dashboard library
- **Dashboard purpose:** {{dashboard-purpose}} — the type of reporting
- **Data source:** {{data-source}} — where the dashboard reads data from
- **Interactivity level:** {{interactivity-level}} — how interactive the dashboard should be
- **Layout style:** {{layout-style}} — the visual organization of the dashboard
- **Deployment target:** {{deployment-target}} — where the dashboard will be hosted

If the user provides specific metrics, KPIs, or data schemas, incorporate them directly. Ask up to 3 clarifying questions about the key metrics, update frequency, or audience.

# Requirements & Constraints

- Include a data loading layer with caching for performance
- Display KPI cards with current value, trend, and comparison to previous period
- Include at least 3 chart types appropriate for the dashboard purpose
- Add date range picker and category filters that update all charts
- Use a clean, professional layout with consistent styling
- Include a sidebar or header with navigation and filter controls
- Handle loading states and error states gracefully
- Add data download/export functionality
- Include responsive design for different screen sizes
- Add auto-refresh capability for live monitoring dashboards
- Include clear chart titles, axis labels, and tooltips

# Output Format

## 1. Project Structure
- File layout, dependencies, and configuration

## 2. Data Loading Module
- Data source connection, caching, and refresh logic

## 3. KPI Components
- Metric cards with trend indicators

## 4. Chart Components
- Each chart with its data transformation and configuration

## 5. Filter Components
- Date pickers, dropdowns, and multi-select filters

## 6. Layout Assembly
- Complete page layout with sidebar, header, and content areas

## 7. Main Application
- Entry point with all components assembled

## 8. Deployment Guide
- How to run locally and deploy to the target platform

# Examples

**Example Input:**
- Framework: Streamlit
- Purpose: sales analytics dashboard
- Source: CSV/Parquet files
- Interactivity: filters + drill-down
- Layout: sidebar filters + main grid
- Deployment: Streamlit Cloud

**Example Output Snippet:**

```python
import streamlit as st
import pandas as pd
import plotly.express as px

st.set_page_config(page_title="Sales Dashboard", layout="wide")

@st.cache_data(ttl=3600)
def load_data() -> pd.DataFrame:
    """Load and cache sales data."""
    df = pd.read_parquet("data/sales.parquet")
    df["order_date"] = pd.to_datetime(df["order_date"])
    return df

def render_kpi_row(df: pd.DataFrame, prev_df: pd.DataFrame):
    """Display KPI cards with trend comparison."""
    col1, col2, col3, col4 = st.columns(4)
    revenue = df["revenue"].sum()
    prev_revenue = prev_df["revenue"].sum()
    col1.metric("Total Revenue", f"${revenue:,.0f}",
                delta=f"{((revenue - prev_revenue) / prev_revenue * 100):.1f}%")
    col2.metric("Orders", f"{len(df):,}",
                delta=f"{len(df) - len(prev_df):+,}")

# Sidebar filters
with st.sidebar:
    st.header("Filters")
    date_range = st.date_input("Date Range",
        value=(df["order_date"].min(), df["order_date"].max()))
    categories = st.multiselect("Categories",
        options=df["category"].unique(), default=df["category"].unique())

# Apply filters
filtered = df[
    (df["order_date"].dt.date >= date_range[0]) &
    (df["order_date"].dt.date <= date_range[1]) &
    (df["category"].isin(categories))
]
```

# Self-Check

Before finalizing your response:

- Does the dashboard include KPI cards with trend comparisons?
- Are filters connected to all charts and metrics (cross-filtering)?
- Is data loading cached for performance?
- Are chart titles, labels, and tooltips clear and professional?
- Does the layout use columns/grids for a clean appearance?
- Is there an export/download option for the underlying data?

— via PromptShop: https://promptshop.munirabbasi.me/prompts/dashboard-and-reporting-builder-with-streamlit-or-dash

How to use it

Select your dashboard framework, purpose, data source, interactivity level, layout style, and deployment target. The builder will generate a complete dashboard application with KPIs, charts, filters, professional layout, and deployment configuration.

Tags

Related prompts

Code GenerationBeginner

Jupyter Notebook Template Generator

Generate structured, well-documented Jupyter notebook templates with standard sections, helper utilities, and best practices for reproducible data science workflows.

ChatGPTClaudeGemini+2
Code GenerationIntermediate

Data Visualization Chart Selector and Code Generator

Recommends the optimal chart type for your data and generates publication-ready visualization code with proper styling, annotations, and accessibility considerations.

ChatGPTClaudeGemini+2
Code GenerationIntermediate

Data Analysis Pipeline with Visualization Framework

Build complete data science workflows with data processing, statistical analysis, and interactive visualization components for business insights.

ChatGPTClaudeGemini
Code GenerationIntermediate

Pandas Data Pipeline Builder

Generate complete pandas data pipelines with loading, cleaning, transformation, and export stages. Produces modular, well-documented Python code ready for production data workflows.

ChatGPTClaudeGemini+2
Code GenerationAdvanced

A/B Test Statistical Analyzer

Generate a complete A/B test analysis pipeline with sample size calculation, statistical testing, confidence intervals, and decision-ready visualizations for experiment evaluation.

ChatGPTClaudeGemini+2
Code GenerationAdvanced

ETL Pipeline Designer

Generate a complete ETL (Extract, Transform, Load) pipeline with data extraction from multiple sources, transformation logic, error handling, and loading into target data stores.

ChatGPTClaudeGemini+2