Mapping headcode to schedule from TD

Skip to first unread message

Matthew Burdett

Aug 4, 2023, 4:43:23 AMAug 4
Following on from my interest in using the S class data, I am now looking to map the headcode from C class movements to it's relevent schedule.

I have come up with the below idea to do this and welcome any feedback or better suggestions.

1. Allocate first two or three digits of tiploc stanox codes to a describer area - in my case X7, Lewes Seaford and Southease all start with 88, I can probably use the third digit as well for more precision. An array if an area has more than one number.

2. Using the area (X7) and headcode from the C class message, look for trust movement (0003) within a time that contains the headcode, but also starts with a stanox (2 digits), or reports at a stanox (3 digits) of the stanox I have mapped to my describer area.

Im guessing this should work in most cases except for the vary small proportion of trains that might use the same HC on same area at the same time - if any.

Would this be a good way of going about this? 

Kind regards 

Chris Wraith

Aug 4, 2023, 5:52:27 AMAug 4
Hi Matthew,

I've written a service that maps the headcode (train identity) from the C-class messages to the schedule from the CIF. I'll try to describe the logic below but for it to work well, you need to have the appropriate reference data:

1. You need to have the CIF data modelled in a way that allows you to reason about the "run date" of the service i.e. you can look at a schedule record and understand the days to which each CIF schedule is applicable.
2. You have enriched the schedule records such that each one contains the areas through which the service passes. I've done this by using the SMART reference data: each STANOX entry in SMART contains a TD attribute which gives the area in which that STANOX exists. You can map TIPLOCs from the CIF schedule to STANOX entries using the TI records in the CIF.

Then, since you know the run date, area and headcode of the service, you can map it to the schedule by searching for a CIF Basic Schedule (BS) entry which applies to the current run date, has a train identity matching the headcode of the service and passes through the area you are in.

I'm not sure if this is the best way of doing it but I've found it seems to work. Let me know if you need any more details.

All the best

You received this message because you are subscribed to the Google Groups "A gathering place for the Open Rail Data community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web, visit
Reply all
Reply to author
0 new messages