Traewelling / traewelling

Free check-in service to log your public transit journeys
https://traewelling.de
GNU Affero General Public License v3.0
233 stars 46 forks source link

"Last station cancelled" may result in "second to last station cancelled" #21

Closed HerrLevin closed 2 years ago

HerrLevin commented 4 years ago

Describe the bug When a train terminates before its last station, it might provoke a false-positive "cancelled station". In this example, the RE 8 19074 terminates in Lauda instead of Würzburg Hbf. Both stops have the cancelled key set to true, however Lauda still has a arrival, a arrivalDelay and a arrivalPlatform, every departure-tag is set to null. I'm guessing that cancelled might only be an indicater whether the train still departs from this stop.

To Reproduce Find a Train with cancelled last stop.

Expected behavior Show the correct stops.

Additional context Tested on 2020-02-21 with 1|262777|0|80|21022020 between 15:50 and 16:10.

API-Response:

{"origin":{"type":"stop","id":"8000096","name":"Stuttgart Hbf","location":{"type":"location","id":"8000096","latitude":48.785052,"longitude":9.182589},"products":{"nationalExpress":true,"national":true,"regionalExp":true,"regional":true,"suburban":true,"bus":true,"ferry":false,"subway":false,"tram":true,"taxi":false}},"destination":{"type":"stop","id":"8000260","name":"Würzburg Hbf","location":{"type":"location","id":"8000260","latitude":49.802163,"longitude":9.93593},"products":{"nationalExpress":true,"national":true,"regionalExp":false,"regional":true,"suburban":false,"bus":true,"ferry":false,"subway":false,"tram":true,"taxi":false}},"departure":"2020-02-21T15:05:00+01:00","arrival":null,"reachable":true,"line":{"type":"line","id":"re-8","fahrtNr":"19074","name":"RE 8","public":true,"mode":"train","product":"regional","operator":{"type":"operator","id":"go-ahead-baden-wurttemberg-gmbh","name":"Go-Ahead Baden-Württemberg GmbH"},"additionalName":"RE 8"},"direction":"Würzburg Hbf","arrivalPlatform":null,"departurePlatform":"5","stopovers":[{"stop":{"type":"stop","id":"8000096","name":"Stuttgart Hbf","location":{"type":"location","id":"8000096","latitude":48.785052,"longitude":9.182589},"products":{"nationalExpress":true,"national":true,"regionalExp":true,"regional":true,"suburban":true,"bus":true,"ferry":false,"subway":false,"tram":true,"taxi":false}},"arrival":null,"arrivalDelay":null,"arrivalPlatform":null,"departure":"2020-02-21T15:05:00+01:00","departureDelay":null,"departurePlatform":"5"},{"stop":{"type":"stop","id":"8000235","name":"Ludwigsburg","location":{"type":"location","id":"8000235","latitude":48.892374,"longitude":9.185115},"products":{"nationalExpress":true,"national":false,"regionalExp":false,"regional":true,"suburban":true,"bus":true,"ferry":false,"subway":false,"tram":false,"taxi":false}},"arrival":"2020-02-21T15:16:00+01:00","arrivalDelay":null,"arrivalPlatform":"1","departure":"2020-02-21T15:19:00+01:00","departureDelay":null,"departurePlatform":"1"},{"stop":{"type":"stop","id":"8000038","name":"Bietigheim-Bissingen","location":{"type":"location","id":"8000038","latitude":48.948044,"longitude":9.137499},"products":{"nationalExpress":false,"national":false,"regionalExp":false,"regional":true,"suburban":true,"bus":true,"ferry":false,"subway":false,"tram":false,"taxi":false}},"arrival":"2020-02-21T15:26:00+01:00","arrivalDelay":null,"arrivalPlatform":"10","departure":"2020-02-21T15:29:00+01:00","departureDelay":null,"departurePlatform":"10"},{"stop":{"type":"stop","id":"8000157","name":"Heilbronn Hbf","location":{"type":"location","id":"8000157","latitude":49.143245,"longitude":9.207579},"products":{"nationalExpress":true,"national":false,"regionalExp":false,"regional":true,"suburban":true,"bus":true,"ferry":false,"subway":false,"tram":false,"taxi":false}},"arrival":"2020-02-21T15:47:00+01:00","arrivalDelay":null,"arrivalPlatform":"3","departure":"2020-02-21T15:48:00+01:00","departureDelay":null,"departurePlatform":"3"},{"stop":{"type":"stop","id":"8004220","name":"Neckarsulm","location":{"type":"location","id":"8004220","latitude":49.188668,"longitude":9.219759},"products":{"nationalExpress":false,"national":false,"regionalExp":false,"regional":true,"suburban":true,"bus":true,"ferry":false,"subway":false,"tram":false,"taxi":false}},"arrival":"2020-02-21T15:52:00+01:00","arrivalDelay":null,"arrivalPlatform":"1","departure":"2020-02-21T15:52:00+01:00","departureDelay":null,"departurePlatform":"1"},{"stop":{"type":"stop","id":"8000017","name":"Bad Friedrichshall Hbf","location":{"type":"location","id":"8000017","latitude":49.231205,"longitude":9.200091},"products":{"nationalExpress":false,"national":false,"regionalExp":false,"regional":true,"suburban":true,"bus":true,"ferry":false,"subway":false,"tram":false,"taxi":false}},"arrival":"2020-02-21T15:57:00+01:00","arrivalDelay":0,"arrivalPlatform":"3","departure":"2020-02-21T15:58:00+01:00","departureDelay":0,"departurePlatform":"3"},{"stop":{"type":"stop","id":"8004050","name":"Möckmühl","location":{"type":"location","id":"8004050","latitude":49.321187,"longitude":9.357977},"products":{"nationalExpress":false,"national":false,"regionalExp":false,"regional":true,"suburban":false,"bus":true,"ferry":false,"subway":false,"tram":false,"taxi":false}},"arrival":"2020-02-21T16:14:00+01:00","arrivalDelay":0,"arrivalPlatform":"2","departure":"2020-02-21T16:15:00+01:00","departureDelay":0,"departurePlatform":"2"},{"stop":{"type":"stop","id":"8000295","name":"Osterburken","location":{"type":"location","id":"8000295","latitude":49.42992,"longitude":9.422996},"products":{"nationalExpress":false,"national":false,"regionalExp":false,"regional":true,"suburban":true,"bus":true,"ferry":false,"subway":false,"tram":false,"taxi":true}},"arrival":"2020-02-21T16:26:00+01:00","arrivalDelay":0,"arrivalPlatform":"4","departure":"2020-02-21T16:27:00+01:00","departureDelay":0,"departurePlatform":"4"},{"stop":{"type":"stop","id":"8000221","name":"Lauda","location":{"type":"location","id":"8000221","latitude":49.56537,"longitude":9.70959},"products":{"nationalExpress":false,"national":false,"regionalExp":false,"regional":true,"suburban":false,"bus":true,"ferry":false,"subway":false,"tram":false,"taxi":true}},"arrival":"2020-02-21T16:49:00+01:00","arrivalDelay":0,"arrivalPlatform":"3","departure":null,"departureDelay":null,"departurePlatform":null,"cancelled":true,"formerDepartureDelay":null,"scheduledDeparture":"2020-02-21T16:50:00+01:00"},{"stop":{"type":"stop","id":"8000260","name":"Würzburg Hbf","location":{"type":"location","id":"8000260","latitude":49.802163,"longitude":9.93593},"products":{"nationalExpress":true,"national":true,"regionalExp":false,"regional":true,"suburban":false,"bus":true,"ferry":false,"subway":false,"tram":true,"taxi":false}},"arrival":null,"arrivalDelay":null,"arrivalPlatform":null,"departure":null,"departureDelay":null,"departurePlatform":null,"cancelled":true,"formerArrivalDelay":null,"scheduledArrival":"2020-02-21T17:20:00+01:00","remarks":[]}],"remarks":[{"text":"Number of bicycles conveyed limited","type":"hint","code":"bicycle-conveyance","summary":"bicycles conveyed"},{"type":"hint","code":"GL","text":"Conveyance of groups is limited"},{"text":"Behindertengerechtes Fahrzeug","type":"hint","code":"barrier-free-vehicle","summary":"barrier-free vehicle"}],"cancelled":true,"arrivalDelay":null,"scheduledArrival":"2020-02-21T17:20:00+01:00","id":"1|262777|0|80|21022020"}
HerrLevin commented 2 years ago

