Giter Club home page Giter Club logo

adsbdb's Introduction

public aircraft, airline, and flightroute api
Built in Rust, with axum, for Docker, using PostgreSQL & Redis
See typescript branch for original typescript version


check adsbdb twitter for any status updates, and please report any incorrect data to the issues page, with the Data tag.
With thanks to;

  • PlaneBase for the aircraft data.
  • The flight route data is the work of David Taylor, Edinburgh and Jim Mason, Glasgow, and may not be copied, published, or incorporated into other databases without the explicit permission of David J Taylor, Edinburgh.
  • Guillaume Michel, for the icao to n-number conversion
  • airport-data for aircraft photographs

  • Routes

    https://api.adsbdb.com/v[semver.major]/aircraft/[MODE_S || REGISTRATION]

    {
    	"response":{
    		"aircraft":{
    			"type": string,
    			"icao_type": string,
    			"manufacturer": string,
    			"mode_s": string,
    			"registration": string,
    			"registered_owner_country_iso_name": string,
    			"registered_owner_country_name": string,
    			"registered_owner_operator_flag_code": string || null,
    			"registered_owner": string,
    			"url_photo": string || null,
    			"url_photo_thumbnail": string || null
    		}
    	}
    }
    

    Unknown aircraft return status 404 with

    { "response": "unknown aircraft"}

    https://api.adsbdb.com/v[semver.major]/callsign/[CALLSIGN]

    {
    	"response": {
    		"flightroute":{
    			"callsign": string,
    
    			"callsign_icao": string || null,
    			"callsign_iata": string || null,
    
    			"airline": {
    				"name": string,
    				"icao": string,
    				"iata": string || null,
    				"country": string,
    				"country_iso": string,
    				"callsign": string || null
    			} || null,
    
    			"origin": {
    				"country_iso_name": string,
    				"country_name": string,
    				"elevation": number,
    				"iata_code": string,
    				"icao_code": string,
    				"latitude": number,
    				"longitude": number,
    				"municipality": string,
    				"name": string,
    			},
    
    			"destination": {
    				"country_iso_name": string,
    				"country_name": string,
    				"elevation": number,
    				"iata_code": string,
    				"icao_code": string,
    				"latitude": number,
    				"longitude": number,
    				"municipality": string,
    				"name": string,
    			}
    		}
    	}
    }

    For a small number of flightroutes, midpoints are also included

    	{
    		"midpoint": {
    				"country_iso_name": string,
    				"country_name": string,
    				"elevation": number,
    				"iata_code": string,
    				"icao_code": string,
    				"latitude": number,
    				"longitude": number,
    				"municipality": string,
    				"name": string,
    			}
    	}

    Unknown callsign return status 404 with

    { "response": "unknown callsign"}

    https://api.adsbdb.com/v[semver.major]/aircraft/[MODE_S || REGISTRATION]?callsign=[CALLSIGN]

    {
    	"response": {
    		
    		"aircraft":{
    			"type": string,
    			"icao_type": string,
    			"manufacturer": string,
    			"mode_s": string,
    			"registration": string,
    			"registered_owner_country_iso_name": string,
    			"registered_owner_country_name": string,
    			"registered_owner_operator_flag_code": string || null,
    			"registered_owner": string,
    			"url_photo": string || null,
    			"url_photo_thumbnail": string || null
    		},
    
    		"flightroute":{
    			"callsign": string,
    
    			"callsign_icao": string || null,
    			"callsign_iata": string || null,
    
    			"airline": {
    				"name": string,
    				"icao": string,
    				"iata": string || null,
    				"country": string,
    				"country_iso": string,
    				"callsign": string || null
    			} || null,
    
    			"origin": {
    				"country_iso_name": string,
    				"country_name": string,
    				"elevation": number,
    				"iata_code": string,
    				"icao_code": string,
    				"latitude": number,
    				"longitude": number,
    				"municipality": string,
    				"name": string,
    			},
    
    			"destination": {
    				"country_iso_name": string,
    				"country_name": string,
    				"elevation": number,
    				"iata_code": string,
    				"icao_code": string,
    				"latitude": number,
    				"longitude": number,
    				"municipality": string,
    				"name": string,
    			}
    		}
    	}
    }

    If an unknown callsign is provided as a query param, but the aircraft is known, response will be status 200 with just aircraft


    https://api.adsbdb.com/v[semver.major]/airline/[AIRLINE_ICAO || AIRLINE_IATA ]

    {
    	"response":{
    		[
    			{
    				"name": string,
    				"icao": string,
    				"iata": string || null,
    				"country": string,
    				"country_iso": string,
    				"callsign": string || null
    			},
    			...
    		]
    	}
    }
    

    Unknown airline return status 404 with

    { "response": "unknown airline"}

    Convert from MODE-S string to N-Number string https://api.adsbdb.com/v[semver.major]/mode-s/[MODE_S]

    {
    	"response": string
    }
    

    Convert from N-Number string to Mode_S string https://api.adsbdb.com/v[semver.major]/n-number/[N-NUMBER]

    {
    	"response": string
    }
    

    Download

    See releases

    download one liner

    wget https://www.github.com/mrjackwills/adsbdb/releases/latest/download/adsbdb_linux_x86_64.tar.gz &&
    tar xzvf adsbdb_linux_x86_64.tar.gz adsbdb

    Run

    Operate docker compose containers via

    ./run.sh

    Build

    cargo build --release
    Build using cross, for x86_64 linux musl targets, in order to run in an Alpine based container
    cross build --target x86_64-unknown-linux-musl --release

    Tests

    Requires both postgres, seeded with data, and redis, operational

    # Watch
    cargo watch -q -c -w src/ -x 'test  -- --test-threads=1 --nocapture'
    
    # Run all 
    cargo test -- --test-threads=1 --nocapture

    adsbdb's People

    Contributors

    mrjackwills avatar

    Stargazers

     avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

    Watchers

     avatar  avatar  avatar  avatar  avatar  avatar

    adsbdb's Issues

    [NEW FEATURE] Return registration for non-US aircraft

    Only US aircraft return a registration number. Given that the field is called "n_number" and not "registration", I'm assuming that's intentional, but that's a pretty important piece of information to leave out. It would be helpful if the registration were returned for all aircraft where one is known.

    [NEW FEATURE] Return IATA callsign for flight

    Would it be possible to return the IATA callsign for a flight for a /callsign request. E.g., for https://api.adsbdb.com/v0/callsign/QFA409, could it return QF409? For many flights this is straightforward (just change that airline ICAO code its IATA code, e.g. QFA to QF), but for some it is trickier, e.g., QLK10 is QF2010.

    Additional context: I've been building a split flap display (using https://github.com/scottbez1/splitflap) to show the planes flying overhead (what I've built: https://photos.app.goo.gl/SUe6HfQkHJN3Eo6X9). I've got an ADS-B receiver set up to get the callsign then use this API in order to get the route (thankyou!). But I'd also like to display the flight callsign in the form that people are more familiar with (and so that it will always fit on my 6 character display!).

    [NEW FEATURE] Update to postgres 15

    Describe the solution you'd like
    Update to postgres 15, currently waiting for alpine postgres15-client to be available - for backup container

    [DATA] VH & ZK, DQ, etc

    Url of request
    [What was the url of the request that was made]
    (https://api.adsbdb.com/v0/aircraft/VH-X4A)

    Why was the data wrong
    Which aspect of the response data was incorrect?
    No Data, VH is downloadable like the N-reg system, they include numbers now! -see below-

    Source of information
    [If possible, would you be able to provide a link that shows the correct data?]
    (https://www.casa.gov.au/aircraft/aircraft-registration/data-files-registered-aircraft#Tipstodownloadthefiles)

    Additional context
    Add any other context about the problem here.
    This can be applied to other sites like ZK, DQ.
    Need to introduce prefix filter to different database to allow for no/low change to store info.

    [NEW FEATURE] n-number & icao routes

    Describe the solution you'd like
    add two new routes /icao, and /n-number, to convert from one to the other

    /icao/A897E4 => N653AE
    /n-number/N653AE => A897E4

    [DATA] SKW9799 is 'special'

    Url of request
    https://api.adsbdb.com/v0/callsign/SKW9799

    Why was the data wrong
    this callsign is 'special'. SkyWest appears to use it for test flights and when shuttling aircrafts.
    Right now, as I type it, it's a plane transfer flight from Palm Springs to Seattle, yesterday they used it to move a plane from Spokane to Portland.

    Additional context
    This isn't a flight with a 'regular' route at all - so giving one of the past values for it might not be the right thing to do.

    [DATA] EJA / 1L airline code

    Url of request
    any request for an EJA or 1L (NetJets) flight

    Why was the data wrong
    Because these aren't scheduled flights - they are on demand. So storing them as 'routes' really doesn't make much sense.

    [DATA] missing aircraft

    Url of request
    [What was the url of the request that was made]
    (https://api.adsbdb.com/v0/aircraft/se-rta)

    Why was the data wrong
    Which aspect of the response data was incorrect? Aircraft not found

    Source of information
    If possible, would you be able to provide a link that shows the correct data? https://www.flightradar24.com/data/aircraft/se-rta#

    Additional context
    Add any other context about the problem here.
    Find many missing planes, especially from Norwegian.

    BTW, thanks a lot for providing this service, really a nice, clean, free and excellent API - Thank you !

    I am new to this, so I could be wrong, but A/C lookup have succeeded many times, but also failed sometimes as described above.

    Best regards,
    Peter

    [NEW FEATURE] FAA search

    Is your feature request related to a problem? Please describe.
    Use the n-number to search FAA db for unknown aircraft

    eventually search foreign db's as well

    [BUG]

    the coming from and going to airports are the same on most of the flights

    [NEW FEATURE] Callsign classification

    Describe the solution you'd like
    Serialize incoming callsign into ICAO, IATA or Other

    Additional context
    Callsign JSON response should include both callsigns, as well as the carrier - if applicable

    [NEW FEATURE] Batch Requests

    Is your feature request related to a problem? Please describe.
    I'm trying to make an initial batch query of ~15 aircraft callsigns to populate a map. From that point on, with caching, it would only be the addition of new callsigns that triggers a request. Still, I imagine it's better for all involved if the first request could be batched.

    Describe the solution you'd like
    Expose a REST endpoint with a reasonable batch size limit:
    https://api.adsbdb.com/v0/callsign?callsigns=ACA123,ACA321

    Describe alternatives you've considered
    Looping through individual queries within the bounds of the rate limit.

    Additional context
    Love this service! Exactly what I'm after for my little hobby project.

    [NEW FEATURE] put rate limits in app_env

    Is your feature request related to a problem? Please describe.
    Upper and lower rate limits are currently hard-coded into the source code, making changing them require a re-compile/re-build.

    Describe the solution you'd like
    Put the rate limits into the .env, so that restarting the container will use the new rate limits, without a rebuild/re-release

    [DATA] SKW 3370 is changing

    Url of request
    https://api.adsbdb.com/v0/callsign/SKW3370

    Why was the data wrong
    SkyWest changes route on many of their flights fairly frequently. This one is currently used for both directions of Seattle / Rogue Valley, but starting on Thursday it will switch to Seattle Glacier Park

    Additional context
    I really don't know what the best way is to deal with flights like that... especially the increasingly common practice that both directions of a city pair have the same flight number...

    [BUG] Rate limiter

    Describe the bug
    There is an issue with the rate limiter, where the TTL is reported as 1, and points are reported over 200, but the TTL does not reset correctly

    Appears to occur after application has been running for one week

    To Reproduce
    Struggle to replicate, only noticed twice when checking status of site

    Expected behavior
    Rate limits & TTL get reset correctly

    Additional context
    Keep checking the status of the site, and check internal redis database to get the value of the Ratelimiter, in points, and the TTL

    Recommend Projects

    • React photo React

      A declarative, efficient, and flexible JavaScript library for building user interfaces.

    • Vue.js photo Vue.js

      ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

    • Typescript photo Typescript

      TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

    • TensorFlow photo TensorFlow

      An Open Source Machine Learning Framework for Everyone

    • Django photo Django

      The Web framework for perfectionists with deadlines.

    • D3 photo D3

      Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

    Recommend Topics

    • javascript

      JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

    • web

      Some thing interesting about web. New door for the world.

    • server

      A server is a program made to process requests and deliver data to clients.

    • Machine learning

      Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

    • Game

      Some thing interesting about game, make everyone happy.

    Recommend Org

    • Facebook photo Facebook

      We are working to build community through open source technology. NB: members must have two-factor auth.

    • Microsoft photo Microsoft

      Open source projects and samples from Microsoft.

    • Google photo Google

      Google โค๏ธ Open Source for everyone.

    • D3 photo D3

      Data-Driven Documents codes.