This website is useful for TOPS numbers because it will confirm which are actually allocated to track machines etc:
https://www.ontrackplant.com/headcodes
That's very useful, thanks. There are certain letter and number combinations in a headcode that make me think they are track machines but I've never seen a complete list, or realised that some headcodes were related to specific machines.
Loco workings are not allocated until the day of so it is not possible to derive this information days before..
Loco diagrams are invariably planned over a week in advance to allow locos to be in position for maintenance (or specific requirements)
Practices might vary between companies, but from what I've seen locos tend to be diagrammed by class (or sub-class) rather than loco number, taking fuel range and traffic requirements for the week into account, but not maintenance assignments. It's more about ensuring that if three locos are required off a depot on Tuesday morning, there will be three locos there, providing some loco or other works the diagrammed services and light engine moves. Locos will sometimes stick to a particular diagram for a week, but it's common for them to swap between diagrams for one reason or another, especially if they are operating from a busy location with a lot of trains.
Actual loco allocations for workings from each depot or yard are produced daily by loco controllers, who will swap locos between diagrams as required to route them towards assigned maintenance allocations at larger depots, and ensure that locos receive routine A exams which are usually done locally. Even then, the actual locos on each working might change. Failures, late running, cancellations, the position of locos on a depot, might affect which loco appears on a train. In some cases it doesn't matter if the locos get swapped about onto different workings for convenience (providing they have sufficient fuel), in other cases specific locos need to be on specific trains to get them into position for maintenance assignments. One exception to daily allocations is that certain locos will be on a "captive diagram" where they end up on the same service for a week (out and back workings between two terminals) before returning to a depot at the weekend.