 
 
 (defn get-facts [& {:keys [where-criteria]}]
+  "Retrieves all facts, potentially narrowed by specified criteria."
   (let [query (-> (db/select* es_events)
                   (#(if where-criteria
                       (db/where % where-criteria)
                       %))
                   (db/order :tx :desc))
-        facts (volatile! {}) ;; need to define it outside xf, as select-lazy transduces multiple times
-        xf (comp (fn [xf]
+        ;;;facts (volatile! {}) ;; need to define it outside xf, as select-lazy transduces multiple times
+        xf (map (fn [{:keys [eid attribute value tx action]}]
+                  [eid attribute value tx action]))
+        #_(comp (fn [xf]
                    (fn
                      ([] (xf))
                      ([result] (xf result))

                                    :value v
                                    :tx (or t (new-txid))
                                    :action action}))]
    (->Fact (:eid data) (:attribute data)
            (:value data) (:tx data))))

(defn add-facts [facts]
  (let [txid (new-txid)]

  (:require [clojure.edn :as edn]
            [clojure.core.logic :as l]
            [clojure.core.logic.pldb :as lp]
            [clojure.core.logic.fd :as lfd]
            [korma.core :as db]
            [eventsourcing.db :as evdb]))

