 (defmethod import/make-dataset-data-table "CSV"
   [tenant-conn {:keys [file-upload-path]} table-name spec]
   (let [path (get-path spec file-upload-path)
-        headers? (boolean (get spec "hasColumnHeaders"))
-        encoding (get-encoding path)]
-      (load-csv! tenant-conn table-name path encoding headers?)))
+        headers? (boolean (get spec "hasColumnHeaders"))]
+      (load-csv! tenant-conn table-name path headers?)))

  "Determines the common type of the given coll of types.
  Defaults to 'text' if types cannot be unified."
  [coll]
  (condp #(all-of-type? %1 %2) coll
    :date {:client "date" :psql "timestamptz"}
    :number {:client "number" :psql "double precision"}
    :text {:client "text" :psql "text"}
    {:client "text" :psql "text"}))

(defn get-column-types
  "Returns a seq of the common types of each column in the given dataset"
  [{:keys [column-names] :as dataset}]
  (->> (map #(incanter/$map get-type % dataset) column-names)
       (map get-common-type)))

(defn get-column-tuples
  "Returns a sequence of maps containing column names, titles & types
  for consumption by the client.

  Example output:

            [clojure.java.io :as io]
            [clojure.java.jdbc :as jdbc]
            [clojure.string :as s]
            [incanter.core :refer [$ $map ncol to-vect]]
            [incanter.io :refer [read-dataset]]))


(defn- get-column-ids
  "Returns a seq of alphanumeric column names of the form
  c1, c2, c3, ... for the given number of columns"
  [num-cols]
  (let [nums (range 1 (inc num-cols))]
    (->> (map vector (repeat "c") nums)
         (map s/join))))

(defn get-type
  "Returns a keyword representing the type of the given value.
  Defaults to `:text`."
  [value]
  (condp #(%1 %2) value
    ;; TODO date-string? :date
    nil? :nil
    number? :number
    :text))

(defn all-of-type?
  "Determines if all types in the given column are the same or `:nil`"
  [coll type-kw]
  {:pre [(contains? #{:date :number :text} type-kw)]}
  (every? true? (map #(contains? #{:nil type-kw} %) coll)))

