Giter Site home page Giter Site logo

jakecob / accidentpredictor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from meraldoantonio/accidentpredictor

0.0 0.0 0.0 14.42 MB

An accurate traffic accident predictor can potentially save lives. I hereby described the creation and deployment of such a model using scikit-learn, Google Maps API, Flask and PythonAnywhere.

JavaScript 0.64% Python 0.05% CSS 0.35% HTML 95.66% Jupyter Notebook 3.30%

accidentpredictor's Introduction

CSE6242 Data & Visual Analytics (Spring 2019)

Team 74 - Road Traffic Accident Prediction Web Application

Description of the project

In this project, we set out to solve the problem of Road Traffic Accident (RTA) in London, United Kingdom by providing a tool to predict RTA risk so that users can make informed decision about their traveling route. We also did a detailed analysis of past data and visuals to gain a better understanding of RTA.

Our web interface contains two parts, namely exploration and interaction. In the exploration part, we presents our research methodology, algorithm used, analysis and visualization of the data. In the interaction part, user can make use of an interactive dashboard to predict the probability of RTA in their chosen routes.

The app uses machine learning models for predictions. User will have to enter a date and time, an origin and travel destination. The app will then call Google maps API for route planning and a weather API, Darksky for weather forecasts. These data will then be fed into the model and probability of RTA occurring in user's route will be displayed on the map as hazard icons.

The web application is built using Python Flask framework and is currently being hosted in Pythonanywhere, here.


Installation and setup

a. First-time setup

  1. Unzip the 'team74final.zip' folder and put it in your local drive.

  2. Make sure you are connected to the internet

  3. The Python virtual environment for this project is created using Pipenv, which is a Python package. First, install the package to your local Python program if you don't have the package. Open a new command line,

pip install pipenv
  1. To install project package requirements from Pipfile and Pipfile.lock in the 'team74final' folder:

    • Change the working directory to the where your unzipped 'team74final' folder is in the command line.
    cd C:\Users\xxx\team74final\CODE
    
    • Create a virtual environment for this project.
    pipenv shell
    
    • Install all the packages from the Pipfile into the virtual environment.
    pipenv install
    
    • All the packages required will now be installed.

ย 

b. To run the Flask app locally:

  1. Navigate to the project folder in command prompt, run the following to activate the virtual environment.
pipenv shell
  1. Running flask,

    • In Windows command prompt, the following command will export the Flask application and run the app in debug mode.
    set FLASK_DEBUG=1
    
    flask run
    
    • The equivalent in Mac,
    export FLASK_DEBUG=1
    
    flask run
    
  2. Ensure that you have internet access. Open the localhost in your Google Chrome, 'http://localhost:5000/'

    NOTE: Should any of the above fail, the web app can still be accessed at the following address.
    https://kteo7.pythonanywhere.com/


Execution

Please refer to the following link for screenshots on how to execute the prediction tool. https://docs.google.com/document/d/1NBnV09YSlKvXVZ0oXIUsbCFj2SeiQCps-0pkpEFj-ss/edit?usp=sharing

We have also created a video demo which can be found here.
https://www.youtube.com/watch?v=5OhZl6achaM

accidentpredictor's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.