A lightweight Python socket server and curses-based client for tracking taxi driver performance ratings.
https://github.com/davidbmar/riot · public · shipped
riot is a distributed system for collecting real-time feedback on taxi drivers. It consists of a central server that stores ride data in SQLite, interactive terminal clients for drivers to log rides and toggle 'thumbs up' ratings (promptness, cleanliness, friendliness), and a reporting agent that generates top-10 lists over rolling 48-hour windows.
python server.py & python taxi_client.py reset
flowchart TD
Client[taxi_client.py] -->|JSON over TCP| Server[server.py]
Server -->|Write| DB[(taxi.sqlite)]
Reporter[report2.py] -->|Read SQL| DB
Test[test_taxi_client.py] -->|CSV Input| Client
The system is built with Python 2 standard libraries. The server uses raw TCP sockets to accept JSON payloads and writes directly to a local SQLite database. The client uses the `curses` library for a text-based user interface (TUI) to manage ride states and rating toggles before sending JSON data over TCP. Reporting is handled by direct SQL queries against the SQLite file.
sequenceDiagram
participant Driver as Driver
participant Client as taxi_client.py
participant Server as server.py
participant DB as taxi.sqlite
Driver->>Client: Start Ride (Press 1)
Driver->>Client: Toggle Ratings (p/c/f)
Driver->>Client: End Ride (Press 2)
Client->>Server: Send JSON (UUID, ratings)
Server->>Server: Parse JSON & Timestamp
Server->>DB: INSERT INTO rides
DB-->>Server: Acknowledge
Server-->>Client: Close Connection
Deploy the server on a central machine accessible by all taxis. Run `server.py` to start listening on port 9998. On each taxi's onboard computer or driver device, run `taxi_client.py` with a unique UUID. Drivers use the TUI to start/end rides and toggle ratings. Periodically run `report2.py` on the server machine to generate performance reports.
✓ all on main — nothing unmerged.