CrashInsight is an advanced web application that leverages artificial intelligence and machine learning to analyze traffic accident data, providing actionable insights for improving road safety.
- Python 3.11+
- Node.js 18+
- npm or yarn
# Navigate to backend directory
cd backend
# Create virtual environment
python -m venv venv
# Activate virtual environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
# Install Python dependencies
pip install -r requirements.txt
# Run the Flask server
python app.pyBackend will be available at: http://localhost:5000
# Navigate to project root
cd ..
# Install Node.js dependencies
npm install
# Start the development server
npm run dev:viteFrontend will be available at: http://localhost:5173
- Start backend:
cd backend && python app.py - Start frontend:
npm run dev:vite - Open http://localhost:5173 in your browser
- Real-time Statistics: Live accident counts, fatality rates, and injury metrics
- Interactive Charts: Hourly trends, daily patterns, and severity distributions
- Dark/Light Mode: Fully responsive design with theme switching
- Predictive Modeling: Random Forest classifier for crash severity prediction
- Feature Importance: Identify key factors contributing to accidents
- Model Performance: Real-time accuracy metrics and validation
- Clustering Analysis: AI-powered accident pattern recognition
- Risk Assessment: Visual risk categorization (High/Medium/Low)
- Time-based Patterns: Rush hour, weekend, and seasonal trends
- Accident Causation: Discover relationships between conditions and outcomes
- Filtered Insights: Focus on accident-relevant patterns only
- Plain English: Human-readable rule interpretations
- React 18 + TypeScript
- Tailwind CSS for styling
- Framer Motion for animations
- Chart.js for data visualizations
- Vite for fast development
- Python Flask REST API
- Pandas & NumPy for data processing
- Scikit-learn for machine learning
- MLxtend for association rule mining
- Chicago Traffic Accidents Dataset (209K+ records)
- Real-time API integration
- Comprehensive accident attributes
- Node.js 18+ and npm
- Python 3.8+ with pip
- Git for version control
git clone https://github.com/Chirag8405/CrashInsight.git
cd CrashInsight# Install dependencies
npm install
# Start development server
npm run dev# Navigate to backend
cd backend
# Install dependencies
pip install -r requirements.txt
# Start Flask server
python app.py- Frontend: http://localhost:5174
- Backend API: http://localhost:5000/api
This application is designed for deployment with:
- Backend: Render.com (Python Flask with dataset)
- Frontend: Netlify (React build)
See RENDER_NETLIFY_DEPLOYMENT.md for detailed deployment instructions.
CrashInsight/
βββ src/ # React frontend
β βββ components/ # React components
β βββ assets/ # Static assets
β βββ styles/ # CSS files
βββ backend/ # Python Flask API
β βββ app.py # Main Flask application
β βββ traffic_accidents.csv # Dataset
βββ public/ # Public assets
βββ README.md # Project documentation
| Endpoint | Method | Description |
|---|---|---|
/api/health |
GET | Health check |
/api/basic-stats |
GET | Basic accident statistics |
/api/time-analysis |
GET | Time-based patterns |
/api/location-analysis |
GET | Location-based insights |
/api/severity-analysis |
GET | Severity distribution |
/api/clustering |
GET | Clustering analysis |
/api/ml-model |
GET | ML model training & results |
/api/association-rules |
GET | Association rule mining |
- High-Risk Pattern: Evening rush hours on Fridays (avg 2.3+ injuries)
- Safest Pattern: Morning weekday accidents (avg 0.8 injuries)
- Peak Danger Time: 17:00-19:00 (6-7 PM)
- Stop Sign + High Injury β Side-Impact Collision (67% confidence)
- Nighttime + Rear-End β Multi-Vehicle Accident (79% confidence)
- Clear Weather + Stop Sign β Angle Collision (66% confidence)
Based on our analysis:
- Enhanced Traffic Control at stop sign intersections during peak hours
- Improved Lighting for nighttime accident prevention
- Speed Reduction Measures in high-injury pattern areas
- Driver Education about angle collision risks at intersections
- Fork the repository
- Create feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Open Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Chirag - @Chirag8405
Project Link: https://github.com/Chirag8405/CrashInsight
- Chicago Data Portal for accident dataset
- React + Chart.js communities
- Scikit-learn documentation
- MLxtend library for association rules
β Star this repository if you found it helpful! β