hh/improvements#4
Merged
Merged
Conversation
hahuang65
commented
Jun 19, 2026
Member
- FEATURE: filter to en-route flights only and fix fixture saving
- FIX: synchronise frame advance with the sliding window so flights get all metric pages before the window moves
- FEATURE: make metric page cycles per flight configurable
- FEATURE: sort fetched flights by distance to home, closest first
- FEATURE: add distance-from-home metric as a 5th metric page
What is this change? - Add en-route status filter in AirLabsAdapter.nearby_flights so grounded flights are excluded at the data layer - Accept optional api_key in AirLabsAdapter.__init__ so scripts/save_fixtures.py can pass the key explicitly - Add load_dotenv() to save_fixtures.py so it reads AIRLABS_API_KEY from .env - Cast dir to float in to_flight (real API returns int or float) - Replace synthetic fixture with a live AirLabs capture (90 en-route flights over Houston) - Update fixture test to assert mapping contract instead of hardcoded airport codes Why is the change being made? The app was fetching all flights in range without filtering, including grounded aircraft with missing telemetry. The en-route filter gives cleaner, more useful data while staying within the API free tier. Fixture tests broke when switching to real data because they asserted specific synthetic values — they now validate the mapping contract instead.
get all metric pages before the window moves What is this change? - Replace time-based window slide (elapsed / slide_interval) with a frame-based slide that advances only after every flight in the window has displayed all PAGES_PER_FLIGHT metric pages - Update the slide test to assert on frame boundaries instead of mocking time.time at slide_interval offsets Why is the change being made? The window was sliding mid-flight-cycle because slide_interval (refresh / n, ~3.3s with 90 flights) was much shorter than the time needed to show all pages (PAGES_PER_FLIGHT * pause, 20s at 5s pause). Flights were shown for 1-2 pages then swapped out. The window now advances by 1 every frames_per_cycle frames (PAGES_PER_FLIGHT * WINDOW_SIZE), ensuring every flight gets its full page rotation before being replaced.
What is this change? - Add cycles_per_flight (default 1) to AppConfig - Use it in _current_frame() so each flight repeats its metric page cycle that many times before the window advances Why is the change being made? With pause=5s and 4 metric pages, each flight gets 20s of screen time. Some users may want more (or less) time per flight without changing the per-page pause. cycles_per_flight=2 gives 40s per flight (all 4 pages shown twice) without altering the pause or the window slide cadence.
What is this change? - Add _haversine_km helper for great-circle distance - Sort raw flights by proximity to home in nearby_flights before converting to Flight objects - Add lat/lng to the AIRLABS_FLIGHT test fixture - Fix two frame-cycle tests to explicitly set cycles_per_flight=1 so they aren't sensitive to the config default Why is the change being made? Without sorting, flights appear in API response order (typically by ICAO hex). The display now shows the closest flights first, which is more useful on a 5-flight sliding-window display — the nearest traffic is the most relevant.
What is this change? - Add distance_km field to Flight model - Add haversine calculation in to_flight, passed home coordinates from nearby_flights - Add page 4 to metrics_label showing rounded distance in km - Increase PAGES_PER_FLIGHT from 4 to 5 so distance is shown alongside altitude, speed, vertical rate, and track Why is the change being made? Knowing how far each flight is from the home location is useful context on the display. The distance is calculated in the adapter from the raw API coordinates and home position, so the model stays clean and the metric is available to any page without recomputing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.