Catching the bus on time -- Using Python, a Pebble Watch and (kind of) Open Data
summary
Built system scrapes RTA’s hidden POST endpoints discovered in the browser network tab, uses Python requests to poll RTA POST endpoints and logs predicted and scheduled times every minute into Postgres via psycopg2, exposes a simple JSON API (Flask/horsemeat) and renders a CloudPebble JavaScript app that displays minutes until bus on a Pebble watch for four local stops. It runs reliably; week-long logs show six instances over 30 minutes late and a maximum delay of 1h25m. Code and DB dump are on GitHub for reuse and extension.
AI-written summary · about
chapters (25)
- 0:00Intro
- 0:23Problem: Catching the Bus
- 1:14MAP!
- 3:52So how do we make it better? Real time arrival times could helpt in 2012, RTA (Cleveland's public transit operator) added GPS to all of their buses
- 5:31Actually catching the bus
- 6:35Where we stand
- 6:56WWDTD (what would Dick Tracy Do)
- 7:26Enter Python and the Pebble
- 8:20Pebble Watch con't
- 9:02Step 1: Python Webapp
- 12:14NextConnect Response
- 13:06Getting data into Python
- 13:23Python request
- 14:25Using the data
- 16:00Database Tables
- 19:46Start filling our database
- 20:36Putting it together
- 21:20Automate it
- 22:34On to the Python API . For the simplest scenario, we'll need a webapp that can handle one request with one arguments
- 25:15Enter: The Pebble Watch
- 26:01Cloud Pebble
- 27:50App.js
- 29:58Select a Menu Item
- 32:48Some analytics
- 34:17Questions / Comments? • Project link - make it better if you want!
related talks
32mEnabling real-time insights through stream processing in Python
28mBoosting Python Web Apps performance with Celery and Concurrency
52mSaturday Lightning Talks
47mBuilding a realtime dashboard with Laravel, Vue and Pusher
26mYour app is async so take advantage of it for development!
27mPython, Pyramid, and Embedded Devices
18mSit back, relax, and enjoy the talk: a journey through FlightRadar24 with Python
28mWorking with dates and times in Pandas
