Open Data Nottingham has released traffic accident data covering incidents in Nottinghamshire for the last four years. For reported accidents, persons are listed (anonymously) if they suffer slight, severe or fatal injuries. Drivers are identified, along with age/gender, but only if they are injured. The quality and format of the data is good.
Nottingham City’s website already has a map representation of the data, but it doesn’t allow filtering and there is no colour coding or categorisation, making it difficult to spot patterns.
To provide a better visualisation, I reorganized the data using a custom Java app and categorised individual accidents by severity, time of accident and age group of persons injured in accidents. The most serious injury sustained by any person involved in an accident determines the overall severity of the accident; times of day have been split into bands, so have driver ages.
I then designed and built a web app using various open source APIs including Open Street Maps, LeafletJS, Bootstrap. Accidents are stored in a Mongo database and there is a Ruby/Sinatra server layer to handle REST AJAX requests. The interface allows users to explore traffic incidents by severity, pedestrian injuries, time of day and vehicle numbers. Historical weather data feeds from Wunderground allow accident details to be combined with the weather at the time/date/location where the accident occurred; so far, this functionality is quite limited since the free use of the API restricts the number of calls, so the weather checks are on demand when clicking individual accidents. However, I plan to fetch weather data for all accidents in bulk and store in the DB to allow filtering by weather conditions. Graphs will soon show show age and gender of people involved in accidents by year. A number of patterns emerge: accident danger spots, clusters of pedestrian injuries, City areas with higher numbers of accidents during the night. The ability to switch years also allows users to see where improvements have been made, or conditions/accidents have worsened. Click here to explore the app.
There are certain attributes missing from the data that would be extremely useful for visualization/analysis purposes and perhaps these things can be added in future:-
- Types of vehicle(s) involved
- More information about the cause of accidents (e.g. alcohol, driving while using smartphone, sleeping at the wheel etc.)
- All drivers included who are involved in accidents, regardless of whether they suffered injuries. For example, at the moment there are many pedestrians involved in accidents where no drivers or passengers are listed because they didn’t suffer injuries.
I’d like to keep working on this project to explore patterns and introduce more sophisticated analysis and mapping techniques to the data. It would be great to reuse and build on the app using traffic data sets from other cities. In the US, it appears that there are very few available; opening up crash data and analysing it would help to improve safety on the roads and raise awareness of problems. I welcome feedback and ideas in the comments at the webpage.
(James is a Nottingham-born expat living and working in Philadelphia since 2009)
- Visualization:- https://github.com/jamestyack/openDataWebapps
- Accident data set processing code:- https://github.com/jamestyack/openDataWebapps