## A quick script to fix the ridiculous format of the raw FAA download data (at least it's available though!)

import csv

# MASTER.txt is from https://www.faa.gov/licenses_certificates/aircraft_certification/aircraft_registry/releasable_aircraft_download/
with open("MASTER.txt") as orig_file:
    orig_file_reader = csv.reader(orig_file, delimiter=",")
    with open("/temp/MASTER_CLEANED.csv", "w", newline='') as clean_file:
        writer = csv.writer(clean_file)
        for orig_record in orig_file_reader:
            new_row = [old_field_data.strip() for old_field_data in orig_record]
            # The data has a trailing comma on every single row (including the header row), so remove it as well
            new_row_without_trailing_comma = new_row[:-1]
            writer.writerow(new_row_without_trailing_comma)

@@ -507,16 +507,103 @@
 reader:%0A
+            # some of the data contains trailing spaces/tabs, so we remove those first%0A
         
@@ -675,16 +675,17 @@
 record%5D%0A
+%0A
         
@@ -846,16 +846,89 @@
 row%5B:-1%5D
+%0A%0A            # write out a new CSV, which is then imported into Postgres
 %0A       

Add comments to explain what the script is doing on ingest