     (let [measurements4 (map #(zipmap [:device_id :type :month :timestamp :error :reading_metadata :metadata :value] %)
                              (rest (csv/read-csv in-file3)))
            m4 (map #(update-in % [:timestamp] (fn [t] (let [d (tf/parse (tf/formatter  "yyyy-MM-dd HH:mm:ssZ") t)]
-                                                      (tf/unparse 
+                                                      (tf/unparse
                                                        (tf/formatter "yyyy-MM-dd HH:mm:ssZ")
                                                        (t/minus (t/plus d (t/years 2)) (t/days 9))))))
                    measurements4)]

    (let [measurements5 (map #(zipmap [:device_id :type :month :timestamp :error :reading_metadata :value] %)
                             (rest (csv/read-csv in-file4)))]
      (batch-csv measurements5 (:measurement-5 urls))))
  
  (with-open [in-file5 (io/reader (io/resource "csv/122b4bf8dfa66cbf8f321f2d03c4d73f924bb719-interpolatedElectricityConsumption.csv"))]
    (let [measurements6 (map #(zipmap [:device_id :type :month :timestamp :error :reading_metadata :value] %)
                             (rest (csv/read-csv in-file5)))]
      (batch-csv measurements6 (:measurement-6 urls)))))


(defn post-generated-measurements 
  "Generates measurements (500) and posts them to Hecuba"
  []
  (let [generated-measurements (generators/measurements  {:type "electricityConsumption"

  (post-resource (:device-1 urls) "application/json" (:device-1 resources))

  (db/with-session [session (:hecuba-session store)]
    (db/execute session
                (hayt/insert :entities (hayt/values {:id "14366c761c74592b9926e851bae8a64ece7239ff"
                                                     :project_id "ba776928f94b3aaa1e444569276ee5b66d6b21f7"})))
    (db/execute session
                (hayt/insert :entities (hayt/values {:id "9ac7f5635832d843dda594f58525239263ffdd37"
                                                     :project_id "ba776928f94b3aaa1e444569276ee5b66d6b21f7"}))))
  ;; cos we're bypassing the api above need to refresh ES.
  (kixi.hecuba.data.entities.search/refresh-search
   (:hecuba-session store) (:search-session store))

  (post-resource (:device-2 urls) "application/json" (:device-2 resources))
  (post-resource (:device-3 urls) "application/json" (:device-3 resources))
  (post-resource (:device-3 urls) "application/json" (:device-4 resources))
