ATCO-CIF is the format of choice for UK public transport authorities. This is a ruby library that reads .cif files and gives you JSON back.
-
ATCO (Association of Transport Coordinating Officers)
-
CIF (Common Interface File)
-
Official spec:
http://www.pti.org.uk/CIF/atco-cif-spec.pdf -
NOTE: official spec is no-longer available from the above URL but can be found on archive.org
-
A copy of the atco-cif-spec.pdf is included in the
docs
folder in this repo
Currently this library is under-development and has several things left to do before it is perfect (see the TODO.md list ).
- clone this library
git clone [email protected]:davidjrice/atco.git
- or install the gem
gem install atco
- start an irb session (with the helper console command)
bin/console
Code example, for more detailed internal api usage see the spec files.
require "rubygems"
require "atco"
result = Atco.parse("filename.cif")
result = Atco.parse("data/SVRTMAO009A-20091005.cif")
=> {
header: {…}, # Atco::Header
locations: […], # Atco::Location
journeys: {
"journey_identifier": {…} # Atco::Journey
},
unparsed: [
{line: "unparsed line", line_number:1234}
]
}
The ATCO-CIF
Ruby library was originally authored by David Rice @davidjrice in response to an FOI request to Translink for there timetable data as part of an OpenDataNI initiative.
See CONTRIBUTORS.md