Imported data from CSV successfully, but slow
I would try a couple of improvements.


Don't call Location.find_by(code: row[0]) on each iteration. Load all the locations once at the beginning with locations = Location.pluck(:id, :code) and then use origin_location_id = locations.find { |l| l[1] == row[0] }.
Do the same with the other attributes where you need a location: destination_location_id, n1st_pol_id, etc...
Do the same with OceanRoute and ServiceLane
Load the user user = User.find_by(name: 'yo') before the cycle and use it in every iteration: val.created_by = user
Use the fastest implementation of ActiveRecordImport: https://github.com/zdennis/activerecord-import/wiki/Examples#import-using-columns-and-arrays


Do these steps one by one to improve your performance.