class StationDetails(Record): record_type = Discriminator('A') spaces = Skip(4) station_name = Field(30, strip) cate_type = Field( 1, one_of( none=Constant('0', 'Not an interchange Point'), small=Constant('1', 'Small Interchange Point'), medium=Constant('2', 'Medium Interchange Point'), large=Constant('3', 'Large Interchange Point'), subsidiary=Constant('9', 'A subsidiary TIPLOC'), )) tiploc = Field(7) subsidiary_code = Field(3) spaces2 = Skip(3) principal_code = Field(3) easting = Field(5, int) coordinate_type = Field( 1, one_of( Constant('E', 'Estimated'), Constant(' ', 'Actual'), )) northing = Field(5, int) change_time = Field(2, int) footnote = Field(2) spaces3 = Skip(11) region = Field(3)
class Association(Record): prefix = Discriminator('AA') type = NewDeleteRevises() main_uid = Field(6, str) associated_uid = Field(6, str) start_date = Field(6, yymmdd) end_date = Field(6, yymmdd) days = Field(7, days) category = Field(2, one_of( Constant('JJ', 'join'), Constant('VV', 'divide'), Constant('NP', 'next'), empty = Constant(' ', 'empty (not in spec)') )) date_indication = Field(1, one_of( same_day = Constant('S', 'standard (same day)'), next_day = Constant('N', 'over next midnight'), prev_day = Constant('P', 'over previous midnight'), empty = Constant(' ', 'empty (not in spec)') )) tiploc = Field(7) base_loc_suffix = Field(1) assoc_loc_suffix = Field(1) diagram_type = Field(1) association_type = Field(1, one_of( passenger = Constant('P', 'passenger use'), operating = Constant('O', 'operating use only'), empty = Constant(' ', 'empty (not in spec)') )) spare = Skip(31) stp = STPIndicator()
class Header(Record): # lie here: the discriminator is actually 'A' but we handle # that manually above record_type = Discriminator('_') spaces = Skip(29) file_spec = Skip(10) version = Field(8) created = Field(17, ddmmyy_hhmmss) spaces2 = Skip(3) version_sequence = Field(2)
class TIPLOCInsert(Record): prefix = Discriminator('TI') tiploc = Field(7) capitals = Field(2, int) nalco = Field(6, int) nlc_check = Field(1) tps_description = Field(26) stanox = Field(5, int) po_mcp_code = Field(4, int) crs = Field(3) capri_description = Field(16)
class Header(Record): prefix = Discriminator('HD') mainframe_id = Field(20) date_of_extract = Field(6, ddmmyy) time_of_extract = Field(4, hhmm) current_file_ref = Field(7) last_file_ref = Field(7) update_indicator = Field(1, one_of( Constant('U', 'update'), Constant('F', 'full') )) version = Field(1) start_date = Field(6, ddmmyy) end_date = Field(6, ddmmyy)
class ZipCodeRecord(Record): type = Discriminator('') zip_code = Field(5) state_code = Field(2) city_name = Field(28) zip_type = Field(1) county_code = Field(5) latitude = Field(7, convertor=float) longitude = Field(8, convertor=float) area_code = Field(3) finance_code = Skip(6) city_official = Field(1) facility = Skip(1) msa_code = Field(4) pmsa_code = Field(4) filler = Skip(3)
class BasicSchedule(Record): prefix = Discriminator('BS') type = NewDeleteRevises() train_uid = Field(6) date_from = Field(6, yymmdd) date_to = Field(6, yymmdd) days = Field(7, days) bank_holiday_running = BHX() status = STATUS() category = CATEGORY() identity = Field(4) headcode = Field(4) course_indicator = Skip(1) train_service_code = Field(8) portion_id = Field(1) # AKA BUSSEC power_type = POWER_TYPE() timing_load = Field(4) # Not decoded as requires power_type field speed = Field(3, safe_int) oper_chars = OPERATING_CHARACTERISTICS() train_class = CLASS() sleepers = Field(1, one_of( none = Constant(' ', 'No sleepers'), both = Constant('B', 'First & Standard Class'), first = Constant('F', 'First Class only.'), standard = Constant('S', 'Standard Class only.'), )) reservations = Field(1, one_of( compulsory = Constant('A', 'Seat Reservations Compulsory'), bicycle = Constant('E', 'Reservations for Bicycles Essential'), recommended = Constant('R', 'Seat Reservations Recommended'), possible = Constant('S', 'Seat Reservations possible from any station'), empty = Constant(' ', 'empty (not in spec)') )) connection_indicator = Field(1) # not used catering_code = CATERING() service_branding = Skip(4) # appears to be always empty spare = Skip(1) stp = STPIndicator()
class Trailer5(Record): record_type = Discriminator('E')
class Trailer4(Record): record_type = Discriminator('M')
class Trailer3(Record): record_type = Discriminator('0')
class Trailer(Record): record_type = Discriminator('Z')
class ThreeAlphaCodeUsageSpace(Record): record_type = Discriminator(' ')
class ThreeAlphaCodeUsageDash(Record): record_type = Discriminator('-')
class Groups(Record): record_type = Discriminator('G')
class RoutingGroup(Record): record_type = Discriminator('V') spaces = Skip(4) group_name = Field(30, strip) space = Skip(1) stations = Field(40, string_set)
class StationAlias(Record): record_type = Discriminator('L') spaces = Skip(4) station_name = Field(30, strip) space = Skip(1) alias_name = Field(30, strip)