noi-techpark / odh-mentor-otp

5 stars 8 forks source link

Mismatch between number of passing times/points in sequence in `ServiceJourneyPattern` and `ServiceJourney` #198

Closed leonardehrenfried closed 3 weeks ago

leonardehrenfried commented 1 month ago

The NeTEx export available from https://cloud.opendatahub.com/index.php/s/dHXsK9KsFWdKXPC contains 920 instances of the following error, which prevents some service journeys from being imported into OpenTripPlanner.

The ServiceJourney and the ServiceJourneyPattern have a different number of passing times/points in sequence.

Example

The service journey it:apb:ServiceJourney:031001T-TI-63-5-43500:sonn: has nine entries in passingTimes.

<ServiceJourney responsibilitySetRef="it:apb:ResponsibilitySet:1_TI:" id="it:apb:ServiceJourney:031001T-TI-63-5-43500:sonn:" version="5">
    <TransportMode>rail</TransportMode>
    <DepartureTime>12:05:00</DepartureTime>
    <dayTypes>
        <DayTypeRef ref="it:apb:DayType:sonn_6:" version="any"></DayTypeRef>
    </dayTypes>
    <ServiceJourneyPatternRef ref="it:apb:ServiceJourneyPattern:03100T.24a5100166:" version="5"></ServiceJourneyPatternRef>
    <VehicleTypeRef ref="it:apb:VehicleType:E2:" version="any"></VehicleTypeRef>
    <trainNumbers>
        <TrainNumberRef ref="it:apb:TrainNumber:23004:" version="any"></TrainNumberRef>
    </trainNumbers>
    <passingTimes>
        <TimetabledPassingTime version="any">
            <StopPointInJourneyPatternRef ref="it:apb:StopPointInJourneyPattern:03100T.24a-5-10016601:" version="5"></StopPointInJourneyPatternRef>
            <DepartureTime>12:05:00</DepartureTime>
        </TimetabledPassingTime>
        <TimetabledPassingTime version="any">
            <StopPointInJourneyPatternRef ref="it:apb:StopPointInJourneyPattern:03100T.24a-5-10016603:" version="5"></StopPointInJourneyPatternRef>
            <ArrivalTime>12:15:00</ArrivalTime>
            <DepartureTime>12:16:00</DepartureTime>
        </TimetabledPassingTime>
        <TimetabledPassingTime version="any">
            <StopPointInJourneyPatternRef ref="it:apb:StopPointInJourneyPattern:03100T.24a-5-10016604:" version="5"></StopPointInJourneyPatternRef>
            <ArrivalTime>12:21:00</ArrivalTime>
            <DepartureTime>12:22:00</DepartureTime>
        </TimetabledPassingTime>
        <TimetabledPassingTime version="any">
            <StopPointInJourneyPatternRef ref="it:apb:StopPointInJourneyPattern:03100T.24a-5-10016605:" version="5"></StopPointInJourneyPatternRef>
            <ArrivalTime>12:26:00</ArrivalTime>
            <DepartureTime>12:27:00</DepartureTime>
        </TimetabledPassingTime>
        <TimetabledPassingTime version="any">
            <StopPointInJourneyPatternRef ref="it:apb:StopPointInJourneyPattern:03100T.24a-5-10016606:" version="5"></StopPointInJourneyPatternRef>
            <ArrivalTime>12:30:00</ArrivalTime>
            <DepartureTime>12:31:00</DepartureTime>
        </TimetabledPassingTime>
        <TimetabledPassingTime version="any">
            <StopPointInJourneyPatternRef ref="it:apb:StopPointInJourneyPattern:03100T.24a-5-10016607:" version="5"></StopPointInJourneyPatternRef>
            <ArrivalTime>12:35:00</ArrivalTime>
            <DepartureTime>12:36:00</DepartureTime>
        </TimetabledPassingTime>
        <TimetabledPassingTime version="any">
            <StopPointInJourneyPatternRef ref="it:apb:StopPointInJourneyPattern:03100T.24a-5-10016608:" version="5"></StopPointInJourneyPatternRef>
            <ArrivalTime>12:40:00</ArrivalTime>
            <DepartureTime>12:41:00</DepartureTime>
        </TimetabledPassingTime>
        <TimetabledPassingTime version="any">
            <StopPointInJourneyPatternRef ref="it:apb:StopPointInJourneyPattern:03100T.24a-5-10016609:" version="5"></StopPointInJourneyPatternRef>
            <ArrivalTime>12:44:00</ArrivalTime>
            <DepartureTime>12:45:00</DepartureTime>
        </TimetabledPassingTime>
        <TimetabledPassingTime version="any">
            <StopPointInJourneyPatternRef ref="it:apb:StopPointInJourneyPattern:03100T.24a-5-10016610:" version="5"></StopPointInJourneyPatternRef>
            <ArrivalTime>12:56:00</ArrivalTime>
        </TimetabledPassingTime>
    </passingTimes>
    <facilities>
        <ServiceFacilitySet id="it:apb:ServiceFacilitySet:031001T-TI-63-5-43500:sonn:" version="any">
            <AccommodationAccessList>freeSeating</AccommodationAccessList>
        </ServiceFacilitySet>
    </facilities>
