Skip to content

Improve generation of synthetic ServiceJourney and DatedServiceJourney IDs #7127

@vpaturet

Description

@vpaturet

Context
When OTP processes a SIRI message that specifies an extra-journey, a new Trip (ServiceJourney), TripPattern (JourneyPattern) and TripOnServiceDate (DatedServiceJourney) are created in the transit model.
Since there is no corresponding object in the static transit data feed (NeTEx), OTP has to create a synthetic ID on the fly for these objects.

Current behavior:
OTP builds the Trip/ServiceJourney ID based on the field EstimatedVehicleJourneyCode in the incoming SIRI-ET message:

Trip ID = EstimatedVehicleJourneyCode

The construction of the DatedServiceJourney ID follows the same logic:
DatedServiceJourney ID = EstimatedVehicleJourneyCode

The two generated ids are identical, which is not problematic inside OTP (there is no semantic associated with the ID string and OTP does not expect a specific ID structure)
However, downstream data consumers may apply validation rules on the ID and expect a given structure such as codespace:object-type:sequence-number.
This is in particular required by the Nordic NeTEx profile.

Moreover the SIRI-profile suggests constructing the EstimatedVehicleJourneyCode with the following formats:
RUT:ServiceJourney:1234 or RUT:DatedServiceJourney:1234
(https://enturas.atlassian.net/wiki/spaces/PUBLIC/pages/637370392/SIRI-ET)
In this case we end up with a service journey ID that seems to refer to a DSJ and vice-versa.

Expected behavior:
In the context of the SIRI-ET updater, OTP should do a best effort to generate IDs that follow SIRI/NeTEX naming conventions.

Suggested implementation:
If the EstimatedVehicleJourneyCode follows the format RUT:ServiceJourney:1234:

  • The Trip/ServiceJourney ID is constructed as RUT:ServiceJourney:1234
  • The TripOnServiceDate/DatedServiceJourney ID is constructed as RUT:DatedServiceJourney:1234

If the EstimatedVehicleJourneyCode follows the format RUT:DatedServiceJourney:1234:

  • The Trip/ServiceJourney ID is constructed as RUT:ServiceJourney:1234
  • The TripOnServiceDate/DatedServiceJourney ID is constructed as RUT:DatedServiceJourney:1234

If the EstimatedVehicleJourneyCode follows neither of these two formats, do not change the IDS and keep them equal.

Note! The id internally in OTP has two parts: feedId and id, encapsulated in FeedScopedId. The above discussion apply to the FeadScopedId.id, the feedId is not touched.

Metadata

Metadata

Assignees

No one assigned

    Labels

    !ImprovementA functional improvement or micro feature

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions