Traffic accident heatmap reflecting accidents reported by the Missouri State Highway Patrol.
https://DangerCrossing.com
UPDATE (12 Sep 2023): The MSHP has placed their accident information database behind a captcha, making it unfeasible for Danger Crossing to continue accessing new data. As a result, the project will no longer be updated with fresh accident information post-12 Sep 2023. However, the website will remain operational, featuring historical data collected up until this date.
Table of Contents
The Missouri State Highway Patrol (MSHP) publishes their accidents reports online. Most of these reports contain the longitude and latitude coordinates of the accident. This project gathers accident information from the MSHP's website and displays it on an interactive heatmap which can be viewed in the user's browser.
The project is comprised of several Docker containers which serve distinct purposes. Docker Compose is used to coordinate these containers into a single application.
The project is comprised of five separate Docker containers which serve distinct purposes. Docker Compose coordinates these containers into a single application.
The Flask application responsible for rendering the heatmap and governing the user's interactions with it. In development builds, also acts as the web server.
A crontab which runs the danger_maker.py
script at some predetermined interval (currently set to once every 3 hours). The danger_maker.py
script is responsible for gathering and saving new accidents from the MSHP's website.
A caching server to store and retrieve the dictionary of accident information.
The web server used in production builds.
An OpenLayers OSM PNG tile server built using Overv's openstreetmap-tile-server Docker project. Relies on the missouri_et_al.osm.pbf
extract file provided by Protomaps.
To get a local copy up and running follow these simple example steps.
- Install Git LFS
- Install Docker
- Install Docker Compose
- Clone the repo
git clone https://github.com/dylanmounts/DangerCrossing.git
- Navigate to the repo directory
cd DangerCrossing
- Verify the PBF extract was downloaded
git lfs pull
- Build and start the project
- In a development environment
docker compose -f docker-compose.dev.yml up --build -d
- In a production environment
docker compose up --build -d
- In a development environment
- (Optional) Add initial accidents to the map manually (or wait for the Cron service to pull new accidents every three hours)
docker compose exec cron python danger_maker.py
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
Dylan Mounts - dmounts@gmail.com
Project Link: https://github.com/dylanmounts/DangerCrossing
- Missouri State Highway Patrol for making this information freely and easily accessible. Additional thanks for including longitude and latitude coordinates in their accident reports.
- OpenLayers and their contributors for providing the map data.
- Protomaps for providing the Missouri PBF extract.
- Overv's openstreetmap-tile-server for maintaining the tile server Docker project.
- othneildrew's Best-README-Template for this README template.