Day 7 – Project Transit Notifier
To do: Make functions to validate vehicle and to process the queueWhat I did: I had to research about what is the average distance between transit stops. Turns out there is a thing called "walk radius," which is the distance individuals are willing to walk to a stop, which city planners and transit take into account. It turns out that in the united states 1/4 of a mile is the magically number:
How big is the walk radius? Actually, different people are comfortable walking different distances, so a truer view of these circles would be very fuzzy, gradually dissapating further out from the stop. You don't want to look at that, though, and it's hard to do geometry with it, so transit planners generally observe that the walking distance that most people seem to tolerate -- the one beyond which ridership falls off drastically -- is about 400m (around 1/4 mi) for a local-stop service, and about 1000m (around 3/5 mi) for a very fast, frequent, and reliable rapid transit service. (I, personally, will walk further than this. You may not be willing to walk even this far, but as an approximation the 400m rule for local service seens to work pretty well.) http://www.humantransit.org/
In the United States, local bus stops are often located about 1/4 mile apart or less, with rapid stops 1/2 to 1 mile apart.[2] http://www.transitwiki.org
So I worked on creating a function to pull the transit_request(queue) that still need to be processed and to check where the vehicle is location and check the vincenty rate in miles (how close it is) and if its equal to or under the "walk radius" from my user's destination geolocation then to send the message to my user and set their request to "complete" (is_finished = True) and if not then it'll leave it alone and try again in a certain amount of time (I'm still playing with how ofter I want to check, I'm testing for every min).I got it working, and I set it to my stop (near my home), but it wasn't working. I looked up the lat/lon for the vehicle and it was no way near the N line's route. AHH! My first thoughts were all the different parts that can have gone wrong! So, I looked up my vehicle number to make sure that I'm not calling the wrong lat/lon. And I look up the vehicle id that my program selected as the closest and looked it up on Firebase and lo and behold its a vehicle for route 1. I forgot to change my default from 1 to N, ha! Totally simple and easy. I love it! I tested it and it worked! Yeah!! I was able to track my vehicle from the powell station to my home :)I tested it several times and one of them didn't work. The distance was getting bigger. Seemed like a fluke, maybe... perhaps... no.... it wasn't. I was able to find the vehicle coming closer to the user, but not necessary right direction. So now I need to figure out a way to decide the direction. I spent time pseudo coding a function to pull the two vehicles that are coming toward my user and then comparing the distance change of the each vehicle to my destination geolocation. Then Natalia, a fellow, asked me if there is a way to tell if its outbound or inbound like with NextBus. I showed her how Firebase has each vehicle set up. She helped me figure out that dirTag contains "O" or "I" which means I can ask my user to select which direction. I talked to her about how I want it to be easier for my user, but she reminded me that I should get it working (ask the direction) and then on my next phase do the magic for my user. She was a great support.To do Tomorrow: Change form and the find vehicle functions to include the direction (in/outbound) and work on editing the transit_request table in my database for is_finished to be True.
My Thoughts/Process: I find myself running a little warmer than the other gals (some of them are wearing sleeveless shirts with a blanket). I normally like to keep my hair up. I wore my normal flats today and I worked at the standing desk which was lovely. I am really liking using the standing desk. I just wished that my screen and keyboard were set up to be easier to use (instead of using my laptop). I am really enjoying figuring out the backend challenges and making something polymorphous or at least more generalized.