EcoPulse AI is a next-generation environmental health awareness platform. It combines high-performance streaming analytics with Generative AI to provide "living" city intelligenceโinterpreting complex sensor data into actionable human safety protocols.
- Project Overview
- System Architecture
- Key Features
- Folder Structure Explanation
- Modular Design Principles
- Tech Stack
- Getting Started
- Example Usage
- Future Improvements
- Development & Quality
- License
Traditional environmental monitoring systems provide static, historical data. EcoPulse AI bridges the gap by treating environmental data as a continuous stream. It doesn't just tell you the AQI was bad 2 hours ago; it uses Pathway to detect momentum peaks as they happen and OpenAI GPT-4o to issue immediate, intelligent safety mandates.
The system is designed for city administrators, health officials, and citizens who need real-time, scientifically-backed environmental guidance.
Our architecture is designed for low-latency event processing and scientific reasoning.
graph TD
subgraph "Data Generation Layer"
P[Kafka Producer Simulator] -->|JSON Telemetry| K[Apache Kafka]
end
subgraph "Processing Layer (Pathway)"
K -->|Poll Stream| PW[Pathway CEP Engine]
PW -->|Feature Extraction| AN[Analytics Module]
AN -->|Volatility/Momentum| DB[(Live State)]
end
subgraph "Intelligence Layer"
DB -->|Context| COP[Climate Copilot RAG]
COP -->|Reasoning| API[Flask Web Service]
end
subgraph "Consumer Layer"
API -->|Dashboards| UI1[City Admin View]
API -->|PDF Reports| UI2[Gov Reporting]
end
- โก Real-Time Stream Processing: Sub-second analysis of AQI, PM2.5, CO2, and Meteorological factors using Pathway.
- ๐ง Climate Copilot (RAG Integration): A context-aware AI safety officer that interprets live data to provide human-readable advice.
- ๐ Root Cause Attribution: Scientifically calculates the percentage impact of Traffic vs. Industry on current pollution levels.
- ๐ฆ Gov-Grade Reporting: Export professional "Mayor Briefings" or "Full Environmental Audits" in PDF format instantly.
- ๐ก๏ธ Adaptive Alerts: Dynamic thresholds that adjust based on peak hours and historical volatility.
- ๐ฎ Urban Simulations: "What-if" scenarios to predict AQI based on hypothetical traffic reductions or industrial restrictions.
The repository follows an enterprise-grade modular structure:
ecopulse_ai/: Root package.api/: The Presentation Layer. Contains Flask routes, user models, and the orchestration factory (app.py).analytics/: The Core logic. Standalone scientific modules for calculating health scores, alerts, and time-series predictions.kafka/: Infrastructure. Contains the producer script that simulates a multi-sensor city-wide mesh.streaming/: The Data Backbone. Contains the Pathway pipeline logic and the "Windows Shim" for local development compatibility.rag/: AI Intelligence. Prompt definitions and LLM orchestration for the Climate Copilot.reports/: Documentation Layer. Logic for PDF generation and muni-report styling.templates/&static/: Frontend assets for the Flask web application.tests/: Quality Assurance. Organized intounitandintegrationsuites.
EcoPulse AI adheres to strict Senior Engineering standards:
- Separation of Concerns: Analytics logic is decoupled from transport layers (Kafka/Pathway).
- Stateless API: The Web layer acts as a pure proxy to the streaming state, ensuring horizontal scalability.
- Defensive Programming: All telemetry inputs are validated and cast safely before computation.
- Logging > Printing: Industry-standard
loggingis used across all modules for a professional audit trail.
| Layer | Tools |
|---|---|
| Streaming Engine | Pathway (Complex Event Processing) |
| Data Broker | Apache Kafka (High-throughput Messaging) |
| Logic Server | Flask 3.x, Python 3.10+ |
| AI Reasoning | OpenAI GPT-4o, Custom RAG Orchestration |
| Frontend | Vanilla CSS (Glassmorphism), Chart.js 4.0, Leaflet.js |
| Reporting | fpdf2 (High-precision document generation) |
- Python 3.10+
- A running Kafka broker (Local or Cloud-based)
- OpenAI API Key (for Copilot and Planner features)
# Clone the repository
git clone https://github.com/DhanushN2005/EcoPluse-AI.git
cd EcoPluse-AI
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtCreate a .env file in the root directory:
OPENAI_API_KEY=sk-xxxx...
KAFKA_BOOTSTRAP_SERVERS=localhost:9092
DEBUG=TrueLaunch the unified orchestrator to start all micro-services simultaneously:
python main.py- Monitor: Observe the live AQI gauges on the dashboard.
- Simulate: Use the "What-if" slider to see how a 50% reduction in traffic would affect city-wide health scores.
- Query: Ask the Copilot: "Should schools in the Industrial North district stay open today?"
- Report: Push the "Generate Audit" button to export a signed PDF briefing for legislative review.
- ๐ก IoT Edge Support: Direct MQTT ingestion for real-world sensor integration.
- ๐ฑ Mobile Companion: React Native App for citizen-level push notifications.
- ๐ฆ๏ธ Weather Integration: Correlation models between humidity/pressure and pollutant entrapment.
- ๐๏ธ Blockchain Archiving: Immutable storage of environmental incident logs for policy accountability.
We maintain a strict Elite Quality Standard:
- Linting: Strict PEP8 adherence via Flake8.
- Format: Automated Black formatting.
- Type Safety: 100% coverage with Python Type Hints.
- Testing: Run
pytest tests/to ensure numerical accuracy of analytics.
Distributed under the MIT License. See LICENSE for details.
Built with โค๏ธ by Dhanush N
Empowering Cities with Real-Time Environmental Vision.
This repository has undergone a Final Quality Review and Senior Engineering Refactor (Feb 2026).