[BACK]Return to pta_import.1 CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / pta

Diff for /pta/pta_import.1 between version 1.3 and 1.9

version 1.3, 2020/11/12 13:08:13 version 1.9, 2020/11/28 15:10:36
Line 22 
Line 22 
 .Nd print pta journal entries from bank CSV file input  .Nd print pta journal entries from bank CSV file input
 .Sh SYNOPSIS  .Sh SYNOPSIS
 .Nm pta_import  .Nm pta_import
 .Fl I Ar bankFormat  .Fl I Ar accountname
 .Op Ar file  .Op Ar file
 .Sh DESCRIPTION  .Sh DESCRIPTION
 The  The
Line 37  If the
Line 37  If the
 .Ar file  .Ar file
 argument is omitted, standard input is read instead.  argument is omitted, standard input is read instead.
 .Pp  .Pp
 .Ar bankFormat  .Ar accountname
 is exactly one of  is exactly one of
 .Bl -tag -width Ds  .Pp
 .It capital_one_credit  .Bl -bullet -offset indent -compact
 .It chase_credit  .It
 .It optum_hsa  .Cm bbva_usa
   .It
   .Cm capital_one_360
   .It
   .Cm capital_one_credit
   .It
   .Cm chase_credit
   .It
   .Cm etrade_ira
   .It
   .Cm optum_hsa
   .It
   .Cm sparkasse_camt
   .It
   .Cm wellsfargo
 .El  .El
 .Pp  .Pp
 and corresponds to an existing  and corresponds to an existing
 .Qq import_bankFormat.txt  .Pa ./import/ Ns Ar accountname Ns Pa .txt
 file in the current directory.  configuration file.
 .Sh FILES  .Ss Configuration file format
   Each configuration file contains rules
   used to import transactions from a financial institution.
   Like all
   .Xr pta 1
   input files, it is an
   .Xr ascii 7
   text file using strings of one or more space characters
   as the field delimiter and using the hash character
   .Pq Sq #
   in the first column to mark lines as ignored.
   .Pp
   The rules are as follows:
 .Bl -tag -width Ds  .Bl -tag -width Ds
 .It Pa ./import_capital_one_credit.txt  .It Ic ACCOUNT Ar csv_account_number
 .It Pa ./import_chase_credit.txt  The number in
 .It Pa ./import_optum_hsa.txt  .Xr pta-accounts 5
   of the bank or credit card account this CSV file contains entries for.
   This rule is required in every configuration file.
   .It Ic DELIM Ar delimiter
   The character used to separate fields.
   This rule is required in every configuration file.
   Most financial institutions use commas but some use semicolons.
   .It Ic HEADER Ar header
   Skip the first line of the CSV file if it matches the
   .Ar header
   line verbatim, or cause parsing to fail if it does not.
   .It Ic IGNORE Ar regular_expression
   Skip all lines in the CSV file matching the
   .Ar regular_expression .
   .It Ic QUOTE Ar quote
   Expects that every field starts and ends with the
   .Ar quote
   character.
   .It Ar selector account_number booking_identifier
   Lines in the CSV file that match the
   .Ar selector
   are associated with the contra account
   .Ar account_number
   and are assigned the
   .Ar booking_identifier .
   The selector is a string consisting of regular expressions separated
   by delimiters defined in the
   .Ic DELIM
   rule.
 .El  .El
   .Sh FILES
   .Bl -tag -width Ds -compact
   .It Pa ./import/bbva_usa.txt
   .It Pa ./import/capital_one_360.txt
   .It Pa ./import/capital_one_credit.txt
   .It Pa ./import/chase_credit.txt
   .It Pa ./import/etrade_ira.txt
   .It Pa ./import/optum_hsa.txt
   .It Pa ./import/sparkasse_camt.txt
   .It Pa ./import/wellsfargo.txt
   .El
 .Pp  .Pp
 These files contain the header that the financial institution uses, the  These files contain the header that the financial institution uses, the
 account number from  account number from
 .Pa ./accounts.txt  .Pa ./accounts.txt
 used by this account, as well as patterns used to map transactions to  used by this account, as well as patterns used to map transactions to
 the correct account and booking identifier.  the correct account and booking identifier.
 .Ss Defining the account number  
 Each file must contain one line beginning with  
 .Qq ACCOUNT  
 and is followed by whitespace and then an account number.  
 The account number corresponds to the account in  
 .Pa ./accounts.txt  
 for the imported account.  
 .Ss Patterns in the import_bankFormat.txt files  
 Each file contains lines of the form  
 .Pp  
 .Ar selector account_number booking_identifier  
 .Sh EXIT STATUS  .Sh EXIT STATUS
 .Ex -std  .Ex -std
 .Sh EXAMPLES  .Sh EXAMPLES
