This source code is accompanied by a tutorial screencast.
This application has two or more parts.
This fetches the data, controls the HTM Engine via HTTP, pipes in mountains of data, displays results in webapp.
River View Traffic Data Service3.
BUILD YOUR OWN
This project started with a fork of the skeleton-htmengine-app. That project is a great place to start if you want to create your own HTM Engine instance. All you really need to change is the MySQL database name and RabbitMQ queue names.
Also, if you want to view the map of all the traffic paths (at
http://localhost:8083/map) you'll need a Google Maps API key.
export GOOGLE_MAPS_API_KEY=<your key>
Install and Start HTM Engine (Python)
Read and follow
python-engine/README.md, then continue with the directions below.
Start HTM HTTP Server (Python)
This provides a simple
PUT HTTP interface on top of the HTM Engine, which is really useful if you don't want to write your HTM application in python. HTM services must be running in supervisor for this HTTP interface to work properly.
cd python-engine python webapp.py
This will run at http://localhost:8080.
cd node-client npm install .
This will run at http://localhost:8083.
Immediately after startup, the Node.js client application will start pulling traffic data from River View and pushing it into the HTM Engine. A model is created for every traffic route available. For example, traffic path "1" contains traffic data for "11th ave n ganservoort - 12th ave @ 40th st" in Manhattan. This correlates to an HTM Engine model named "1". You can see the raw data for this model by querying the Python HTM Engine HTTP wrapper at http://localhost:8080/1. You should see a bunch of text data in the response.
There are lots of Dygraphs and Google Maps.