Agricultural cooperative driver: per-trip load-factor and fuel log tool - a single-file offline web page logging every run's stop count, crate count, odometer mileage, fuel, and tolls, computing trip load factor (crates over full-crates) and miles-per-gallon; fuel economy computed only for fill-the-tank trips (partial fills stay blank, never averaged), empty return legs tallied separately and never blended into outbound averages, and sub-line trips flagged by route into a 'consolidation candidates' table ranked by trip count - recording and computing only, no cost allocation to members (that is finance's ledger), no maps, no network, missed trips stay blank
Requirement for a coding agent: build a single-file offline web page
for an agricultural cooperative's delivery driver, logging loads and
fuel trip by trip, computing load factor, and surfacing the runs
that should be consolidated. Opens and runs locally, data in browser
storage, no network.
Per-trip entry fields:
- Date, route name (dropdown, user-extendable), direction (outbound
/ return)
- Stop count, crates loaded
- Mileage (odometer reading, hand-copied)
- Fuel (volume and price), tolls
Computation and display rules:
- Trip load factor = crates on that trip / full-truck crates (the
full-crates figure is one setting per vehicle, defined by the
driver)
- Fuel economy = trip fuel / trip miles, computed ONLY for
fill-the-tank trips; partial fills leave the economy field blank -
never patched with an average
- Empty returns (return-leg crates = zero) tally in a separate
"empty-run share" stat; empty legs never blend into the outbound
average
- Trips below the load-factor line I set show flagged yellow, and a
"consolidation candidates" table groups by route: route / flagged
trip count / dates involved / stop count per trip - only
low-stop-count routes are consolidation candidates; the table
sorts by flagged-trip count descending
- Monthly view: per route - trips / average load factor / empty-run
share / fuel and toll totals
Hard constraints:
- No cost allocation to members and no freight-rate calculations -
that is finance's ledger; this tool records the driver's trips
- A missed trip is a missing row - no interpolation, no patching from
neighboring trips
- No maps, no computed mileage - mileage is the odometer reading the
driver copies; the tool does arithmetic only
- Single HTML file, no build, no external dependencies; usable in a
phone browser, large fields, one-handed entry
Why it is written this way
The "consolidation candidates" table groups by route and requires low stop counts because that is where consolidation lives. Low-load trips are everywhere, but whether two runs can merge depends on route structure: two thin routes with three or four stops each, heading the same way, merge into one run both drivers appreciate; a thin route with eight stops across half the county merges into nothing but delay for everyone. The tool decides nothing - it lays out which route, how many flagged trips, how many stops, and lets the driver and dispatcher argue over evidence rather than impressions.
"Fuel economy only on fill-the-tank trips, blank on partial fills" is the requirement's least intuitive and least removable clause. Miles-per-gallon arithmetic presupposes "everything burned this trip came from this fill"; forcing a partial-fill trip through the formula yields a fake number - and a fake number is worse than a blank, because it looks like data. Empty legs tallied separately rather than blended into an outbound average run on the same logic: delivery empty-returns are structural, and a blended "average economy" represents neither leg - useless for comparing trucks or routes. Two clean tables beat one muddled mean.
"No cost allocation to members" is drawn into the hard constraints to fence the tool's jurisdiction. Sooner or later the co-op will ask how transport cost spreads across members, but that computation belongs to finance armed with an allocation rule - the driver's trip log is the raw material, not the allocation itself. A tool that oversteps and allocates produces numbers nobody agreed to, and the trip log gets discredited as "taking sides." Raw material and conclusions stay separate so this table can serve as neutral evidence in the allocation discussion later.
"Large fields, one-handed entry" is the detail this tool's success hangs on: entries happen during loading gaps - one hand on the doorframe, crate stack at the elbow - and one mistyped digit wastes the whole record. "Missed trips stay blank" matches the ledger tools' principle: the log's entire value is truthfulness, a missing trip is a missing trip, and a patched one would poison the month's load factor. The tool does not chase completeness; it guarantees that everything recorded is reliable.
Variables
| Variable | Notes |
|---|---|
| Full-truck crates | How many crates the vehicle holds fully loaded - load factor's denominator, set from the driver's actual loading experience |
| Load-factor line | Below this a trip flags into the candidate table - set from the fleet's cost structure; too low a line starves the table, too high drowns it |
| Route list | The regular routes preloaded into the dropdown - the route name is the grouping key, and sloppy naming breaks the consolidation table |