Line 78  Add journal entries to a journal file using a CSV file
Line 132  Add journal entries to a journal file using a CSV file
 a financial institution:  a financial institution:
 .Pp  .Pp
 .Dl "$ pta_import -I chase_credit chasedownload.csv >> journal.txt"  .Dl "$ pta_import -I chase_credit chasedownload.csv >> journal.txt"
 .Ss A sample credit card purchase  .Ss Account numbers in the configuration file
 Suppose a line in the  The line
 .Pa chasedownload.csv  
 file looks like  
 .Pp  .Pp
 .Dl "10/26/2020,10/26/2020,example.com*asldfkj,Shopping,Sale,-17.07"  .Dl ACCOUNT 3235
 .Pp  .Pp
 If the line matching the  in the configuration file corresponds to a line such as
 .Qq Shopping  
 category in the user's  
 .Pa ./import_chase_credit.txt  
 file is  
 .Pp  .Pp
 .Dl ,,,Shopping,,, 9996 SHOP  .Dl 3235 L Capital One credit card
 .Pp  .Pp
 then the  in
 .Qq Shopping  
 category defined by Chase is mapped to the user's  
 .Qq SHOP  
 booking identifier, and the user's account for shopping  
 expenses is defined as  
 .Qq 9996  
 in their  
 .Pa ./accounts.txt .  .Pa ./accounts.txt .
 .Pp  .Pp
 We further assume in this example that the user has edited  
 .Pa ./import_chase_credit.txt  
 so that the line beginning with  
 .Qq ACCOUNT  
 contains the liability account they have defined for their Chase card  
 in  
 .Pa ./accounts.txt  
 .Pp  
 In this example,  
 .Pa ./import_chase_credit.txt  
 contains  
 .Dl ACCOUNT 3234  
 .Pp  
 Then  
 .Nm  
 prints  
 .Pp  
 .Dl "20201026 SHOP 9996 3234 17.07 example.com*asldfkj"  
 .Ss A sample credit card payment  
 .Dl "10/27/2020,10/27/2020,Payment Thank You - Web,,Payment,1653.42"  
 .Pp  
 Suppose the user's  
 .Pa ./import_chase_credit.txt  
 file contains  
 .Pp  
 .Dl ,,,,Payment,, 1700 PAY  
 .Pp  
 which matches Chase's payment category to the user's asset account  
 .Qq 1700  
 used to pay off the credit card.  
 Then  
 .Nm  
 prints  
 .Pp  
 .Dl "20201027 PAY 3234 1700 1653.2 Payment Thank You - Web"  
 .Ss Account numbers in the import_bankFormat.txt files  
 For example, if  
 .Pa ./import_capital_one_credit.txt  
 contains  
 .Pp  
 .Dl ACCOUNT 1293  
 .Pp  
 then there must be a corresponding entry in  
 .Pa ./accounts.txt  
 such as  
 .Dl 1293 L Capital One credit card  
 .Pp  
 The description  The description
 .Qq Capital One credit card  .Qq Capital One credit card
 may vary, but in this example, the account numbers  may vary, but in this example, the account numbers
 .Qq 1293  .Qq 3235
 match, and the account type is  match, and the account type is
 .Qq L  .Qq L
 to indicate that it is a liability account.  to indicate that it is a liability account.
 .Ss Patterns in the import_bankFormat.txt files  .Ss Patterns in the configuration file
 Suppose  Suppose
   .Pp
 .Dl ,,,Automotive,,, 1111 AUTO  .Dl ,,,Automotive,,, 1111 AUTO
 .Pp  .Pp
 is a sample entry in the  is a sample entry in the
 .Pa ./import_chase_credit.txt  .Pa ./import/chase_credit.txt
 file which uses headers of the form  file which uses headers of the form
 .Pp  .Pp
 .Dl Transaction Date,Post Date,Description,Category,Type,Amount  .Dl Transaction Date,Post Date,Description,Category,Type,Amount
