Statistics
TravStats turns your flight log into numbers in three places:
- Dashboard widgets — at-a-glance summary above the map
- Advanced Stats page (
/stats) — the deep dive: 50+ metrics across five sections, with year-comparison and a year heatmap - Top-K cards — airline ranking, country ranking, route master, inline on Advanced Stats
All numbers are computed server-side from the flights table. Rate-
limited, per-user, scoped to flights with status: flown or
historical for distance/time metrics; planned and cancelled
flights are counted only where it makes sense (totals, status pie).
Dashboard summary
Section titled “Dashboard summary”The bar above the map shows:
- Total flights — count of all flights regardless of status
- Total distance — great-circle sum across flown + historical legs
- Total flight time — sum of arrival − departure (timezone-aware, see time semantics for the contract)
- Countries visited — distinct ISO country codes touched
- Airlines flown — distinct (normalised) airline operators
- Cost (this year) — if you’ve entered prices anywhere
Each tile links to the relevant Advanced Stats section.
Advanced Stats page
Section titled “Advanced Stats page”Click Stats in the nav (or click any dashboard tile). Five sections, top to bottom:
Overview cards
Section titled “Overview cards”The same six tiles as the dashboard, plus year filter + comparison.
Pick a year from the dropdown to scope every stat below to that year; toggle “compare with…” to display delta values vs. another year.
Charts section
Section titled “Charts section”- Flights by month — bar chart, 12 months
- Flights by year — column chart over your full history
- Distance by year — same axis, distance instead of count
- Day-of-week — radial chart, busiest weekday for departures
Distance section
Section titled “Distance section”- Total km
- Average distance per flight
- Longest single flight (with route + date link)
- Shortest single flight
- Distance distribution histogram
Flight breakdown
Section titled “Flight breakdown”- Status pie (flown / planned / cancelled / historical)
- Category pie (business / leisure / family / commute / unassigned)
- Aircraft type bar chart (if you’ve tagged aircraft)
Fun section
Section titled “Fun section”The lighthearted metrics from funStats:
- Timezone hopper — distinct IANA timezones visited
- Early bird / Afternoon / Night owl — flights by departure hour bucket
- Weekend warrior — count + percentage of flights on Sat/Sun
- Loyalty score — % of flights with your most-flown airline
- Short-haul king — count of flights under 500 km
- Long-haul pilot — count of flights ≥ 5,000 km
- Fastest day — busiest single day on record
- CO2 footprint in kg, and as elephants (1 elephant ≈ 4,000 kg)
- Milestone year — the year with most flights
- Route master — your most-flown route + count
Business section
Section titled “Business section”Spend metrics, computed from businessStats:
- Cost per km / per flight hour — only across flights with a recorded price; bookings count once even if they produced multiple legs
- Total cost in your currency
- Seat class distribution — % economy / premium / business / first
- Most common category
- Airport diversity — distinct airports visited
- Average flight duration — hours
- Busiest month
Unique section
Section titled “Unique section”The “interesting trivia” metrics from uniqueStats:
- Time travellers — flights where local arrival hour < local departure hour
- Equator crossings — North↔South hemisphere transitions
- Arctic flights — any leg crossing 66.5°N
- Ocean crossings — flights > 5,000 km (heuristic, no actual coastline check)
- Highest airport — by altitude in metres
- Northernmost / southernmost point
- Longest travel chain — consecutive same-airport hand-offs within 24 h
- Fastest route — highest average ground speed (capped at 1,200 km/h to ignore bad data)
- Most countries in a single day
Airports section
Section titled “Airports section”Top 20 airports by visit count, with arrows for most departed, most arrived, and first/last visit dates.
Seats section
Section titled “Seats section”- Window / aisle / middle distribution
- Row range histogram (front, middle, rear thirds)
- Seat consistency score (% of times you got the same letter)
Year heatmap
Section titled “Year heatmap”A GitHub-style yearly calendar grid: each cell is a day, shaded by the number of flights that day. Hover for tooltip with airlines + IATA codes; click a date to scroll to that day’s flights in the table.
The year picker at the top lets you flip between any year you have flights in.
Year report PDF
Section titled “Year report PDF”A “Generate flight certificate” button on Advanced Stats lets you download a one-page PDF summarising the selected year — total flights, distance, top route, top airline. Useful as a screenshot-able year-in- review or to print as a memento.
Where the numbers come from
Section titled “Where the numbers come from”All endpoints sit under /api/v1/stats:
| Endpoint | Returns |
|---|---|
GET /summary | The headline numbers — total flights/distance/time/cost, status pie, airline pie |
GET /routes | Per-route counts for the top-N table |
GET /fun | The Fun section metrics (funStats) |
GET /business | The Business section metrics (businessStats) |
GET /unique | The Unique section metrics (uniqueStats) |
GET /seats | Seat-class + position distributions |
GET /airlines | Per-airline aggregations (count, distance, hours) |
GET /countries | Per-country counts of arrivals/departures |
All accept fromDate, toDate, and a year parameter (with optional
compareYear) — the same scoping the UI applies. Authentication is
via cookie (UI) or PAT with read scope (API).
The full request/response shapes are in
REST API, and the OpenAPI spec at
/api-docs for live exploration.
Limitations
Section titled “Limitations”- Distance uses great-circle, not actual flight path. No jet-stream rerouting, no waypoint-based correction. Real flown distance is typically 1–3 % higher
- Timezone-aware calculations need the airport’s IANA timezone in the cached airport database. Coverage is good (>95 % of commercial IATA airports) but private/general-aviation strips may fall back to “skip rather than guess”
- CO2 figures are rough. 0.25 kg/km short-haul, 0.20 kg/km long-haul, single-cabin assumption. Don’t use for offset certification — use a dedicated calculator like myclimate.org
- No multi-user aggregates. Every stat is scoped to your own flights. There’s no instance-wide “all users’ totals” dashboard; multi-user privacy is the design intent