Project bus-routes-3

Image Posted on Updated on

work on web app is in progress, I have replaced the drop-down menu with jQuery auto-complete widget. The result:

  • the home page loads in quickly also searching is lot simpler now. Just type the respective stop name and the auto-complete function will find it for you.
  • The api call is also reduced which has contributed to the speed.

Now I will be working on other functionality, such as in this window


the bus number will be clickable, which will in turn show all the details associated with it. Also on the home page


I will add few more options in the navbar and probably take care of the alignment of the elements.

Also by tomorrow I have to start working on the mobile aspect of the site.


Project bus-routes -2

Posted on

After my first post on the same I worked on the adding the database and the api. So, for the now there are some entries in the database(156) and an api can interact this. I now need to work on the web interface to interact with the api. I will also have to add a form that will store the edit options.


The source code for the api is available on Github

Project bus-routes -1

Posted on Updated on

For the last 4 days I have been writing codes for this project. Let me first explain whats it about. Basically it will be a mobile app which will show the bus number of different routes of kolkata. There are many websites and mobile apps which give this service but the real problem is that these sites are not totally correct and information is sometimes incomplete. For this I have decided to add an edit feature to the app.

So, if the user feels that the information needs some correction or is totally wrong  he/she can edit the record, this will help in creating a better database. At the start I got this idea that I simply cannot get information that is 100% correct, so this edit feature. Just like wikipedia does. 😉

I wrote some code (basically extracted information into my local database). The site I am using to get all the information is here.

there were few other sites as well but the html so badly written that I couldn’t parse the desired data. In this case a single line python regrex expression did the job for me. Another python code got me all data present across 9 pages on the site.

Once I had all the desired data I stored them into my mongodb database and then some sorting. Adding few fields such as from, to, via, bus number. This was piece of cake, the real work was presenting this data when a query was made on the site. I started with the web app and would hence copy the same logic across mobile app.

Wrote a simple web app in Flask the site was up in few minutes. I used my API code (written in Bangalore) to search for the required data from the database. And boom, I realized my first problem, the site I chose to extract the information had multiple instances of same name. For ex: there was Howrah. and Howrah so if the former is to be matched against the latter in the database no result will be given. There are 405 records which had approx 10 names in it. So, the total number of names becomes approx 4k, wow!!!.

Now how to remove this shortcoming? (which I would not have got, if the admin of the site choose to be little bit sensible while writing the code.) i am thinking of adding models (just like in Django ) in the code and store all the record in a separate model. This would give me a standard entry to search for. But this would also mean I would have to feed all the data across every field. (there are many records) I can write a script that would populate all the models for me, hmm I will have to think about it.

The models will also help me in adding the edit feature that I was talking about. Something I had done in my previous internship. I will keep posting with all the progress. Meanwhile the present codes reside at Github, lot of changes need to be done in the coming days.

Until next