Skip to main content
The airline-codes package syncs airline data from the upstream OpenFlights.org database maintained by jpatokal/openflights. This ensures you always have access to the latest airline information.

Automated Weekly Updates

The data is automatically updated every Monday at 6am UTC via GitHub Actions. The workflow:
1

Fetch Latest Data

Downloads the latest airlines.dat file from the OpenFlights GitHub repository
wget https://raw.githubusercontent.com/jpatokal/openflights/master/data/airlines.dat
2

Apply Corrections

Runs normalize.js to apply local corrections for country names and data quality fixes
node normalize.js
3

Regenerate JSON

Converts the corrected CSV data to JSON format with convert.js
node convert.js
4

Commit & Publish

If changes are detected, the workflow automatically:
  • Bumps the patch version
  • Commits the updated data files
  • Pushes to the repository
The automated workflow runs on the schedule defined in .github/workflows/update-data.yml and can also be triggered manually via the GitHub Actions interface.

Manual Updates

You can update the airline data manually at any time by running the data pipeline locally:
1

Install Dependencies

Make sure you have the required npm packages installed:
npm ci
2

Download Latest Data

Fetch the current airlines.dat file from OpenFlights:
wget https://raw.githubusercontent.com/jpatokal/openflights/master/data/airlines.dat
This downloads the latest airline data in CSV format.
3

Apply Corrections

Run the normalization script to apply local corrections:
node normalize.js
This script reads airlines.dat, applies corrections from COUNTRY_CORRECTIONS and ID_CORRECTIONS, and writes the corrected data back to airlines.dat.
4

Generate JSON

Convert the corrected CSV to JSON format:
node convert.js
This creates airlines.json with all airline records as JSON objects, sorted with active airlines first.
After running these commands, you’ll have updated airlines.dat and airlines.json files ready to commit.

Data Pipeline Overview

The update process follows this pipeline:

What Gets Updated

When you update the data, the following files are modified:
FileDescriptionFormat
airlines.datRaw airline data with corrections appliedCSV
airlines.jsonStructured airline data for the npm packageJSON
Always run normalize.js before convert.js to ensure corrections are applied. Running convert.js alone will generate JSON from uncorrected upstream data.

Triggering GitHub Actions Workflow

If you have write access to the repository, you can manually trigger the update workflow:
  1. Go to the Actions tab in the GitHub repository
  2. Select Update Airline Data from the workflow list
  3. Click Run workflow
  4. Choose the branch (usually master) and click Run workflow
The workflow will complete all update steps automatically and commit changes if new data is detected.

Verifying Updates

After updating, you can verify the changes:
git diff airlines.dat
git diff airlines.json

Data Freshness

The OpenFlights database is community-maintained and updated regularly. The weekly sync ensures that:
  • New airlines are added within days of being submitted upstream
  • Defunct airlines are marked inactive
  • Airline information changes (rebrands, mergers) are reflected
  • IATA/ICAO code assignments stay current
The package version is automatically bumped on each data update, so you can track data freshness via the version number in package.json.

Build docs developers (and LLMs) love