The other day I was riding a 2 train, and the Trip Descriptor's Path Identifier changed while I was still on the train. Since I was doing an exact string match on the Trip Descriptor, the old trip descriptor and the new trip descriptor were no longer equal.
After looking at the documentation, I found that the Shape Identifier shouldn't be used for equality: "The combination of Origin Time, Route ID and Direction can be used to identify a unique trip. The Path Identifier should be considered optional data that will only be provided when known. This could result with it being there at the start of a trip but not during portions of the trip."
So yesterday, I spent some time doing a partial string match on Trip Descriptors, leaving off the Path Identifier. My experience riding the 2 train reflected what the documentation said: "This could result with it being there at the start of a trip but not during portions of the trip."
But then I ran into colliding Trip Descriptors, for what really looked like two different trains, as noted in my original post.
What key should I use to uniquely identify a train?
The Trip Descriptor minus the Path Identifier plus the train_id?