Merge branch 'master' into port-datomic-cloud

This commit is contained in:
2023-04-04 16:32:25 -07:00
2 changed files with 13 additions and 3 deletions

View File

@@ -68,8 +68,8 @@
(filter (fn [[_ _ _ _ _ _ _ _ _ _ _ break-flag]]
(= "Y" break-flag)))
(map (fn [[vendor location-hint invoice-number ship-date invoice-total ]]
(let [[matching-client similarity] (and location-hint
(parse/best-match clients location-hint 0.0))]
(let [matching-client (and location-hint
(parse/exact-match clients location-hint))]
{:invoice/vendor vendor
:invoice/location (parse/best-location-match matching-client location-hint location-hint )
:invoice/date (coerce/to-date (atime/parse ship-date atime/normal-date))
@@ -115,7 +115,7 @@
first
:content
first)
[matching-client similarity] (and location-hint (parse/best-match clients location-hint 0.0))
matching-client (and location-hint (parse/exact-match clients location-hint))
]
(if matching-client

View File

@@ -121,6 +121,16 @@
first)]
(or fuzzy-match client-word-match))))
(defn exact-match
([clients invoice-client-name]
(->> clients
(filter (fn [{:keys [:client/matches :client/name] :as client :or {matches []}}]
(seq
(filter (fn [m]
(= (.toLowerCase invoice-client-name) (.toLowerCase m)))
(conj matches name)))))
first)))
(defn best-location-match [client text full-text]
(or (->> client
:client/location-matches