Skip to content
Datablare
Claude Code Logistics Risk & compliance

Lost and returned shipments

881 shipments lost and 948 returned this year, costing ₹3.33M; Coastal Freight loses about twice as many as other carriers.

Data
Synthetic freight demo data (PostgreSQL)
Asked in
Claude Code
Updated
Try this on your data

1 · The brief

What Claude Code was asked

Show me our shipment exceptions this year: how many were lost or returned, what they cost, which carriers lose the most, the monthly trend, and which origin states have the highest exception rate.

Given exactly like this. Claude Code asked Datablare which tables it could read, wrote the SQL itself, ran each query through Datablare and built the dashboard from what came back.

2 · The dashboard

The dashboard Claude Code built

Lost and returned shipments dashboard: Lost and returned rate by carrier, Exception rate by origin state, Lost and returned shipments per month

Built from 4 read-only queries. Every figure on the dashboard was read from the database through Datablare; nothing was estimated or typed in.

Headline numbers (January–October 2026):

  • Lost: 881 (Shipments, 2026)
  • Returned: 948 (Shipments, 2026)
  • Exception rate: 7.6% (Lost or returned)
  • Cost of exceptions: ₹3.33M (Freight paid on them)

What stands out:

  • Lost and returned rate by carrier: Coastal Freight loses 5.9% of shipments
  • Exception rate by origin state: Gujarat is highest at 8.0%
  • Lost and returned shipments per month: 1,829 exceptions since January

The data is a synthetic freight dataset made for this example, so the numbers describe no real company. The queries, the dashboard and the audit entries are real: Claude reached the database only through Datablare, read-only, and every query is on record with the question it served.

3 · What Datablare ran

4 read-only queries, nothing changed

Each query below is copied from the audit log of this run. Datablare checked that it only reads, ran it read-only, and gave only the rows to Claude Code; it never stores them.

  1. Query 1

    Lost and returned shipments, exception rate and freight cost of exceptions, 2026

    1 row · 62 ms

    SELECT count(*) FILTER (WHERE status = 'lost') AS lost, count(*) FILTER (WHERE status = 'returned') AS returned,
           round(avg(CASE WHEN status IN ('lost', 'returned') THEN 1.0 ELSE 0 END), 4) AS exception_rate,
           round(sum(cost) FILTER (WHERE status IN ('lost', 'returned')), 0) AS exception_cost
    FROM logistics.shipments
    WHERE shipped_at >= TIMESTAMP '2026-01-01'
  2. Query 2

    Lost rate and returned rate by carrier, 2026

    5 rows · 72 ms

    SELECT c.name AS carrier, count(*) AS shipments,
           round(avg(CASE WHEN s.status = 'lost' THEN 1.0 ELSE 0 END), 4) AS lost_rate,
           round(avg(CASE WHEN s.status = 'returned' THEN 1.0 ELSE 0 END), 4) AS returned_rate
    FROM logistics.shipments s
    JOIN logistics.carriers c ON c.id = s.carrier_id
    WHERE s.shipped_at >= TIMESTAMP '2026-01-01'
    GROUP BY 1
    ORDER BY 3 DESC
  3. Query 3

    Lost and returned shipments by month, 2026

    10 rows · 79 ms

    SELECT to_char(date_trunc('month', shipped_at), 'YYYY-MM') AS month,
           count(*) FILTER (WHERE status = 'lost') AS lost, count(*) FILTER (WHERE status = 'returned') AS returned
    FROM logistics.shipments
    WHERE shipped_at >= TIMESTAMP '2026-01-01'
    GROUP BY 1
    ORDER BY 1
  4. Query 4

    Exception rate by origin state, 2026

    6 rows · 61 ms

    SELECT origin_state, count(*) AS shipments,
           round(avg(CASE WHEN status IN ('lost', 'returned') THEN 1.0 ELSE 0 END), 4) AS exception_rate
    FROM logistics.shipments
    WHERE shipped_at >= TIMESTAMP '2026-01-01'
    GROUP BY 1
    ORDER BY 3 DESC
Tables read logistics.carrierslogistics.shipments

4 · The audit entry

Who asked what, on record

Every query is recorded with the person who asked, the question in their words and why the agent ran it. Admins see this in the audit log; nothing reaches the database without it.

How the audit log works

query_data_source

via Claude Code

Allowed
Who
The person signed in (hidden on this public page)
Question
Show me our shipment exceptions this year: how many were lost or returned, what they cost, which carriers lose the most, the monthly trend, and which origin states have the highest exception rate.
Intent
Lost and returned shipments, exception rate and freight cost of exceptions, 2026
Result
4 queries, 22 rows, read-only

More use cases

All examples
  • Carrier delivery performance dashboard: On-time rate by carrier, On-time rate per month, Lanes with the lowest on-time rate, Cost per kg by carrier
    Claude Code Logistics Operations

    Carrier delivery performance

    24,000 shipments, 80.2% on time and 46 hours from pickup to delivery on average, with on-time rate and cost by carrier and lane.

    Updated Open

  • Freight spend and cost per kg dashboard: Spend per month by mode, Cost per kg by weight band, Spend by destination state
    Claude Code Logistics Cost & spend

    Freight spend and cost per kg

    ₹44.17M of freight this year at ₹1.8K a shipment; air is 33% of spend, and small parcels cost the most per kg.

    Updated Open

  • E-commerce sales and retention dashboard dashboard: Monthly revenue, Revenue by category, 2026, Lifetime revenue per customer, by channel, Orders per month
    Claude Code E-commerce Executive overview

    E-commerce sales and retention dashboard

    ₹5.21M revenue from 11,897 orders this year, a 57.9% repeat-customer rate, and which channels bring the customers who spend most.

    Updated Open

Build this on your own data.

Connect your database, choose the tables Claude may read, and give it the same brief. Claude is connected in about two minutes.

30 minutes with the founder. Or WhatsApp / [email protected]