Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add route lookup via a route API server #232

Closed
wants to merge 1 commit into from
Closed

Add route lookup via a route API server #232

wants to merge 1 commit into from

Conversation

dirkhh
Copy link
Contributor

@dirkhh dirkhh commented Mar 20, 2023

So far there are two servers that I'm aware of that offer this API service: api.adsb.lol and adsbdb.com.
The api.adsb.lol code is open source and can also be run locally in a container. Either way, that code uses the VirtualRaderServer route data as published on GitHub, adsbdb uses its own, independently maintained data.

For use with remote servers like adsbdb.com this commit also adds a rate limiting library and a reference to axios in order to easily and cleanly allow API accesses without exceeding the rate limits of the API provider.

Once the app receives a callsign for a flight (and that is different from the registration - as none of the free providers track 'live flight plans'; they all only include information about scheduled flights), it checks if there is already route information for this flight cached and if not it makes an API call to look up the origin and destination of that flight.

If the API service is using the second generation API service that works with the VRS data, it also implements a (somewhat simplistic) plausibility check to ensure that obviously questionable route information isn't shown to the user (assuming the user enables passing lat/lng data to the server.

The code tries to be very careful not to run afoul of rate limits of route API sites - right now this is hopefully conservative enough that even people running a couple of different tar1090 instances won't get in trouble - but one can create a scenario where power users with many windows open might still end up with too many API requests. The number of requests and the corresponding time slice can be configured.

@dirkhh
Copy link
Contributor Author

dirkhh commented Mar 20, 2023

This allows running a local API server in a docker container and directing the API calls to that.
It's been tested somewhat more thoroughly, but there may still be issue lurking.

So far there are two servers that I'm aware of that offer this
API service: api.adsb.lol and adsbdb.com.
The api.adsb.lol code is open source and can also be run locally
in a container. Either way, that code uses the VirtualRaderServer
route data as published on GitHub, adsbdb uses its own, independently
maintained data.

For use with remote servers like adsbdb.com this commit also adds a
rate limiting library and a reference to axios in order to easily
and cleanly allow API accesses without exceeding the rate limits of
the API provider.

Once the app receives a callsign for a flight (and that is different
from the registration - as none of the free providers track 'live
flight plans'; they all only include information about scheduled
flights), it checks if there is already route information for this
flight cached and if not it makes an API call to look up the origin
and destination of that flight.

If the API service is using the second generation API service that
works with the VRS data, it also implements a (somewhat simplistic)
plausibility check to ensure that obviously questionable route
information isn't shown to the user (assuming the user enables passing
lat/lng data to the server.

The code tries to be very careful not to run afoul of rate limits
of route API sites - right now this is hopefully conservative enough
that even people running a couple of different tar1090 instances won't
get in trouble - but one can create a scenario where power users with
many windows open might still end up with too many API requests. The
number of requests and the corresponding time slice can be configured.

Signed-off-by: Dirk Hohndel <[email protected]>
@dirkhh
Copy link
Contributor Author

dirkhh commented Mar 20, 2023

quick update on this...
@katlol has been extremely supportive and has helped me see the impact this has on servers (she merged this PR into her setup so we could test on a live server).
The results of this put some things that @wiedehopf said to me earlier into much better perspective.

Fundamentally, I'm poking around and learning more about a new (to me) infrastructure. And I think the design how I have implemented this right now is fundamentally not right. Thanks to Katia I have a different path I want to go down for a little while to see if that isn't much better in the larger context.
I appreciate everyone's patience with the starts and stops 🤷🏼‍♂️

@dirkhh dirkhh closed this Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant