Skip to main content

Bikun Tracker Location Service

ETA and broadcast layer for the Bikun ecosystem. It listens to the live shuttle stream, predicts arrival time, and serves the data back as an API for the frontend.

At a Glance

AreaDetails
RoleETA prediction and live-stream bridge
RuntimePython 3.10 + FastAPI
ModelCatBoost Regressor
TargetRemaining Time to Arrival in seconds
Input streamBackend V2 WebSocket
OutputREST JSON responses

What It Does

  • Consumes live coordinates from Backend V2.
  • Predicts ETA using a CatBoost-based model.
  • Performs chain prediction for the remaining stops.
  • Exposes APIs for single-bus, multi-bus, and all-stop ETA.
  • Keeps the prediction pipeline separate from the location ingest layer.

Service Split

ComponentResponsibility
masterPolls the upstream vehicle API and publishes updates to Redis
slaveSubscribes to Redis and broadcasts updates via WebSocket
clientVisual dashboard used to observe live fleet state

Data Flow

  1. The backend or upstream vehicle feed changes.
  2. The master process polls and republishes the latest state.
  3. The slave process picks up the update and keeps WebSocket clients in sync.
  4. The client dashboard renders status, coordinates, speed, and trip metrics.

Project Structure

PathResponsibility
master/src/app/main.pyPolls the upstream API and publishes to Redis
slave/src/app/main.pySubscribes to Redis and broadcasts to clients
client/index.htmlFleet monitoring dashboard
client/srcBrowser app code and styling

Key Components

  • master/src/app/main.py: adaptive polling, Redis publishing, bearer-token access.
  • slave/src/app/main.py: WebSocket server, connection handling, and client broadcast.
  • client/index.html: live dashboard with connection state, fleet cards, and trip metrics.

Operational Notes

Infrastructure

ItemValue
Container registry638207107223.dkr.ecr.ap-southeast-1.amazonaws.com
Image namebikun-tracker-v2-backend
Production tagstable
Staging taglatest
Regionap-southeast-1

Environment Variables

KeyPurposeNotes
REDIS_HOSTRedis hostnameMaster process dependency
REDIS_PORTRedis portMaster process dependency
REDIS_PASSWORDRedis passwordSecret value, not committed
MCEASY_API_TOKENUpstream API tokenSecret value, not committed

Notes

  • The service treats ETA as a separate concern from raw tracking so the model can evolve independently.
  • Redis is the transport between the polling side and the broadcast side.
  • The current docs describe a split deployment, so the dashboard, broadcast layer, and polling layer can scale independently.