ETL + Analytics

FreightLens

A freight analytics pipeline turning 8,000 messy simulated FTL shipment records into carrier scorecards and lane economics — cleaning, warehouse, and dashboard included.

End-to-end data product: raw CSV → cleaned → SQLite warehouse → live KPI dashboard

Python 3.12pandasNumPySQLiteSQLChart.jsVercel
Why It Exists

Three decisions every freight ops team keeps making.

Which carrier to use on a lane. Whether costs are drifting. Where delays concentrate. FreightLens builds the data foundation and the analytical views to answer all three — an ETL pipeline that ingests messy shipment data, cleans and models it into a SQLite warehouse, and serves a live analytics dashboard on top.

The dataset is simulated, and that's the point: 8,000 shipments across 8 real Indian FTL lanes with realistic parameters — per-km rates by lane, vehicle capacity by truck type, carrier-specific reliability profiles, and fuel-linked monthly cost drift. The generator intentionally injects real-world data quality problems, because the cleaning logic is the demonstration.

Live Output

These numbers come from the deployed pipeline — right now.

The Mess

Injected data problems, and how the pipeline handles each.

~1.5% duplicate rows
Deduplication on the business key
Three date formats in one column
Mixed-format datetime parsing
Inconsistent carrier spellings
Fragment-matching to canonical names
Missing delivery dates
Reconstructed from pickup + transit hours
Missing load weights
Median imputation per vehicle type
Fat-finger 10x cost outliers
IQR fence computed per lane
SQL Layer

Five analyses in the documented SQL layer.

  • Carrier ranking per lane — CTE + RANK() OVER (PARTITION BY ...)
  • Month-over-month cost trend — LAG() window
  • Delay cost exposure — CTE + conditional aggregation
  • Cumulative spend burn-down — running SUM() OVER
  • Lane efficiency quartiles — NTILE(4)
Findings

What the data actually says.

01

A ~15-point on-time gap separates best and worst carriers

Reallocating volume on shared lanes is the fastest reliability win available.

02

Cost per km drifts upward steadily through the year

Fuel-linked — a contract-negotiation signal rather than a seasonal effect.

03

Price and reliability are uncorrelated across carriers

Carrier choice should be lane-specific, not network-wide.