An opinionated YAML-driven analytics dashboarding library. Define a config, get a beautiful dashboard.
Project description
Lens
An opinionated YAML-driven analytics dashboarding library. Define a config, get a beautiful dashboard. Built by Mindcase.
pip install mindcase-lens
Quick Start
1. Create a YAML config:
app:
title: "My Dashboard"
database:
connection: "postgresql://user:pass@localhost:5432/mydb"
pages:
- id: sales
name: Sales
icon: bar-chart
rows:
- height: small
items:
- type: kpi
title: Total Revenue
query: "SELECT SUM(amount) as current_value FROM sales"
prefix: "$"
compact: true
2. Serve it:
lens serve dashboard.yaml
That's it. You get a full React dashboard with KPIs, charts, tables, filters, theming, and more -- all from YAML.
Features
- KPIs with trend indicators, formatting, and compact numbers
- Charts -- bar, line, area, pie, donut, horizontal bar, combo (via ApexCharts)
- Data Tables -- pagination, sorting, conditional formatting, CSV export
- Filters -- dropdown (single/multi), date range, date, text search, number range, toggle
- Theming -- light/dark mode, color themes, font selector, border radius
- Sidebar -- auto-generated from pages, collapsible, supports logos
- Hot Reload -- edit YAML, dashboard updates instantly (debug mode)
- Security -- read-only queries, parameterized SQL, no raw SQL on the client
YAML Config
app:
title: "Dashboard Title"
theme: system # light | dark | system
port: 8080
debug: true # enables hot reload
database:
connection: "postgresql://..."
pool_size: 10
query_timeout: 30
sidebar:
logo: "/logo.png"
logo_dark: "/logo-dark.png"
title: "My App"
sections:
- label: Analytics
pages: [sales, customers]
footer: "Powered by Lens"
pages:
- id: sales
name: Sales
icon: bar-chart
default: true
filters:
- id: region
type: dropdown
label: Region
query: "SELECT DISTINCT region FROM sales"
all: true
tabs:
- name: Overview
rows:
- height: small
items:
- type: kpi
title: Revenue
query: "SELECT SUM(amount) as current_value FROM sales WHERE (:region = 'ALL' OR region = :region)"
prefix: "$"
compact: true
Widget Types
KPI
- type: kpi
title: Total Revenue
query: "SELECT SUM(amount) as current_value, SUM(prev_amount) as previous_value FROM sales"
prefix: "$"
suffix: ""
decimals: 0
compact: true
Chart
- type: chart
chart_type: bar # bar | line | area | pie | donut | horizontal_bar | combo
title: Revenue by Month
query: "SELECT month, SUM(amount) as revenue FROM sales GROUP BY month"
x: month
y: revenue
y_format: currency # currency | number | percentage | compact
stacked: false
data_labels: false
Table
- type: table
title: Recent Orders
query: "SELECT id, customer, amount, date FROM orders ORDER BY date DESC"
page_size: 25
default_sort:
column: date
direction: desc
columns:
- id: amount
label: Amount
format: currency
conditional:
rule: threshold
threshold: 1000
Filter Types
| Type | Config | SQL Params |
|---|---|---|
dropdown |
query or options, multi, all |
:filter_id |
daterange |
presets, min_date, max_date |
:filter_id_start, :filter_id_end |
date |
-- | :filter_id |
text |
placeholder |
:filter_id |
number_range |
min, max, step |
:filter_id_min, :filter_id_max |
toggle |
on_label, off_label |
:filter_id |
CLI
lens serve dashboard.yaml # start dashboard
lens serve dashboard.yaml --port 3000 # custom port
lens serve dashboard.yaml --no-browser # don't open browser
lens validate dashboard.yaml # validate config
Python API
from lens import Lens
app = Lens("dashboard.yaml")
app.serve(port=8080)
Development
# Install
pip install -e .
cd frontend && npm install
# Frontend dev (hot reload)
cd frontend && npm run dev
# Build
make build
# Run
lens serve examples/northwind_dashboard.yaml
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mindcase_lens-0.1.0.tar.gz.
File metadata
- Download URL: mindcase_lens-0.1.0.tar.gz
- Upload date:
- Size: 705.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd759389a457966793f30572f024cb8636f3eb722789d8277bc297fa7c0911ec
|
|
| MD5 |
8f9ba2afcc1554ec571dbf44a9636fa5
|
|
| BLAKE2b-256 |
d77ad41ded5fcb5212f17b534f111efeea896495ff60176041c6324695ee8b56
|
Provenance
The following attestation bundles were made for mindcase_lens-0.1.0.tar.gz:
Publisher:
publish.yml on mindcase-co/lens
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mindcase_lens-0.1.0.tar.gz -
Subject digest:
cd759389a457966793f30572f024cb8636f3eb722789d8277bc297fa7c0911ec - Sigstore transparency entry: 1290032184
- Sigstore integration time:
-
Permalink:
mindcase-co/lens@c2000ddaf79e8b5932704fbb51a2941a5127e169 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/mindcase-co
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c2000ddaf79e8b5932704fbb51a2941a5127e169 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mindcase_lens-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mindcase_lens-0.1.0-py3-none-any.whl
- Upload date:
- Size: 486.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac05d437b25076394881fecae7ae7c8d9467190d45373a54876be84d05b5a417
|
|
| MD5 |
05537deccaf3d141eec753d0c9011b6f
|
|
| BLAKE2b-256 |
8cab676ddee729c8c10821d1b27e3c8137186ef769a8374a020345adcfa8ddd4
|
Provenance
The following attestation bundles were made for mindcase_lens-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on mindcase-co/lens
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mindcase_lens-0.1.0-py3-none-any.whl -
Subject digest:
ac05d437b25076394881fecae7ae7c8d9467190d45373a54876be84d05b5a417 - Sigstore transparency entry: 1290032257
- Sigstore integration time:
-
Permalink:
mindcase-co/lens@c2000ddaf79e8b5932704fbb51a2941a5127e169 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/mindcase-co
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c2000ddaf79e8b5932704fbb51a2941a5127e169 -
Trigger Event:
push
-
Statement type: