riot

A lightweight Python socket server and curses-based client for tracking taxi driver performance ratings.

https://github.com/davidbmar/riot  ·  public  ·  shipped

What it is

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.

Features

Quickstart

python server.py &
python taxi_client.py
reset

Architecture

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

How it's built

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.

How it runs

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

How to apply & reuse

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.

At a glance

CapabilitiesReal-time ride loggingCategory-based rating togglingHistorical data analysisAutomated testing via CSV
Componentsserver.pytaxi_client.pyreport2.pytest_taxi_client.pytaxi.sqlite
TechPython 2SQLite3TCP SocketsCursesJSON
Depends onpython-cursessqlite3
Integrates with
PatternsClient-ServerPublish-Subscribe (via DB)Command Line Interface
Reuse tagsiot-feedbacksocket-servercurses-uisqlite-storagepython-2

Repo hygiene

✓ all on main — nothing unmerged.