Skip to content

Commit

Permalink
Merge branch 'master' into refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
jpsingleton committed May 14, 2015
2 parents 25e8393 + bf79931 commit 923b7f5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
# Huxley

![Huxley](src/Huxley/huxley.png "Huxley")
[![Huxley](https://huxley.apphb.com/huxley.png "Huxley")](https://huxley.apphb.com/)

![Build Status](https://ci.appveyor.com/api/projects/status/github/jpsingleton/huxley?retina=true "Build Status")
[![Build Status](https://ci.appveyor.com/api/projects/status/github/jpsingleton/huxley?retina=true "Build Status")](https://ci.appveyor.com/project/jpsingleton/huxley)

## UK National Rail Live Departure Boards JSON proxy

Huxley is a [CORS](http://enable-cors.org/) enabled JSON [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) proxy for the UK National Rail Enquires Live Departure Board [SOAP](http://harmful.cat-v.org/software/xml/soap/simple) [API](http://www.nationalrail.co.uk/46391.aspx) (Darwin).

[SOAP](http://harmful.cat-v.org/software/xml/soap/simple) is a pain to use (you have to POST specially crafted XML) so this proxy allows you to GET nicely formatted JSON instead ([REST](https://en.wikipedia.org/wiki/Representational_state_transfer)). It also adds [CORS](http://enable-cors.org/) headers so you can access it with JavaScript from a different domain.

Huxley also has a built in CRS code lookup API so you can search for station names from your app. You can also use station names directly in any query. The codes are automatically kept up to date from the official sources.

In addition it has a function for calculating delays which allows you to build useful IoT devices like this [LED strip delay indicator](https://unop.uk/dev/train-disruption-indicator-with-a-blinky-tape-rgb-led-strip-and-raspberry-pi/). You can specify specific trains and it even knows about London Terminals.

[![Train Disruption Indicator](https://unop.uk/wp-content/uploads/2015/05/trains.jpg "Train Disruption Indicator")](https://unop.uk/dev/train-disruption-indicator-with-a-blinky-tape-rgb-led-strip-and-raspberry-pi/)

## Demo
There is an example deployment set up [here](https://huxley.apphb.com/).
(**DO NOT USE THIS FOR ANYTHING SERIOUS!**)
Expand Down
24 changes: 22 additions & 2 deletions src/Huxley/Controllers/DelaysController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,28 @@ public async Task<DelaysResponse> Get([FromUri] StationBoardRequest request) {
}
}

// https://en.wikipedia.org/wiki/London_station_group (Farringdon [ZFD] is not a London terminal but it probably should be. Maybe when Crossrail opens it will.)
var londonTerminals = new List<string> { "BFR", "LBG", "CST", "CTX", "CHX", "EUS", "FST", "KGX", "LST", "MYB", "PAD", "STP", "SPX", "VIC", "VXH", "WAT", "WAE", };
// https://en.wikipedia.org/wiki/London_station_group
// Farringdon [ZFD] is not a London Terminal but it probably should be (maybe when Crossrail opens it will be)
var londonTerminals = new List<string> {
"BFR", // Blackfriars
"CST", // Cannon Street
"CHX", // Charing Cross
"CTX", // City Thameslink
"EUS", // Euston
"FST", // Fenchurch Street
"KGX", // King's Cross
"LST", // Liverpool Street
"LBG", // London Bridge
"MYB", // Marylebone
"MOG", // Moorgate
"OLD", // Old Street
"PAD", // Paddington
"STP", // St. Pancras
"VXH", // Vauxhall
"VIC", // Victoria
"WAT", // Waterloo
"WAE", // Waterloo East
};

var totalDelayMinutes = 0;
var delayedTrains = new List<ServiceItem>();
Expand Down

0 comments on commit 923b7f5

Please sign in to comment.