revamped logging!
This commit is contained in:
@@ -2,29 +2,29 @@
|
||||
(:require [auto-ap.parse.util :as u]
|
||||
[clojure.data.csv :as csv]
|
||||
[clojure.java.io :as io]
|
||||
[clojure.string :as str]))
|
||||
[clojure.string :as str]
|
||||
[clojure.tools.logging :as log]))
|
||||
|
||||
(defn determine
|
||||
[[header :as z]]
|
||||
(prn header)
|
||||
(doto (cond (str/includes? (second header) "Customer's PO No.")
|
||||
:mama-lus
|
||||
(let [csv-type (cond (str/includes? (second header) "Customer's PO No.")
|
||||
:mama-lus
|
||||
|
||||
(str/includes? (str header) "Ship-To Number")
|
||||
:sysco-style-2
|
||||
(str/includes? (str header) "Ship-To Number")
|
||||
:sysco-style-2
|
||||
|
||||
(str/includes? (str header) "Closed Date")
|
||||
:sysco-style-1
|
||||
(str/includes? (str header) "Closed Date")
|
||||
:sysco-style-1
|
||||
|
||||
(str/includes? (str header) "Business Unit")
|
||||
:mission
|
||||
(str/includes? (str header) "Business Unit")
|
||||
:mission
|
||||
|
||||
(str/includes? (str header) "Document Number")
|
||||
:philz
|
||||
(str/includes? (str header) "Document Number")
|
||||
:philz
|
||||
|
||||
:else
|
||||
nil)
|
||||
println))
|
||||
:else
|
||||
nil)]
|
||||
(log/info "csv type was determined to be" csv-type)))
|
||||
|
||||
(defmulti parse-csv
|
||||
determine
|
||||
@@ -44,7 +44,6 @@
|
||||
|
||||
(defmethod parse-csv :sysco-style-1
|
||||
[rows]
|
||||
(println "Importing Sysco-styled 1")
|
||||
(let [header (first rows)]
|
||||
(transduce
|
||||
(comp (drop 1)
|
||||
@@ -68,7 +67,7 @@
|
||||
|
||||
(defmethod parse-csv :sysco-style-2
|
||||
[rows]
|
||||
(println "Importing Sysco-styled 1")
|
||||
|
||||
(let [header (first rows)]
|
||||
(transduce
|
||||
(comp (drop 1)
|
||||
@@ -125,9 +124,7 @@
|
||||
(comp
|
||||
(filter (fn [[dt _ doc-number name _ status _ _ amount :as row]]
|
||||
(= status "Billed")))
|
||||
|
||||
(map (fn [[dt _ doc-number name _ _ _ _ amount :as row]]
|
||||
(print name)
|
||||
{:vendor-code "PHILZ COFFEE, INC"
|
||||
:customer-identifier name
|
||||
:invoice-number doc-number
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
[clojure.java.shell :as sh]
|
||||
[clojure.string :as str]
|
||||
[clj-time.format :as f]
|
||||
[clj-time.core :as time]))
|
||||
[clj-time.core :as time]
|
||||
[clojure.tools.logging :as log]))
|
||||
|
||||
(defmulti parse-value (fn [method _ _]
|
||||
method))
|
||||
@@ -39,7 +40,7 @@
|
||||
(reduced (time/from-time-zone (f/parse (f/formatter format) value)
|
||||
(time/time-zone-for-id "America/Los_Angeles")))
|
||||
(catch Exception e
|
||||
(println (.getMessage e))
|
||||
(log/warn e)
|
||||
nil)))
|
||||
nil
|
||||
format)
|
||||
|
||||
Reference in New Issue
Block a user