Example OpenXC web application in Python for vehicle data logging
Python JavaScript CSS
Permalink
Failed to load latest commit information.
handlers Clean up old Flask code to make tests pass. Apr 12, 2012
logconfig
static Only redraw every 2 seconds to avoid destroying browser. Mar 7, 2013
templates
tests
.gitignore
CONTRIBUTING.mkd
LICENSE
README.mkd Update README to show new repo name and URL. May 16, 2013
fabfile.py Remove default host from fabfile. Apr 3, 2013
pip-requirements.txt
recorder.py
settings.py
urls.py Clean up old Flask code to make tests pass. Apr 12, 2012
util.py

README.mkd

OpenXC Web Logging Example Application

This is a small Python web application (using the Tornado framework) that receives trace messages from an OpenXC-enabled and network-connected device and them out to disk, split by hour. It supports visualizing a single vehicle's data in real-time using HighCharts and Google Maps.

This application is intended as a proof-of-concept and is lacking in quite a few areas - please do take this as a starting point for a web-enabled OpenXC application, but don't expect this to be production-ready out of the box!

Installation

First, I recommend installing pip, the Python package manager (if you don't have it already):

$ [sudo] easy_install pip

Next, clone this repository and install the Python requirements:

$ git clone https://github.com/openxc/web-logging-example.git
$ cd web-logging-example
$ pip install -r pip-requirements.txt

While not required, I also recommend installing Fabric - it's a command-line tool that I use to create shortcuts for some common tasks (running the development server, resetting the database, etc.).

$ pip install fabric

Running

Without Fabric:

$ python recorder.py

Using Fabric:

$ fab runserver

Test data

You can send test data with a Fabric command:

$ fab send_test_data:path_to_trace.json

API

All API calls accept JSON. There is no authentication (seriously, don't try and run this example app in production!).

Create new log records

The format of the individual log messages should match the output format from an OpenXC vehicle interface.

POST /records

{'records': [
    {'timestamp': 1332975697.078000, 'name': 'steering_wheel_angle',
            'value': 42.0},
    {'timestamp': 1332975698.078000, 'name': 'steering_wheel_angle',
            'value': 38.0}
]}

Contributing

Please see our Contribution Documents.

License

Copyright (c) 2013 Ford Motor Company Licensed under the BSD license.