Further renames from data to records

This commit is contained in:
Ben Sturmfels 2024-03-15 13:46:08 +11:00
parent a1b59bc609
commit 0a5f798aa4
Signed by: bsturmfels
GPG key ID: 023C05E2C9C068F0
2 changed files with 20 additions and 20 deletions

View file

@ -41,8 +41,8 @@
(defn unmatched-employees
"Identify any mismatches between employees in the pay run and --project employee allocations."
[data projects]
(set/difference (set (keys projects)) (->> data (map :name) set)))
[records projects]
(set/difference (set (keys projects)) (->> records (map :name) set)))
(defn -main [& args]
(let [{:keys [options errors summary]} (parse-opts args cli-options)
@ -55,15 +55,15 @@
(str "The following errors occurred while parsing your command:\n\n"
(str/join \newline errors)))
(System/exit 1))
(let [data (import/read-csv (:csv options))
imported (concat (import/net-pay date period pay-invoice-no project data)
(import/individual-taxes date period pay-invoice-no retirement-invoice-no project data)
(import/employer-taxes date period pay-invoice-no project data)
(import/net-pay-ach-debit date period pay-receipt-no pay-invoice-no {} data)
(import/taxes-ach-debit date period pay-receipt-no pay-invoice-no {} data)
(import/fees date period fees-receipt-no fees-invoice-no total-fees project data)
(import/retirement date period retirement-receipt-no retirement-invoice-no data))
unmatched (unmatched-employees data project)]
(let [records (import/read-csv (:csv options))
imported (concat (import/net-pay date period pay-invoice-no project records)
(import/individual-taxes date period pay-invoice-no retirement-invoice-no project records)
(import/employer-taxes date period pay-invoice-no project records)
(import/net-pay-ach-debit date period pay-receipt-no pay-invoice-no {} records)
(import/taxes-ach-debit date period pay-receipt-no pay-invoice-no {} records)
(import/fees date period fees-receipt-no fees-invoice-no total-fees project records)
(import/retirement date period retirement-receipt-no retirement-invoice-no records))
unmatched (unmatched-employees records project)]
(when-not (empty? unmatched)
(println
(str "Could not find these employees in the payroll:\n\n"
@ -81,15 +81,15 @@
;; These examples are not included with the code for privacy reasons.
(require '[examples])
(def data (import/read-csv "/home/ben/Downloads/2024-01-29_Pay-Item-Details_2024-01.csv"))
(def records (import/read-csv "/home/ben/Downloads/2024-01-29_Pay-Item-Details_2024-01.csv"))
(def imported
(concat (import/net-pay "2024-01-31" "January 2024" "rt:19462/685751" {} data)
(import/individual-taxes "2024-01-31" "January 2024" "rt:19462/685751" "rt:19403/685602" {} data)
(import/employer-taxes "2024-01-31" "January 2024" "rt:19462/685751" {} data)
(import/net-pay-ach-debit "2024-01-31" "January 2024" "TODO-PAY-RECEIPT" "TODO-PAY-INVOICE" {} data)
(import/taxes-ach-debit "2024-01-31" "January 2024" "TODO-PAY-RECEIPT" "TODO-PAY-INVOICE" {} data)
(import/fees "2024-01-31" "January 2024" "rt:19459/675387" "rt:19459/674887" 206.50M {} data)
(import/retirement "2024-01-31" "January 2024" "rt:19403/685929" "rt:19403/685602" data)))
(concat (import/net-pay "2024-01-31" "January 2024" "rt:19462/685751" {} records)
(import/individual-taxes "2024-01-31" "January 2024" "rt:19462/685751" "rt:19403/685602" {} records)
(import/employer-taxes "2024-01-31" "January 2024" "rt:19462/685751" {} records)
(import/net-pay-ach-debit "2024-01-31" "January 2024" "TODO-PAY-RECEIPT" "TODO-PAY-INVOICE" {} records)
(import/taxes-ach-debit "2024-01-31" "January 2024" "TODO-PAY-RECEIPT" "TODO-PAY-INVOICE" {} records)
(import/fees "2024-01-31" "January 2024" "rt:19459/675387" "rt:19459/674887" 206.50M {} records)
(import/retirement "2024-01-31" "January 2024" "rt:19403/685929" "rt:19403/685602" records)))
;; Compare hand-written transactions with imported (ignoring ordering).
(dd/pretty-print
(dd/diff

View file

@ -121,7 +121,7 @@
;; without realising that file existed and instead by precisely matching the
;; recent manually created payroll transactions).
;;
;; These functions take the input CSV data, pre-formatted and grouped by
;; These functions take the input CSV records, pre-formatted and grouped by
;; employee.
;;
;; The output is an intermediate data structure that can then be run through