Progress towards sensible-enough numpy based querying using shared memory views rather than duplicated data.
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
from national_rail_timetable.parsing import main
|
from national_rail_timetable.mca_querying import main
|
||||||
|
|
||||||
print(main())
|
print(main())
|
||||||
|
|||||||
@@ -4,136 +4,110 @@
|
|||||||
# Imports
|
# Imports
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
|
||||||
# Classes
|
# Classes
|
||||||
@dataclass
|
@dataclass
|
||||||
class BS:
|
class BS:
|
||||||
|
|
||||||
@property
|
|
||||||
def record_identity(self):
|
def record_identity(self):
|
||||||
"""With the constant value ‘BS’."""
|
"""With the constant value ‘BS’."""
|
||||||
return slice(0, 2)
|
return slice(0, 2)
|
||||||
|
|
||||||
@property
|
|
||||||
def transaction_type(self):
|
def transaction_type(self):
|
||||||
"""‘N’ = New. ‘D’ = Delete. ‘R’ = Revise."""
|
"""‘N’ = New. ‘D’ = Delete. ‘R’ = Revise."""
|
||||||
return slice(2, 3)
|
return slice(2, 3)
|
||||||
|
|
||||||
@property
|
|
||||||
def train_uid(self):
|
def train_uid(self):
|
||||||
"""Unique train Identifier."""
|
"""Unique train Identifier."""
|
||||||
return slice(3, 9)
|
return slice(3, 9)
|
||||||
|
|
||||||
@property
|
|
||||||
def date_runs_from(self):
|
def date_runs_from(self):
|
||||||
"""yymmdd"""
|
"""yymmdd"""
|
||||||
return slice(9, 15)
|
return slice(9, 15)
|
||||||
|
|
||||||
@property
|
|
||||||
def date_runs_to(self):
|
def date_runs_to(self):
|
||||||
"""yymmdd"""
|
"""yymmdd"""
|
||||||
return slice(15, 21)
|
return slice(15, 21)
|
||||||
|
|
||||||
@property
|
|
||||||
def days_run(self):
|
def days_run(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(21, 28)
|
return slice(21, 28)
|
||||||
|
|
||||||
@property
|
|
||||||
def bank_holiday_running(self):
|
def bank_holiday_running(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(28, 29)
|
return slice(28, 29)
|
||||||
|
|
||||||
@property
|
|
||||||
def train_status(self):
|
def train_status(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(29, 30)
|
return slice(29, 30)
|
||||||
|
|
||||||
@property
|
|
||||||
def train_category(self):
|
def train_category(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(30, 32)
|
return slice(30, 32)
|
||||||
|
|
||||||
@property
|
|
||||||
def train_identity(self):
|
def train_identity(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(32, 36)
|
return slice(32, 36)
|
||||||
|
|
||||||
@property
|
|
||||||
def headcode(self):
|
def headcode(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(36, 40)
|
return slice(36, 40)
|
||||||
|
|
||||||
@property
|
|
||||||
def course_indicator(self):
|
def course_indicator(self):
|
||||||
"""Not used - always set to 1."""
|
"""Not used - always set to 1."""
|
||||||
return slice(40, 41)
|
return slice(40, 41)
|
||||||
|
|
||||||
@property
|
|
||||||
def profit_centre_code(self):
|
def profit_centre_code(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(41, 49)
|
return slice(41, 49)
|
||||||
|
|
||||||
@property
|
|
||||||
def business_sector(self):
|
def business_sector(self):
|
||||||
"""Now used to contain the portion suffix for RSID"""
|
"""Now used to contain the portion suffix for RSID"""
|
||||||
return slice(49, 50)
|
return slice(49, 50)
|
||||||
|
|
||||||
@property
|
|
||||||
def power_type(self):
|
def power_type(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(50, 53)
|
return slice(50, 53)
|
||||||
|
|
||||||
@property
|
|
||||||
def timing_load(self):
|
def timing_load(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(53, 57)
|
return slice(53, 57)
|
||||||
|
|
||||||
@property
|
|
||||||
def speed(self):
|
def speed(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(57, 60)
|
return slice(57, 60)
|
||||||
|
|
||||||
@property
|
|
||||||
def operating_chars(self):
|
def operating_chars(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(60, 66)
|
return slice(60, 66)
|
||||||
|
|
||||||
@property
|
|
||||||
def train_class(self):
|
def train_class(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(66, 67)
|
return slice(66, 67)
|
||||||
|
|
||||||
@property
|
|
||||||
def sleepers(self):
|
def sleepers(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(67, 68)
|
return slice(67, 68)
|
||||||
|
|
||||||
@property
|
|
||||||
def reservations(self):
|
def reservations(self):
|
||||||
"""Permitted values are: A – Seat Reservations Compulsory (R symbol in white box) E – Reservations for Bicycles Essential (Inverted black triangle) R – Seat Reservations Recommended (R symbol in black box) S – Seat Reservations possible from any station (white diamond symbol)"""
|
"""Permitted values are: A – Seat Reservations Compulsory (R symbol in white box) E – Reservations for Bicycles Essential (Inverted black triangle) R – Seat Reservations Recommended (R symbol in black box) S – Seat Reservations possible from any station (white diamond symbol)"""
|
||||||
return slice(68, 69)
|
return slice(68, 69)
|
||||||
|
|
||||||
@property
|
|
||||||
def connect_indicator(self):
|
def connect_indicator(self):
|
||||||
"""Not used - always set to blank."""
|
"""Not used - always set to blank."""
|
||||||
return slice(69, 70)
|
return slice(69, 70)
|
||||||
|
|
||||||
@property
|
|
||||||
def catering_code(self):
|
def catering_code(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(70, 74)
|
return slice(70, 74)
|
||||||
|
|
||||||
@property
|
|
||||||
def service_branding(self):
|
def service_branding(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(74, 78)
|
return slice(74, 78)
|
||||||
|
|
||||||
@property
|
|
||||||
def spare(self):
|
def spare(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(78, 79)
|
return slice(78, 79)
|
||||||
|
|
||||||
@property
|
|
||||||
def stp_indicator(self):
|
def stp_indicator(self):
|
||||||
"""‘C’ = STP cancellation of permanent schedule. ‘N’ = New STP schedule. ‘O’ = STP overlay of permanent schedule. ‘P’ = Permanent. Read in association with the Transaction Type in Field 2"""
|
"""‘C’ = STP cancellation of permanent schedule. ‘N’ = New STP schedule. ‘O’ = STP overlay of permanent schedule. ‘P’ = Permanent. Read in association with the Transaction Type in Field 2"""
|
||||||
return slice(79, 80)
|
return slice(79, 80)
|
||||||
@@ -141,58 +115,46 @@ class BS:
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class HD:
|
class HD:
|
||||||
|
|
||||||
@property
|
|
||||||
def record_identity(self):
|
def record_identity(self):
|
||||||
"""With the constant value ‘HD’."""
|
"""With the constant value ‘HD’."""
|
||||||
return slice(0, 2)
|
return slice(0, 2)
|
||||||
|
|
||||||
@property
|
|
||||||
def file_identity(self):
|
def file_identity(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(2, 22)
|
return slice(2, 22)
|
||||||
|
|
||||||
@property
|
|
||||||
def date_of_extract(self):
|
def date_of_extract(self):
|
||||||
"""Format ddmmyy defining the date that the BTD extract file was created."""
|
"""Format ddmmyy defining the date that the BTD extract file was created."""
|
||||||
return slice(22, 28)
|
return slice(22, 28)
|
||||||
|
|
||||||
@property
|
|
||||||
def time_of_extract(self):
|
def time_of_extract(self):
|
||||||
"""hhmm defining the time that the BTD extract file was created."""
|
"""hhmm defining the time that the BTD extract file was created."""
|
||||||
return slice(28, 32)
|
return slice(28, 32)
|
||||||
|
|
||||||
@property
|
|
||||||
def current_file_reference(self):
|
def current_file_reference(self):
|
||||||
"""Unique file reference."""
|
"""Unique file reference."""
|
||||||
return slice(32, 39)
|
return slice(32, 39)
|
||||||
|
|
||||||
@property
|
|
||||||
def last_file_reference(self):
|
def last_file_reference(self):
|
||||||
"""Unique file reference."""
|
"""Unique file reference."""
|
||||||
return slice(39, 46)
|
return slice(39, 46)
|
||||||
|
|
||||||
@property
|
|
||||||
def update_indicator(self):
|
def update_indicator(self):
|
||||||
"""‘U’=Update. ‘F’=Full extract."""
|
"""‘U’=Update. ‘F’=Full extract."""
|
||||||
return slice(46, 47)
|
return slice(46, 47)
|
||||||
|
|
||||||
@property
|
|
||||||
def version(self):
|
def version(self):
|
||||||
"""Version identifier of CIF software."""
|
"""Version identifier of CIF software."""
|
||||||
return slice(47, 48)
|
return slice(47, 48)
|
||||||
|
|
||||||
@property
|
|
||||||
def extract_start_date(self):
|
def extract_start_date(self):
|
||||||
"""Same as Field 3 above."""
|
"""Same as Field 3 above."""
|
||||||
return slice(48, 54)
|
return slice(48, 54)
|
||||||
|
|
||||||
@property
|
|
||||||
def extract_end_date(self):
|
def extract_end_date(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(54, 60)
|
return slice(54, 60)
|
||||||
|
|
||||||
@property
|
|
||||||
def spare(self):
|
def spare(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(60, 80)
|
return slice(60, 80)
|
||||||
@@ -200,13 +162,10 @@ class HD:
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class ZZ:
|
class ZZ:
|
||||||
|
|
||||||
@property
|
|
||||||
def record_identity(self):
|
def record_identity(self):
|
||||||
"""With the constant value ‘ZZ’."""
|
"""With the constant value ‘ZZ’."""
|
||||||
return slice(0, 2)
|
return slice(0, 2)
|
||||||
|
|
||||||
@property
|
|
||||||
def spare(self):
|
def spare(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(2, 80)
|
return slice(2, 80)
|
||||||
@@ -214,63 +173,50 @@ class ZZ:
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class TA:
|
class TA:
|
||||||
|
|
||||||
@property
|
|
||||||
def record_identity(self):
|
def record_identity(self):
|
||||||
"""With the constant value ‘TA’."""
|
"""With the constant value ‘TA’."""
|
||||||
return slice(0, 2)
|
return slice(0, 2)
|
||||||
|
|
||||||
@property
|
|
||||||
def tiploc_code(self):
|
def tiploc_code(self):
|
||||||
"""A TIPLOC is 4-7 characters. If less than 7 then it will be padded by blanks."""
|
"""A TIPLOC is 4-7 characters. If less than 7 then it will be padded by blanks."""
|
||||||
return slice(2, 9)
|
return slice(2, 9)
|
||||||
|
|
||||||
@property
|
|
||||||
def capitals(self):
|
def capitals(self):
|
||||||
"""Defines capitalisation of TIPLOC. Can be ignored for retailing/journey planners."""
|
"""Defines capitalisation of TIPLOC. Can be ignored for retailing/journey planners."""
|
||||||
return slice(9, 11)
|
return slice(9, 11)
|
||||||
|
|
||||||
@property
|
|
||||||
def national_location_code(self):
|
def national_location_code(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(11, 17)
|
return slice(11, 17)
|
||||||
|
|
||||||
@property
|
|
||||||
def nlc_check_character(self):
|
def nlc_check_character(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(17, 18)
|
return slice(17, 18)
|
||||||
|
|
||||||
@property
|
|
||||||
def tps_description(self):
|
def tps_description(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(18, 44)
|
return slice(18, 44)
|
||||||
|
|
||||||
@property
|
|
||||||
def stanox(self):
|
def stanox(self):
|
||||||
"""TOPS location code."""
|
"""TOPS location code."""
|
||||||
return slice(44, 49)
|
return slice(44, 49)
|
||||||
|
|
||||||
@property
|
|
||||||
def po_mcp_code(self):
|
def po_mcp_code(self):
|
||||||
"""Post Office Location Code. (Not used but may contain historic data or three blank spaces followed by 0)."""
|
"""Post Office Location Code. (Not used but may contain historic data or three blank spaces followed by 0)."""
|
||||||
return slice(49, 53)
|
return slice(49, 53)
|
||||||
|
|
||||||
@property
|
|
||||||
def crs_code(self):
|
def crs_code(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(53, 56)
|
return slice(53, 56)
|
||||||
|
|
||||||
@property
|
|
||||||
def description(self):
|
def description(self):
|
||||||
"""Description used in LENNON."""
|
"""Description used in LENNON."""
|
||||||
return slice(56, 72)
|
return slice(56, 72)
|
||||||
|
|
||||||
@property
|
|
||||||
def new_tiploc(self):
|
def new_tiploc(self):
|
||||||
"""Only present if TIPLOC change."""
|
"""Only present if TIPLOC change."""
|
||||||
return slice(72, 79)
|
return slice(72, 79)
|
||||||
|
|
||||||
@property
|
|
||||||
def spare(self):
|
def spare(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(79, 80)
|
return slice(79, 80)
|
||||||
@@ -278,113 +224,90 @@ class TA:
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class CR:
|
class CR:
|
||||||
|
|
||||||
@property
|
|
||||||
def record_identity(self):
|
def record_identity(self):
|
||||||
"""With the constant value ‘CR’."""
|
"""With the constant value ‘CR’."""
|
||||||
return slice(0, 2)
|
return slice(0, 2)
|
||||||
|
|
||||||
@property
|
|
||||||
def location(self):
|
def location(self):
|
||||||
"""TIPLOC + Suffix. Suffix is always the eighth character."""
|
"""TIPLOC + Suffix. Suffix is always the eighth character."""
|
||||||
return slice(2, 10)
|
return slice(2, 10)
|
||||||
|
|
||||||
@property
|
|
||||||
def train_category(self):
|
def train_category(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(10, 12)
|
return slice(10, 12)
|
||||||
|
|
||||||
@property
|
|
||||||
def train_identity(self):
|
def train_identity(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(12, 16)
|
return slice(12, 16)
|
||||||
|
|
||||||
@property
|
|
||||||
def headcode(self):
|
def headcode(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(16, 20)
|
return slice(16, 20)
|
||||||
|
|
||||||
@property
|
|
||||||
def course_indicator(self):
|
def course_indicator(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(20, 21)
|
return slice(20, 21)
|
||||||
|
|
||||||
@property
|
|
||||||
def profit_centre_code(self):
|
def profit_centre_code(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(21, 29)
|
return slice(21, 29)
|
||||||
|
|
||||||
@property
|
|
||||||
def business_sector(self):
|
def business_sector(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(29, 30)
|
return slice(29, 30)
|
||||||
|
|
||||||
@property
|
|
||||||
def power_type(self):
|
def power_type(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(30, 33)
|
return slice(30, 33)
|
||||||
|
|
||||||
@property
|
|
||||||
def timing_load(self):
|
def timing_load(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(33, 37)
|
return slice(33, 37)
|
||||||
|
|
||||||
@property
|
|
||||||
def speed(self):
|
def speed(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(37, 40)
|
return slice(37, 40)
|
||||||
|
|
||||||
@property
|
|
||||||
def operating_chars(self):
|
def operating_chars(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(40, 46)
|
return slice(40, 46)
|
||||||
|
|
||||||
@property
|
|
||||||
def train_class(self):
|
def train_class(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(46, 47)
|
return slice(46, 47)
|
||||||
|
|
||||||
@property
|
|
||||||
def sleepers(self):
|
def sleepers(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(47, 48)
|
return slice(47, 48)
|
||||||
|
|
||||||
@property
|
|
||||||
def reservations(self):
|
def reservations(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(48, 49)
|
return slice(48, 49)
|
||||||
|
|
||||||
@property
|
|
||||||
def connect_indicator(self):
|
def connect_indicator(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(49, 50)
|
return slice(49, 50)
|
||||||
|
|
||||||
@property
|
|
||||||
def catering_code(self):
|
def catering_code(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(50, 54)
|
return slice(50, 54)
|
||||||
|
|
||||||
@property
|
|
||||||
def service_branding(self):
|
def service_branding(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(54, 58)
|
return slice(54, 58)
|
||||||
|
|
||||||
@property
|
|
||||||
def traction_class(self):
|
def traction_class(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(58, 62)
|
return slice(58, 62)
|
||||||
|
|
||||||
@property
|
|
||||||
def uic_code(self):
|
def uic_code(self):
|
||||||
"""Only populated for trains travelling to/from Europe via the Channel Tunnel, otherwise blank."""
|
"""Only populated for trains travelling to/from Europe via the Channel Tunnel, otherwise blank."""
|
||||||
return slice(62, 67)
|
return slice(62, 67)
|
||||||
|
|
||||||
@property
|
|
||||||
def retail_service_id(self):
|
def retail_service_id(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(67, 75)
|
return slice(67, 75)
|
||||||
|
|
||||||
@property
|
|
||||||
def spare(self):
|
def spare(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(75, 80)
|
return slice(75, 80)
|
||||||
@@ -392,43 +315,34 @@ class CR:
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class LT:
|
class LT:
|
||||||
|
|
||||||
@property
|
|
||||||
def record_identity(self):
|
def record_identity(self):
|
||||||
"""With the constant value ‘LT’."""
|
"""With the constant value ‘LT’."""
|
||||||
return slice(0, 2)
|
return slice(0, 2)
|
||||||
|
|
||||||
@property
|
|
||||||
def location(self):
|
def location(self):
|
||||||
"""TIPLOC +Suffix. Suffix is always the eighth character."""
|
"""TIPLOC +Suffix. Suffix is always the eighth character."""
|
||||||
return slice(2, 10)
|
return slice(2, 10)
|
||||||
|
|
||||||
@property
|
|
||||||
def scheduled_arrival_time(self):
|
def scheduled_arrival_time(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(10, 15)
|
return slice(10, 15)
|
||||||
|
|
||||||
@property
|
|
||||||
def public_arrival_time(self):
|
def public_arrival_time(self):
|
||||||
"""If there is no Public Arrival time this field will default to 0000."""
|
"""If there is no Public Arrival time this field will default to 0000."""
|
||||||
return slice(15, 19)
|
return slice(15, 19)
|
||||||
|
|
||||||
@property
|
|
||||||
def platform(self):
|
def platform(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(19, 22)
|
return slice(19, 22)
|
||||||
|
|
||||||
@property
|
|
||||||
def path(self):
|
def path(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(22, 25)
|
return slice(22, 25)
|
||||||
|
|
||||||
@property
|
|
||||||
def activity(self):
|
def activity(self):
|
||||||
"""Up to 6 activity codes may be present. The first 2 characters will always be TF (train finishes). If there are no other activity codes, this defaults to being an advertised arrival."""
|
"""Up to 6 activity codes may be present. The first 2 characters will always be TF (train finishes). If there are no other activity codes, this defaults to being an advertised arrival."""
|
||||||
return slice(25, 37)
|
return slice(25, 37)
|
||||||
|
|
||||||
@property
|
|
||||||
def spare(self):
|
def spare(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(37, 80)
|
return slice(37, 80)
|
||||||
@@ -436,78 +350,62 @@ class LT:
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class LI:
|
class LI:
|
||||||
|
|
||||||
@property
|
|
||||||
def record_identity(self):
|
def record_identity(self):
|
||||||
"""With the constant value ‘LI’."""
|
"""With the constant value ‘LI’."""
|
||||||
return slice(0, 2)
|
return slice(0, 2)
|
||||||
|
|
||||||
@property
|
|
||||||
def location(self):
|
def location(self):
|
||||||
"""TIPLOC + Suffix. Suffix is always the eighth character."""
|
"""TIPLOC + Suffix. Suffix is always the eighth character."""
|
||||||
return slice(2, 10)
|
return slice(2, 10)
|
||||||
|
|
||||||
@property
|
|
||||||
def scheduled_arrival_time(self):
|
def scheduled_arrival_time(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(10, 15)
|
return slice(10, 15)
|
||||||
|
|
||||||
@property
|
|
||||||
def scheduled_departure_time(self):
|
def scheduled_departure_time(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(15, 20)
|
return slice(15, 20)
|
||||||
|
|
||||||
@property
|
|
||||||
def scheduled_pass(self):
|
def scheduled_pass(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(20, 25)
|
return slice(20, 25)
|
||||||
|
|
||||||
@property
|
|
||||||
def public_arrival(self):
|
def public_arrival(self):
|
||||||
"""If there is no Public Arrival time this field will default to 0000."""
|
"""If there is no Public Arrival time this field will default to 0000."""
|
||||||
return slice(25, 29)
|
return slice(25, 29)
|
||||||
|
|
||||||
@property
|
|
||||||
def public_departure(self):
|
def public_departure(self):
|
||||||
"""If there is no Public Departure time this field will default to 0000."""
|
"""If there is no Public Departure time this field will default to 0000."""
|
||||||
return slice(29, 33)
|
return slice(29, 33)
|
||||||
|
|
||||||
@property
|
|
||||||
def platform(self):
|
def platform(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(33, 36)
|
return slice(33, 36)
|
||||||
|
|
||||||
@property
|
|
||||||
def line(self):
|
def line(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(36, 39)
|
return slice(36, 39)
|
||||||
|
|
||||||
@property
|
|
||||||
def path(self):
|
def path(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(39, 42)
|
return slice(39, 42)
|
||||||
|
|
||||||
@property
|
|
||||||
def activity(self):
|
def activity(self):
|
||||||
"""Up to 6 activity codes may be present."""
|
"""Up to 6 activity codes may be present."""
|
||||||
return slice(42, 54)
|
return slice(42, 54)
|
||||||
|
|
||||||
@property
|
|
||||||
def engineering_allowance(self):
|
def engineering_allowance(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(54, 56)
|
return slice(54, 56)
|
||||||
|
|
||||||
@property
|
|
||||||
def pathing_allowance(self):
|
def pathing_allowance(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(56, 58)
|
return slice(56, 58)
|
||||||
|
|
||||||
@property
|
|
||||||
def performance_allowance(self):
|
def performance_allowance(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(58, 60)
|
return slice(58, 60)
|
||||||
|
|
||||||
@property
|
|
||||||
def spare(self):
|
def spare(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(60, 80)
|
return slice(60, 80)
|
||||||
@@ -515,18 +413,14 @@ class LI:
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class TD:
|
class TD:
|
||||||
|
|
||||||
@property
|
|
||||||
def record_identity(self):
|
def record_identity(self):
|
||||||
"""With the constant value ‘TD’."""
|
"""With the constant value ‘TD’."""
|
||||||
return slice(0, 2)
|
return slice(0, 2)
|
||||||
|
|
||||||
@property
|
|
||||||
def tiploc_code(self):
|
def tiploc_code(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(2, 9)
|
return slice(2, 9)
|
||||||
|
|
||||||
@property
|
|
||||||
def spare(self):
|
def spare(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(9, 80)
|
return slice(9, 80)
|
||||||
@@ -534,83 +428,66 @@ class TD:
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class AA:
|
class AA:
|
||||||
|
|
||||||
@property
|
|
||||||
def record_identity(self):
|
def record_identity(self):
|
||||||
"""With the constant value ‘AA’."""
|
"""With the constant value ‘AA’."""
|
||||||
return slice(0, 2)
|
return slice(0, 2)
|
||||||
|
|
||||||
@property
|
|
||||||
def transaction_type(self):
|
def transaction_type(self):
|
||||||
"""‘N’ = New. ‘D’ = Delete. ‘R’ = Revise."""
|
"""‘N’ = New. ‘D’ = Delete. ‘R’ = Revise."""
|
||||||
return slice(2, 3)
|
return slice(2, 3)
|
||||||
|
|
||||||
@property
|
|
||||||
def base_uid(self):
|
def base_uid(self):
|
||||||
"""One of the trains involved in the association. This will always be the through train, not the splitting/joining portion."""
|
"""One of the trains involved in the association. This will always be the through train, not the splitting/joining portion."""
|
||||||
return slice(3, 9)
|
return slice(3, 9)
|
||||||
|
|
||||||
@property
|
|
||||||
def assoc_uid(self):
|
def assoc_uid(self):
|
||||||
"""The other train involved."""
|
"""The other train involved."""
|
||||||
return slice(9, 15)
|
return slice(9, 15)
|
||||||
|
|
||||||
@property
|
|
||||||
def assoc_start_date(self):
|
def assoc_start_date(self):
|
||||||
"""Format: yymmdd. May not be the same as the dates of the train schedules."""
|
"""Format: yymmdd. May not be the same as the dates of the train schedules."""
|
||||||
return slice(15, 21)
|
return slice(15, 21)
|
||||||
|
|
||||||
@property
|
|
||||||
def assoc_end_date(self):
|
def assoc_end_date(self):
|
||||||
"""Format: yymmdd. May not be the same as the dates of the train schedules."""
|
"""Format: yymmdd. May not be the same as the dates of the train schedules."""
|
||||||
return slice(21, 27)
|
return slice(21, 27)
|
||||||
|
|
||||||
@property
|
|
||||||
def assoc_days(self):
|
def assoc_days(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(27, 34)
|
return slice(27, 34)
|
||||||
|
|
||||||
@property
|
|
||||||
def assoc_cat(self):
|
def assoc_cat(self):
|
||||||
"""The ASSOC-CAT for the base UID (first byte), followed by the ASSOC-CAT for the assoc. UID (second byte). Note: Although this field isn’t specified as having blanks in the Network Rail CIF specification, if blanks are supplied they will be carried forward. (Blanks are used to override the permanent value in overlays and cancellations). ‘JJ’ for Joining trains and ‘VV’ for Dividing trains. ‘NP’ for Next/Previous Associations may also be displayed but as this is an Operating association it should be ignored by journey planners."""
|
"""The ASSOC-CAT for the base UID (first byte), followed by the ASSOC-CAT for the assoc. UID (second byte). Note: Although this field isn’t specified as having blanks in the Network Rail CIF specification, if blanks are supplied they will be carried forward. (Blanks are used to override the permanent value in overlays and cancellations). ‘JJ’ for Joining trains and ‘VV’ for Dividing trains. ‘NP’ for Next/Previous Associations may also be displayed but as this is an Operating association it should be ignored by journey planners."""
|
||||||
return slice(34, 36)
|
return slice(34, 36)
|
||||||
|
|
||||||
@property
|
|
||||||
def assoc_date_ind(self):
|
def assoc_date_ind(self):
|
||||||
"""‘S’ = Standard. ‘N’ = Over-next-midnight. ‘P’ = Over-previous-midnight. Note: Although this field isn’t specified as having blanks in the Network Rail CIF specification, if blanks are supplied they will be carried forward. (Blanks are used to override the permanent value in overlays and cancellations)."""
|
"""‘S’ = Standard. ‘N’ = Over-next-midnight. ‘P’ = Over-previous-midnight. Note: Although this field isn’t specified as having blanks in the Network Rail CIF specification, if blanks are supplied they will be carried forward. (Blanks are used to override the permanent value in overlays and cancellations)."""
|
||||||
return slice(36, 37)
|
return slice(36, 37)
|
||||||
|
|
||||||
@property
|
|
||||||
def assoc_location(self):
|
def assoc_location(self):
|
||||||
"""TIPLOC where association occurs."""
|
"""TIPLOC where association occurs."""
|
||||||
return slice(37, 44)
|
return slice(37, 44)
|
||||||
|
|
||||||
@property
|
|
||||||
def base_location_suffix(self):
|
def base_location_suffix(self):
|
||||||
"""Values are space or 2."""
|
"""Values are space or 2."""
|
||||||
return slice(44, 45)
|
return slice(44, 45)
|
||||||
|
|
||||||
@property
|
|
||||||
def assoc_location_suffix(self):
|
def assoc_location_suffix(self):
|
||||||
"""Values are space or 2."""
|
"""Values are space or 2."""
|
||||||
return slice(45, 46)
|
return slice(45, 46)
|
||||||
|
|
||||||
@property
|
|
||||||
def diagram_type(self):
|
def diagram_type(self):
|
||||||
"""With the constant value ‘T’."""
|
"""With the constant value ‘T’."""
|
||||||
return slice(46, 47)
|
return slice(46, 47)
|
||||||
|
|
||||||
@property
|
|
||||||
def association_type(self):
|
def association_type(self):
|
||||||
"""‘P’ = Passenger use. ‘O’ = Operating use. Note: Although this field isn’t specified as having blanks in the Network Rail CIF specification, if blanks are supplied they will be carried forward. (If blank then association defaults to Operating and should be ignored by journey planners)."""
|
"""‘P’ = Passenger use. ‘O’ = Operating use. Note: Although this field isn’t specified as having blanks in the Network Rail CIF specification, if blanks are supplied they will be carried forward. (If blank then association defaults to Operating and should be ignored by journey planners)."""
|
||||||
return slice(47, 48)
|
return slice(47, 48)
|
||||||
|
|
||||||
@property
|
|
||||||
def filler(self):
|
def filler(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(48, 79)
|
return slice(48, 79)
|
||||||
|
|
||||||
@property
|
|
||||||
def stp_indicator(self):
|
def stp_indicator(self):
|
||||||
"""Read in conjunction with the ‘Transaction Type’ in Field 2. ‘C’ = STP cancellation of permanent schedule. ‘N’ = New STP schedule. ‘O’ = STP overlay of permanent schedule. ‘P’ = Permanent."""
|
"""Read in conjunction with the ‘Transaction Type’ in Field 2. ‘C’ = STP cancellation of permanent schedule. ‘N’ = New STP schedule. ‘O’ = STP overlay of permanent schedule. ‘P’ = Permanent."""
|
||||||
return slice(79, 80)
|
return slice(79, 80)
|
||||||
@@ -618,58 +495,46 @@ class AA:
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class LO:
|
class LO:
|
||||||
|
|
||||||
@property
|
|
||||||
def record_identity(self):
|
def record_identity(self):
|
||||||
"""With the constant value ‘LO’."""
|
"""With the constant value ‘LO’."""
|
||||||
return slice(0, 2)
|
return slice(0, 2)
|
||||||
|
|
||||||
@property
|
|
||||||
def location(self):
|
def location(self):
|
||||||
"""TIPLOC + Suffix. Suffix is always the eighth character."""
|
"""TIPLOC + Suffix. Suffix is always the eighth character."""
|
||||||
return slice(2, 10)
|
return slice(2, 10)
|
||||||
|
|
||||||
@property
|
|
||||||
def scheduled_departure_time(self):
|
def scheduled_departure_time(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(10, 15)
|
return slice(10, 15)
|
||||||
|
|
||||||
@property
|
|
||||||
def public_departure_time(self):
|
def public_departure_time(self):
|
||||||
"""If there is no Public Departure time this field will default to 0000."""
|
"""If there is no Public Departure time this field will default to 0000."""
|
||||||
return slice(15, 19)
|
return slice(15, 19)
|
||||||
|
|
||||||
@property
|
|
||||||
def platform(self):
|
def platform(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(19, 22)
|
return slice(19, 22)
|
||||||
|
|
||||||
@property
|
|
||||||
def line(self):
|
def line(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(22, 25)
|
return slice(22, 25)
|
||||||
|
|
||||||
@property
|
|
||||||
def engineering_allowance(self):
|
def engineering_allowance(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(25, 27)
|
return slice(25, 27)
|
||||||
|
|
||||||
@property
|
|
||||||
def pathing_allowance(self):
|
def pathing_allowance(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(27, 29)
|
return slice(27, 29)
|
||||||
|
|
||||||
@property
|
|
||||||
def activity(self):
|
def activity(self):
|
||||||
"""Up to 6 activity codes may be present. The first 2 characters will always be TB (train begins). If there are no other activity codes, this defaults to being an advertised departure."""
|
"""Up to 6 activity codes may be present. The first 2 characters will always be TB (train begins). If there are no other activity codes, this defaults to being an advertised departure."""
|
||||||
return slice(29, 41)
|
return slice(29, 41)
|
||||||
|
|
||||||
@property
|
|
||||||
def performance_allowance(self):
|
def performance_allowance(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(41, 43)
|
return slice(41, 43)
|
||||||
|
|
||||||
@property
|
|
||||||
def spare(self):
|
def spare(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(43, 80)
|
return slice(43, 80)
|
||||||
@@ -677,43 +542,34 @@ class LO:
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class BX:
|
class BX:
|
||||||
|
|
||||||
@property
|
|
||||||
def record_identity(self):
|
def record_identity(self):
|
||||||
"""With the constant value ‘BX’."""
|
"""With the constant value ‘BX’."""
|
||||||
return slice(0, 2)
|
return slice(0, 2)
|
||||||
|
|
||||||
@property
|
|
||||||
def traction_class(self):
|
def traction_class(self):
|
||||||
"""Not used – always blank."""
|
"""Not used – always blank."""
|
||||||
return slice(2, 6)
|
return slice(2, 6)
|
||||||
|
|
||||||
@property
|
|
||||||
def uic_code(self):
|
def uic_code(self):
|
||||||
"""Only populated for trains travelling to/from Europe via the Channel Tunnel, otherwise blank."""
|
"""Only populated for trains travelling to/from Europe via the Channel Tunnel, otherwise blank."""
|
||||||
return slice(6, 11)
|
return slice(6, 11)
|
||||||
|
|
||||||
@property
|
|
||||||
def atoc_code(self):
|
def atoc_code(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(11, 13)
|
return slice(11, 13)
|
||||||
|
|
||||||
@property
|
|
||||||
def applicable_timetable_code(self):
|
def applicable_timetable_code(self):
|
||||||
"""Always set to ‘Y’."""
|
"""Always set to ‘Y’."""
|
||||||
return slice(13, 14)
|
return slice(13, 14)
|
||||||
|
|
||||||
@property
|
|
||||||
def retail_service_id(self):
|
def retail_service_id(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(14, 22)
|
return slice(14, 22)
|
||||||
|
|
||||||
@property
|
|
||||||
def source(self):
|
def source(self):
|
||||||
"""Not used – always blank."""
|
"""Not used – always blank."""
|
||||||
return slice(22, 23)
|
return slice(22, 23)
|
||||||
|
|
||||||
@property
|
|
||||||
def spare(self):
|
def spare(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(23, 80)
|
return slice(23, 80)
|
||||||
@@ -721,59 +577,46 @@ class BX:
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class TI:
|
class TI:
|
||||||
|
|
||||||
@property
|
|
||||||
def record_identity(self):
|
def record_identity(self):
|
||||||
"""With the constant value ‘TI’."""
|
"""With the constant value ‘TI’."""
|
||||||
return slice(0, 2)
|
return slice(0, 2)
|
||||||
|
|
||||||
@property
|
|
||||||
def tiploc_code(self):
|
def tiploc_code(self):
|
||||||
"""A TIPLOC is 4-7 characters. If less than 7 then it will be padded by blanks."""
|
"""A TIPLOC is 4-7 characters. If less than 7 then it will be padded by blanks."""
|
||||||
return slice(2, 9)
|
return slice(2, 9)
|
||||||
|
|
||||||
@property
|
|
||||||
def capitals(self):
|
def capitals(self):
|
||||||
"""Defines capitalisation of TIPLOC. Can be ignored for retailing/journey planners."""
|
"""Defines capitalisation of TIPLOC. Can be ignored for retailing/journey planners."""
|
||||||
return slice(9, 11)
|
return slice(9, 11)
|
||||||
|
|
||||||
@property
|
|
||||||
def national_location_code(self):
|
def national_location_code(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(11, 17)
|
return slice(11, 17)
|
||||||
|
|
||||||
@property
|
|
||||||
def nlc_check_character(self):
|
def nlc_check_character(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(17, 18)
|
return slice(17, 18)
|
||||||
|
|
||||||
@property
|
|
||||||
def tps_description(self):
|
def tps_description(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(18, 44)
|
return slice(18, 44)
|
||||||
|
|
||||||
@property
|
|
||||||
def stanox(self):
|
def stanox(self):
|
||||||
"""TOPS location code."""
|
"""TOPS location code."""
|
||||||
return slice(44, 49)
|
return slice(44, 49)
|
||||||
|
|
||||||
@property
|
|
||||||
def po_mcp_code(self):
|
def po_mcp_code(self):
|
||||||
"""Post Office Location Code. (Not used but may contain historic data or three blank spaces followed by 0)."""
|
"""Post Office Location Code. (Not used but may contain historic data or three blank spaces followed by 0)."""
|
||||||
return slice(49, 53)
|
return slice(49, 53)
|
||||||
|
|
||||||
@property
|
|
||||||
def crs_code(self):
|
def crs_code(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(53, 56)
|
return slice(53, 56)
|
||||||
|
|
||||||
@property
|
|
||||||
def description(self):
|
def description(self):
|
||||||
"""Description used in LENNON."""
|
"""Description used in LENNON."""
|
||||||
return slice(56, 72)
|
return slice(56, 72)
|
||||||
|
|
||||||
@property
|
|
||||||
def spare(self):
|
def spare(self):
|
||||||
"""No description."""
|
"""No description."""
|
||||||
return slice(72, 80)
|
return slice(72, 80)
|
||||||
|
|
||||||
|
|||||||
@@ -180,7 +180,6 @@ def generate_mca_stubs(
|
|||||||
stop = int(row["Position"].split("-")[-1])
|
stop = int(row["Position"].split("-")[-1])
|
||||||
text += [
|
text += [
|
||||||
"",
|
"",
|
||||||
" @property",
|
|
||||||
f" def {func_name}(self):",
|
f" def {func_name}(self):",
|
||||||
f' """{t if (t := str(row["Notes"])) != "nan" else "No description."}"""',
|
f' """{t if (t := str(row["Notes"])) != "nan" else "No description."}"""',
|
||||||
f" return slice({start}, {stop})",
|
f" return slice({start}, {stop})",
|
||||||
|
|||||||
Reference in New Issue
Block a user