4. Trip details

Observations

  • tripid attribute exists in vehicle trip details API but does not exist in route details API. Ex: tripid = 71830930

Issue 1. Vehicle is assigned to more than one route

Vehicles on some occassions are assigned to more than one route. Ex: Vehicle KA57F5808 is assigned to two routes, routeno = 210-NA and routeno = D33-PPLO.

"LiveLocation": [
    {
        "latitude": 12.909809,
        "longitude": 77.536422,
        "location": "Depot-33 Poornapragna layout (Towards Depot-33 (Poornapragna layout))",
        "lastrefreshon": "17-09-2025 23:19:34",
        "nextstop": null,
        "previousstop": "Arehalli (Towards Kengeri)",
        "vehicleid": 27211,
        "vehiclenumber": "KA57F5808",
        "routeno": "210-NA",
        "servicetypeid": 72,
        "servicetype": "Non AC/Ordinary",
        "heading": 210.18,
        "responsecode": 200,
        "trip_status": 1,
        "lastreceiveddatetimeflag": 1
    },
    {
        "latitude": 12.909809,
        "longitude": 77.536422,
        "location": "Depot-33 Poornapragna layout (Towards Depot-33 (Poornapragna layout))",
        "lastrefreshon": "17-09-2025 23:19:34",
        "nextstop": null,
        "previousstop": "Arehalli (Towards Kengeri)",
        "vehicleid": 27211,
        "vehiclenumber": "KA57F5808",
        "routeno": "D33-PPLO",
        "servicetypeid": 72,
        "servicetype": "Non AC/Ordinary",
        "heading": 210.18,
        "responsecode": 200,
        "trip_status": 1,
        "lastreceiveddatetimeflag": 1
    }
]

Issue 2. Live location is missing

Live location was empty for about 2.5% of vehicles (185 out of 7,247 vehicles) when run on 2025-09-17. Ex: Vehicle ID 28622 with registration number KA01AR4181.

{
    "RouteDetails": [],
    "LiveLocation": [],
    "Message": "No Records Found",
    "Issuccess": true,
    "exception": null,
    "RowCount": 0,
    "responsecode": 200
}

Fetch


source

fetch_trip_details

 fetch_trip_details (vehicle_id:int, sleep_duration:float=0.1)

Fetch trip details for a given vehicle ID from the BMTC API.

Extract

Dataset 1. Live Location


source

extract_live_location

 extract_live_location (trip_details)

Extract live location from trip details.


source

get_live_locations

 get_live_locations (directory:pathlib.Path)

Extract live location for all trip details in a directory.

Dataset 2. Route Details


source

extract_route_detail

 extract_route_detail (trip_detail)

Task


source

task_fetch_trip_details

 task_fetch_trip_details (data_directory:pathlib.Path)