Inspiration

After missing important lessons due to bad experiences with trains, we found that we could have planned ahead of time from SMRT's status update tweets. Unfortunately nobody has time to check every day. Hence, we want to bring them to people through a Telegram bot. No downloads (if you already have telegram), no registration.

What it does

The bot allows users to enter their daily routes, and will send them a message when these lines go down, as soon as the status update tweet is posted. Users can interface with the bot (@TrainTrack_bot) just like any other telegram user and receive updates, using the following list of commands. /help: Display help /route station, station, [station...]: Specify a route to track. A route will be generated based on the list of stations (e.g /route Clementi, Jurong East, Woodlands) /check [all]: Display all routes you are tracking. Include 'all' for detailed routes /stop : Clear all routes

How I built it

  • A telegram component routinely sends and retrieves messages and passes them to the main component.
  • The main component parses the message and determines what to do.
  • The model component keeps track of user and station data and saves regularly to a database.
  • Meanwhile, a twitter component regularly keeps tracks of tweets as they come. Using simplified NLP, it works out the train stations affected and notifies the main component accordingly for messages to be disbursed.
  • The third component handles all interaction with the bot and the user, and uses these updates to inform people when train lines are delayed, disrupted or resumed, as well as if free bus services are still provided.

Challenges I ran into

  • SMRT/SBS has no public API for checking train status, so we had to resort to getting that from tweets.
  • Twitter's API needs us to apply for it with our phone numbers. Lacking the time to wait for approval, we decided to scrape HTML.
  • The posts do not follow consistent formats, and contains typos. The parser had to be robust and work despite these errors.
  • A lot of different forms of data had to be scraped and processed.

Accomplishments that I'm proud of

This is our first time creating a telegram bot.

Built With

Share this project:

Updates