cheeaun / busrouter-sg

BusRouter SG: Singapore Bus Routes Explorer

Home Page:https://busrouter.sg/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bus arrivals do not differentiate between directions/visit number

joeyfoo opened this issue Β· comments

Some bus services call at the same stop multiple times, or while on different directions.

The best example is Serangoon Garden Circus, stop 66271. There, service 136 calls at the stop in both direction 1 and 2, while service 315 and 317 calls at the same stop twice in the same direction (they're loop services so there's only direction 1).

An example of how this is handled by the MyTransport app attached:
image

Proposed solution

It turns out to solve this, changes would be needed both in busrouter-sg as well as in arrivelah:

  • Update arrivelah to include a field that merges both direction and visit number (I don't think there's a situation that has both)
  • Update busrouter-sg bus arrival page logic to handle having to use both service number and direction as identifier

I've also made a quick mockup of how I envision the updated arrival time page to look:
image

I'm willing to work on this, just want to get a go-ahead before I proceed

Wow this is quite the discovery. You're right, this requires both arrivelah and busroutersg changes.

I've just checked the API response from LTA, there's no direction but there's OriginCode and DestinationCode, which I think they are the start and end bus stop codes.

Screenshot 2022-06-14 at 8 28 13 PM

As for bus 73, the only hint seems to be when both codes are the same:

Screenshot 2022-06-14 at 8 29 56 PM

Seems like VisitNumber would be important too, since it could hint which destination(?) the bus is going to πŸ€”

Your mockup looks good, but will need to extend this to the "summary" view here too:

Screenshot 2022-06-14 at 8 32 54 PM

Obviously the above is a bug, since it's only showing one 136. Maybe could still show one but two timings instead(?) Or maybe no need any changes as user can still open up the more detailed view πŸ€”

Looking at bus 73, seems like even the diagram can be "wrong" too, looking at this:

Screenshot 2022-06-14 at 8 38 47 PM

Since they are the same stop, it could be "combined" into a single dot πŸ˜… For this, I think I'll set aside first for now πŸ˜›

Thanks for the report, I'll look into adding the fields on arrivelah first πŸ™

Just for clarity, there are two situations here:

  • Same bus number, same direction, calling twice at the same stop

    • 73, 315, 317 - all loop services (i.e. the service only has a single Direction 1)
    • In the Bus Arrival API, you only have a single object with "ServiceNo": "73", and the way to tell buses apart is to check each next bus's VisitNumber
    • "315": {
          "name": "S'Goon Int ⟲ Blk 538",
          "routes": [
              [
                  "66009",
                  // ...
                  "66121",
                  "66271", // <---
                  "66131",
                  // ...
                  "66139",
                  "66271", // <---
                  "66129",
                  // ...
                  "66009"
              ]
          ]
      }
  • Same bus number, different direction, calling once each at the same stop

    • 136 Direction 1 and 136 Direction 2
    • In the Bus Arrival API: you have two objects with "ServiceNo": "136", and the way to tell buses apart is to check each next bus's DestinationCode, tho they will be grouped together
    • "136": {
          "name": "Ang Mo Kio Int ⇄ Punggol Temp Int",
          "routes": [
              [
                  "54009",
                  // ...
                  "66121",
                  "66271", // <---
                  "66131",
                  // ...
                  "65009"
              ],
              [
                  "65009",
                  // ...
                  "66139",
                  "66271", // <---
                  "66129",
                  // ...
                  "54009"
              ]
          ]
      }

Since they are the same stop, it could be "combined" into a single dot

I don't think they should be combined, will be even more confusing. The only reason Serangoon Garden has this mess is because the bus stop is on a roundabout, and buses in both directions need to share the same bus shelter. Maybe just a solid line instead of a dashed line will do the trick.

I was having this issue too. These bus services have/had differentiation by their two-sided additional plate with the number - one way red plate & white number, the other way, the colours are reversed.

This could be used in the visualisation. Unfortunately, it seems to be required to be hard coded as 73 has white plate, then red plate. 123M red, then white. 123, 131 not loop but impacted. 136 stopped the practice altogether in 2016. The midway destination is shown on the LED front panel on first visit. I think that could be the best indication but not trivial to implement.

(Also, just ranting, these bus stops suffer from JSONs max. 3 buses structure as they practically show two of one direction, one of the other.)