Line 179  defined in
Line 174  defined in
 with the  with the
 .Qq Auto  .Qq Auto
 booking identifier.  booking identifier.
   .Ss A sample credit card purchase
   If
   .Pa chasedownload.csv
   file contains
   .Pp
   .Dl "10/26/2020,10/26/2020,example.com*asldfkj,Shopping,Sale,-17.07"
   .Pp
   and
   .Pa ./import/chase_credit.txt
   contains
   .Bd -literal -offset Ds
   ACCOUNT 3234
   ,,,Shopping,,, 9996 SHOP
   .Ed
   .Pp
   and
   .Pa ./accounts.txt
   contains
   .Bd -literal -offset Ds
   3234 L Chase credit card
   9996 X shopping
   .Ed
   .Pp
   then the
   .Qq Shopping
   category defined by Chase is mapped to the user's
   .Qq SHOP
   booking identifier, the user's account for shopping
   expenses is defined as
   .Qq 9996
   in their
   .Pa ./accounts.txt ,
   the user's account for the credit card is 3234 in their
   .Pa ./accounts.txt ,
   and
   .Nm
   prints
   .Pp
   .Dl "20201026 SHOP 9996 3234 17.07 example.com*asldfkj"
 .Ss A complete example  .Ss A complete example
 Suppose  Suppose
 .Pa ./accounts.txt  .Pa ./accounts.txt
Line 189  is given by
Line 223  is given by
 5102 X Physician expenses  5102 X Physician expenses
 5103 X Dental expenses  5103 X Dental expenses
 5203 X Shopping  5203 X Shopping
   
 .Ed  .Ed
 .Pp  .Pp
 and  and
Line 204  Transaction Date,Post Date,Description,Category,Type,A
Line 237  Transaction Date,Post Date,Description,Category,Type,A
 .Ed  .Ed
 .Pp  .Pp
 and  and
 .Pa ./import_chase_credit.txt  .Pa ./import/chase_credit.txt
 is given by  is given by
 .Bd -literal  .Bd -literal
 # Chase credit card header is  # Chase credit card header is
Line 231  ACCOUNT 3234
Line 264  ACCOUNT 3234
 .Ed  .Ed
 .Pp  .Pp
 Then  Then
   .Pp
 .Dl pta_import -I chase_credit chasedownload.csv  .Dl pta_import -I chase_credit chasedownload.csv
   .Pp
 outputs  outputs
 .Bd -literal  .Bd -literal
 20201109 PHYSICIAN 5102 3234 100.00 Dr. Joseph Schmoe  20201109 PHYSICIAN 5102 3234 100.00 Dr. Joseph Schmoe
Line 239  outputs
Line 274  outputs
 20201108 SHOP 5203 3234 53.83 example.com  20201108 SHOP 5203 3234 53.83 example.com
 20201104 PAY 3234 1700 75.43 Payment Thank You - Web  20201104 PAY 3234 1700 75.43 Payment Thank You - Web
 .Ed  .Ed
   .Pp
   Note that the selector for Dr\&. Sally Sue
   in the example configuration file comes before the
   Health & Wellness selector.
   Since the first match wins, transactions for Dr\&. Sally Sue
   can be classified with the DENTAL booking identifier,
   even though the bank's CSV file classifies
   these transactions as Health & Wellness.
 .Sh SEE ALSO  .Sh SEE ALSO
 .Xr pta-accounts 5 ,  .Xr pta-accounts 5 ,
 .Xr pta-journal 5 ,  .Xr pta-journal 5 ,
Line 250  has the following limitations:
Line 293  has the following limitations:
 .Bl -dash  .Bl -dash
 .It  .It
 Pattern recognition in the  Pattern recognition in the
 .Pa import_bankFormat.txt  .Pa import/accountname.txt
 files is under continued development.  files is under continued development.
 .It  .It
 The only defined import formats are for Chase credit cards,  User-defined configuration files are not currently
 Capital One credit cards, and Optum Health Savings Accounts.  supported.
 .It  
 Note that the first pattern match wins in  
 .Pa ./import_bankFormat.txt .  
 In the complete example above, we put the line containing  
 .Qq Dr. Sally Sue  
 before the line matching the  
 .Qq Health & Wellness  
 category because we wanted to override the  
 .Qq Health & Wellness  
 category, and use the  
 .Qq Dental expenses  
 account instead.  
 .El  .El

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.9

CVSweb