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

Annotation of pta/pta_import.1, Revision 1.4

1.4     ! schwarze    1: .\" $Id: pta_import.1,v 1.3 2020/11/12 13:08:13 schwarze Exp $
1.1       schwarze    2: .\"
                      3: .\" Copyright (c) 2020 Freda Bundchen
                      4: .\"
                      5: .\" Permission to use, copy, modify, and distribute this software for any
                      6: .\" purpose with or without fee is hereby granted, provided that the above
                      7: .\" copyright notice and this permission notice appear in all copies.
                      8: .\"
                      9: .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
                     10: .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                     11: .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
                     12: .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     13: .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
                     14: .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
                     15: .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
                     16: .\"
1.4     ! schwarze   17: .Dd $Mdocdate: November 12 2020 $
1.1       schwarze   18: .Dt PTA_IMPORT 1
                     19: .Os
                     20: .Sh NAME
                     21: .Nm pta_import
                     22: .Nd print pta journal entries from bank CSV file input
                     23: .Sh SYNOPSIS
                     24: .Nm pta_import
1.3       schwarze   25: .Fl I Ar bankFormat
1.2       schwarze   26: .Op Ar file
1.1       schwarze   27: .Sh DESCRIPTION
                     28: The
                     29: .Nm
1.2       schwarze   30: utility converts lines from a CSV
                     31: .Ar file
                     32: generated by a financial
1.1       schwarze   33: institution into journal entries used by
                     34: .Xr pta 1 .
1.2       schwarze   35: .Pp
                     36: If the
                     37: .Ar file
                     38: argument is omitted, standard input is read instead.
1.3       schwarze   39: .Pp
                     40: .Ar bankFormat
                     41: is exactly one of
1.4     ! schwarze   42: .Pp
        !            43: .Bl -bullet -offset indent -compact
        !            44: .It
        !            45: .Cm capital_one_credit
        !            46: .It
        !            47: .Cm chase_credit
        !            48: .It
        !            49: .Cm optum_hsa
1.3       schwarze   50: .El
                     51: .Pp
                     52: and corresponds to an existing
1.4     ! schwarze   53: .Pa import_ Ns Ar bankFormat Ns Pa .txt
1.3       schwarze   54: file in the current directory.
1.1       schwarze   55: .Sh FILES
1.4     ! schwarze   56: .Bl -tag -width Ds -compact
1.3       schwarze   57: .It Pa ./import_capital_one_credit.txt
                     58: .It Pa ./import_chase_credit.txt
                     59: .It Pa ./import_optum_hsa.txt
1.1       schwarze   60: .El
1.3       schwarze   61: .Pp
                     62: These files contain the header that the financial institution uses, the
                     63: account number from
                     64: .Pa ./accounts.txt
                     65: used by this account, as well as patterns used to map transactions to
                     66: the correct account and booking identifier.
                     67: .Ss Defining the account number
                     68: Each file must contain one line beginning with
                     69: .Qq ACCOUNT
                     70: and is followed by whitespace and then an account number.
                     71: The account number corresponds to the account in
                     72: .Pa ./accounts.txt
                     73: for the imported account.
                     74: .Ss Patterns in the import_bankFormat.txt files
                     75: Each file contains lines of the form
                     76: .Pp
                     77: .Ar selector account_number booking_identifier
1.1       schwarze   78: .Sh EXIT STATUS
                     79: .Ex -std
                     80: .Sh EXAMPLES
                     81: Add journal entries to a journal file using a CSV file generated by
                     82: a financial institution:
                     83: .Pp
1.3       schwarze   84: .Dl "$ pta_import -I chase_credit chasedownload.csv >> journal.txt"
                     85: .Ss A sample credit card purchase
                     86: Suppose a line in the
                     87: .Pa chasedownload.csv
                     88: file looks like
