Skip to content
mneha05Public

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

GridLens — Enterprise Analytics, Reporting, API & AI Platform

Self-service analytics, enterprise reporting & visualization, full-lifecycle API management, an ETL data pipeline, and an AI analyst — for power-grid operations.

GridLens is a single, production-shaped product that does what an Enterprise BI & Integration team actually ships: it ingests operational data through a validated ETL pipeline, serves it through a versioned REST API, renders it as self-service dashboards and reports, lets analysts write SQL against a live warehouse, and answers plain-English questions with an AI agent that writes and runs SQL for you. Live demo: gridlens-eight-vercel.app

Architecture

            ┌─────────────────────────────────────────────┐
  Python    │  etl/build_dataset.py                        │
  ETL  ───► │  Extract (CSV) → Transform/Validate → Load   │ ──► public/data.json
            └─────────────────────────────────────────────┘
                                  │
            ┌─────────────────────┼───────────────────────┐
            ▼                     ▼                        ▼
   /api/v1 REST API      In-browser SQLite          AI Analyst route
   (Next.js routes)      (sql.js / WASM)            (/api/v1/ask → Claude)
            │                     │                        │
            └──────────── React dashboards & reports ──────┘
  • Front end: Next.js 14 (App Router), React, TypeScript, Recharts
  • Warehouse: SQLite compiled to WebAssembly (sql.js), hydrated client-side — a real SQL engine with no database server to run or pay for
  • API: Next.js Route Handlers under /api/v1, versioned, documented, dogfooded by the dashboard
  • AI agent: a serverless route that calls the Anthropic API to translate questions into safe, read-only SQL

The dataset

A realistic 2025 power-grid operations warehouse generated by the ETL pipeline:

  • 15 facilities across Solar, Wind, Hydro, Nuclear, Gas, Geothermal
  • 6 regions mapped to real grid operators (WECC, ERCOT, MISO, PJM, ISO-NE)
  • 5,475 daily generation readings with seasonality, weather noise, and outages
  • 60 incidents with severity, category, and downtime

It's synthetic but physically plausible (industry-realistic capacity factors, seasonal solar/wind/hydro curves, gas-only CO₂). Deterministic seed → reproducible analytics.


Run locally

git clone <your-repo-url> gridlens
cd gridlens
npm install
npm run etl       # (optional) regenerate the dataset with Python
npm run dev       # http://localhost:3000

The app is fully functional immediately — dashboards, SQL Workbench, and the API Console all work with no keys.



API reference (/api/v1)

Method Endpoint Description
GET /health Service status, dataset metadata, endpoint catalog
GET /metrics?type=&region=&from=&to= Aggregate fleet KPIs
GET /facilities?type=&region= Facility roster + YTD generation
GET /generation?granularity=month|day&type= Time-series + source breakdown
POST /ask { question } AI Analyst: NL → generated SQL

Try them interactively in the API Console tab.


Project layout

gridlens/
├── etl/build_dataset.py        # Python ETL pipeline (Extract/Transform/Load)
├── public/data.json            # warehouse snapshot (ETL output, bundled)
├── src/
│   ├── app/
│   │   ├── page.tsx            # Operations dashboard
│   │   ├── workbench/          # SQL Workbench
│   │   ├── analyst/            # AI Analyst (NL → SQL agent)
│   │   ├── api-explorer/       # Interactive API Console
│   │   ├── pipeline/           # ETL lineage & data quality
│   │   └── api/v1/             # Versioned REST API
│   ├── components/             # Shell, UI primitives
│   └── lib/                    # dataset helpers + sql.js engine
└── README.md

Built by Neha Mahesh · Computer Science, Purdue University

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages