#asterix #aerospace #sac #aeronautical-data

app fetch-sac

Fetch the official list of SAC codes from ASTERIX site

4 releases

0.6.1 Apr 6, 2023
0.6.0 Apr 4, 2023
0.5.1 Apr 3, 2023
0.5.0 Apr 3, 2023

#1133 in Parser implementations

MIT license

28KB
559 lines

fetch-sac

Library to fetch the latest list of SAC codes from the official ECTL website

Build status Buildstatus (develop) Docs GitHub release GitHub issues fetch-sac: 1.56+ SemVer License

Licensed under the MIT license.

  1. About
  2. History
  3. Installation
  4. Usage
  5. MSRV
  6. Supported platforms
  7. TODO
  8. Contributing

About

This is a small CLI utility to fetch the official list of SAC codes from the ECTL Asterix website.

History

ECTL is the official maintainer of the worldwide list of SAC codes, representing different zones in the world.
These are used in Surveillance work in the Aeronautical world to represent a given (and large) zone from which a given surveillance record has been issued when using the Asterix specifications.

This thing is, this list of not available in any usable format, and you are supposed to just read the web page. This is for me clearly unacceptable in 2023 and getting the list in various formats like JSON or even CSV is desirable.

Installation

It is be available as a crate on Crates.io and as a repository on GitHub. Installation can be done either through a compiled binary for your platform or by cloning the repo and compiling.

cargo

UNIX/macOS:

$ cargo install fetch-sac

Windows

C:\> cargo.exe install fetch-sac

From source

$ git clone https://github.com/keltia/fetch-sac
$ cd fetch-sac
$ cargo build
$ cargo test
$ cargo install --release

Usage

For the moment, there is only one binary called fetch-sac (with .exe on Windows). It scrapes the official website, remove all the HTML and outputs the result into usable formats.

Fetch the latest SAC codes data from ECTL.
Source: https://www.eurocontrol.int/asterix/

Usage: fetch-sac [OPTIONS]

Options:
  -C, --csv              CSV
  -J, --json             JSON
  -o, --output <OUTPUT>  Output file
  -q, --quiet            Quiet mode
  -v, --verbose...       Verbose mode
  -V, --version          Display utility full version
  -h, --help             Print help

NOTE

As this utility is scraping the web page directly, looking for what interests it, it may of course break from time to time as the page get updated (not very often though). The format of the various tabs in the table is different between all of them which makes it more complicated. There is also the matter of the <br> inserted at some points breaking the parsing, it tries to compensate for this.

This way of doing things is so '90 and broken.

MSRV

The Minimum Supported Rust Version is 1.56 due to the 2021 Edition.

Supported platforms

  • Unix (tested on FreeBSD, Linux and macOS)
  • Windows
    • cmd.exe
    • Powershell

TODO

  • fetch and parse the page
  • text output
  • json output
  • handle different output
  • csv output
  • adding CLI tests
  • tests & documentation

Contributing

Please see CONTRIBUTING.md for some simple rules.

I use Git Flow for this package so please use something similar or the usual GitHub workflow.

  1. Fork it here
  2. Checkout the develop branch (git checkout develop)
  3. Create your feature branch (git checkout -b my-new-feature)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create a new Pull Request

Dependencies

~13–27MB
~421K SLoC