logo Netzschleuder network catalog, repository, and centrifuge

History of bts_ontime_flights

The changes to the source code of this entry in the repository, newest first, each with the differences it made to the entry's files. They are also listed on GitLab.

[entries] Remove superfluous details of the upstream distribution from the descriptions by Tiago de Paula Peixoto dc07aa0
The descriptions mentioned incidental details of how the upstream data
are made available: the file formats (CSV, JSON, XML, GEXF, SBML, HIF,
Pajek, UCINET, ...), file names, where the files were published or
obtained from (Zenodo, figshare, Kaggle, the Pajek datasets page, the
Internet Archive), and that some networks are only available in the gt
format. These are left out; caveats about the data themselves are kept,
referring to "the data" instead of "the file". The description of
sp_baboons now lists its properties instead of the upstream columns,
and says that events without a recipient are left out.
diff --git a/entries/bts_ontime_flights/__init__.py b/entries/bts_ontime_flights/__init__.py
index 2fe8dee..6c39c55 100644
--- a/entries/bts_ontime_flights/__init__.py
+++ b/entries/bts_ontime_flights/__init__.py
@@ -24,7 +24,7 @@ import process_entry
 title = "US domestic flights with on-time performance (1987-2025)"
 description = r"""Temporal networks of the scheduled domestic flights of the large airlines of the United States, from the "Reporting Carrier On-Time Performance" data of the Bureau of Transportation Statistics (BTS) of the US Department of Transportation. The airlines whose share of the revenues of domestic scheduled passenger service is at least 0.5% must report every non-stop domestic flight to the BTS, with its scheduled and actual departure and arrival times, delays, cancellations and diversions (the number of reporting airlines varies between about 10 and 20 over the years). The data start in October 1987; there is one network per calendar year, from 1987 (October to December only) to 2025, named after the year (e.g. `2025`).
 
-Each node is an airport, identified by the airport ID of the Department of Transportation (which, unlike the three-letter codes, is not reused for different airports), and a directed edge from airport A to airport B is a scheduled flight from A to B (including cancelled and diverted flights), so that the networks are multigraphs with one edge per flight. Only the airports with some flight in the year are included. The times are given as in the source, in the local time of the airports, so the edge `time` is the date of the flight only; the scheduled and actual times of the day are separate properties. The taxi times, wheels-off and wheels-on times, delay groups and time blocks, the details of the diversions (landing airports), and the other identifiers of the airlines and airports (DOT ID and IATA code of the airline, sequence and city market IDs of the airports, FIPS codes and world area codes), given in the source, are not included. The monthly files of the BTS may be revised in place, so the data are those of the time of download. The months of 1990 to 1999, whose pre-zipped files the BTS no longer distributes, are downloaded through its download form, which gives the same data. The flights are not a nearly planar network (the airports have no coordinates in these data), so they are laid out as any other network.
+Each node is an airport, identified by the airport ID of the Department of Transportation (which, unlike the three-letter codes, is not reused for different airports), and a directed edge from airport A to airport B is a scheduled flight from A to B (including cancelled and diverted flights), so that the networks are multigraphs with one edge per flight. Only the airports with some flight in the year are included. The times are given as in the source, in the local time of the airports, so the edge `time` is the date of the flight only; the scheduled and actual times of the day are separate properties. The taxi times, wheels-off and wheels-on times, delay groups and time blocks, the details of the diversions (landing airports), and the other identifiers of the airlines and airports (DOT ID and IATA code of the airline, sequence and city market IDs of the airports, FIPS codes and world area codes), given in the source, are not included. The data may be revised by the BTS, so they are those of the time of download. The flights are not a nearly planar network (the airports have no coordinates in these data), so they are laid out as any other network.
 
 The networks have the following properties:
 
@@ -35,7 +35,7 @@ The networks have the following properties:
 - (Edge) `time`: the date of the flight, as the Unix time of its beginning (midnight UTC).
 - (Edge) `airline`: the unique carrier code of the airline (as used by the BTS; codes used by several airlines have a numeric suffix for the earlier users, e.g. `PA(1)`).
 - (Edge) `flight_number`: the flight number.
-- (Edge) `tail_number`: the tail number (registration) of the aircraft (often empty before 1995). In some files of 2001 and 2002, the letters S to Z of the tail numbers are given as their bytes in the EBCDIC encoding (e.g. `N850\xe4\xe2` for `N850US`, invalid in UTF-8); they are decoded.
+- (Edge) `tail_number`: the tail number (registration) of the aircraft (often empty before 1995). In some of the data of 2001 and 2002, the letters S to Z of the tail numbers are given as their bytes in the EBCDIC encoding (e.g. `N850\xe4\xe2` for `N850US`, invalid in UTF-8); they are decoded.
 - (Edge) `crs_dep_time`, `crs_arr_time`: the scheduled times of departure and arrival, in local time as `hhmm` (e.g. 937 for 9:37).
 - (Edge) `dep_time`, `arr_time`: the actual times of departure and arrival, in local time as `hhmm` (-1 if missing, e.g. for cancelled flights).
 - (Edge) `dep_delay`, `arr_delay`: the departure and arrival delays, in minutes (negative for early departures and arrivals; NaN if missing).
[entries] Add the date when each entry was added, and remove icon_hash by Tiago de Paula Peixoto beff7c9
The dates are those of the commits that first added the entries' files
(2020-08-11 for the entries of the initial commit); renamed entries keep
the date of their first name.

Changed: none
diff --git a/entries/bts_ontime_flights/__init__.py b/entries/bts_ontime_flights/__init__.py
index e1d7215..2fe8dee 100644
--- a/entries/bts_ontime_flights/__init__.py
+++ b/entries/bts_ontime_flights/__init__.py
@@ -50,7 +50,7 @@ url = ['https://www.transtats.bts.gov/Fields.asp?gnoyr_VQ=FGJ',
        'https://transtats.bts.gov/PREZIP/']
 citation = [('Bureau of Transportation Statistics, "Reporting Carrier On-Time Performance (1987-present)." US Department of Transportation (1987-2025)',
              'https://www.transtats.bts.gov/Fields.asp?gnoyr_VQ=FGJ')]
-icon_hash = None
+date_added = '2026-10-28'
 upstream_license = ("Public domain (US government work)", "https://www.usa.gov/government-works")
 
 upstream_prefix = 'https://transtats.bts.gov/PREZIP'
[entries] Prefix the properties in the descriptions with (Node), (Edge) or (Graph) by Tiago de Paula Peixoto bc3dbbd
The lists of properties at the end of the descriptions marked edge
properties with "Edge" but left node properties unmarked, or grouped
them in "Nodes: `a`, ...; `b`, ..." items, so the kind of a property
was often unclear. Every item now starts with (Node), (Edge) or (Graph),
followed by the property names, a colon and the explanation, one item
per property or group of properties; qualifications (kinds of nodes,
networks) follow the names in parentheses. Properties that were only
named got a short explanation, and a few items that named the wrong
kind of property were corrected.
diff --git a/entries/bts_ontime_flights/__init__.py b/entries/bts_ontime_flights/__init__.py
index b6a2f94..e1d7215 100644
--- a/entries/bts_ontime_flights/__init__.py
+++ b/entries/bts_ontime_flights/__init__.py
@@ -28,23 +28,23 @@ Each node is an airport, identified by the airport ID of the Department of Trans
 
 The networks have the following properties:
 
-- `airport_id`: the airport ID of the Department of Transportation.
-- `code`: the three-letter code of the airport (as of its last flight of the year).
-- `city`: the city of the airport, with its state (e.g. `Oakland, CA`).
-- `state`: the two-letter code of the state or territory of the airport.
-- Edge `time`: the date of the flight, as the Unix time of its beginning (midnight UTC).
-- Edge `airline`: the unique carrier code of the airline (as used by the BTS; codes used by several airlines have a numeric suffix for the earlier users, e.g. `PA(1)`).
-- Edge `flight_number`: the flight number.
-- Edge `tail_number`: the tail number (registration) of the aircraft (often empty before 1995). In some files of 2001 and 2002, the letters S to Z of the tail numbers are given as their bytes in the EBCDIC encoding (e.g. `N850\xe4\xe2` for `N850US`, invalid in UTF-8); they are decoded.
-- Edge `crs_dep_time`, `crs_arr_time`: the scheduled times of departure and arrival, in local time as `hhmm` (e.g. 937 for 9:37).
-- Edge `dep_time`, `arr_time`: the actual times of departure and arrival, in local time as `hhmm` (-1 if missing, e.g. for cancelled flights).
-- Edge `dep_delay`, `arr_delay`: the departure and arrival delays, in minutes (negative for early departures and arrivals; NaN if missing).
-- Edge `cancelled`: whether the flight was cancelled.
-- Edge `cancellation_code`: the reason of the cancellation (`A` carrier, `B` weather, `C` national air system, `D` security; empty if not cancelled or not reported, as before mid-2003).
-- Edge `diverted`: whether the flight was diverted.
-- Edge `crs_elapsed_time`, `actual_elapsed_time`, `air_time`: the scheduled and actual elapsed times of the flight, and its time in the air, in minutes (NaN if missing).
-- Edge `distance`: the distance between the airports, in miles.
-- Edge `carrier_delay`, `weather_delay`, `nas_delay`, `security_delay`, `late_aircraft_delay`: the minutes of arrival delay attributed to each cause, reported from June 2003 on for flights with an arrival delay of 15 minutes or more (NaN otherwise)."""
+- (Node) `airport_id`: the airport ID of the Department of Transportation.
+- (Node) `code`: the three-letter code of the airport (as of its last flight of the year).
+- (Node) `city`: the city of the airport, with its state (e.g. `Oakland, CA`).
+- (Node) `state`: the two-letter code of the state or territory of the airport.
+- (Edge) `time`: the date of the flight, as the Unix time of its beginning (midnight UTC).
+- (Edge) `airline`: the unique carrier code of the airline (as used by the BTS; codes used by several airlines have a numeric suffix for the earlier users, e.g. `PA(1)`).
+- (Edge) `flight_number`: the flight number.
+- (Edge) `tail_number`: the tail number (registration) of the aircraft (often empty before 1995). In some files of 2001 and 2002, the letters S to Z of the tail numbers are given as their bytes in the EBCDIC encoding (e.g. `N850\xe4\xe2` for `N850US`, invalid in UTF-8); they are decoded.
+- (Edge) `crs_dep_time`, `crs_arr_time`: the scheduled times of departure and arrival, in local time as `hhmm` (e.g. 937 for 9:37).
+- (Edge) `dep_time`, `arr_time`: the actual times of departure and arrival, in local time as `hhmm` (-1 if missing, e.g. for cancelled flights).
+- (Edge) `dep_delay`, `arr_delay`: the departure and arrival delays, in minutes (negative for early departures and arrivals; NaN if missing).
+- (Edge) `cancelled`: whether the flight was cancelled.
+- (Edge) `cancellation_code`: the reason of the cancellation (`A` carrier, `B` weather, `C` national air system, `D` security; empty if not cancelled or not reported, as before mid-2003).
+- (Edge) `diverted`: whether the flight was diverted.
+- (Edge) `crs_elapsed_time`, `actual_elapsed_time`, `air_time`: the scheduled and actual elapsed times of the flight, and its time in the air, in minutes (NaN if missing).
+- (Edge) `distance`: the distance between the airports, in miles.
+- (Edge) `carrier_delay`, `weather_delay`, `nas_delay`, `security_delay`, `late_aircraft_delay`: the minutes of arrival delay attributed to each cause, reported from June 2003 on for flights with an arrival delay of 15 minutes or more (NaN otherwise)."""
 tags = ['Transportation', 'Airport', 'Multigraph', 'Temporal', 'Timestamps', 'Metadata']
 url = ['https://www.transtats.bts.gov/Fields.asp?gnoyr_VQ=FGJ',
        'https://transtats.bts.gov/PREZIP/']
[entries] bts_ontime_flights: decode the tail numbers given in EBCDIC by Tiago de Paula Peixoto df00e6f
Some monthly files of 2001 and 2002 give the letters S to Z of the tail
numbers as their EBCDIC bytes (0xe2-0xe9, e.g. "N850\xe4\xe2" for
"N850US"), which makes them invalid UTF-8, and polars failed to read
them. In the files that are not valid UTF-8, these bytes are decoded.
diff --git a/entries/bts_ontime_flights/__init__.py b/entries/bts_ontime_flights/__init__.py
index ae9785c..b6a2f94 100644
--- a/entries/bts_ontime_flights/__init__.py
+++ b/entries/bts_ontime_flights/__init__.py
@@ -18,6 +18,7 @@
 
 from .. import *
 import html
+import io
 import process_entry
 
 title = "US domestic flights with on-time performance (1987-2025)"
@@ -34,7 +35,7 @@ The networks have the following properties:
 - Edge `time`: the date of the flight, as the Unix time of its beginning (midnight UTC).
 - Edge `airline`: the unique carrier code of the airline (as used by the BTS; codes used by several airlines have a numeric suffix for the earlier users, e.g. `PA(1)`).
 - Edge `flight_number`: the flight number.
-- Edge `tail_number`: the tail number (registration) of the aircraft (often empty before 1995).
+- Edge `tail_number`: the tail number (registration) of the aircraft (often empty before 1995). In some files of 2001 and 2002, the letters S to Z of the tail numbers are given as their bytes in the EBCDIC encoding (e.g. `N850\xe4\xe2` for `N850US`, invalid in UTF-8); they are decoded.
 - Edge `crs_dep_time`, `crs_arr_time`: the scheduled times of departure and arrival, in local time as `hhmm` (e.g. 937 for 9:37).
 - Edge `dep_time`, `arr_time`: the actual times of departure and arrival, in local time as `hhmm` (-1 if missing, e.g. for cancelled flights).
 - Edge `dep_delay`, `arr_delay`: the departure and arrival delays, in minutes (negative for early departures and arrivals; NaN if missing).
@@ -157,6 +158,8 @@ _form_cols = {"FL_DATE": "FlightDate", "OP_UNIQUE_CARRIER": "Reporting_Airline",
               "CRS_DEP_TIME": "CRSDepTime", "DEP_TIME": "DepTime",
               "CRS_ARR_TIME": "CRSArrTime", "ARR_TIME": "ArrTime"}
 
+_EBCDIC_S_Z = bytes.maketrans(bytes(range(0xe2, 0xea)), b"STUVWXYZ")
+
 def _read_month(name, fname):
     import polars as pl
     cols = (["FlightDate", "Reporting_Airline", "Tail_Number",
@@ -165,6 +168,16 @@ def _read_month(name, fname):
              "DestCityName", "DestState", "Cancelled", "CancellationCode",
              "Diverted"] + list(_float_cols) + list(_time_cols))
     with open_upstream_file(name, fname, "rb") as f:
+        # Some files of 2001-2002 give the letters S-Z of the tail numbers
+        # in EBCDIC (bytes 0xe2-0xe9), which makes them invalid UTF-8; in
+        # those, these bytes are decoded (in valid UTF-8 they start other
+        # characters)
+        data = f.read()
+        try:
+            data.decode("utf-8")
+        except UnicodeDecodeError:
+            data = data.translate(_EBCDIC_S_Z)
+        f = io.BytesIO(data)
         if fname.startswith("T_ONTIME_REPORTING"):
             df = pl.read_csv(f, columns=list(_form_cols), infer_schema=False)
             # (dates as "1/31/1990 12:00:00 AM")
[entries] bts_ontime_flights: download 1990-1999 through the BTS download form by Tiago de Paula Peixoto 6885b94
The BTS removed the pre-zipped monthly files of 1990 to 1999 from
PREZIP/ (between September 2024 and January 2025), so the fetch failed
at the first of them. These months are now downloaded through the
download form of TranStats, with all its fields, which gives the same
data under other column names (checked on December 1989, available in
both ways). The form sometimes answers with its page instead of the
file, in which case the download is tried again.
diff --git a/entries/bts_ontime_flights/__init__.py b/entries/bts_ontime_flights/__init__.py
index 41be0e7..ae9785c 100644
--- a/entries/bts_ontime_flights/__init__.py
+++ b/entries/bts_ontime_flights/__init__.py
@@ -17,11 +17,13 @@
 # with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from .. import *
+import html
+import process_entry
 
 title = "US domestic flights with on-time performance (1987-2025)"
 description = r"""Temporal networks of the scheduled domestic flights of the large airlines of the United States, from the "Reporting Carrier On-Time Performance" data of the Bureau of Transportation Statistics (BTS) of the US Department of Transportation. The airlines whose share of the revenues of domestic scheduled passenger service is at least 0.5% must report every non-stop domestic flight to the BTS, with its scheduled and actual departure and arrival times, delays, cancellations and diversions (the number of reporting airlines varies between about 10 and 20 over the years). The data start in October 1987; there is one network per calendar year, from 1987 (October to December only) to 2025, named after the year (e.g. `2025`).
 
