Git Product home page Git Product logo

smart-bus's Introduction

Background

KMB has a website and mobile application to track bus arrival time. We can improve it by digest such data and visualize it on a map, such that we can see the overall traffic status. Note that we shall not be bounded to KMB, the system should accept other data source as well, and we are not limited to show bus.

Goal

The goal of this project is to make a portal / platform which fetch data from KMB and process it such that we can estimate buses location and display on Google Map. The bus location should be update and it looks like real time traffic monitor. As there are about 3920 buses on KMB, we usually don’t display all buses at once (but it looks so fun), we shall provide a filter mechanic on the platform.

Servers

The platform consist of the follow servers, which can be installed on standalone machine or just colocated.

  1. MySQL
  2. Data Grabber and Processor
  3. Portal

Setup (MySQL)

  1. Install MySQL Server
> sudo apt-get install mysql-server
  1. Login mysql
mysql -u root -p
  1. Create database user
CREATE USER 'bususer'@'localhost' IDENTIFIED BY '1234';
CREATE USER 'bususer'@'%' IDENTIFIED BY '1234';
CREATE DATABASE busdb;
GRANT ALL ON busdb.* TO 'bususer'@'localhost'
GRANT ALL ON busdb.* TO 'bususer'@'%'
  1. Create Tables
Reference to database/create_table.txt
  1. Install store-procedures
Reference to database/sp_*.txt

Setup (Data Grabber)

  1. Install Node.JS 8
https://nodejs.org/en/download/package-manager/
  1. Install npm packages
> cd src
> npm install

Run Data Grabber

  1. Adjust config.json if needed
  2. Update bus stop information
> cd src
> nodejs kmb_updateroute.js 12A
  1. Update arrival estimation
> cd src
> nodejs kmb_updateeta.js 12A

PS. You might want to setup cron job for this

Setup (Portal Server)

  1. Install Node.JS 8
https://nodejs.org/en/download/package-manager/
  1. Install npm packages
> cd src
> npm install

Run Portal

NOTE: Adjust config.json if needed

> cd src
> nodejs portal.js

NOTE: As PoC the route is hardcoded on index.html

smart-bus's People

Contributors

hidden-dimensions avatar shadow-paw avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

smart-bus's Issues

Bus Schedule

  • Fetch bus schedule according to KMB.pdf, save to database
  • Get current schedule time

Bus Path

  • Fetch bus path into database (path segments on bus stop listing request)
  • Convert path to Lat,Lon and distance(meters)
  • Improve bus position estimation with the path info

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.