This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Cosmin Stejerean (author)
Mon Apr 28 10:13:03 -0700 2008
commit 72da2bc8b73485426282e59ec594ae7901f331fc
tree 9a15d4ff14b57dafab0ee1562e4d6f8ec1f05290
parent 9bbe6401fa45fdc2a43c02abd3c0684cb5788579
tree 9a15d4ff14b57dafab0ee1562e4d6f8ec1f05290
parent 9bbe6401fa45fdc2a43c02abd3c0684cb5788579
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Fri Apr 25 21:24:15 -0700 2008 | [cosmin] |
| |
README | Mon Apr 28 10:13:03 -0700 2008 | [Cosmin Stejerean] |
| |
THANKS | Thu Apr 10 11:16:33 -0700 2008 | [Cosmin Stejerean] |
| |
app.yaml | Sat Apr 12 01:06:57 -0700 2008 | [cosmin] |
| |
data/ | Sun Apr 27 19:26:45 -0700 2008 | [cosmin] |
| |
index.yaml | Sat Apr 26 11:45:14 -0700 2008 | [cosmin] |
| |
main.py | Thu Apr 10 13:14:24 -0700 2008 | [Cosmin Stejerean] |
| |
metratime/ | Mon Apr 28 00:17:39 -0700 2008 | [cosmin] |
| |
simplejson/ | Sat Apr 12 01:06:07 -0700 2008 | [cosmin] |
| |
static/ | Sun Apr 27 18:13:19 -0700 2008 | [cosmin] |
| |
util/ | Sun Apr 27 11:11:32 -0700 2008 | [cosmin] |
README
MetraTime ========= About ----- The MetraTime project started as a way to build a better interface to the train schedules for Metra (http://metrarail.com), a commuter train serving Northeast Illinois. The application lives at http://metratime.com Currently there is only an iPhone interface that allows one to find upcoming trains based on the date and time (Chicago time) the site is accessed. Get Involved ------------ Although comments and suggestions are welcome consider sending a patch instead. See THANKS for a list of people that have contributed to this project. The google group for this project is at http://metratime.googlegroups.com The source code is available in the Git repository at git://github.com/metratime.git The code is based on the Google AppEngine SDK. To start the application use dev_appserver.py /path/to/checkout By default the application will be available on http://localhost:8080 The necessary data can be found in the ./data/data.csv file which can be imported using the bulkload_client.py from the AppEngine SDK. To load the data use bulkload_client.py --url="http://localhost:8080/bulk/import/csv/" --batch_size=5 --filename=data/data.csv --kind=ANY kind can be one of SCHEDULE, LINE, STATION, RUN, STOP. Setting kind to ANY will import all the entities in the file. The kind is case sensitive. The imported csv can contain a leading + or - which the import tools will strip. This is to allow files created by diff to be easily imported. In addition to import the data it is also possible to delete data. For this the same tool (bulkload_client.py) can be used but the url needs to be changed to /bulk/delete/csv/. Here's an example bulkload_client.py --url="http://localhost:8080/bulk/delete/csv/" --batch_size=5 --filename=data/data.csv --kind=ANY The CSV file (data/data.csv) is generated dynamicaly from the data/schedule.json (which is just a json representation of the metra.pickle file provided by Masssimo Di Pierro). The data extracted from the Metra site contains several inconsitencies which need to be cleaned out before importing it (for example to prevent having multiple names for the same station). A tool to generate the CSV file can be found in ./util/jsonextractor.py. PYTHONPATH=`pwd` util/jsonextractor.py data/schedule.json > data/data.csv If you import a CSV file and later find you need to make modifications you can use the bulkload_client to delete the changes and the import the additions. diff data1.csv data2.csv | grep "$-" > remove.csv diff data1.csv data2.csv | grep "$+" > add.csv The tool to remove data from a CSV needs to receive the rows in reverse order from the tool to import them (in order to properly handle dependencies between the various entities). You can either reverse the entire file or just repeatedly call the bulk delete setting kind each time to (in order): STOP, RUN, STATION, LINE, SCHEDULE Once you have loaded data from the CSV you need to set the station order (for each line you want to use). The correct station ordering can be found on the Metra website (feel free to create a tool to automatically import the ordering). To do so go to http://localhost:8080/edit/line/ to get a list of lines you can edit. Click on a line and you will be taken to the screen to set the ordering of stations. Drag and drop the station names in the correct order and press Save. It might take a while but you should get a Javascript alert with the message Saved! if everything completed successfuly. You can use the Cancel button to go back to the list of lines. Enjoy!





