Trey T a031a1aafd Live tab: resolve dep/arr for every aircraft via schedule cascade
OpenSky alone can't answer "where is this plane going" — /flights/aircraft
only returns landed flights, so an in-progress flight produced an empty
route card. Built a 3-tier resolution cascade that always lands somewhere
useful:

1) Scheduled lookup via route-explorer's /schedule endpoint. Parse the
   ADS-B callsign (AAL3055 → carrier AA, number 3055), pull the day's
   operating record, get real departure + arrival airports and times.
   Works for every carrier route-explorer indexes (mainline + many
   regionals). Smoke-tested live: AAL3055 → DFW→MIA, DAL1050 → IAH→MSP,
   AAL1753 → XNA→DFW, AAL2978 → XNA→PHL. All from live aircraft caught
   in the DFW area at the moment.

2) OpenSky historical (/flights/aircraft). If route-explorer doesn't
   have the carrier, fall back to whatever OpenSky last logged for
   this airframe. Labeled "LAST FLIGHT · 3h AGO" etc.

3) Trail-derived inference. Last resort for ICAO24s nothing knows about
   (private jets, cargo, ad-hoc callsigns). Pull the OpenSky track,
   take the first position, find the nearest airport in the bundled
   3,900-entry DB (new AirportDatabase.nearestAirport(to:)). Shows
   "Departed from KAUS — Austin Bergstrom" with "Heading to —"
   acknowledging arrival is unknown.

Plumbed RouteExplorerClient through LiveFlightsView → RootView →
FlightsApp. Added searchSchedule(carrierCode:flightNumber:startDate:
endDate:) that returns [RouteFlight] directly (the /schedule envelope
is `{ flights: [...] }`, distinct from /route's `{ connections: [...] }`).

Three distinct route cards now render based on what we resolved:
  - scheduled  → green live dot + "Departed / Heading to"
  - openSky    → "Departed / Arrived" with age label
  - inferred   → "Departed from X / Heading to —"
  - none       → explicit "Route unavailable" message

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-27 06:48:26 -05:00
2026-04-08 15:01:07 -05:00
2026-04-08 15:01:07 -05:00
2026-04-08 15:01:07 -05:00
S
Description
No description provided
9.7 MiB
Languages
Swift 57.9%
HTML 33.9%
JavaScript 4.5%
Python 3.5%
Shell 0.2%