Convert account data in CSV format (eg downloaded from a bank) to journal format, and print it on stdout. See the manual for more details.
- data CsvRules = CsvRules {
- dateField :: Maybe FieldPosition
- dateFormat :: Maybe String
- statusField :: Maybe FieldPosition
- codeField :: Maybe FieldPosition
- descriptionField :: [FormatString]
- amountField :: Maybe FieldPosition
- inField :: Maybe FieldPosition
- outField :: Maybe FieldPosition
- currencyField :: Maybe FieldPosition
- baseCurrency :: Maybe String
- accountField :: Maybe FieldPosition
- account2Field :: Maybe FieldPosition
- effectiveDateField :: Maybe FieldPosition
- baseAccount :: AccountName
- accountRules :: [AccountRule]
- type FieldPosition = Int
- type AccountRule = ([(String, Maybe String)], AccountName)
- type CsvRecord = [String]
- convert :: CliOpts -> IO ()
- parseCsv :: FilePath -> IO (Either ParseError CSV)
- maxFieldIndex :: CsvRules -> Int
- rulesFileFor :: CliOpts -> FilePath -> FilePath
- initialRulesFileContent :: String
- validateRules :: CsvRules -> Maybe String
- parseCsvRulesFile :: FilePath -> IO (Either ParseError CsvRules)
- parseCsvRules :: FilePath -> String -> Either ParseError CsvRules
- csvrulesfile :: GenParser Char CsvRules CsvRules
- definitions :: GenParser Char CsvRules ()
- descriptionFieldValue :: GenParser Char st [FormatString]
- accountrule :: GenParser Char CsvRules AccountRule
- printTxn :: Bool -> CsvRules -> CsvRecord -> IO ()
- formatD :: CsvRecord -> Bool -> Maybe Int -> Maybe Int -> Field -> String
- formatDescription :: CsvRecord -> [FormatString] -> String
- transactionFromCsvRecord :: CsvRules -> CsvRecord -> Transaction
- normaliseDate :: Maybe String -> String -> String
- identify :: [AccountRule] -> String -> String -> (String, String)
- getAmount :: CsvRules -> CsvRecord -> String
Documentation
A set of data definitions and account-matching patterns sufficient to convert a particular CSV data file into meaningful journal transactions. See above.
type FieldPosition = IntSource
type AccountRule = ([(String, Maybe String)], AccountName)Source
convert :: CliOpts -> IO ()Source
Read the CSV file named as an argument and print equivalent journal transactions, using/creating a .rules file.
maxFieldIndex :: CsvRules -> IntSource
The highest (0-based) field index referenced in the field definitions, or -1 if no fields are defined.
rulesFileFor :: CliOpts -> FilePath -> FilePathSource
formatDescription :: CsvRecord -> [FormatString] -> StringSource
:: Maybe String | User-supplied date format: this should be tried in preference to all others |
-> String | |
-> String |
Convert some date string with unknown format to YYYYMMDD.