Context Help: Comma-Separated Value (CSV) Format

This document defines Revision 0.41 of the comma-separated value (CSV) format natively exported and imported by OpenFlights.

OpenFlights CSV follows RFC 4180.

Field definition

1. Date
Date of flight, in YYYY-MM-DD (dash-separated, preferred format), MM/DD/YYYY (slash-separated), DD.MM.YYYY (dot-separated) or YYYY (year-only) format. The date may optionally also contain the departure time of the flight in the format HH:MM[:SS], separated from the date by a space. Seconds are optional, but presently ignored. Mandatory (date part only).
2. From
IATA or ICAO code of source airport. Mandatory unless "From_OID" is provided.
3. To
IATA or ICAO code of destination airport. Mandatory unless "To_OID" is provided.
4. Flight_Number
Flight number. If first two characters are an airline code (two alphanumeric digits), the code is used to override "Airline".
5. Airline
Full name of airline name. Airline codes are not recognized. May be overridden by "Flight_Number", defaults to Unknown if not available.
6. Distance
Distance of flight, in miles. Calculated automatically if not provided.
7. Duration
Duration of flight, in the format HH:MM. Estimated automatically if not provided.
8. Seat
Seat number.
9. Seat_Type
Seat type: one of "W" for Window, "A" for Aisle or "M" for Middle.
10. Class
Class: one of "F" for First, "C" for Business, "P" for Premium Economy, "Y" for Economy.
11. Reason
Reason for flight: one of "B" for Business, "L" for Personal, "C" for Crew or "O" for Other.
12. Plane
Plane type.
13. Registration
Plane registration number.
14. Trip
Internal OpenFlights Trip ID. Optional, but must exist and belong to the user importing the data if specified.
15. Note
User-entered note or comment about flight.
The final four fields contain internal OpenFlights IDs (OID) for ensuring accurate imports. They are generated automatically when exporting, but should not be provided if creating or importing your own data, or altering the airline, airport or plane fields of exported data.
16. From_OID
Internal OpenFlights airport ID. Overrides "From" if provided.
17. To_OID
Internal OpenFlights airport ID. Overrides "To" if provided.
18. Airline_OID
Internal OpenFlights airline ID. Overrides "Airline" if provided.
19. Plane_OID
Internal OpenFlights plane ID. Overrides "Plane" if provided.

Airline matching

Airlines are matched in the following order:

  1. "Airline_OID" as internal identifier
  2. First two characters of "Flight_Number" as IATA code, if alphanumeric and not numeric (AB, A1, 1A are OK, but 11 is not)
  3. "Airline" as name or alias

Note that the airline code (IATA/ICAO) must be supplied in "Flight_Number", not "Airline".

Sample

The following sample shows the maximal, recommended, and three minimal data sets for importing a flight (airline and flight number, airline only, and neither airline nor flight number).

            Date,From,To,Flight_Number,Airline,Distance,Duration,Seat,Seat_Type,Class,Reason,Plane,Registration,Trip,Note,From_OID,To_OID,Airline_OID,Plane_OID
            2008-01-18 10:30:10,DXB,RUH,SV559,Saudi Arabian Airlines,542,01:35,40C,A,Y,B,Boeing 777,HZ-AKH,16,"First, to Saudi!",2188,2082,4533,3
            2008-01-18 10:30,DXB,RUH,SV559,Saudi Arabian Airlines,542,01:35,40C,A,Y,B,Boeing 777,HZ-AKH,16,"First, to Saudi!"
            2008-01-18,DXB,RUH,SV559
            2008-01-18,DXB,RUH,,Saudi Arabian Airlines
            2008-01-18,DXB,RUH
            

Note: The first line of any CSV file is always ignored, the field key is provided only for your own reference.

Revision history

0.42 — Nov 7, 2010
Fix representation of byte-order mark in UTF-8.
0.41 — Jul 21, 2009
Clarified encoding.
0.4 — Feb 1, 2009
Date field now allows an optional time element.
0.3 — Dec 22, 2008
Corrected business class specifier to "C", although "B" is still accepted. Support for American (DD/MM/YYYY) and European (DD.MM.YYYY) dates added.
0.2 — Dec 2, 2008
Specifying airline no longer mandatory. Clarified field names and airline matching logic.
0.1 — Nov 30, 2008
Original release.