             [clj-time.core :as t]
             [clj-time.coerce :as c]
             [clj-time.format :as f]
+            [clojure.java.io :as io]
             [clojure.tools.logging :as log]
             [clojure.pprint :refer [cl-format]]
             [clojure.string :refer [upper-case]]

  (try
    [:div {:style (str section-style "margin: 16px;")}
      (if include-title [:div {:style "margin-bottom: 16px;"}
        [:a {:style header-style :href (h (str (setting/get :-site-url) "/card/" (:id card) "?clone"))}
          (-> card :name h)]])
      (case (detect-pulse-card-type card data)
        :scalar    (render-scalar data)
        :sparkline (render-sparkline data render-img)
        :bar       (render-bar-chart data)
        :table     (render-table data nil)
        [:div {:style (str font-style "color: #F9D45C; font-weight: 700;")}
          "We were unable to display this card." [:br] "Please view this card in Metabase."])]
  (catch Throwable e
    [:div {:style (str font-style "color: #EF8C8C; font-weight: 700;")} "An error occurred while displaying this card."])))

(defn render-img-data-uri

            [:img {:style "display: block; left: 20px;" :src (render-img (render-sparkline-to-png xs' ys' 285 150))}]
          ]
          [:div
            [:div {:style (str "height: 15px; margin-left: 10px; margin-right: 10px; border: 4px solid " color-grey-1 "; border-top: none; border-bottom: none;")} "&#160;"]
            [:div {:style "height: 15px; margin-left: 10px; margin-right: 10px;"}
              [:div {:style "float: left;"} (format-timestamp xmin)]
              [:div {:style "float: right;"} (format-timestamp xmax)]]
          ]]]
      [:div {:style "margin-top: 20px; margin-left: 30px;"}
        (render-table card [(last rows) (first rows)] cols render-img [0 1] nil)]]))

(defn datetime-field?
  [field]