Okay, so this is definitely happening.

Current example is the S8 from Wiesbaden Hbf towards Offenbach. They're ending in Mainz-Bischofsheim.

The last available station also has a cancelled tag. We could distinguish a cancelled station from an available station by looking at arrival, plannedArrival and the not nulled arrivalPlatform.

      "arrival": "2022-03-03T09:42:00+01:00",
      "plannedArrival": "2022-03-03T09:40:00+01:00",
      "arrivalDelay": 120,
      "arrivalPlatform": "1",
      "plannedArrivalPlatform": "2",
      "departure": null,
      "plannedDeparture": "2022-03-03T09:40:00+01:00",
      "departureDelay": null,
      "departurePlatform": null,
      "plannedDeparturePlatform": null,
      "cancelled": true,

The result of https://v5.db.transport.rest/trips/1|229480|2|80|3032022?lineName=S 8 (in parts):

{
  "origin": {
    "type": "stop",
    "id": "8000250",
    "name": "Wiesbaden Hbf",
    "location": {
      "type": "location",
      "id": "8000250",
      "latitude": 50.070563,
      "longitude": 8.243639
    },
    "products": {
      "...": "..."
    }
  },
  "destination": {
    "type": "stop",
    "id": "8004645",
    "name": "Offenbach(Main)Ost",
    "location": {
      "type": "location",
      "id": "8004645",
      "latitude": 50.102655,
      "longitude": 8.784529
    },
    "products": {
      "...": "..."
    }
  },
  "departure": "2022-03-03T09:18:00+01:00",
  "plannedDeparture": "2022-03-03T09:18:00+01:00",
  "departureDelay": 0,
  "arrival": null,
  "plannedArrival": "2022-03-03T10:32:00+01:00",
  "arrivalDelay": null,
  "reachable": true,
  "line": {
    "type": "line",
    "id": "4-800528-8",
    "fahrtNr": "35825",
    "name": "S 8",
    "public": true,
    "adminCode": "800528",
    "productName": "S",
    "mode": "train",
    "product": "suburban",
    "operator": {
      "type": "operator",
      "id": "db-regio-ag-s-bahn-rhein-main",
      "name": "DB Regio AG S-Bahn Rhein-Main"
    }
  },
  "direction": "Offenbach(Main)Ost",
  "arrivalPlatform": null,
  "plannedArrivalPlatform": null,
  "departurePlatform": "3",
  "plannedDeparturePlatform": "3",
  "stopovers": [
    {
      "stop": {
        "type": "stop",
        "id": "8000250",
        "name": "Wiesbaden Hbf",
        "location": {
          "type": "location",
          "id": "8000250",
          "latitude": 50.070563,
          "longitude": 8.243639
        },
        "products": {
          "nationalExpress": true,
          "national": true,
          "regionalExp": false,
          "regional": true,
          "suburban": true,
          "bus": true,
          "ferry": false,
          "subway": false,
          "tram": false,
          "taxi": false
        }
      },
      "arrival": null,
      "plannedArrival": null,
      "arrivalDelay": null,
      "arrivalPlatform": null,
      "plannedArrivalPlatform": null,
      "departure": "2022-03-03T09:18:00+01:00",
      "plannedDeparture": "2022-03-03T09:18:00+01:00",
      "departureDelay": 0,
      "departurePlatform": "3",
      "plannedDeparturePlatform": "3"
    },
    {
      "stop": {
        "type": "stop",
        "id": "8006404",
        "name": "Wiesbaden Ost",
        "location": {
          "type": "location",
          "id": "8006404",
          "latitude": 50.041438,
          "longitude": 8.256412
        },
        "products": {
          "nationalExpress": false,
          "national": false,
          "regionalExp": false,
          "regional": true,
          "suburban": true,
          "bus": true,
          "ferry": false,
          "subway": false,
          "tram": false,
          "taxi": false
        }
      },
      "arrival": "2022-03-03T09:22:00+01:00",
      "plannedArrival": "2022-03-03T09:22:00+01:00",
      "arrivalDelay": 0,
      "arrivalPlatform": "3",
      "plannedArrivalPlatform": "3",
      "departure": "2022-03-03T09:22:00+01:00",
      "plannedDeparture": "2022-03-03T09:22:00+01:00",
      "departureDelay": 0,
      "departurePlatform": "3",
      "plannedDeparturePlatform": "3"
    },
    {
      "...": "..."
    },
    {
      "stop": {
        "type": "stop",
        "id": "8000241",
        "name": "Mainz-Bischofsheim",
        "location": {
          "type": "location",
          "id": "8000241",
          "latitude": 49.992941,
          "longitude": 8.358062
        },
        "products": {
          "...": "..."
        }
      },
      "arrival": "2022-03-03T09:42:00+01:00",
      "plannedArrival": "2022-03-03T09:40:00+01:00",
      "arrivalDelay": 120,
      "arrivalPlatform": "1",
      "plannedArrivalPlatform": "2",
      "departure": null,
      "plannedDeparture": "2022-03-03T09:40:00+01:00",
      "departureDelay": null,
      "departurePlatform": null,
      "plannedDeparturePlatform": null,
      "cancelled": true,
      "remarks": []
    },
    {
      "stop": {
        "type": "stop",
        "id": "8005221",
        "name": "Rüsselsheim Opelwerk",
        "location": {
          "type": "location",
          "id": "8005221",
          "latitude": 49.987827,
          "longitude": 8.400743
        },
        "products": {
          "...": "..."
        }
      },
      "arrival": null,
      "plannedArrival": "2022-03-03T09:44:00+01:00",
      "arrivalDelay": null,
      "arrivalPlatform": null,
      "plannedArrivalPlatform": null,
      "departure": null,
      "plannedDeparture": "2022-03-03T09:44:00+01:00",
      "departureDelay": null,
      "departurePlatform": null,
      "plannedDeparturePlatform": null,
      "cancelled": true,
      "remarks": []
    }
  ],
  "cancelled": true,
  "id": "1|229480|2|80|3032022",
  "realtimeDataUpdatedAt": 1646295074
}