• Our new ticketing site is now live! Using either this or the original site (both powered by TrainSplit) helps support the running of the forum with every ticket purchase! Find out more and ask any questions/give us feedback in this thread!

Historic running data: service codes from headcodes

Status
Not open for further replies.

Bielsa96

New Member
Joined
27 Dec 2023
Messages
4
Location
London
I'm trying to deduce the service codes of historic services from a limited set of information from a dataset I'm working on. The data I've got include:
- Date
- Operator
- Station stop
- Departure time from stop (scheduled)
- 4 digit headcode/train ID

For example:
- Saturday 8th July 2023
- Avanti
- Stafford
- 13:24
- 9A53

Is there an open datafeed/ Rail Data Marketplace dataset which would allow me to deduce the service code from this information?

I can use https://live.rail-record.co.uk/run-history/?headcode=9A53&a= to show me recent services with that headcode, which should allow me to isolate the Origin and Destination when cutting by Operator as well. The issues with this are:
a) I'm writing some code to try and automate this, as there's a lot of these and it will be updated a few times a year, so searching one-by-one isn't really feasible
b) It doesn't actually have the service code (although it's probably deducible from the OD pair, so maybe just an extra step)
c) I'd have to assume these headcodes are fairly static (i.e. the 9A53 which Avanti ran this week is the same service as the one which ran a year or so ago). Not sure how strong this assumption is. If they're mostly stable then that's fine.

Thanks in advance.
 
Sponsor Post - registered members do not see these adverts; click here to register, or click here to log in
R

RailUK Forums

jfollows

Established Member
Joined
26 Feb 2011
Messages
10,097
Location
Wilmslow
c) I'd have to assume these headcodes are fairly static (i.e. the 9A53 which Avanti ran this week is the same service as the one which ran a year or so ago). Not sure how strong this assumption is. If they're mostly stable then that's fine.

Thanks in advance.
The “53” is really just in numeric order, so it might not change every year but you need to be careful of assuming that it doesn’t. It’s probably preceded by 1A52 and followed by 1A54, with the “9” denoting that the train goes via Birmingham, but it could easily change in a different timetable year.
 

Robski

Member
Joined
15 May 2016
Messages
336
Do you mean service group code (also known as a train service code), i.e. 22114001 for your example? If this is the case, then this archive should contain what you are looking for. The CIF timetable data contains train service codes, more info here. You'll need to do some work to process the timetables though.

Also worth pointing out that one service can have multiple TSCs - e.g. Thameslink services change TSCs at Farringdon/City Thameslink.
 

Bielsa96

New Member
Joined
27 Dec 2023
Messages
4
Location
London
Thanks very much for the quick replies.

Yes it's the service group code I'm after (22114001 in this case).

I've got access to planned timetable information with service group codes, but this doesn't have the headcodes as it's more for future demand modelling. I will primarily use that to match, but where there is ambiguity I'll try and reference the CIF archive for help.

For example, when I try and find a matching service using the info provided with my timetable data, there are two Avanti trains scheduled to depart Stafford at 13:24: one EUS<>BPN, and one EUS<>CTR. The addition of the headcode from that CIF archive will, I hope, remove this ambiguity for the few cases of simultaneous departure from the same stop. In this case it suggests the BPN service is the correct one.

Thanks again.
 
Status
Not open for further replies.

Top