Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 119 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,125 @@
# 🌍 Sky Swachh

# Sky Swachh
## Sky Swachh Map Dashboard
<img width="1600" height="872" alt="image" src="https://github.com/user-attachments/assets/86d8ad61-ae98-45f8-a0aa-c5ad80c78539" />

This is a code for detection of illegal dump sites in Bengaluru and providing collection, reporting and allocating it for better use.

## Running the code
**Sky Swachh** is an intelligent, map-based platform designed to detect, monitor, and manage illegal waste dumping in Bengaluru. By leveraging AI-detected dump sites, citizen reports, and smart routing algorithms, it streamlines the waste collection process from detection to processing.

### Frontend
cd frontend
## ✨ Key Features

Run `npm i` to install the dependencies.
- **🗺️ Interactive Map Dashboard**: Built with React and Leaflet to visualize active dump sites, ward boundaries, dry waste collection centres (DWCC), and waste processing units (WPU).
- **🤖 AI Dump Detection Integration**: Displays AI-identified risk zones and illegal dump sites from spatial data models.
- **📸 Citizen Reporting**: Citizens can report illegal dumping with photos and locations, seamlessly integrating into the municipal dashboard.
- **🚚 Smart Logistics & Routing**: Uses the **OSRM (Open Source Routing Machine)** API to automatically calculate optimized routes for garbage trucks from a dump site to the nearest DWCC, and finally to a WPU.
- **📊 Real-time Monitoring**: Track active dump sites, cleaned zones, and active fleet operations through a responsive UI.

Run `npm run dev` to start the development server.

### Backend
cd backend

pip install -r requirements.txt

python app.py
## 📱 Sky Swachh Citizen App

<img src="space_app.jpeg" alt="Citizen App Space" width="170" align="left" style="margin-right: 20px;" />

