<commit_before>(ns yetibot.core.db
  (:require
    [yetibot.core.config :refer [get-config config-for-ns conf-valid?]]
    [yetibot.core.loader :refer [find-namespaces]]
    [datomico.db :as db]
    [datomico.core :as dc]
    [datomic.api :as api]
    [taoensso.timbre :refer [info warn error]]))

(def db-ns-pattern #"(yetibot|plugins).*\.db\..+")

(defn schemas []
  (let [nss (find-namespaces db-ns-pattern)]
    (apply require nss)
    (for [n nss :when (ns-resolve n 'schema)]
      (deref (ns-resolve n 'schema)))))

(defn start [& [opts]]
  (if (conf-valid? (get-config :yetibot :db))
    (do
      (info "☐ Loading Datomic schemas")
      (dc/start (merge opts {:uri (:datomic-url (get-config :yetibot :db))
                             :schemas (filter identity (schemas))}))
      (info "☑ Datomic connected"))
    (warn ":datomic-url is not configured, unable to connect.")))

(def repl-start (partial start {:dynamic-vars true}))
<commit_msg>Add database url to loading schemas logs<commit_after>(ns yetibot.core.db
  (:require
    [yetibot.core.config :refer [get-config config-for-ns conf-valid?]]
    [yetibot.core.loader :refer [find-namespaces]]
    [datomico.db :as db]
    [datomico.core :as dc]
    [datomic.api :as api]
    [taoensso.timbre :refer [info warn error]]))

(def db-ns-pattern #"(yetibot|plugins).*\.db\..+")

(defn schemas []
  (let [nss (find-namespaces db-ns-pattern)]
    (apply require nss)
    (for [n nss :when (ns-resolve n 'schema)]
      (deref (ns-resolve n 'schema)))))

(defn start [& [opts]]
  (if (conf-valid? (get-config :yetibot :db))
    (do
      (info "☐ Loading Datomic schemas at" (:datomic-url (get-config :yetibot :db)))
      (dc/start (merge opts {:uri (:datomic-url (get-config :yetibot :db))
                             :schemas (filter identity (schemas))}))
      (info "☑ Datomic connected"))
    (warn ":datomic-url is not configured, unable to connect.")))

(def repl-start (partial start {:dynamic-vars true}))

{'fraction_non_alphanumeric': 0.17129863567458312, 'fraction_numerical': 0.0, 'mean_word_length': 3.107883817427386, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4192182', 'n_tokens_mistral': 739, 'n_tokens_neox': 710, 'n_words': 195}