AI-powered pothole detection web application with GPS geotagging, user feedback, interactive maps, and analytics dashboard.
- ✅ Real-time Pothole Detection: Automatically identifies potholes using YOLO AI models
- ✅ GPS-based Geotagging: Associates detected potholes with accurate location data
- ✅ Interactive Map Visualization: Displays potholes on a map with filtering options
- ✅ Public Reporting: Manual report submission with photos and location
- ✅ Severity Assessment: Automatic size and severity classification
- ✅ Status Tracking: Track repair status (reported, in progress, repaired)
- ✅ User Feedback System: Verify/dispute, upvote/downvote, comments, and photo updates
- ✅ Automated Alerts: Notifications for high-priority potholes
- ✅ Data Export & Analytics: CSV export and comprehensive analytics dashboard
- ✅ User Account Management: Role-based access (citizen, admin, contractor)
- ✅ Mobile & Web Compatible: Responsive design for all devices
pothole-detection-app/
├── backend/
│ ├── api/
│ │ ├── auth.py # Authentication endpoints
│ │ ├── detection.py # YOLO inference endpoints
│ │ ├── report.py # Report CRUD endpoints
│ │ ├── feedback.py # Feedback endpoints
│ │ └── analytics.py # Analytics endpoints
│ ├── db/
│ │ ├── models.py # SQLAlchemy models
│ │ └── database.py # Database configuration
│ ├── utils/
│ │ ├── auth.py # Authentication utilities
│ │ ├── geolocation.py # GPS utilities
│ │ └── notifications.py # Alert utilities
│ └── main.py # FastAPI application
│
├── frontend/
│ ├── src/
│ │ ├── components/
│ │ │ ├── DetectionUpload.jsx # Image upload & detection
│ │ │ ├── MapDashboard.jsx # Interactive map
│ │ │ └── FeedbackPanel.jsx # User feedback UI
│ │ ├── pages/
│ │ │ ├── Home.jsx # Landing page
│ │ │ ├── Login.jsx # Authentication
│ │ │ ├── UserDashboard.jsx # Citizen dashboard
│ │ │ └── AdminDashboard.jsx # Admin analytics
│ │ ├── utils/
│ │ │ ├── api.js # API client
│ │ │ ├── AuthContext.jsx # Auth state management
│ │ │ └── geolocation.js # GPS helpers
│ │ └── App.jsx # Main React app
│ ├── package.json
│ └── vite.config.js
│
├── database/
│ └── pothole.db # SQLite database (auto-created)
│
├── app.py # Original detection app (legacy)
├── best.pt # YOLO model weights
├── requirements.txt # Python dependencies
└── README.md
-
Install Python dependencies:
pip install -r requirements.txt
-
Initialize database: The database will be automatically created on first run. To manually initialize:
from backend.db.database import init_db init_db()
-
Run backend server:
cd backend python main.pyOr using uvicorn directly:
uvicorn backend.main:app --reload --port 8000
Backend will be available at
http://localhost:8000API documentation athttp://localhost:8000/docs
-
Install Node.js dependencies:
cd frontend npm install -
Run development server:
npm run dev
Frontend will be available at
http://localhost:3000 -
Build for production:
npm run build
- Register/Login: Create an account or login
- Upload Image: Upload a road image for AI detection
- Add Location: Provide GPS coordinates or use browser location
- Submit Report: Create a pothole report
- View Map: See all reported potholes on interactive map
- Provide Feedback: Verify/dispute reports, add comments, upvote/downvote
- Login: Use admin credentials
- View Analytics: Access comprehensive dashboard with statistics
- Update Status: Change pothole repair status
- Export Data: Download reports as CSV
- Monitor Trends: View charts and reports trend analysis
POST /api/auth/register- Register new userPOST /api/auth/login- Login and get tokenGET /api/auth/me- Get current user info
POST /api/detection/detect- Detect potholes in image (requires auth)
GET /api/reports- Get all reports (with filters)GET /api/reports/{id}- Get specific reportPUT /api/reports/{id}/status- Update report status (admin/contractor)DELETE /api/reports/{id}- Delete report (admin/contractor)
POST /api/feedback/{report_id}- Submit feedbackPOST /api/feedback/{report_id}/photo- Upload updated photoGET /api/feedback/{report_id}- Get all feedback for reportDELETE /api/feedback/{feedback_id}- Delete own feedback
GET /api/analytics- Get analytics dataGET /api/analytics/export/csv- Export reports as CSV
- id, username, email, hashed_password, full_name, role, is_active, created_at
- id, reporter_id, image_path, output_image_path, detections_count, latitude, longitude, address, description, severity, status, detection_data, statistics, material_estimate, verification_count, dispute_count, upvote_count, downvote_count, created_at, updated_at
- id, report_id, user_id, feedback_type, comment, upvote, downvote, updated_photo_path, created_at
- id, report_id, updated_by_id, old_status, new_status, notes, created_at
- FastAPI: Modern Python web framework
- SQLAlchemy: ORM for database operations
- SQLite: Database (can be migrated to PostgreSQL)
- YOLO (Ultralytics): AI model for pothole detection
- JWT: Authentication tokens
- bcrypt: Password hashing
- React 18: UI framework
- Material-UI (MUI): Component library
- React Router: Routing
- Leaflet: Interactive maps
- Recharts: Data visualization
- Axios: HTTP client
- Vite: Build tool
Create a .env file for production:
SECRET_KEY=your-secret-key-here
DATABASE_URL=sqlite:///./database/pothole.db
MODEL_PATH=./best.pt- Change
SECRET_KEYinbackend/utils/auth.pyfor production - Use environment variables for sensitive data
- Implement rate limiting for production
- Use HTTPS in production
- Consider migrating to PostgreSQL for production
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
MIT License
For issues or questions, please open an issue on GitHub.