DATOMIC. WHAT COULD POSSIBLY GO WRONG.

Site state change queries: http://dbs-are-fn.com/2013/datomic_history_of_an_entity/

user=> (def changes (q '[:find ?when ?tx ?state ?change :where [?e :site/state ?s ?tx ?change] [?s :db/ident ?state] [?tx :db/txInstant ?when] [(= ?change true)]] (d/history (db conn))))

user=> (doseq [change (sort changes)] (println change))
[#inst "2013-11-07T14:21:02.864-00:00" 13194139534323 :site.state/up true]
[#inst "2013-11-07T14:21:32.518-00:00" 13194139534324 :site.state/down true]
[#inst "2013-11-07T14:23:33.058-00:00" 13194139534325 :site.state/unknown true]
[#inst "2013-11-07T14:25:35.046-00:00" 13194139534326 :site.state/up true]
nil