     :article article
     :source source
     :ancestors ancestors
+    :root root
     :ts ts}))
 
 


  (mc/ensure-index (:db @mongo-state) "tweets" (array-map :id 1) {:unique true})

  (def sz-url (->> (mc/find-maps (:db @mongo-state) "articles" {:ts {$gt (t/today)}} [:title])
                  (map #(vec [(:_id %) (:title %) (first (find-source (:_id %)))]))
                  (remove #(empty? (last %)))
                  (filter #(= "SZ" (-> % last :source)))
                  first))


  (def sz-tweet (mc/find-map-by-id (:db @mongo-state) "tweets" (-> sz-url last :tweet)))

  (->> (compute-tweet-diffusion (:id_str sz-tweet))
       clojure.pprint/pprint)


  (->> (mc/find-maps (:db @mongo-state) "urls" {:article (first sz-url)})
       (mapv #(assoc % :tweet  (mc/find-map-by-id (:db @mongo-state) "tweets" (:tweet %) [:in_reply_to_status_id_str :text :user.screen_name :retweeted :id_str])))
       clojure.pprint/pprint)

  (def spon-url (->> (mc/find-maps (:db @mongo-state) "articles" {:ts {$gt (t/date-time 2014 7 27)}} [:title])
                  (map #(vec [(:_id %) (:title %) (first (find-source (:_id %)))]))
                  (remove #(empty? (last %)))
                  (filter #(= "SPIEGELONLINE" (-> % last :source)))
                  first))

  (def spon-tweet (mc/find-map-by-id (:db @mongo-state) "tweets" (-> spon-url last :tweet)))

  (->> (compute-tweet-diffusion (:id_str spon-tweet) [])
       flatten
       clojure.pprint/pprint)

  (->> (mc/find-maps (:db @mongo-state) "urls" {:article (first spon-url)})
       (mapv #(assoc % :tweet  (mc/find-map-by-id (:db @mongo-state) "tweets" (:tweet %) [:in_reply_to_status_id_str :text :user.screen_name :retweeted_status.id_str :id_str])))
       count
       clojure.pprint/pprint)


  (let [tweet (-> (mc/find-maps (:db @mongo-state) "tweets" {:created_at {$gt (t/today)}})
                  rand-nth)
        record-urls (-> tweet :entities :urls)
        expanded-urls (if (empty? record-urls)
                        nil
                        (map #(let [expanded-url (expand-url (:expanded_url %))]
                                (if (:url expand-url)
                                  expanded-url
                                  (assoc expanded-url :url (:expanded_url %)))) record-urls))
        articles (if (nil? expanded-urls)
                   nil
                   (map #(assoc % :article (-> (mc/find-one-as-map (:db @mongo-state) "articles" {:url (:url %)}) :_id)) expanded-urls))]
    (-> (vec [(:text tweet) (trace-parent tweet []) articles])
        clojure.pprint/pprint))

  (->> (mc/find-maps (:db @mongo-state) "origins")
       (filter #(nil? (-> % :article)))
       )

  )

    :ts ts}))


(defn store-origin [{:keys [article record ts source ancestors root]}]
  (mc/insert-and-return
   (:db @mongo-state)
   "origins"
