TheTransitClock / transitime

TheTransitClock real-time transit information system

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Change block_id of a trip at runtime

zabuTNT opened this issue · comments

Hi,
I was wondering if TC contemplates the possibility to change the block_id assigned to one or more trips at runtime, only for the current day.

Let's assume we have this data in the trip.txt of GTFS provided:

route_id, trip_id, service_id, block_id
R1, T1, S1, B1
R1, T2, S1, B1
R1, T3, S2, B1
R2, T4, S3, B2

today, due a last minute problem, trip T2 cannot be carried out in block B1, but must be assigned to block B2.

The change is valid only for the current day and it is reasonable to think that the agency does not want to generate new GTFS, in addition to the fact that this reassignment could be made even just a few minutes before the departure of the vehicle (or start of shift).

I have seen in the code that a "supplement directory" for GTFS files is mentioned, but I cannot understand if and how it can be helpful to this case or not.

Hi Federico,

Thanks for your interest in TheTransitClock.

I do not think this can be changed without restarting core.

You would need to re-import the GTFS file for the specific day, with a new trips.txt file in a specified supplementary directory with the block_id changes for the specific trip_id. This change to block_id is not something I have done before so I will be interested to hear how you get on.

Hope this helps.

Cheers,

Sean.

Hi Sean,
thank you, I looked more in the code about this supplementary directory in order to figure out how to do.
I tried with a trips.txt with the new assignment blockId - tripId, and it seems sufficient for the use case.

2021-02-19-114514_670x445_scrot

Now I'm working on how automatize this procedure: supplementary trips.txt creation, reimport and restart of the core.
I'm finding inspiration for a custom module looking here:
https://github.com/TheTransitClock/transitime/blob/develop/transitclock/src/main/java/org/transitclock/custom/mbta/GenerateMbtaBlockInfo.java
and maybe listen to events coming from others components (with RabbitMQ for instance?).
I'll keep you informed. Best regards.

Nice work! I think you may be on a good road. Keep us posted.

Oh, just to mention there is a new proposed spec called "GTFS Service Changes" that may cover this use case. Might be worth a look.

https://docs.google.com/document/d/1oPfQ6Xvui0g3xiy1pNiyu5cWFLhvrTVyvYsMVKGyGWM/edit

Thank you Sean,
I'll read it for sure.

Can this be closed? I think you have answered the original query.

If you are going to add a new feature it would be good to have it in a separate issue and hopefully with a matching pull request.

Yes, this can be closed.
Thank you.