Tons of small fixes
This commit is contained in:
@@ -70,24 +70,22 @@
|
||||
[rows]
|
||||
(println "Importing Sysco-styled 1")
|
||||
(let [header (first rows)]
|
||||
(doto
|
||||
(transduce
|
||||
(comp (drop 1)
|
||||
(map (fn [row]
|
||||
(into {} (map vector header row))))
|
||||
(map (fn [row]
|
||||
{:vendor-code nil
|
||||
:customer-identifier (str (get row "Ship-To Name") " " (or (get row "Ship-To Number")
|
||||
(get row "\"Ship-To Number\"")))
|
||||
:invoice-number (str/trim (get row "Invoice Number"))
|
||||
:date (parse-date-fallover (get row "Invoice Date") ["yyyy-MM-dd"])
|
||||
:total (str/replace (get row "Original Amount") #"[,\$]" "")
|
||||
:text (str/join " " (vals row))
|
||||
:full-text (str/join " " (vals row))})))
|
||||
conj
|
||||
[]
|
||||
rows)
|
||||
println)))
|
||||
(transduce
|
||||
(comp (drop 1)
|
||||
(map (fn [row]
|
||||
(into {} (map vector header row))))
|
||||
(map (fn [row]
|
||||
{:vendor-code nil
|
||||
:customer-identifier (str (get row "Ship-To Name") " " (or (get row "Ship-To Number")
|
||||
(get row "\"Ship-To Number\"")))
|
||||
:invoice-number (str/trim (get row "Invoice Number"))
|
||||
:date (parse-date-fallover (get row "Invoice Date") ["yyyy-MM-dd" "M/d/yyyy"])
|
||||
:total (str/replace (get row "Original Amount") #"[,\$]" "")
|
||||
:text (str/join " " (vals row))
|
||||
:full-text (str/join " " (vals row))})))
|
||||
conj
|
||||
[]
|
||||
rows)))
|
||||
|
||||
(defmethod parse-csv :mama-lus
|
||||
[rows]
|
||||
|
||||
@@ -175,6 +175,17 @@
|
||||
:multi #"\n"
|
||||
:multi-match? #"^\s+.*?\d{6,}.*?\$"}
|
||||
|
||||
|
||||
;; C & L
|
||||
{:vendor "C&L Produce"
|
||||
:keywords [#"440 Franklin Street"]
|
||||
:extract {:date #"([0-9]+/[0-9]+/[0-9]+)"
|
||||
:customer-identifier #"Bill To.*\n.*\n\s+(.*?)\s{2,}"
|
||||
:invoice-number #"Invoice #.*\n.*\n.*?(\d{5,})\n"
|
||||
:total #"Total\s+\$([0-9\.,]+)"}
|
||||
:parser {:date [:clj-time "MM/dd/yy"]
|
||||
:total [:trim-commas nil]}}
|
||||
|
||||
{:vendor "General Produce Company"
|
||||
:keywords [#"generalproduce.com"]
|
||||
:extract {:date #"INVOICE DATE.*\n.*?([0-9]+/[0-9]+/[0-9]+)"
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
(reduced (time/from-time-zone (f/parse (f/formatter format) value)
|
||||
(time/time-zone-for-id "America/Los_Angeles")))
|
||||
(catch Exception e
|
||||
(println e)
|
||||
(println (.getMessage e))
|
||||
nil)))
|
||||
nil
|
||||
format)
|
||||
|
||||
Reference in New Issue
Block a user