Removes docjure, freeing space

This commit is contained in:
2023-05-10 10:39:58 -07:00
parent 05f1f009fd
commit 8bd73b8a98
5 changed files with 60 additions and 125 deletions

View File

@@ -3,6 +3,7 @@
[auto-ap.datomic :refer [audit-transact conn]]
[auto-ap.logging :as alog]
[clojure.data.json :as json]
[auto-ap.parse.excel :as excel]
[auto-ap.parse :as parse]
[amazonica.aws.lambda :as lambda]
[config.core :refer [env]]
@@ -16,7 +17,6 @@
[clojure.java.io :as io]
[com.brunobonacci.mulog :as mu]
[datomic.api :as dc]
[dk.ative.docjure.spreadsheet :as doc]
[hiccup2.core :as hiccup]
[amazonica.aws.s3 :as s3]))
@@ -27,14 +27,7 @@
(.setScale 2 java.math.RoundingMode/HALF_UP)
(double))))
(defn extract-sheet-details [bucket object]
(-> (lambda/invoke {:function-name "xls-extractor" :payload
(json/write-str
{"s3_url" object "s3_bucket" bucket})}
)
:payload
slurp
json/read-str))
(defn rows->maps [rows]
@@ -43,12 +36,7 @@
(into {}
(map vector headers r)))))
(defn xls-date->date [f]
(when (not-empty f)
(let [f (Double/parseDouble f)
unix-days (- f 25569.0)
unix-secs (* unix-days 86400.0)]
(java.util.Date. (long (Math/round (* 1000.0 unix-secs)))))))
(defn map->sales-order [r clients]
@@ -67,7 +55,7 @@
(parse/exact-match clients))
client-id (:db/id client)
location (first (:client/locations client))
event-date (some-> (xls-date->date event-date)
event-date (some-> (excel/xls-date->date event-date)
coerce/to-date-time
atime/as-local-time
coerce/to-date )]
@@ -137,7 +125,7 @@
:key object
:input-stream s})
(into []
(->> (extract-sheet-details (:data-bucket env) object)
(->> (excel/extract-sheet-details (:data-bucket env) object)
rows->maps
(map #(map->sales-order % clients))
(filter identity)))))