-Each node is an airport, identified by the airport ID of the Department of Transportation (which, unlike the three-letter codes, is not reused for different airports), and a directed edge from airport A to airport B is a scheduled flight from A to B (including cancelled and diverted flights), so that the networks are multigraphs with one edge per flight. Only the airports with some flight in the year are included. The times are given as in the source, in the local time of the airports, so the edge `time` is the date of the flight only; the scheduled and actual times of the day are separate properties. The taxi times, wheels-off and wheels-on times, delay groups and time blocks, the details of the diversions (landing airports), and the other identifiers of the airlines and airports (DOT ID and IATA code of the airline, sequence and city market IDs of the airports, FIPS codes and world area codes), given in the source, are not included. The monthly files of the BTS may be revised in place, so the data are those of the time of download. The flights are not a nearly planar network (the airports have no coordinates in these data), so they are laid out as any other network.
+Each node is an airport, identified by the airport ID of the Department of Transportation (which, unlike the three-letter codes, is not reused for different airports), and a directed edge from airport A to airport B is a scheduled flight from A to B (including cancelled and diverted flights), so that the networks are multigraphs with one edge per flight. Only the airports with some flight in the year are included. The times are given as in the source, in the local time of the airports, so the edge `time` is the date of the flight only; the scheduled and actual times of the day are separate properties. The taxi times, wheels-off and wheels-on times, delay groups and time blocks, the details of the diversions (landing airports), and the other identifiers of the airlines and airports (DOT ID and IATA code of the airline, sequence and city market IDs of the airports, FIPS codes and world area codes), given in the source, are not included. The monthly files of the BTS may be revised in place, so the data are those of the time of download. The months of 1990 to 1999, whose pre-zipped files the BTS no longer distributes, are downloaded through its download form, which gives the same data. The flights are not a nearly planar network (the airports have no coordinates in these data), so they are laid out as any other network.
 
 The networks have the following properties:
 
