fixes commit problems, bad vendors

This commit is contained in:
Bryce
2023-06-08 22:18:46 -07:00
parent 49a5af9409
commit 6a43ac257b
3 changed files with 45 additions and 45 deletions

View File

@@ -205,9 +205,8 @@
"vendors"
(for [[result] (dc/qseq {:query '[:find (pull ?v [:vendor/search-terms :db/id :vendor/name :vendor/hidden])
:in $
:where [?v :vendor/search-terms ]]
:where [?v :vendor/name]]
:args [(dc/db conn)]})]
{"id" (:db/id result)
"name" (or (first (:vendor/search-terms result))
(:vendor/name result))
"name" (:vendor/name result)
"hidden" (boolean (:vendor/hidden result))}))))

View File

@@ -4,8 +4,7 @@
(def pdf-templates
[
;; CHEF's WAREHOUSE
[;; CHEF's WAREHOUSE
{:vendor "CHFW"
:keywords [#"CHEF'S WAREHOUSE"]
:extract {:total #"2 WKS C\.C\.\s+([\d.,]+)"
@@ -75,8 +74,6 @@
:parser {:date [:clj-time "MM/dd/yy"]
:total [:trim-commas-and-negate nil]}}
;; SOUTHBAY FRESH
{:vendor "Southbay Fresh Produce"
:keywords [#"SOUTH BAY FRESH PRODUCE"]
@@ -173,8 +170,7 @@
:parser {:date [:clj-time "MM/dd/yy"]
:total [:trim-commas nil]}
:multi (. java.util.regex.Pattern (compile (-> \formfeed str) java.util.regex.Pattern/CASE_INSENSITIVE))
:multi-match? #"(Total\s+[0-9\.]+|Total Order)"
}
:multi-match? #"(Total\s+[0-9\.]+|Total Order)"}
;; AUTO-CHLOR
{:vendor "Auto-Chlor"
@@ -208,7 +204,6 @@
:multi #"\n"
:multi-match? #"^\s+.*?\d{6,}.*?\$"}
;; C & L
{:vendor "C&L Produce"
:keywords [#"440 Franklin Street"]
@@ -239,7 +234,6 @@
:parser {:date [:clj-time "dd-MMM-yy"]
:total [:trim-commas-and-negate nil]}}
;;; credits don't have the same format
{:vendor "General Produce Company"
:keywords [#"1330 NORTH B"]
@@ -362,8 +356,6 @@
:parser {:date [:clj-time "MM/dd/yyyy"]
:total [:trim-commas nil]}}
;; PACIFIC SEAFOOD
{:vendor "Pacific Seafood"
:keywords [#"(pacseafood|PACIFIC FRESH)"]
@@ -426,7 +418,6 @@
:total #" Total:\s+([\d\.]+)"}
:parser {:date [:clj-time "MMM dd, yyyy"]}}
;; A&B
{:vendor "A&B Produce"
:keywords [#"ABProduce"]
@@ -560,8 +551,6 @@
:parser {:date [:clj-time "MM/dd/yy"]
:total [:trim-commas nil]}}
;; JFC
{:vendor "JFC International"
:keywords [#"48490 MILMONT DRIVE"]
@@ -609,6 +598,15 @@
:customer-identifier #"Bill To\s+(.*?)\s{2,}"
:invoice-number #"Invoice #\n.*?([\d\-]+)\n"
:total #"Invoice Total\s+([\d\-,]+\.\d{2,2}+)"}
:parser {:date [:clj-time "MM/dd/yy"]
:total [:trim-commas-and-negate nil]}}
{:vendor "Reel Produce"
:keywords [#"reelproduce.com"]
:extract {:date #"([0-9]+/[0-9]+/[0-9]+)"
:customer-identifier #"Bill To(?:.*?)\n\n\s+(.*?)\s{2,}"
:invoice-number #"Invoice #\n.*?([\d\-]+)\n"
:total #"Total\s*\n\s+\$([\d\-,]+\.\d{2,2}+)"}
:parser {:date [:clj-time "MM/dd/yy"]
:total [:trim-commas-and-negate nil]}}])

View File

@@ -136,7 +136,8 @@
(index-documents-raw [this index xs]
(client/post
(str (assoc (url/url solr-uri "solr" index "update")
:query {"commitWithin" 5000}))
:query {"commitWithin" 5000
"commit" true}))
{:headers {"Content-Type" "application/json"}
:socket-timeout 30000
@@ -147,7 +148,8 @@
(index-documents [this index xs]
(client/post
(str (assoc (url/url solr-uri "solr" index "update")
:query {"commitWithin" 5000}))
:query {"commitWithin" 5000
"commit" true}))
{:headers {"Content-Type" "application/json"}
:socket-timeout 30000
:connection-timeout 30000
@@ -168,7 +170,8 @@
(delete [this index]
(client/post
(str (assoc (url/url solr-uri "solr" index "update")
:query {"commitWithin" 15000}))
:query {"commitWithin" 15000
"commit" true}))
{:headers {"Content-Type" "application/json"}
:method "POST"
:body (json/write-str {"delete" {"query" "*:*"}})})))