Skip to content

MathiasPechinger/UnfallAtlasBicycleAccidentAnalyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚴‍♂️ UnfallAtlasBicycleAccidentAnalyzer

A comprehensive analysis tool for bicycle accidents in Germany using official Unfallatlas data (2016-2024). Features interactive web interface, temporal trend analysis, and geographic visualization.

✨ Features

🗺️ Multiple Interfaces

  • Streamlit Web App: Modern, interactive web interface (recommended)
  • GUI Application: Traditional desktop interface with Tkinter
  • Command Line: Scriptable interface for automation

📊 Comprehensive Analysis

  • Load and process traffic accident data from German Unfallatlas (2016-2024)
  • Advanced filtering by accident type, severity, time, and lighting conditions
  • Interactive maps with color-coded severity indicators
  • Temporal trend analysis showing changes over 9 years
  • Seasonal and day-of-week pattern analysis
  • Statistical dashboards with exportable data

🎯 Smart Filtering

  • Geographic: Select analysis areas with GPS coordinates and dimensions
  • Temporal: Filter by year range, hour of day, month, day of week
  • Severity: Filter by accident outcomes (fatal, serious injury, light injury)
  • Accident Type: Filter by collision types (pedestrian, oncoming traffic, etc.)
  • Environmental: Filter by lighting conditions (daylight, twilight, darkness)

🚀 Quick Start

Prerequisites

  • Python 3.8+
  • Internet connection (for map tiles)

Installation

  1. Clone the repository
git clone https://github.com/yourusername/UnfallAtlasBicycleAccidentAnalyzer.git
cd UnfallAtlasBicycleAccidentAnalyzer
  1. Install dependencies
pip install -r requirements.txt
  1. Download data (place in data/ folder)

Usage

🌐 Streamlit Web App (Recommended)

streamlit run streamlit_app.py
  • Open browser to http://localhost:8501
  • Select location and filters in sidebar
  • Explore interactive maps and trend analysis

🖥️ Desktop GUI

python accident_analyzer.py
  1. Click "Load Accident Data"
  2. Enter coordinates and area dimensions
  3. Click "Analyze and Plot"

⌨️ Command Line

python accident_analyzer.py --cli

Follow prompts for coordinates and area dimensions.

📊 Analysis Capabilities

🗺️ Interactive Mapping

  • Color-coded markers by accident severity (🔴 fatal, 🟠 serious, 🟡 light)
  • Hover details with accident information
  • Multiple map styles (OpenStreetMap, Satellite imagery)
  • Real-time filtering with instant map updates

📈 Trend Analysis

  • 9-year temporal trends (2016-2024)
  • Seasonal patterns and monthly distributions
  • Day-of-week analysis for targeted safety campaigns
  • Before/after comparisons for policy impact assessment

📋 Data Export

  • CSV export of filtered datasets
  • Interactive charts with Plotly
  • Statistical summaries for reports

📁 Data Requirements

Place these files in the data/ folder:

data/
├── Unfallorte2016_EPSG25832_CSV.zip
├── Unfallorte2017_EPSG25832_CSV.zip
├── Unfallorte2018_EPSG25832_CSV.zip
├── Unfallorte2019_EPSG25832_CSV.zip
├── Unfallorte2020_EPSG25832_CSV.zip
├── Unfallorte2021_EPSG25832_CSV.zip
├── Unfallorte2022_EPSG25832_CSV.zip
├── Unfallorte2023_EPSG25832_CSV.zip
└── Unfallorte2024_EPSG25832_CSV.zip

Data Source: German Unfallatlas

Note: The tool handles format inconsistencies between years automatically (2016-2019 use .txt files in csv/ folders, 2020-2024 use direct .csv files).

🏙️ Example Locations

Pre-configured coordinates for major German cities:

  • Munich: 48.1351, 11.5820
  • Augsburg: 48.3661, 10.8985
  • Berlin: 52.5200, 13.4050
  • Hamburg: 53.5511, 9.9937

⚙️ Technical Details

Architecture

  • Core: AccidentAnalyzer class for data processing
  • Frontend: Streamlit web app with Plotly visualizations
  • Legacy: Tkinter GUI and CLI interfaces

Data Processing

  • Coordinate Systems: WGS84 ↔ UTM Zone 32N (EPSG:25832)
  • Format Handling: Automatic detection of CSV/TXT formats
  • Performance: Optimized for datasets with 300K+ records

Dependencies

  • Core: pandas, numpy, pyproj, plotly
  • Mapping: geopandas, contextily (legacy), streamlit-folium (web)
  • UI: streamlit, tkinter (built-in)

🚀 Performance Notes

  • Large datasets: 300K+ bicycle accidents across 9 years
  • Memory usage: ~500MB RAM for full dataset
  • Rendering: Interactive maps handle 10K+ points efficiently
  • Network: Internet required for map tiles

🤝 Contributing

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

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

📧 Support

For questions or issues:

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages