← Back to all products
$19
KPI Dashboard
Self-contained HTML dashboard with metric cards, threshold alerts, trend indicators, and time period comparison.
JSONMarkdownPython
📄 Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample📁 File Structure 10 files
kpi-dashboard/
├── LICENSE
├── README.md
├── examples/
│ └── sample_kpis.json
├── free-sample.zip
├── guide/
│ ├── 01_features.md
│ ├── 02_quick-start.md
│ ├── 03_scheduling.md
│ └── 04_license.md
├── index.html
└── src/
└── kpi_dashboard.py
📖 Documentation Preview README excerpt
KPI Dashboard
KPI dashboard builder: generate a self-contained HTML dashboard with metric cards, threshold alerts, trend indicators, traffic-light status, and target progress bars. Know your numbers at a glance.
Features
- Traffic-light status — Green/yellow/red indicators based on configurable thresholds
- Trend indicators — Period-over-period change with directional arrows
- Target progress bars — Visual progress toward goals
- Alert summary — Critical and warning KPIs highlighted at the top
- Category grouping — Organize metrics by category (revenue, engagement, growth)
- Auto-refresh — Set a refresh interval for live monitoring
- Dark theme — Professional dark UI with brand accent color
- Self-contained HTML — Single file output with embedded CSS
Requirements
- Python 3.10+
- No external dependencies (stdlib only)
Quick Start
# Generate KPI dashboard from JSON
python src/kpi_dashboard.py --data examples/sample_kpis.json --output dashboard.html
# Custom title and auto-refresh every 30 seconds
python src/kpi_dashboard.py --data kpis.json --title "Acme Corp KPIs" --refresh 30
# Custom brand color
python src/kpi_dashboard.py --data kpis.csv --color "#FF3366" --output report.html
Input Format
JSON array of KPI objects:
[
{
"name": "MRR",
"value": 68700,
"unit": "$",
"green_above": 60000,
"yellow_above": 45000,
"trend": 5.2,
"target": 75000,
"description": "Monthly Recurring Revenue",
"category": "revenue"
}
]
Field Reference
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | Metric name displayed on card |
value | number | yes | Current metric value |
unit | string | no | Value format hint: "$", "%", "k" |
... continues with setup instructions, usage examples, and more.
📄 Code Sample .py preview
src/kpi_dashboard.py
#!/usr/bin/env python3
"""
KPI Dashboard — Analytics Hub (DataNest)
KPI dashboard builder: generate a real-time-style HTML dashboard with
metric cards, threshold alerts, trend indicators, and traffic-light
status. Feed it metrics data and get a self-contained dashboard page.
Usage:
python kpi_dashboard.py --data kpis.json --output dashboard.html
python kpi_dashboard.py --data kpis.csv --title "Acme Corp KPIs"
python kpi_dashboard.py --data kpis.json --refresh 30
Dependencies: Python 3.10+ stdlib only (no pip packages)
License: MIT
"""
from __future__ import annotations
import argparse
import csv
import json
import logging
import sys
from dataclasses import dataclass, field
from datetime import datetime, timezone
from pathlib import Path
from typing import Any
logger = logging.getLogger("kpi_dashboard")
# ---------------------------------------------------------------------------
# Data models
# ---------------------------------------------------------------------------
@dataclass
class KPIMetric:
"""A single KPI metric with optional thresholds and trend data."""
name: str
value: float
formatted: str = ""
unit: str = ""
# Thresholds for traffic-light status
green_above: float | None = None # >= this = green
yellow_above: float | None = None # >= this = yellow, < green
# red = below yellow threshold
trend: float | None = None # Period-over-period change %
target: float | None = None # Target value
description: str = ""
category: str = "general" # Grouping label
# ... 353 more lines ...