</ServiceJourney>

This service journey references the ServiceJourneyPattern it:apb:ServiceJourneyPattern:03100T.24a5100166: at version 5. However, this pattern has ten (not nine) points in sequence:

<ServiceJourneyPattern id="it:apb:ServiceJourneyPattern:03100T.24a5100166:" version="5">
    <Name lang="it">166</Name>
    <RouteRef ref="it:apb:Route:3-100-T-24a-5-100/R:" version="any"></RouteRef>
    <pointsInSequence>
        <StopPointInJourneyPattern id="it:apb:StopPointInJourneyPattern:03100T.24a-5-10016601:" version="5" order="1">
            <ScheduledStopPointRef ref="it:apb:ScheduledStopPoint:it-22022-95699-50-1:" version="any"></ScheduledStopPointRef>
            <ForAlighting>true</ForAlighting>
            <ForBoarding>true</ForBoarding>
            <DestinationDisplayRef ref="it:apb:DestinationDisplay:5000:" version="any"></DestinationDisplayRef>
            <RequestStop>false</RequestStop>
            <StopUse>access</StopUse>
        </StopPointInJourneyPattern>
        <StopPointInJourneyPattern id="it:apb:StopPointInJourneyPattern:03100T.24a-5-10016602:" version="5" order="2">
            <ScheduledStopPointRef ref="it:apb:ScheduledStopPoint:it-22022-95139-50-1:" version="any"></ScheduledStopPointRef>
            <ForAlighting>true</ForAlighting>
            <ForBoarding>true</ForBoarding>
            <RequestStop>false</RequestStop>
            <StopUse>passthrough</StopUse>
        </StopPointInJourneyPattern>
        <StopPointInJourneyPattern id="it:apb:StopPointInJourneyPattern:03100T.24a-5-10016603:" version="5" order="3">
            <ScheduledStopPointRef ref="it:apb:ScheduledStopPoint:it-22022-95140-0-1:" version="any"></ScheduledStopPointRef>
            <ForAlighting>true</ForAlighting>
            <ForBoarding>true</ForBoarding>
            <RequestStop>false</RequestStop>
            <StopUse>access</StopUse>
        </StopPointInJourneyPattern>
        <StopPointInJourneyPattern id="it:apb:StopPointInJourneyPattern:03100T.24a-5-10016604:" version="5" order="4">
            <ScheduledStopPointRef ref="it:apb:ScheduledStopPoint:it-22021-663-50-31110:" version="any"></ScheduledStopPointRef>
            <ForAlighting>true</ForAlighting>
            <ForBoarding>true</ForBoarding>
            <RequestStop>false</RequestStop>
            <StopUse>access</StopUse>
        </StopPointInJourneyPattern>
        <StopPointInJourneyPattern id="it:apb:StopPointInJourneyPattern:03100T.24a-5-10016605:" version="5" order="5">
            <ScheduledStopPointRef ref="it:apb:ScheduledStopPoint:it-22021-679-50-31107:" version="any"></ScheduledStopPointRef>
            <ForAlighting>true</ForAlighting>
            <ForBoarding>true</ForBoarding>
            <RequestStop>false</RequestStop>
            <StopUse>access</StopUse>
        </StopPointInJourneyPattern>
        <StopPointInJourneyPattern id="it:apb:StopPointInJourneyPattern:03100T.24a-5-10016606:" version="5" order="6">
            <ScheduledStopPointRef ref="it:apb:ScheduledStopPoint:it-22021-696-50-31106:" version="any"></ScheduledStopPointRef>
            <ForAlighting>true</ForAlighting>
            <ForBoarding>true</ForBoarding>
            <RequestStop>false</RequestStop>
            <StopUse>access</StopUse>
        </StopPointInJourneyPattern>
        <StopPointInJourneyPattern id="it:apb:StopPointInJourneyPattern:03100T.24a-5-10016607:" version="5" order="7">
            <ScheduledStopPointRef ref="it:apb:ScheduledStopPoint:it-22021-647-50-31104:" version="any"></ScheduledStopPointRef>
            <ForAlighting>true</ForAlighting>
            <ForBoarding>true</ForBoarding>
            <RequestStop>false</RequestStop>
            <StopUse>access</StopUse>
        </StopPointInJourneyPattern>
        <StopPointInJourneyPattern id="it:apb:StopPointInJourneyPattern:03100T.24a-5-10016608:" version="5" order="8">
            <ScheduledStopPointRef ref="it:apb:ScheduledStopPoint:it-22021-2460-50-31101:" version="any"></ScheduledStopPointRef>
            <ForAlighting>true</ForAlighting>
            <ForBoarding>true</ForBoarding>
            <RequestStop>false</RequestStop>
            <StopUse>access</StopUse>
        </StopPointInJourneyPattern>
        <StopPointInJourneyPattern id="it:apb:StopPointInJourneyPattern:03100T.24a-5-10016609:" version="5" order="9">
            <ScheduledStopPointRef ref="it:apb:ScheduledStopPoint:it-22021-2444-50-31098:" version="any"></ScheduledStopPointRef>
            <ForAlighting>true</ForAlighting>
            <ForBoarding>true</ForBoarding>
            <RequestStop>false</RequestStop>
            <StopUse>access</StopUse>
        </StopPointInJourneyPattern>
        <StopPointInJourneyPattern id="it:apb:StopPointInJourneyPattern:03100T.24a-5-10016610:" version="5" order="10">
            <ScheduledStopPointRef ref="it:apb:ScheduledStopPoint:it-22021-468-50-31065:" version="any"></ScheduledStopPointRef>
            <ForAlighting>true</ForAlighting>
            <ForBoarding>true</ForBoarding>
            <RequestStop>false</RequestStop>
            <StopUse>access</StopUse>
        </StopPointInJourneyPattern>
    </pointsInSequence>
</ServiceJourneyPattern>

This seems like a data error, since the StopPointInJourneyPattern it:apb:StopPointInJourneyPattern:03100T.24a-5-10016602: is never referenced? What is supposed to happen with the missing stop?

cc @rcavaliere

leonardehrenfried commented 1 month ago

Here is the complete list of journey and pattern IDs: https://gist.github.com/leonardehrenfried/72657148aaccd837ffa0243b7344814a

rcavaliere commented 1 month ago

@leonardehrenfried I understood this issue. You can see that the second point in the ServiceJourneyPattern has StopUse = passthrough. This means that in this case the vehicle (in this case a train) does not stop at the stop, just travels by. The reason why we have this is mainly related to passenger information purposes, this data are also used for some basic travel information products and they want also to visualize such stops even if not served.

Travel times in correspondence of these passthrough points are not set, and therefore you this point is not reported in the structure ServiceJourney. Can you configure the import so that you simply ignore from the export the passthrough points? I am pretty sure that 920 cases you found have exactly this issue. Most of the rail services in South Tyrol contained such thing.

leonardehrenfried commented 2 weeks ago

Upstream issue: https://github.com/opentripplanner/OpenTripPlanner/issues/6036