GridSense is a specialized analytics engine designed to detect and classify non-technical losses (NTL) in electricity distribution networks. By shifting focus from individual meters to the feeder-meter gap, GridSense identifies theft and anomalies that traditional systems miss.
Web app: https://praisser.github.io/GridSense/
Note: First load may take ~30 seconds while the backend wakes from sleep (free hosting tier). Subsequent interactions are instant. If the backend is slow, hit the page once, wait, then refresh.
India loses over ₹26,000 crore annually to electricity theft and non-technical losses. Traditional Advanced Metering Infrastructure (AMI) often fails to detect sophisticated theft because a tampered meter simply looks like a low-consumption customer. Most anomalies go undetected for months until manual field audits are conducted.
Theft doesn't make energy disappear; it just makes it invisible to the billing meter. GridSense monitors the real-time gap between the energy supplied by a feeder and the energy recorded by all downstream meters. When consumption drops but the gap increases, GridSense fingerprints the signature of theft.
graph TD
A[Smart Meters] -->|Consumption Data| B(Gap Detector)
F[Feeder Meter] -->|Supply Data| B
B -->|Anomaly Signals| C{AI Classifier}
C -->|Bypass| D[Ranked Alerts]
C -->|Tampering| D
C -->|Faulty| D
D --> E[Field Inspection App]
- Gap Detection Engine: Real-time comparison between feeder input and aggregated meter readings.
- Loss Fingerprinting: Heuristic and ML models classify anomalies into
Bypass,Tampering, orFaulty. - Neighborhood Correlation: Detects coordinated tampering events across nearby meters.
- Risk Ranking: Prioritizes alerts based on total energy lost and detection confidence.
The live walkthrough path is documented in docs/demo_script.md. Start the backend and frontend, open the dashboard, then use the amber Simulate control to inject theft on M03; the alert feed and map update without a manual refresh.
Demo video link: to be added after recording.
| Layer | Tech |
|---|---|
| Frontend | React, Vite, Tailwind CSS, Recharts, Leaflet |
| Backend | Python, FastAPI, Scikit-learn, Pandas |
| Data | Synthetic Meter Data Generator (15-min intervals) |
| DevOps | GitHub Actions (CI), Pytest |
cd backend
python -m venv venv
source venv/bin/activate # or venv\Scripts\activate on Windows
pip install -r requirements.txt
export DATABASE_URL="postgresql://gridsense:gridsense@localhost:55432/gridsense"
python -m uvicorn app.main:app --reload --port 8000Note: The
DATABASE_URLexport is required at runtime. Copybackend/.env.exampletobackend/.envto persist it. The app works from the bundled CSV data without Docker; Docker only enables TimescaleDB features.
Open a new terminal window (the backend server must stay running in the first one). Navigate back to the repo root, then:
cd frontend
npm install
npm run devOpen http://localhost:5173 in your browser.
Run all commands from the repo root.
# Backend tests
pytest backend/tests
# Frontend tests + build verification
cd frontend && npm test && npm run build && cd ..GridSense/
├── backend/ # FastAPI Application
│ ├── app/ # Core Logic
│ │ ├── detection/ # ML Models & Heuristics
│ │ └── main.py # API Endpoints
│ └── tests/ # Pytest Suite
├── frontend/ # React Dashboard
│ ├── src/ # Components & Hooks
│ └── tailwind.config # Visual Styling
├── data/ # Simulation Data & Generator
└── docs/ # Architecture & Screenshots
GridSense uses an Isolation Forest ensemble to score meter-level deviations against a 3-day baseline. These scores are then correlated with the Feeder Gap Ratio. A high anomaly score concurrent with a widening gap triggers a bypass_theft alert. Coordinated drops across a geographic cluster trigger meter_tampering alerts.
- Real-time Stream: Integration with Kafka for sub-second processing.
- Geospatial Intelligence: PostGIS for advanced neighborhood loss heatmaps.
- Predictive Maintenance: Forecasting transformer failure due to overload from theft.
- GridSense Prototype Team — product, detection logic, backend API, and React dashboard.
See CONTRIBUTING.md for local setup, test commands, and contribution guidelines.
MIT

