OpendataCH / Transport

Swiss public transport API
http://transport.opendata.ch/
MIT License
241 stars 50 forks source link

Inconsistent information in /stationboard and /connections #140

Closed WalterWolf49 closed 7 years ago

WalterWolf49 commented 8 years ago

The stationboard api returns train informations like operator : "THURBO", name : "S 30" and number : "30". The connections api returns different informations for the same train e.g: operator : "THU", name : "S 30 8047" and number : "8047"

fabian commented 8 years ago

Is this the same issue as reported in https://github.com/OpendataCH/Transport/issues/122?

WalterWolf49 commented 8 years ago

Yes it's the same issue... Is it not possible to get the full train number for both the stationboard and the connections?

fabian commented 7 years ago

If you can send me the requests (full URL) for both /stationboard and /connections which return the S 30 8047 I can have a detailed look.

WalterWolf49 commented 7 years ago

It's for the S 30 8055: http://transport.opendata.ch/v1/stationboard?station=winterthur&datetime=2016-09-12%2013:45 and http://transport.opendata.ch/v1/connections?from=winterthur&to=weinfelden&date=2016-09-12&time=13:44

fabian commented 7 years ago

Okay, so this is the information we get back:

Stationboard

<JourneyAttributeList>
  <JourneyAttribute from="0" to="10">
    <Attribute type="NAME">
      <AttributeVariant type="NORMAL">
        <Text>S 30</Text>
      </AttributeVariant>
    </Attribute>
  </JourneyAttribute>
  <JourneyAttribute from="0" to="10">
    <Attribute type="OPERATOR">
      <AttributeVariant type="NORMAL">
        <Text>THURBO</Text>
      </AttributeVariant>
    </Attribute>
  </JourneyAttribute>
  <JourneyAttribute from="0" to="10">
    <Attribute type="NUMBER">
      <AttributeVariant type="NORMAL">
        <Text>30</Text>
      </AttributeVariant>
    </Attribute>
  </JourneyAttribute>
</JourneyAttributeList>

Connections

<JourneyAttributeList>
  <JourneyAttribute from="0" to="10">
    <Attribute type="NAME">
      <AttributeVariant type="NORMAL">
        <Text>S 30 8055</Text>
      </AttributeVariant>
    </Attribute>
  </JourneyAttribute>
  <JourneyAttribute from="0" to="10">
    <Attribute type="OPERATOR">
      <AttributeVariant type="SHORT">
        <Text>THU</Text>
      </AttributeVariant>
      <AttributeVariant type="NORMAL">
        <Text>THURBO</Text>
      </AttributeVariant>
      <AttributeVariant type="LONG">
        <Text>THURBO</Text>
      </AttributeVariant>
    </Attribute>
  </JourneyAttribute>
  <JourneyAttribute from="0" to="10">
    <Attribute type="NUMBER">
      <AttributeVariant type="NORMAL">
        <Text>8055</Text>
      </AttributeVariant>
    </Attribute>
  </JourneyAttribute>
</JourneyAttributeList>

So we can improve the operator field by checking the variant type and I will create a pull request for that but unfortunately the name and number are not consistent at SBB so it would require parsing additional fields to get it right - contributions are welcome here.

WalterWolf49 commented 7 years ago

Okay, having a correct operator is a nice improvement. Thanks for that. The biggest improvement would be to have consistent numbers, maybe that can be added in the future.

fabian commented 7 years ago

Okay, I've merged the operator pull request.

fabian commented 7 years ago

I've just improved the parsing of the number by using the LINE attribute.

@WalterWolf49 can you confirm this is now as expected?

WalterWolf49 commented 7 years ago

@fabian I've checked it and it does look as expected! Thanks for adding this!

WalterWolf49 commented 7 years ago

Just so you don't get bored, another improvement would be to have the train number in addition to the line number :) If it's possible... But for now I'm happy with the line number.