add prompt dir

This commit is contained in:
bel
2023-10-15 10:42:45 -06:00
parent 1c06e472c2
commit 7e9b85d0f4
9 changed files with 3075 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
package analyzer
import (
"encoding/json"
"errors"
"os"
)
// Transaction represents a transaction from our upstream source.
// URL: https://catalog.data.gov/dataset/purchase-card-pcard-fiscal-year-2014
type Transaction struct {
Category string `json:"MerchantCategory"`
Vendor string
Description string
AgencyName string
CardholderLastName string
TransactionDate string
Amount Amount `json:",string"`
YearMonth string
CardholderFirstInitial string
AgencyNumber string
PostedDate string
}
func (trn Transaction) String() string {
// TODO: Not implemented.
return ""
}
// Transactions represents a list of Transaction
type Transactions []Transaction
// Sum adds all transactions together.
func (trns Transactions) Sum() Amount {
// TODO: Not implemented.
return 0.0
}
// Count is the number of unique Transactions.
func (trns Transactions) Count() int {
return len(trns)
}
func TransactionsFromFile(path string) (Transactions, error) {
jsonFile, err := os.Open(path)
if err != nil {
return nil, err
}
defer jsonFile.Close()
var transactions Transactions
if err := json.NewDecoder(jsonFile).Decode(&transactions); err != nil {
return nil, err
}
return transactions, nil
}
func TransactionsFromURLs(url ...string) (Transactions, error) {
return nil, errors.New("not implemented")
}