   :name onyx-java.IPipeline
   :methods [[writeBatch [clojure.lang.IPersistentMap] clojure.lang.IPersistentMap]])
 
-(defn boolean-string [y] (if (= (type y) java.lang.String) (read-string y) y))
+(defn boolean-string [x]
+    (if (= (type x) java.lang.String) (read-string x) x))
 
 (def casts
   {:boolean (fn [x] (boolean (boolean-string x)))

     (apply merge (map #(hash-map % nil) required-keys))))

(defn update-required-keymap [required-keymap keyword]
    ;(println keyword)
    (if (boolean (some #{keyword} (keys required-keymap))) (assoc required-keymap keyword true) required-keymap))

(defn cast-types [section m]
  (let [section* (keyword section)]
        ;required-keymap (get-required-keymap section*)]
    (reduce-kv
     (fn [m* k v]
       (let [k* (keyword k)
             type (get-in model [section* :model k* :type])
             choices (get-in model [section* :model k* :choices] [:all])
             required (not (get-in model [section* :model k* :optional?] true))
             v* (check-choices choices ((get casts type identity) v))]
         (assoc m* k* v*)))
     {}
     m)))

(defn coerce-workflow [workflow]
  (mapv #(mapv (fn [v] (keyword v)) %) workflow))


(defn check-choices [choices value]
    (if (boolean (some #{:all} (flatten choices))) value
        (if (some #{value} choices)
            value
            "CHOICE-ERROR"
            ;(throw (Exception. "Not a valid choice."))
            )))

(defn get-required-keymap [section]
    (let [required-keys (vec (keys (filter (fn [[k v]] (and (-> v :optional? not)
