             :column-names column-names
             :required-header-names (required-header-names columns)
             :line-number (atom 1)
-            :format-rules (data-spec/create-format-rules data-specs filename columns)
-            :transforms (apply comp (data-spec/translation-fns columns))}
-           (chunk-rows-and-process ctx data-spec)))))
+            :format-rules
+            (data-spec/create-format-rules data-specs filename columns)
+            :row-translation-fn
+            (make-row-translation-fn columns column-names headers)}
+            (chunk-rows-and-process ctx data-spec)))))
 
 (defn-traced bulk-import-and-validate-csv
   "Bulk importing and CSV validation is done in one go, so that it can

(defn process-row-chunks
  "Processes all the map rows in a chunk via `process-row` with the
  supplied format-rules (see `data-spec/create-format-rules` in
  `do-bulk-import-and-validate-csv`) and transforms (see
  `data-spec/translation-fns` in
  `do-bulk-import-and-validate-csv`). Inserts the row into the
  database, retries any UNIQUE id constraint-failing SQLExceptions

  `ctx`. If the supplied chunk is empty, simply returns the context
  as-is."
  [{:keys [columns filename] :as data-spec}
   {:keys [row-translation-fn column-names headers sql-table line-number] :as file-ctx}
   ctx chunk]
  (if (seq chunk)
    (let [ctx' (reduce (partial process-row data-spec file-ctx) ctx chunk)
          chunk-values (->> chunk
                            (map row-translation-fn)
                            (maybe-coerce-to-db-type ctx' sql-table columns))]
      (try
        (korma/insert sql-table (korma/values chunk-values))
        ctx'
        (catch java.sql.SQLException e
          (let [message (.getMessage e)]
            (if (re-find #"UNIQUE constraint failed: (\w+).id" message)
              (db.util/retry-chunk-without-dupe-ids ctx' sql-table chunk-values)
              (let [identifier (if (= "3.0" @(:spec-version ctx'))
                                 @line-number
                                 (csv-error-path filename @line-number))]
                (errors/add-errors
                 ctx' :fatal (:name sql-table) identifier
                 :unknown-sql-error message)))))))
    ctx))

