        (cs/split-lines)
        (filter #(pos? (count %)))
        (pmap json/read-json)))
+
+(defn open-log-kopet
+  [fname]
+  (->> (str dir-kopet fname)
+       (slurp)
+       (cs/split-lines)
+       (filter #(pos? (count %)))
+       (pmap json/read-json)))
+
+(defn open-file
+  [fname]
+  (->> (str "resources/relevant/" fname ".edn")
+       slurp read-string))
 
 (defonce cdb (-> {:bucket "znetroyalty"
                   :uris   ["http://127.0.0.1:8091/pools"]}

            (cc/get-json cdb (keyword (:key (cbkey "content" id)))
                         (merge from-db v))
            (cc/get-json cdb (keyword (:key (cbkey "content" id)))
                         (merge v {:ctype "content"
                                   :tutors []
                                   :hits {}}))))
        (println (:id v))
        (recur vs)))))







        (do (println strday)
            (recur (next-day sday) (merge-with #(merge-with + %1 %2) res resi)))))))

(defn store-user-log-kopet
  [start-date end-date]
  (loop [[sday strday] (next-day start-date) res {}]
    (if (= strday end-date)
      (do (spit "resources/kopet-data.edn" res)
          (->> (take 100 res)
               (into {})))
      (let [resi (time (loop [[x & xs] (open-log-kopet (str "click-log-" strday)) resi {}]
                         (if x
                           (recur xs (->> #(merge-with + % {(first (:content-id x)) 1})
                                          (update-in resi [(:user-id x)])))
                           resi)))]
        (do (println strday)
            (recur (next-day sday) (merge-with #(merge-with + %1 %2) res resi)))))))

(defn get-top-parent
  [content-id]
  (let [{:keys [cg-id]} (cc/get-json cdb (str "content-" content-id))]
