Urban carbon emission hotspot mapping and preventive action recommendation system for Bhubaneswar.
CarbonLens is a full-stack web application that identifies, visualizes, and analyzes carbon emission hotspots in urban areas. The platform helps city planners, environmental agencies, and citizens understand emission patterns and take preventive measures.
- Frontend: Next.js 14 (App Router) + TypeScript + Tailwind CSS
- Backend: Next.js API Routes (Node.js)
- Database: MongoDB Atlas (via Mongoose)
- Mapping: Leaflet / react-leaflet
- Data Processing: Python (mock logic, ready for real models)
carbonlens/
├── frontend/ # Next.js frontend application
│ ├── app/ # App Router pages
│ ├── components/ # React components
│ └── lib/ # API helpers
├── backend/ # Backend API and models
│ ├── models/ # Mongoose schemas
│ ├── lib/ # MongoDB connection
│ └── app/api/ # API routes
├── data/ # Mock data files
├── python/ # Python data processing scripts
└── package.json # Dependencies
- 🗺️ Interactive Map View: Visualize emission hotspots on an interactive map with color-coded risk levels
- 📊 Data Analysis: View aggregate statistics, risk distributions, and source type breakdowns
- 🔍 Hotspot Filtering: Filter hotspots by risk level and explore detailed information
- 🛡️ Preventive Measures: Access recommended preventive measures for each hotspot
- Node.js 18+ and npm
- MongoDB Atlas account (or local MongoDB)
- Python 3.8+ (for data generation scripts)
-
Clone the repository
git clone <repository-url> cd CarbonLens
-
Install dependencies
npm install
-
Set up environment variables
cp .env.example .env
Edit
.envand add your MongoDB Atlas connection string:MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/carbonlens?retryWrites=true&w=majority -
Generate mock data (optional, if you want to regenerate)
cd python python generate_mock_data.py cd ..
-
Seed the database
npm run seed
-
Start the development server
npm run dev
-
Open your browser Navigate to
http://localhost:3000
- Project overview and introduction
- Key statistics dashboard
- Quick navigation to map and hotspots
- Interactive Leaflet map centered on Bhubaneswar
- Color-coded markers (Red: High, Amber: Medium, Green: Low)
- Click markers to view hotspot details
- Risk level legend
- List view of all emission hotspots
- Filter by risk level (All, High, Medium, Low)
- View detailed information and preventive measures
GET /api/hotspots- Get all hotspots (supports?risk_level=and?source_type=filters)GET /api/hotspots/:id- Get single hotspot by zone_idGET /api/stats- Get aggregate statistics
- Export your real sensor data as CSV
- Modify
backend/scripts/seed.jsto read CSV files:const csv = require('csv-parser'); const fs = require('fs'); // Parse CSV and convert to hotspot documents
- Run
npm run seedto import real data
- Train your ML model for risk classification
- Update
python/process_emissions.py:# Replace mock thresholds with: risk_level = model.predict([[pm25, co2]])
- Integrate with your data pipeline
- Set up a data ingestion pipeline
- Create scheduled jobs to update MongoDB
- Replace
data/mock_hotspots.jsonwith real-time data sources
- MongoDB Atlas: Cloud-hosted, scalable, flexible schema for emission data
- Next.js: Full-stack framework with built-in API routes, server-side rendering, and excellent developer experience
- Modular Architecture: Easy to swap mock data/logic with real implementations
npm run dev- Start development servernpm run build- Build for productionnpm run start- Start production servernpm run seed- Seed database with mock datanpm run lint- Run ESLint
- Modular Design: All logic is separated into modules for easy replacement
- Type Safety: Full TypeScript support throughout
- Comments: Extensive comments explaining where real data would replace mocks
- Real-time sensor data integration
- Machine learning model integration
- Historical trend analysis
- User authentication and personalized dashboards
- Mobile app support
- Advanced filtering and search
- Export functionality (PDF, CSV)
- Alert system for high-risk zones
This is a capstone project. For production use, ensure:
- Data validation and sanitization
- Error handling and logging
- Security best practices
- Performance optimization
- Accessibility compliance
MIT License - see LICENSE file for details
This application uses MOCK DATA for demonstration purposes. All emission values, risk classifications, and preventive measures are simulated and should not be used for real-world decision-making without proper validation and real data integration.