Skip to content

Traffic accident heatmap reflecting accidents reported by the Missouri State Highway Patrol.

License

Notifications You must be signed in to change notification settings

dylanmounts/DangerCrossing

Repository files navigation

DangerCrossing

LinkedIn


Logo

Danger Crossing

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
  1. About
  2. Getting Started
  3. Contributing
  4. License
  5. Contact
  6. Acknowledgments

About

Danger Crossing Screen Shot

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.

(back to top)

Built With

Services

The project is comprised of five separate Docker containers which serve distinct purposes. Docker Compose coordinates these containers into a single application.

Web

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.

Cron

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.

Redis

A caching server to store and retrieve the dictionary of accident information.

Nginx

The web server used in production builds.

Tile Server

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.

(back to top)

Getting Started

To get a local copy up and running follow these simple example steps.

Prerequisites

  1. Install Git LFS
  2. Install Docker
  3. Install Docker Compose

Installation

  1. Clone the repo
    git clone https://github.com/dylanmounts/DangerCrossing.git
  2. Navigate to the repo directory
    cd DangerCrossing
  3. Verify the PBF extract was downloaded
    git lfs pull
  4. Build and start the project
    1. In a development environment
      docker compose -f docker-compose.dev.yml up --build -d
    2. In a production environment
      docker compose up --build -d
  5. (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

(back to top)

Contributing

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!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

Contact

Dylan Mounts - [email protected]

Project Link: https://github.com/dylanmounts/DangerCrossing

(back to top)

Acknowledgments

(back to top)