<commit_before>;; TODO: Replace everything SQL with HoneySQL
(ns qcast.cache
  (:gen-class)
  (:import [java.sql SQLException])
  (:require [qcast.db        :as db]
            [taoensso.timbre :refer :all]))


;;; Globals
(defonce ^:private db-spec (db/sqlite))


;;; Internals
(defn- pre-process [row]
  (-> row
      (update-in [:data]         db/from-edn)
      (update-in [:publish_date] db/from-inst)))

(defn- post-process [row]
  (-> row
      (update-in [:publish_date] db/to-inst)
      (update-in [:data]         db/to-edn)))


;;; Interface

(defn init []<commit_msg>Fix crash if since parameter value doesn't exist<commit_after>;; TODO: Replace everything SQL with HoneySQL
(ns qcast.cache
  (:gen-class)
  (:import [java.sql SQLException])
  (:require [qcast.db        :as db]
            [taoensso.timbre :refer :all]))


;;; Globals
(defonce ^:private db-spec (db/sqlite))


;;; Internals
(defn- pre-process [row]
  (some-> row
          (update-in [:data]         db/from-edn)
          (update-in [:publish_date] db/from-inst)))

(defn- post-process [row]
  (some-> row
          (update-in [:publish_date] db/to-inst)
          (update-in [:data]         db/to-edn)))


;;; Interface

(defn init []
{'fraction_non_alphanumeric': 0.17009038619556285, 'fraction_numerical': 0.0, 'mean_word_length': 2.625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4893056', 'n_tokens_mistral': 464, 'n_tokens_neox': 446, 'n_words': 107}