Here is a site where lot of GTFS related solutions are collected together; its maintained by a network of people working in the sector:
Mentioned there is one tool being used by a lot of folks in other countries for figuring out the trip_id and other stuff: http://thetransitclock.org/
It's not a simple solution. Their mailing list will give a good picture of what all it takes.
What Rigved has mentioned is unfortunately the situation for most bus transit systems, and it's unfortunate seeing that a lot of investment and buzz went into fitting buses with GPS, but they didn't bother looking into how they will update which route number the vehicle is on.
It would possible to set it up if one can get a buy-in from the bus agency.
Here's what in my opinion would be a lowest effort way to do it:
- Make a mobile app for depot managers. Every depot logs in here.
- Have them input the bus's unique number (usually a serial number painted on the bus, or the license plate number), and the route the bus is going on, the departure time and submit.
- This information is sent by the app to the backend system where the GPS data is also flowing in
- Now this backend system is able to attach route_id with each vehicle and change it when the route changes.
- It'll be possible for backend to determine which trip_id under that route this is on with some programming work put in.
At present, bus depots maintain registers where they write in which bus is going on which route and which driver and conductor. There is also a lot of paperwork later for compiling the data together to submit up the management chain. This intervention would be attractive if this writing business was replaced by digital medium and it also removes most of the paperwork burden.
But at the same time a level of flexibility and autonomy needs to be maintained. You shouldn't have the HQ breathing down their necks and micro-managing things. The Depot managers are weighing in a ton of tacit real world parameters when making decisions about which bus to send on which route, including human requirements of the personnel, street level complications etc. The dynamic decision making process goes a long way in optimizing the transit agency's utilization, efficiency, costs etc and it would be tragic to lose that all in a blind technocratic digitization rush.
Extra: I have a net negative faith in the AI/ML lobby's advertised promises to take care of this stuff. I trust the depot managers far higher and believe working with them will give better results than trying to replace them. But that's just an unqualified personal opinion.