#aircraft #aviation #faa

bin+lib uap

Toolkit for looking up aircraft registration information

2 releases

0.2.1 Jan 16, 2022
0.2.0 Jan 16, 2022

#1274 in Database interfaces

MIT license

16KB
304 lines

uap

MIT licensed Documentation Coverage

uap is a Rust crate that supports looking up aircraft registration and type information from the FAA database and or Mictronics database.


lib.rs:

This crate provides a unified interface to several sources of information on aircraft worldwide, including registration and type information.

The main use case is finding an aircraft's registration ("tail number") if you have its ICAO code (AKA Mode S code). ICAO codes can be broadcast by aircraft transponders, so if you're looking at a transponder data packet and want to find out more about the aircraft that sent it, the first step is often to find its registration.

This crate currently supports two source of information, both of which can be downloaded by the public:

  • The FAA registration database. The FAA database has information on all aircraft in the United States with civilian registrations.
  • The Mictronics database; Specifically, the "Complete database for old readsb (non protocol buffer version)" zip file that's contained at this link. The Microntronics database tries to collect information on all aircraft in the world, including military aircraft.

To use this crate, you need to

  1. Download the FAA database zip, or the Mictronics database, or both.
  2. Unzip the database(s) into a directory.
  3. Call [faa::Faa::from_dir()] or [mictronics::Mictronics::from_dir()] with the directory containing the database files.
  4. Call the resulting struct's lookup_mode_s function with the Mode S code of the aircraft you want information on.
use uap::Database;
use uap::faa::Faa;
use uap::mictronics::Mictronics;
use std::str::FromStr;

// ./tests/data/faa is a directory containing the FAA CSV files.

let faa = Faa::from_dir(&std::path::PathBuf::from_str("./tests/data/faa").unwrap()).unwrap();
let aircraft = faa.lookup_mode_s("A44360").unwrap().unwrap();
assert_eq!(aircraft.registration, Some("N374HK".to_string()));
assert_eq!(aircraft.registrant.unwrap().name, "GENERAL ATOMICS AERONAUTICAL SYSTEMS INC".to_string());
assert_eq!(aircraft.kind, None);

// ./tests/data/mictronics is a directory containing the FAA CSV files.

let mictronics = Mictronics::from_dir(
  &std::path::PathBuf::from_str("./tests/data/mictronics").unwrap(),
)
.unwrap();
let aircraft = mictronics.lookup_mode_s("A44360").unwrap().unwrap();
assert_eq!(aircraft.registration, Some("N374HK".to_string()));
assert_eq!(aircraft.kind, Some("UHK97000-12".to_string()));

Dependencies

~4.5MB
~75K SLoC