1.1       schwarze   89: .Pp
1.3       schwarze   90: .Dl "10/26/2020,10/26/2020,example.com*asldfkj,Shopping,Sale,-17.07"
1.1       schwarze   91: .Pp
1.3       schwarze   92: If the line matching the
                     93: .Qq Shopping
                     94: category in the user's
                     95: .Pa ./import_chase_credit.txt
                     96: file is
                     97: .Pp
                     98: .Dl ,,,Shopping,,, 9996 SHOP
                     99: .Pp
                    100: then the
                    101: .Qq Shopping
                    102: category defined by Chase is mapped to the user's
                    103: .Qq SHOP
                    104: booking identifier, and the user's account for shopping
                    105: expenses is defined as
                    106: .Qq 9996
                    107: in their
                    108: .Pa ./accounts.txt .
                    109: .Pp
                    110: We further assume in this example that the user has edited
                    111: .Pa ./import_chase_credit.txt
                    112: so that the line beginning with
                    113: .Qq ACCOUNT
                    114: contains the liability account they have defined for their Chase card
                    115: in
                    116: .Pa ./accounts.txt
                    117: .Pp
                    118: In this example,
                    119: .Pa ./import_chase_credit.txt
                    120: contains
                    121: .Dl ACCOUNT 3234
1.1       schwarze  122: .Pp
                    123: Then
                    124: .Nm
                    125: prints
                    126: .Pp
1.3       schwarze  127: .Dl "20201026 SHOP 9996 3234 17.07 example.com*asldfkj"
                    128: .Ss A sample credit card payment
                    129: .Dl "10/27/2020,10/27/2020,Payment Thank You - Web,,Payment,1653.42"
                    130: .Pp
                    131: Suppose the user's
                    132: .Pa ./import_chase_credit.txt
                    133: file contains
                    134: .Pp
                    135: .Dl ,,,,Payment,, 1700 PAY
                    136: .Pp
                    137: which matches Chase's payment category to the user's asset account
                    138: .Qq 1700
                    139: used to pay off the credit card.
                    140: Then
                    141: .Nm
                    142: prints
1.1       schwarze  143: .Pp
1.3       schwarze  144: .Dl "20201027 PAY 3234 1700 1653.2 Payment Thank You - Web"
                    145: .Ss Account numbers in the import_bankFormat.txt files
                    146: For example, if
                    147: .Pa ./import_capital_one_credit.txt
1.1       schwarze  148: contains
                    149: .Pp
1.3       schwarze  150: .Dl ACCOUNT 1293
1.1       schwarze  151: .Pp
1.3       schwarze  152: then there must be a corresponding entry in
1.1       schwarze  153: .Pa ./accounts.txt
1.3       schwarze  154: such as
1.4     ! schwarze  155: .Pp
1.3       schwarze  156: .Dl 1293 L Capital One credit card
1.1       schwarze  157: .Pp
1.3       schwarze  158: The description
                    159: .Qq Capital One credit card
                    160: may vary, but in this example, the account numbers
                    161: .Qq 1293
                    162: match, and the account type is
                    163: .Qq L
                    164: to indicate that it is a liability account.
                    165: .Ss Patterns in the import_bankFormat.txt files
                    166: Suppose
1.4     ! schwarze  167: .Pp
1.3       schwarze  168: .Dl ,,,Automotive,,, 1111 AUTO
                    169: .Pp
                    170: is a sample entry in the
                    171: .Pa ./import_chase_credit.txt
                    172: file which uses headers of the form
                    173: .Pp
                    174: .Dl Transaction Date,Post Date,Description,Category,Type,Amount
                    175: .Pp
                    176: Then this
                    177: .Ar selector
                    178: ignores the transaction date, post date, description, type, and amount.
                    179: It matches the
                    180: .Qq Automotive
                    181: category and maps transactions to account
                    182: .Qq 1111
                    183: defined in
                    184: .Pa ./accounts.txt
                    185: with the
                    186: .Qq Auto
                    187: booking identifier.
                    188: .Ss A complete example
                    189: Suppose
                    190: .Pa ./accounts.txt
                    191: is given by
                    192: .Bd -literal
                    193: 1700 A My Bank
                    194: 3234 L My Chase Credit Card
                    195: 5102 X Physician expenses
                    196: 5103 X Dental expenses
                    197: 5203 X Shopping
                    198: .Ed
