Skip to main content

Language for Exploratory & Narrative Statistics - A declarative analytics language

Project description

LENS - Language for Exploratory & Narrative Statistics

LENS is an open-source analytics programming language that bridges the gap between business questions and data execution using natural language.

Features

  • Declarative Syntax: English-like queries (show net_sales by region)
  • Time Intelligence: Built-in FY, YTD, rolling dates
  • Auto-Visualization: Generates best-fit charts (Vega-Lite)
  • Story Engine: Produces narratives from data trends
  • No-Code Studio: Streamlit-based visual interface

Installation

pip install lens-lang

Or install from source:

git clone https://github.com/Anay007-git/lens.git
cd lens
pip install -e .

Quick Start

CLI

python cli/lens_cli.py -q "show net_sales by region for FY2025"

Studio (No-Code UI)

python -m streamlit run studio/app.py

Python API

from lens.compiler.parser import LensParser

parser = LensParser()
ast = parser.parse("show net_sales by region for FY2025")
print(ast)

Example Query

show net_sales by region
for FY2025
compare with previous year

Output:

  • SQL query
  • Data table
  • Auto-generated chart
  • Business narrative

Architecture

lens/
├── compiler/        # Lark parser + AST
├── semantics/       # Metric/Dimension registry
├── time_intelligence/  # FY, YTD, relative dates
├── planner/         # Logical plan builder
├── sql_gen/         # DuckDB SQL generator
├── runtime/         # Query execution
├── visualization/   # Altair/Vega-Lite charts
└── story/           # Trend analysis + narratives

License

Apache 2.0

Author

Anay Biswas


Built with ❤️ for the analytics community

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

lens_lang-0.1.0.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lens_lang-0.1.0-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file lens_lang-0.1.0.tar.gz.

File metadata

  • Download URL: lens_lang-0.1.0.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lens_lang-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e0534ed8b4ac556c5d19a9f01720d1738899a76104bb8471a162d2225e0dee6e
MD5 9e7487d43d109714024a67a5c935dfd0
BLAKE2b-256 f39ac666c931f560d54816f5d8413dc5efab6a50a5b9270abd091367f05b0552

See more details on using hashes here.

Provenance

The following attestation bundles were made for lens_lang-0.1.0.tar.gz:

Publisher: publish.yml on Anay007-git/lens

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lens_lang-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: lens_lang-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lens_lang-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c332978094d0aec3653a4fc02b477714f4607ec77238cc000e87c6fb7ec3aefe
MD5 f898cf8fd656e3560a5112aaa1e1b9ea
BLAKE2b-256 67c5341ea2d70aca8f6484e26b1cdde16eae5242934dfba2995d66a0fc8dbbb7

See more details on using hashes here.

Provenance

The following attestation bundles were made for lens_lang-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Anay007-git/lens

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page