> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tabsutra.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Electric vehicle fleets

> Battery health, energy use, charging demand and loan risk from vehicle telematics.

Electric vehicle fleets, such as delivery vans, taxis, e-scooters, buses and leased cars, produce a steady stream of data: trips, charging sessions, battery readings and repayments. Fleet operators, lenders and insurers use this data to plan charging, schedule maintenance, set residual values and manage credit risk. This page shows how the data fits tabSutra.

> [!TIP]
>
> For the business side of this problem, and how it compares with classic machine learning, read the case study on our website: [Battery health and downtime for EV fleets](https://tabsutra.com/case-studies/ev-battery-health-prediction/).

## The table

Use one row per vehicle per day, or per trip if your questions are about trips. Each row holds the values as they stood at the end of that day.

```csv vehicle_days.csv theme={null}
vehicle_id,date,model,km_driven,energy_used_kwh,charging_sessions,fast_charge_share,avg_temp_c,battery_soh_pct,odometer_km,days_since_service,repayment_due,repayment_made
V0042,2026-09-01,cargo-3w,84,7.9,1,0.0,31,96.2,18240,40,0,0
V0042,2026-09-02,cargo-3w,102,9.8,2,0.5,33,96.2,18342,41,0,0
...
```

The vehicle is the group. Each day of a vehicle reads the vehicle's earlier days. So trends such as a rising energy use per kilometre, a growing share of fast charging, or a run of missed repayments are visible to the model without you building them.

## Questions you can ask

| Question | Target | Settings |
| - | - | - |
| What will the battery's state of health be in 90 days? | `battery_soh_pct` 90 days ahead | `time_column`, `group_column="vehicle_id"`, `target_delay_days=90` |
| How much energy will the vehicle use tomorrow? | `energy_used_kwh` of the next day | `target_delay_days=1` |
| Will the vehicle need unplanned service in the next 30 days? | a yes or no flag | `target_delay_days=30` |
| Will the borrower miss a repayment in the next 60 days? | a yes or no flag | `target_delay_days=60` |
| How much charging will each depot need, hour by hour, next week? | energy drawn per depot per hour | a forecast with `series_column="depot"` |

For a target about a future period, put the answer on the row of the day the question is asked, and set `target_delay_days` to the length of the period. Each row is then predicted only from answers that were known by its own date. See [Time and leakage](https://docs.tabsutra.com/concepts/time-and-leakage.md).

## Battery health in 90 days

```python theme={null}
fitted = requests.post(f"{API}/v1/fit", headers=HEADERS, json={
    "rows": records(vehicle_days), "target": "soh_in_90_days", "task": "regression",
    "time_column": "date", "group_column": "vehicle_id", "target_delay_days": 90,
    "target_range": [0, 100],
}).json()
scored = requests.post(f"{API}/v1/predict", headers=HEADERS, json={
    "context_id": fitted["context_id"], "rows": records(today),
    "outputs": ["median", "quantiles"], "quantiles": [0.1, 0.5, 0.9],
}).json()
```

The lower quantile matters for residual values and warranty reserves. A battery whose 10% quantile falls below the warranty threshold is a candidate for an early check, even when its median is fine.

## Lenders and insurers

An EV loan or lease adds telematics to the usual credit data. The vehicle's use says a lot about the borrower's business: a delivery three-wheeler that stops driving often stops earning. A monthly table per loan, with the month's usage summarised next to the repayment status, fits the same setup as a [behaviour score](https://docs.tabsutra.com/use-cases/credit-scoring.md). The vehicle's usage columns sit next to the credit columns, and the model reads both.

## Things that often go wrong

* **Readings dated by upload.** A vehicle that uploads its data a week late should still have each reading on the day it was taken. Otherwise a row reads data it could not have had.
* **State of health that jumps.** Battery health estimates are often recalibrated after a firmware update. A sudden step on many vehicles at once is a change in measurement, not in the batteries. Add the firmware version as a column.
* **Vehicles replaced under the same id.** If a vehicle id is reused for a new vehicle, its history starts again. Give the new vehicle a new id.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.