An interactive intelligence dashboard and automated reporting tool built to analyze road safety data across West Yorkshire. This project transforms raw government datasets into actionable insights using a modern Python stack.
This project is divided into two main components to balance real-time interaction with deep-dive analysis:
The "Frontend" of the project. It provides a real-time interface for users to explore the data.
- Dynamic Geospatial Mapping: Visualizes accident hotspots across Leeds, Bradford, Wakefield, Kirklees, and Calderdale.
- Instant Filtering: Filter by Severity (Fatal, Serious, Slight), Year, Weather, and Road Type.
- Key Metrics: High-level KPIs that update instantly based on user selection.
The "Analytical Backend." This script handles the heavy lifting of data visualization and document generation.
- 16 Custom Charts: Generates a comprehensive suite of visualizations (Trend lines, Hourly heatmaps, Vehicle type distributions).
- Automated PDF Generation: Compiles all 16 charts into a professional forensic report (
West_Yorkshire_Report.pdf) for offline review.
app.py: Entry point for the Streamlit web application.main.py: Logic for chart generation and PDF reporting.src/: Modularized helper scripts (load_data.py,filters.py,map_utils.py).data/: Regionalized West Yorkshire datasets (Accidents, Vehicles, Casualties).output_charts/: Destination folder for generated PDF forensic analyses.
- Python 3.10 (Development Environment)
- Streamlit: For the web interface.
- Pandas: For high-performance data manipulation.
- Folium/Leaflet: For interactive geospatial mapping.
- Matplotlib/Seaborn: For forensic chart generation.
- FPDF/ReportLab: For automated PDF document creation.
- reverse-geocoder: For high-speed, offline reverse geocoding of incident coordinates into human-readable locations.
To run this project locally:
- Clone the repo:
git clone https://github.com/reory/west_yorkshire_traffic_analysis.git - Install dependencies:
pip install -r requirements.txt - Launch the app:
streamlit run app.py
- Data Source: UK Department for Transport (DfT) Open Data.
- Community: Thanks to the Streamlit and Python communities for the robust library support.
- Testing: Special thanks to my family for "Quality Assurance" and bug reporting! 🍻
This project is licensed under the MIT License - see the LICENSE file for details.
Built By Roy Peters Click here for contact details


















