mrjackwills / adsbdb

public api for aircraft, airlines, & flightroutes
https://adsbdb.com
MIT License
111 stars 6 forks source link

[NEW FEATURE] Return registration for non-US aircraft #13

Closed ladewig closed 1 year ago

ladewig commented 1 year ago

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.

mrjackwills commented 1 year ago

Yeah, don't know why I didn't even consider that, should change n_number to just registration

mrjackwills commented 1 year ago

This might be quite breathtakingly stupid question, but, is there any uniform syntax for an aircraft's registration, taking a random sample from the current dataset, we have;

N2150H
M-AKER
EC-KUB
RA-73755
B-001E
UR-UBB
N280GC
YR-BGK
RA-73426
N597NN
B-1503

Should also implement the /aircraft endpoint to be able to search by either the MODES hex code, or the aircraft registration

ladewig commented 1 year ago

It varies by country/registry. What is it you're trying to do?

mrjackwills commented 1 year ago

Currently, if one makes a request to /aircraft/A197D0, it verifies that A197D0 is a valid hex code ([a-fA-F0-9]{6}), although it doesn't use regex.

If I want adsbdb to be able to search, on this same route, by hex or registration, my plan was to check that the path was either a hex code or a registration, before it tries to hit the database or cache.

I think I can just check if it's [a-zA-z0-9] and also optionally includes a -, of some sane minimum and maximum lengths. Although, this could result in a clash where the path is both a valid hex and also a valid aircraft registration Actually I don't think a clash is possible

ladewig commented 1 year ago

You can see the various formats of registrations here: https://en.wikipedia.org/wiki/List_of_aircraft_registration_prefixes

mrjackwills commented 1 year ago

Thanks, working on a 0.1.0 release, which will switch the n_number response to registration, and enables searching by registration as well, hopefully get it out soon