 
 (def tmp-dir  (System/getProperty "java.io.tmpdir"))
 (def path-env (System/getenv "PATH"))
+
+;;;
+;;; Helper function
+;;;
+
+(defn- remove-vector-items [coll & items]
+  (->> coll
+       (remove (set items))
+       (vec)))
 
 ;;;
 ;;; Auth functions

    (.format (SimpleDateFormat. "YYYY-MM-dd HH:mm")
             pg-time)))

(defn- remove-vector-items [coll & items]
  (->> coll
       (remove (set items))
       (vec)))

;;;
;;; Dump aggregate
;;;

                               (update r :visible_id tc/val->int)
                               (dissoc r :lon :lat)))
                           (rest rows))]
      (if (and (some #(= % :lon) header-keys)
               (some #(= % :lat) header-keys))
        [(remove-vector-items header-keys [:lon :lat]) body]
        (init-throw (str "The provided "
                         design-type
                         " CSV file must contain a LAT and LON column."))))))

(defmethod get-file-data :default [distribution _ _ _]
  (throw (str "No such distribution (" distribution ") defined for collect-earth-online.db.projects/get-file-data")))

(defn- check-headers [headers primary-key design-type]
  (let [header-diff     (set/difference (set primary-key) (set headers))