**[Sky Swachh Citizen App Repository](https://github.com/aniksha23/Sky-Swachh---Citizen-App)**

CitizenApp gamifies civic engagement in Bengaluru by empowering residents to take action against illegal waste dumping. The app acts as the primary data collection tool for the Sky Swachh ecosystem, seamlessly feeding citizen reports directly into the main map dashboard.

**Core App Features:**
- **📍 Smart Location Tracking**: Snap photos of illegal dump sites with automatic GPS tagging and time-stamps for precise location mapping.
- **⚡ AI Verification**: Integrated AI-powered machine learning verifies waste presence in seconds before the report is logged.
- **🎮 Gamification System**: Verified reports earn 50 points, unlocking ranks and badges to encourage continuous community participation.
- **🏆 Leaderboards**: Compete on local leaderboards, become an Environmental Hero, and make cities cleaner together.
- **🚨 Instant Alerts**: Automatically notifies cleanup authorities and syncs with the main municipal dashboard for prompt action.

<br clear="both"/>

## 🛠️ Tech Stack

### Frontend
- **Framework**: React 18 with Vite
- **Styling**: Tailwind CSS v4, Radix UI Primitives, Lucide Icons, Framer Motion
- **Maps**: Leaflet, React-Leaflet
- **Forms & State**: React Hook Form, Embla Carousel

### Backend
- **Framework**: FastAPI (Python)
- **Database**: Firebase Firestore (with fallback JSON data)
- **Geospatial & Routing**: OSRM API, Photon Geocoding API

## 📂 Project Structure

```text
sky-swachh/
├── backend/
│ ├── data/ # GeoJSON and JSON fallback data (wards, WPUs, DWCCs)
│ ├── main.py # FastAPI application entry point
│ ├── seed_firestore.py # Script to populate Firestore DB
│ └── requirements.txt # Python dependencies
├── frontend/
│ ├── src/
│ │ ├── app/components/ # React components (MapDashboard, UI elements)
│ │ ├── services/ # API integration services
│ │ └── styles/ # Tailwind and global CSS
│ ├── package.json # Node dependencies
│ └── vite.config.ts # Vite configuration
└── waste_model.pth # PyTorch weights for AI dump detection
```

## 🚀 Getting Started

### Prerequisites
- [Node.js](https://nodejs.org/) (v18 or higher)
- [Python](https://www.python.org/) (3.9 or higher)
- (Optional) Firebase Service Account JSON for Firestore integration.

### 1. Backend Setup

Navigate to the backend directory and set up a Python virtual environment:

```bash
cd backend
python3 -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`

# Install dependencies
pip install -r requirements.txt

# Start the FastAPI server
python3 main.py
```
The backend will run on `http://127.0.0.1:8000`.

*(Optional)*: To use Firebase, place your `serviceAccount.json` inside the `backend/` folder. If not present, the backend gracefully falls back to local mock data.

### 2. Frontend Setup

Open a new terminal window, navigate to the frontend directory:

```bash
cd frontend

# Install dependencies
npm install

# Start the Vite development server
npm run dev
```
The frontend will run on `http://localhost:5173`. Open this URL in your browser to view the Map Dashboard.

## 📡 API Endpoints (Backend)

- `GET /api/dumpsites`: Retrieve all detected dump sites.
- `GET /api/citizen-reports`: Fetch user-submitted reports.
- `POST /api/reports`: Submit a new citizen report.
- `GET /api/logistics-route`: Calculates the optimal cleanup route (Dump Site -> DWCC -> WPU).
- `POST /api/optimize-route`: TSP optimization for multiple waypoints using OSRM.
- `GET /api/geocode` & `/api/reverse-geocode`: Location search capabilities.

## 🤝 Contributing

1. Fork the repository
2. Create a new feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

---
*Developed for a cleaner, greener Bengaluru.* 🌳
9 changes: 8 additions & 1 deletion backend/data/training_polygons.geojson
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
{ "type": "Feature", "properties": { "id": 5, "label": 1, "confidence": "high", "class_name": "dump_site" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 77.758859641423285, 12.94940964649679 ], [ 77.759207447253601, 12.94937550604719 ], [ 77.7593610792768, 12.948852730412678 ], [ 77.759245855259394, 12.948722569948576 ], [ 77.759004738334099, 12.948750309063875 ], [ 77.759023942336995, 12.949068242000783 ], [ 77.758848972532789, 12.949066108222683 ], [ 77.758859641423285, 12.94940964649679 ] ] ] ] } },
{ "type": "Feature", "properties": { "id": 6, "label": 0, "confidence": "high", "class_name": "vegetation" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 77.747611391486089, 12.97673719055428 ], [ 77.747800325028464, 12.97715799708047 ], [ 77.751115249908253, 12.977802088702191 ], [ 77.749698248340465, 12.978059725350878 ], [ 77.748744992740328, 12.978386065105884 ], [ 77.748221131554658, 12.977261051739946 ], [ 77.748641938080851, 12.976608372229936 ], [ 77.747611391486089, 12.97673719055428 ] ] ] ] } },
{ "type": "Feature", "properties": { "id": 7, "label": 0, "confidence": "high", "class_name": "vegetation" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 77.749739280202988, 12.977621311907056 ], [ 77.751099554714756, 12.977740335926836 ], [ 77.750810496381007, 12.976941174651175 ], [ 77.749739280202988, 12.977621311907056 ] ] ] ] } },
{ "type": "Feature", "properties": { "id": 8, "label": 0, "confidence": "high", "class_name": "water" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 77.713806804899662, 13.019452447550275 ], [ 77.714078673623106, 13.019416198387148 ], [ 77.712166530268192, 13.016126586833435 ], [ 77.711994346743353, 13.018111228514602 ], [ 77.711994346743353, 13.018111228514602 ], [ 77.713806804899662, 13.019452447550275 ] ] ] ] } }
{ "type": "Feature", "properties": { "id": 8, "label": 0, "confidence": "high", "class_name": "water" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 77.713806804899662, 13.019452447550275 ], [ 77.714078673623106, 13.019416198387148 ], [ 77.712166530268192, 13.016126586833435 ], [ 77.711994346743353, 13.018111228514602 ], [ 77.711994346743353, 13.018111228514602 ], [ 77.713806804899662, 13.019452447550275 ] ] ] ] } },
{ "type": "Feature", "properties": { "id": 11, "label": 1, "confidence": "high", "class_name": "dump_site", "area": "Whitefield" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 77.7469, 12.9631 ], [ 77.7487, 12.9626 ], [ 77.7511, 12.9629 ], [ 77.7530, 12.9642 ], [ 77.7533, 12.9662 ], [ 77.7519, 12.9676 ], [ 77.7496, 12.9682 ], [ 77.7478, 12.9674 ], [ 77.7470, 12.9658 ], [ 77.7469, 12.9631 ] ] ] ] } },
{ "type": "Feature", "properties": { "id": 12, "label": 1, "confidence": "high", "class_name": "dump_site", "area": "Hebbal" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 77.5897, 13.0421 ], [ 77.5917, 13.0417 ], [ 77.5942, 13.0422 ], [ 77.5958, 13.0434 ], [ 77.5961, 13.0455 ], [ 77.5949, 13.0473 ], [ 77.5929, 13.0481 ], [ 77.5907, 13.0474 ], [ 77.5895, 13.0458 ], [ 77.5897, 13.0421 ] ] ] ] } },
{ "type": "Feature", "properties": { "id": 13, "label": 1, "confidence": "high", "class_name": "dump_site", "area": "Bommanahalli" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 77.6187, 12.8871 ], [ 77.6207, 12.8866 ], [ 77.6232, 12.8869 ], [ 77.6250, 12.8881 ], [ 77.6254, 12.8901 ], [ 77.6241, 12.8919 ], [ 77.6219, 12.8927 ], [ 77.6197, 12.8921 ], [ 77.6186, 12.8906 ], [ 77.6187, 12.8871 ] ] ] ] } },
{ "type": "Feature", "properties": { "id": 14, "label": 1, "confidence": "high", "class_name": "dump_site", "area": "Rajajinagar" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 77.5491, 12.9899 ], [ 77.5510, 12.9894 ], [ 77.5535, 12.9896 ], [ 77.5553, 12.9909 ], [ 77.5558, 12.9926 ], [ 77.5546, 12.9943 ], [ 77.5523, 12.9950 ], [ 77.5502, 12.9942 ], [ 77.5491, 12.9929 ], [ 77.5491, 12.9899 ] ] ] ] } },
{ "type": "Feature", "properties": { "id": 15, "label": 1, "confidence": "high", "class_name": "dump_site", "area": "BTM Layout" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 77.6107, 12.9049 ], [ 77.6127, 12.9044 ], [ 77.6152, 12.9047 ], [ 77.6170, 12.9059 ], [ 77.6174, 12.9079 ], [ 77.6161, 12.9096 ], [ 77.6139, 12.9103 ], [ 77.6117, 12.9096 ], [ 77.6106, 12.9081 ], [ 77.6107, 12.9049 ] ] ] ] } },
{ "type": "Feature", "properties": { "id": 16, "label": 1, "confidence": "high", "class_name": "dump_site", "area": "Yeshwanthpur" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 77.5427, 13.0193 ], [ 77.5447, 13.0187 ], [ 77.5471, 13.0189 ], [ 77.5489, 13.0201 ], [ 77.5493, 13.0222 ], [ 77.5479, 13.0238 ], [ 77.5458, 13.0244 ], [ 77.5436, 13.0237 ], [ 77.5426, 13.0222 ], [ 77.5427, 13.0193 ] ] ] ] } },
{ "type": "Feature", "properties": { "id": 17, "label": 1, "confidence": "high", "class_name": "dump_site", "area": "Electronic City" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 77.6757, 12.8413 ], [ 77.6778, 12.8407 ], [ 77.6802, 12.8410 ], [ 77.6820, 12.8422 ], [ 77.6824, 12.8442 ], [ 77.6810, 12.8459 ], [ 77.6788, 12.8466 ], [ 77.6767, 12.8459 ], [ 77.6756, 12.8444 ], [ 77.6757, 12.8413 ] ] ] ] } }
]
}
82 changes: 82 additions & 0 deletions backend/data/ward_boundaries.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": { "name": "Byrasandra", "dumps": 18, "center": [12.915, 77.610] },
"geometry": {
"type": "Polygon",
"coordinates": [[
[77.602, 12.908], [77.615, 12.907], [77.620, 12.913],
[77.618, 12.922], [77.608, 12.924], [77.601, 12.918], [77.602, 12.908]
]]
}
},
{
"type": "Feature",
"properties": { "name": "HSR Layout", "dumps": 24, "center": [12.911, 77.648] },
"geometry": {
"type": "Polygon",
"coordinates": [[
[77.636, 12.897], [77.652, 12.895], [77.661, 12.902],
[77.659, 12.925], [77.645, 12.927], [77.634, 12.920], [77.636, 12.897]
]]
}
},
{
"type": "Feature",
"properties": { "name": "Indiranagara", "dumps": 31, "center": [12.979, 77.641] },
"geometry": {
"type": "Polygon",
"coordinates": [[
[77.628, 12.970], [77.645, 12.968], [77.655, 12.974],
[77.653, 12.989], [77.640, 12.991], [77.627, 12.984], [77.628, 12.970]
]]
}
},
{
"type": "Feature",
"properties": { "name": "JP Nagara", "dumps": 15, "center": [12.898, 77.591] },
"geometry": {
"type": "Polygon",
"coordinates": [[
[77.578, 12.884], [77.595, 12.882], [77.604, 12.888],
[77.602, 12.911], [77.588, 12.914], [77.577, 12.907], [77.578, 12.884]
]]
}
},
{
"type": "Feature",
"properties": { "name": "Sarakki", "dumps": 12, "center": [12.918, 77.564] },
"geometry": {
"type": "Polygon",
"coordinates": [[
[77.554, 12.907], [77.569, 12.905], [77.577, 12.912],
[77.575, 12.930], [77.561, 12.932], [77.553, 12.924], [77.554, 12.907]
]]
}
},
{
"type": "Feature",
"properties": { "name": "Thanisandra", "dumps": 28, "center": [13.058, 77.611] },
"geometry": {
"type": "Polygon",
"coordinates": [[
[77.597, 13.045], [77.616, 13.043], [77.627, 13.050],
[77.624, 13.072], [77.607, 13.074], [77.595, 13.066], [77.597, 13.045]
]]
}
},
{
"type": "Feature",
"properties": { "name": "Whitefield", "dumps": 42, "center": [12.970, 77.750] },
"geometry": {
"type": "Polygon",
"coordinates": [[
[77.729, 12.952], [77.758, 12.950], [77.772, 12.957],
[77.769, 12.986], [77.748, 12.989], [77.728, 12.982], [77.729, 12.952]
]]
}
}
]
}
Loading