@@ -53,16 +55,77 @@ upstream_license = ("Public domain (US government work)", "https://www.usa.gov/g
 upstream_prefix = 'https://transtats.bts.gov/PREZIP'
 years = range(1987, 2026)
 
+# The pre-zipped monthly files of 1990-1999 were removed from PREZIP/ (between
+# September 2024 and January 2025); these months are downloaded through the
+# download form of TranStats instead, with all its fields, which gives the
+# same data under other column names (see _form_cols)
+_form_years = range(1990, 2000)
+_form_url = "https://transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=FGJ&QO_fu146_anzr=b0-gvzr"
+
 def _month(y, m):
+    if y in _form_years:
+        return f"T_ONTIME_REPORTING_{y}_{m}.zip:T_ONTIME_REPORTING.csv"
     return (f"On_Time_Reporting_Carrier_On_Time_Performance_1987_present_{y}_{m}.zip:"
             f"On_Time_Reporting_Carrier_On_Time_Performance_(1987_present)_{y}_{m}.csv")
 
 files = [(tuple(_month(y, m) for m in range(10 if y == 1987 else 1, 13)), str(y), None)
          for y in years]
 
+def _fetch_form(name, y, m, tries=5, pause=60):
+    """Download the month `m` of year `y` through the download form, which
+    sometimes answers with the form page instead of the file (it is then
+    requested again)."""
+    import http.cookiejar
+    fname = _month(y, m).split(":")[0]
+    for i in range(tries):
+        # the form needs the state fields of the page, in the same session
+        opener = urllib.request.build_opener(
+            urllib.request.HTTPCookieProcessor(http.cookiejar.CookieJar()))
+        opener.addheaders = [("User-Agent", USER_AGENTS[0])]
+        pace_request(_form_url)
+        page = opener.open(_form_url, timeout=DOWNLOAD_TIMEOUT).read().decode("utf-8", "replace")
+        data = {k: html.unescape(v) for k, v in
+                re.findall(r'<input type="hidden" name="([^"]+)" id="[^"]*" value="([^"]*)"', page)}
+        data.update(cboGeography="All", cboYear=str(y), cboPeriod=str(m),
+                    btnDownload="Download")
+        for field in re.findall(r'<input[^>]*type="checkbox"[^>]*name="([^"]+)"', page):
+            if not field.startswith("chk"):
+                data[field] = "on"
+        req = urllib.request.Request(_form_url, headers={"Referer": _form_url},
+                                     data=urllib.parse.urlencode(data).encode())
+        pace_request(_form_url)
+        with opener.open(req, timeout=3600) as f:
+            if f.headers.get_content_type() == "application/zip":
+                buf = io.BytesIO()
+                copy_download(f, buf, label=fname)
+                with zipfile.ZipFile(buf) as z:
+                    if z.testzip() is None and "T_ONTIME_REPORTING.csv" in z.namelist():
+                        with open_upstream_file(name, fname, "wb") as output:
+                            output.write(buf.getvalue())
+                        return
+        print(f"\t{fname}: no file from the download form, trying again...")
+        time.sleep(pause * (i + 1))
+    raise IOError(f"cannot download {fname} from {_form_url}")
+
 def fetch_upstream(force=False):
-    return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
-                                force)
+    name = __name__.split(".")[-1]
+    fetch_upstream_files(name, upstream_prefix,
+                         [(fnames, alt, fmt) for fnames, alt, fmt in files
+                          if int(alt) not in _form_years], force)
+    if process_entry._check_health:
+        # the form must still offer the years
+        with open_url(_form_url) as f:
+            page = f.read().decode("utf-8", "replace")
+        missing = [y for y in _form_years if f'value="{y}"' not in page]
+        if missing:
+            raise IOError(f"the download form does not offer the years {missing}")
+        return
+    for y in _form_years:
+        for m in range(1, 13):
+            fname = _month(y, m).split(":")[0]
+            if not force and os.path.exists(f"cache/upstream/{name}/{fname}"):
+                continue
+            _fetch_form(name, y, m)
 
 _float_cols = {"DepDelay": "dep_delay", "ArrDelay": "arr_delay",
                "CRSElapsedTime": "crs_elapsed_time",
@@ -74,6 +137,26 @@ _float_cols = {"DepDelay": "dep_delay", "ArrDelay": "arr_delay",
 _time_cols = {"CRSDepTime": "crs_dep_time", "DepTime": "dep_time",
               "CRSArrTime": "crs_arr_time", "ArrTime": "arr_time"}
 
+# The names of the columns in the files of the download form, which has the
+# same fields as the pre-zipped files, in the same order
+_form_cols = {"FL_DATE": "FlightDate", "OP_UNIQUE_CARRIER": "Reporting_Airline",
+              "TAIL_NUM": "Tail_Number",
+              "OP_CARRIER_FL_NUM": "Flight_Number_Reporting_Airline",
+              "ORIGIN_AIRPORT_ID": "OriginAirportID", "ORIGIN": "Origin",
+              "ORIGIN_CITY_NAME": "OriginCityName", "ORIGIN_STATE_ABR": "OriginState",
+              "DEST_AIRPORT_ID": "DestAirportID", "DEST": "Dest",
+              "DEST_CITY_NAME": "DestCityName", "DEST_STATE_ABR": "DestState",
+              "CANCELLED": "Cancelled", "CANCELLATION_CODE": "CancellationCode",
+              "DIVERTED": "Diverted", "DEP_DELAY": "DepDelay", "ARR_DELAY": "ArrDelay",
+              "CRS_ELAPSED_TIME": "CRSElapsedTime",
+              "ACTUAL_ELAPSED_TIME": "ActualElapsedTime", "AIR_TIME": "AirTime",
+              "DISTANCE": "Distance", "CARRIER_DELAY": "CarrierDelay",
+              "WEATHER_DELAY": "WeatherDelay", "NAS_DELAY": "NASDelay",
+              "SECURITY_DELAY": "SecurityDelay",
+              "LATE_AIRCRAFT_DELAY": "LateAircraftDelay",
+              "CRS_DEP_TIME": "CRSDepTime", "DEP_TIME": "DepTime",
+              "CRS_ARR_TIME": "CRSArrTime", "ARR_TIME": "ArrTime"}
+
 def _read_month(name, fname):
     import polars as pl
     cols = (["FlightDate", "Reporting_Airline", "Tail_Number",
@@ -82,8 +165,16 @@ def _read_month(name, fname):
              "DestCityName", "DestState", "Cancelled", "CancellationCode",
              "Diverted"] + list(_float_cols) + list(_time_cols))
     with open_upstream_file(name, fname, "rb") as f:
-        df = pl.read_csv(f, columns=cols, infer_schema=False)
-    return df
+        if fname.startswith("T_ONTIME_REPORTING"):
+            df = pl.read_csv(f, columns=list(_form_cols), infer_schema=False)
+            # (dates as "1/31/1990 12:00:00 AM")
+            df = (df.rename(_form_cols)
+                  .with_columns(pl.col("FlightDate")
+                                .str.strptime(pl.Date, "%m/%d/%Y %I:%M:%S %p")
+                                .dt.strftime("%Y-%m-%d")))
+        else:
+            df = pl.read_csv(f, columns=cols, infer_schema=False)
+    return df.select(cols)
 
 @cache_network()
 @coerce_props()
[entries] New entry: bts_ontime_flights by Tiago de Paula Peixoto 8124c68
diff --git a/entries/bts_ontime_flights/__init__.py b/entries/bts_ontime_flights/__init__.py
new file mode 100644
index 0000000..41be0e7
--- /dev/null
+++ b/entries/bts_ontime_flights/__init__.py
@@ -0,0 +1,148 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2026 Tiago de Paula Peixoto <tiago@skewed.de>
+#
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Affero General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Affero General Public License along
+# with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+from .. import *
+
+title = "US domestic flights with on-time performance (1987-2025)"
+description = r"""Temporal networks of the scheduled domestic flights of the large airlines of the United States, from the "Reporting Carrier On-Time Performance" data of the Bureau of Transportation Statistics (BTS) of the US Department of Transportation. The airlines whose share of the revenues of domestic scheduled passenger service is at least 0.5% must report every non-stop domestic flight to the BTS, with its scheduled and actual departure and arrival times, delays, cancellations and diversions (the number of reporting airlines varies between about 10 and 20 over the years). The data start in October 1987; there is one network per calendar year, from 1987 (October to December only) to 2025, named after the year (e.g. `2025`).
+
+Each node is an airport, identified by the airport ID of the Department of Transportation (which, unlike the three-letter codes, is not reused for different airports), and a directed edge from airport A to airport B is a scheduled flight from A to B (including cancelled and diverted flights), so that the networks are multigraphs with one edge per flight. Only the airports with some flight in the year are included. The times are given as in the source, in the local time of the airports, so the edge `time` is the date of the flight only; the scheduled and actual times of the day are separate properties. The taxi times, wheels-off and wheels-on times, delay groups and time blocks, the details of the diversions (landing airports), and the other identifiers of the airlines and airports (DOT ID and IATA code of the airline, sequence and city market IDs of the airports, FIPS codes and world area codes), given in the source, are not included. The monthly files of the BTS may be revised in place, so the data are those of the time of download. The flights are not a nearly planar network (the airports have no coordinates in these data), so they are laid out as any other network.
+
+The networks have the following properties:
+
+- `airport_id`: the airport ID of the Department of Transportation.
+- `code`: the three-letter code of the airport (as of its last flight of the year).
+- `city`: the city of the airport, with its state (e.g. `Oakland, CA`).
+- `state`: the two-letter code of the state or territory of the airport.
+- Edge `time`: the date of the flight, as the Unix time of its beginning (midnight UTC).
+- Edge `airline`: the unique carrier code of the airline (as used by the BTS; codes used by several airlines have a numeric suffix for the earlier users, e.g. `PA(1)`).
+- Edge `flight_number`: the flight number.
+- Edge `tail_number`: the tail number (registration) of the aircraft (often empty before 1995).
+- Edge `crs_dep_time`, `crs_arr_time`: the scheduled times of departure and arrival, in local time as `hhmm` (e.g. 937 for 9:37).
+- Edge `dep_time`, `arr_time`: the actual times of departure and arrival, in local time as `hhmm` (-1 if missing, e.g. for cancelled flights).
+- Edge `dep_delay`, `arr_delay`: the departure and arrival delays, in minutes (negative for early departures and arrivals; NaN if missing).
+- Edge `cancelled`: whether the flight was cancelled.
+- Edge `cancellation_code`: the reason of the cancellation (`A` carrier, `B` weather, `C` national air system, `D` security; empty if not cancelled or not reported, as before mid-2003).
+- Edge `diverted`: whether the flight was diverted.
+- Edge `crs_elapsed_time`, `actual_elapsed_time`, `air_time`: the scheduled and actual elapsed times of the flight, and its time in the air, in minutes (NaN if missing).
+- Edge `distance`: the distance between the airports, in miles.
+- Edge `carrier_delay`, `weather_delay`, `nas_delay`, `security_delay`, `late_aircraft_delay`: the minutes of arrival delay attributed to each cause, reported from June 2003 on for flights with an arrival delay of 15 minutes or more (NaN otherwise)."""
+tags = ['Transportation', 'Airport', 'Multigraph', 'Temporal', 'Timestamps', 'Metadata']
+url = ['https://www.transtats.bts.gov/Fields.asp?gnoyr_VQ=FGJ',
+       'https://transtats.bts.gov/PREZIP/']
+citation = [('Bureau of Transportation Statistics, "Reporting Carrier On-Time Performance (1987-present)." US Department of Transportation (1987-2025)',
+             'https://www.transtats.bts.gov/Fields.asp?gnoyr_VQ=FGJ')]
+icon_hash = None
+upstream_license = ("Public domain (US government work)", "https://www.usa.gov/government-works")
+
+upstream_prefix = 'https://transtats.bts.gov/PREZIP'
+years = range(1987, 2026)
+
+def _month(y, m):
+    return (f"On_Time_Reporting_Carrier_On_Time_Performance_1987_present_{y}_{m}.zip:"
+            f"On_Time_Reporting_Carrier_On_Time_Performance_(1987_present)_{y}_{m}.csv")
+
+files = [(tuple(_month(y, m) for m in range(10 if y == 1987 else 1, 13)), str(y), None)
+         for y in years]
+
+def fetch_upstream(force=False):
+    return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+                                force)
+
+_float_cols = {"DepDelay": "dep_delay", "ArrDelay": "arr_delay",
+               "CRSElapsedTime": "crs_elapsed_time",
+               "ActualElapsedTime": "actual_elapsed_time", "AirTime": "air_time",
+               "Distance": "distance", "CarrierDelay": "carrier_delay",
+               "WeatherDelay": "weather_delay", "NASDelay": "nas_delay",
+               "SecurityDelay": "security_delay",
+               "LateAircraftDelay": "late_aircraft_delay"}
+_time_cols = {"CRSDepTime": "crs_dep_time", "DepTime": "dep_time",
+              "CRSArrTime": "crs_arr_time", "ArrTime": "arr_time"}
+
+def _read_month(name, fname):
+    import polars as pl
+    cols = (["FlightDate", "Reporting_Airline", "Tail_Number",
+             "Flight_Number_Reporting_Airline", "OriginAirportID", "Origin",
+             "OriginCityName", "OriginState", "DestAirportID", "Dest",
+             "DestCityName", "DestState", "Cancelled", "CancellationCode",
+             "Diverted"] + list(_float_cols) + list(_time_cols))
+    with open_upstream_file(name, fname, "rb") as f:
+        df = pl.read_csv(f, columns=cols, infer_schema=False)
+    return df
+
+@cache_network()
+@coerce_props()
+@annotate()
+def parse(alts=None):
+    import polars as pl
+    name = __name__.split(".")[-1]
+    for fnames, alt, fmt in files:
+        if alts is not None and alt not in alts:
+            continue
+        df = pl.concat([_read_month(name, f) for f in fnames])
+        df = df.with_columns(pl.col(c).cast(pl.Int64) for c in
+                             ["OriginAirportID", "DestAirportID"])
+        # the airports, in the order of their IDs, with the attributes of
+        # their last flight of the year
+        ap = pl.concat([df.select(airport_id="OriginAirportID", code="Origin",
+                                  city="OriginCityName", state="OriginState"),
+                        df.select(airport_id="DestAirportID", code="Dest",
+                                  city="DestCityName", state="DestState")])
+        ap = (ap.unique(subset="airport_id", keep="last", maintain_order=True)
+              .sort("airport_id"))
+        ids = ap["airport_id"].to_numpy()
+        s = numpy.searchsorted(ids, df["OriginAirportID"].to_numpy())
+        t = numpy.searchsorted(ids, df["DestAirportID"].to_numpy())
+
+        g = Graph(directed=True)
+        g.add_vertex(len(ids))
+        g.vp.airport_id = g.new_vp("int32_t", vals=ids)
+        for c in ["code", "city", "state"]:
+            g.vp[c] = g.new_vp("string", vals=ap[c].fill_null("").to_list())
+        g.add_edge_list(numpy.column_stack((s, t)))
+        del s, t
+        day = (df["FlightDate"].str.strptime(pl.Date, "%Y-%m-%d")
+               .cast(pl.Datetime("us")).dt.epoch("s"))
+        g.ep.time = g.new_ep("int64_t", vals=day.to_numpy())
+        g.ep.airline = g.new_ep("string", vals=df["Reporting_Airline"].fill_null("").to_list())
+        g.ep.flight_number = g.new_ep("int32_t", vals=df["Flight_Number_Reporting_Airline"]
+                                      .cast(pl.Int32, strict=False).fill_null(-1).to_numpy())
+        g.ep.tail_number = g.new_ep("string", vals=df["Tail_Number"].fill_null("").to_list())
+        for c, k in _time_cols.items():
+            x = (df[c].str.strip_chars().cast(pl.Int32, strict=False)
+                 .fill_null(-1).to_numpy())
+            g.ep[k] = g.new_ep("int32_t", vals=x)
+        for c, k in _float_cols.items():
+            x = df[c].cast(pl.Float64, strict=False).fill_null(numpy.nan).to_numpy()
+            g.ep[k] = g.new_ep("double", vals=x)
+        g.ep.cancelled = g.new_ep("bool", vals=df["Cancelled"].cast(pl.Float64).to_numpy() > 0)
+        g.ep.cancellation_code = g.new_ep("string", vals=df["CancellationCode"].fill_null("").to_list())
+        g.ep.diverted = g.new_ep("bool", vals=df["Diverted"].cast(pl.Float64).to_numpy() > 0)
+        # the edge properties in the order of the description
+        order = (["time", "airline", "flight_number", "tail_number",
+                  "crs_dep_time", "crs_arr_time", "dep_time", "arr_time",
+                  "dep_delay", "arr_delay", "cancelled", "cancellation_code",
+                  "diverted"] + [k for k in _float_cols.values()
+                                 if k not in ("dep_delay", "arr_delay")])
+        eprops = {k: g.ep[k] for k in order}
+        for k in list(g.ep.keys()):
+            del g.ep[k]
+        for k, p in eprops.items():
+            g.ep[k] = p
+        del df
+        yield alt, g