Public Housing in Singapore. Photo by DollarsAndSense
Public Housing in Singapore. Photo by DollarsAndSense

A little background

Recently, I applied for Build-To-Order (BTO) under the Housing Development Board (HDB) for a new flat. For those who are not familiar with Singapore’s public housing, Singaporeans can apply for a brand new flat built by HDB with a waiting period of 3–5 years. Those successful applicants will get a queue number which determines their order of selecting a unit in the project. Thankfully, I was lucky enough to get a queue number. All that’s left to do was to select a unit of my choice and pray hard enough it remains available until my appointment date.

Initially, it was easy to shortlist a couple of units based on my own criteria such as potential resale value, blocked/unblocked view, etc. However, as they always say reality is harsh and my favorite units were being taken by others.

Here comes the problem…

Eventually, I started to find myself in a painful cycle every day : 1) Check if any units were selected on the HDB website. 2) If yes, are they among my shortlisted units? 3) If yes, c̶r̶i̶e̶s̶ ̶i̶n̶t̶e̶r̶n̶a̶l̶l̶y̶ re-evaluate my choices.

The very page I can’t help but stare at every single day before our appointment
The very page I can’t help but stare at every single day before our appointment

Apparently, I wasn’t the only one with this issue. This realization came pretty quick after being in a Telegram group with my future neighbors for a day. *Yeap you heard that right, smart nation FTW. *So I figured, it’s Python time.


And the plan?

To automate the whole process of checking units and personalize the experience while incurring minimal or zero cost for me.

The Process

First of all, content. I needed to extract the availability of units and other miscellaneous information from HDB website. This can be done using BeautifulSoup package or Selenium in Python. In this case, I went with BeautifulSoup due to the simplistic nature of the task. I won’t be going into details on the implementation as that will be a separate topic. However, for those interested, there are plenty of tutorials online and here’s a pretty good one.

Second, storage. In order to cater to individuals, I will have to store user data on top of units data for future reference, which I went with MongoDB Free Tier Cloud Database (Atlas M0). Atlas M0 was definitely more than enough for the task at hand. Furthermore, Python has pymongo package which made setup really simple.

Most importantly, consumption. How will I want to view this information, get updates from? Also, who else will want to use this? Naturally, since I found my future neighbors from Telegram, it made immediate sense to serve this in the form of a Telegram bot. Without a doubt, I went with python-telegram-bot package given my first-hand experience with the strong support from its community and the amount of customization I could do with it.

Process of setting up an Azure VM
Process of setting up an Azure VM

After spending a couple of hours to create basic features such as user signup, notifications when units of their choice are taken and sending of daily summaries, the bot was ready for deployment. Hosting the scripts on a virtual machine will allow the bot to run 24/7. I hosted it on Azure, Microsoft’s very own cloud computing platform. By the way, students get $100 credits when they sign up on Azure. Setting up a VM on Azure was pretty much a piece of cake, purely clicking and deciding the tier and location of my VM. Within minutes, BTO Buddy went live.


Importance of User Feedback

One thing I made sure to do this time was to include a feedback button in the very first version, allowing users to anonymously leave suggestions on how I could improve BTO Buddy. You’ll be surprised by the kind of feedback you receive. One user suggested that instead of manually typing one unit at a time for a stack (e.g. #07–111, #08–111, #09–111), they could input the stack and all units with #xx-111 will be included into the watchlist. I went on to develop that feature for them.


The Result

Finally, after a couple of revisions and listening to users’ feedback, here’s what BTO Buddy can do:

  • Personalization of watchlist and notifications

Example of heartbreaking notification sent to users when their favourite units are taken
Example of heartbreaking notification sent to users when their favourite units are taken

  • Estimation of users’ chances based on their queue number

Example of a user’s profile and chances
Example of a user’s profile and chances

  • Display the current status of units and its’ popularity

Example of how a user can check the status of their units
Example of how a user can check the status of their units

With that, BTO Buddy is more or less completed and currently serving 200+ users. As for its sustainability, perhaps I might have to find some way to offset the cost of hosting ($5~10). If you ever have a chance to apply for BTO, do give BTO Buddy (@btobuddy_bot) a try!

Update: Part 2 has been released!