Skip to content

Commit b0c22e2

Browse files
committed
betterized
1 parent 97dca12 commit b0c22e2

15 files changed

Lines changed: 6920 additions & 2604 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Click any aircraft to view detailed information including registration, operator
4141
![Aircraft Detail](docs/screenshots/detail.png)
4242
![Aircraft Detail](docs/screenshots/airplane1.png)
4343
![Aircraft Detail](docs/screenshots/airplane2.png)
44+
![Aircraft Detail](docs/screenshots/airplane3.png)
4445

4546
### Safety Alerts & Proximity Warnings
4647

adsb-api/app/routers/history.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from app.schemas import (
1717
SightingsListResponse, SessionsListResponse, HistoryStatsResponse
1818
)
19+
from app.services.opensky_db import lookup as opensky_lookup
1920

2021
router = APIRouter(prefix="/api/v1/history", tags=["History"])
2122

@@ -311,11 +312,22 @@ async def get_sessions(
311312
count += 1
312313
safety_counts[s.id] = count
313314

315+
# Batch lookup aircraft info for registration data
316+
aircraft_info_cache = {}
317+
unique_icaos = list(set(s.icao_hex for s in session_list))
318+
for icao in unique_icaos:
319+
info = opensky_lookup(icao)
320+
if info:
321+
aircraft_info_cache[icao] = info
322+
314323
for s in session_list:
315324
duration = (s.last_seen - s.first_seen).total_seconds() / 60
325+
info = aircraft_info_cache.get(s.icao_hex, {})
316326
sessions.append({
317327
"icao_hex": s.icao_hex,
318328
"callsign": s.callsign,
329+
"registration": info.get("registration"),
330+
"country": info.get("country"),
319331
"first_seen": s.first_seen.isoformat() + "Z",
320332
"last_seen": s.last_seen.isoformat() + "Z",
321333
"duration_min": round(duration, 1),

docs/screenshots/airplane3.png

2.19 MB
Loading

docs/screenshots/history.png

1.04 MB
Loading

docs/screenshots/history2.png

1.44 MB
Loading

docs/screenshots/safety.png

564 KB
Loading

docs/screenshots/stats.png

1.41 MB
Loading

0 commit comments

Comments
 (0)