1.1       schwarze  199: .Pp
1.3       schwarze  200: and
                    201: .Pa chasedownload.csv
                    202: is given by
                    203: .Bd -literal
                    204: Transaction Date,Post Date,Description,Category,Type,Amount,Memo
                    205: 11/06/2020,11/09/2020,Dr. Joseph Schmoe,Health & Wellness,Sale,-100.00,
                    206: 11/06/2020,11/09/2020,Dr. Sally Sue,Health & Wellness,Sale,-183.00,
                    207: 11/08/2020,11/08/2020,example.com,Shopping,Sale,-53.83,
                    208: 11/04/2020,11/04/2020,Payment Thank You - Web,,Payment,75.43,
                    209: .Ed
1.1       schwarze  210: .Pp
1.3       schwarze  211: and
                    212: .Pa ./import_chase_credit.txt
                    213: is given by
                    214: .Bd -literal
                    215: # Chase credit card header is
                    216: # Transaction Date,Post Date,Description,Category,Type,Amount
                    217: # The format of this file is
                    218: # selector account_number booking_identifier
                    219: # selector is a comma-separated list of regular expressions which
                    220: # matches corresponding fields in the CSV file
                    221: ACCOUNT 3234
                    222: ,,,Automotive,,, 1111 AUTO
                    223: ,,,Bills & Utilities,,, 2222 BILLS
                    224: ,,,Fees & Adjustments,,, 3333 FEES
                    225: ,,,Food & Drink,,, 4444 FOOD
                    226: ,,,Gas,,, 5555 GAS
                    227: ,,,Gifts & Donations,,, 6666 GIFTS
                    228: ,,,Groceries,,, 7777 GROCERIES
                    229: ,,Dr. Sally Sue,,,, 5103 DENTAL
                    230: ,,,Health & Wellness,,, 5102 PHYSICIAN
                    231: ,,,Home,,, 9999 HOME
                    232: ,,,Personal,,, 9998 PERSONAL
                    233: ,,,Professional Services,,, 9997 PRO
                    234: ,,,Shopping,,, 5203 SHOP
                    235: ,,,,Payment,, 1700 PAY
                    236: .Ed
1.1       schwarze  237: .Pp
                    238: Then
1.4     ! schwarze  239: .Pp
1.3       schwarze  240: .Dl pta_import -I chase_credit chasedownload.csv
1.4     ! schwarze  241: .Pp
1.3       schwarze  242: outputs
                    243: .Bd -literal
                    244: 20201109 PHYSICIAN 5102 3234 100.00 Dr. Joseph Schmoe
                    245: 20201109 DENTAL 5103 3234 183.00 Dr. Sally Sue
                    246: 20201108 SHOP 5203 3234 53.83 example.com
                    247: 20201104 PAY 3234 1700 75.43 Payment Thank You - Web
                    248: .Ed
1.1       schwarze  249: .Sh SEE ALSO
                    250: .Xr pta-accounts 5 ,
                    251: .Xr pta-journal 5 ,
                    252: .Xr pta-glossary 7
                    253: .Sh BUGS
                    254: Currently,
                    255: .Nm
                    256: has the following limitations:
                    257: .Bl -dash
                    258: .It
1.3       schwarze  259: Pattern recognition in the
                    260: .Pa import_bankFormat.txt
                    261: files is under continued development.
                    262: .It
                    263: The only defined import formats are for Chase credit cards,
                    264: Capital One credit cards, and Optum Health Savings Accounts.
1.1       schwarze  265: .It
1.3       schwarze  266: Note that the first pattern match wins in
                    267: .Pa ./import_bankFormat.txt .
                    268: In the complete example above, we put the line containing
                    269: .Qq Dr. Sally Sue
                    270: before the line matching the
                    271: .Qq Health & Wellness
                    272: category because we wanted to override the
                    273: .Qq Health & Wellness
                    274: category, and use the
                    275: .Qq Dental expenses
                    276: account instead.
1.1       schwarze  277: .El

CVSweb