leolabs/you-need-a-parser

Update existing Nordea format and add support for the new site

Closed this issue · 11 comments

Update: Re-created this issue in the bank2ynab repo as that seems more fitting (as the parsers come from there)

bank2ynab/bank2ynab#339

Thanks for the pointer! I'll update the parsers then. Could you tell me which encoding the CSV files have when exported from the site? Optimally, that would be UTF-8, but I know that a lot of banks use WIN-1252 instead which leads to some wonky characters when opened as UTF-8 :)

I've fixed the existing parser and added a new one with a PR in the bank2ynab repo -- do you automatically sync with those?

bank2ynab/bank2ynab#340

The "old" format is UTF-8
The "new" format indicates UTF-8 with BOM

Yeah, I sync with bank2ynab, but it's manually triggered. Just tell me when your PR has been merged and I'll trigger the sync :)

in the case of bank2ynab, YNAP tries to automatically detect the file's encoding. With UTF-8 (with and without BOM), this should be no problem.

Fantastic, cheers! Thanks for the snappy responses, glad to see you're active in this repo.

Does YNAP detect the bank purely by filename? This causes issues with bank2ynab: bank2ynab/bank2ynab#339 where several configurations use the exact same name.

It depends. In the case of the YNAP-native parsers, every bank script can decide to use its own methods to verify that the file can be parsed by it (see here, for example).

With bank2ynab parsers, I don't have that level of flexibility, so the matcher uses the filename and checks that the CSV has enough columns to satisfy the Input Columns config. In addition to that, it checks that the columns contain believable data. If you want to see all checks, you can see them in bank2ynab.ts.

Feel free to ask me if anything is still unclear :)

FYI: The PR just got merged :)

Seems your extra logic should suffice for this usecase!

Cool! I've updated the configs in YNAP and it should support your new formats now. Could you try it out and check if it works? :)

Thanks, I've just tried it and these were my findings.

The old format - [SE Nordea - internetbanken.privat.nordea.se]

For the old format I notice it's not parsing amounts of 1.000,00 and above, it outputs NaN for those:

Input

Datum,Transaktion,Kategori,Belopp,Saldo
2020-05-05,Reservation Kortköp Spotify,,"-99,00",
2020-05-03,Reservation Kortköp HEMKOP,,"-34,95",
2020-05-05,Swish inbetalning JOHN DOE,,"3.000,00","8.778,76"
2020-05-05,Kortköp 200999 YOU NEED A BUDGET,,"-50,19","5.778,76"
2020-05-05,Autogiro K*SomeStore,,"-943,00","5.828,95"
2020-05-04,Kortköp 200999 APPLE COM BILL,,"-9,00","6.779,95"
2020-05-04,Kortköp 200999 STEAMGAMES COM,,"-165,00","6.788,95"
2020-05-01,Vardagspaket Månadspris kort,,"-12,00","6.953,95"
2020-04-30,Autogiro K*HEMKOP,,"-279,36","6.965,95"
2020-04-29,Autogiro K*DISCORD* N,,"-50,60","7.245,31"


Output

Category,Payee,Date,Inflow,Outflow
,Reservation Kortköp Spotify,05/05/2020,,99
,Reservation Kortköp HEMKOP,05/03/2020,,34.95
,Swish inbetalning JOHN DOE,05/05/2020,NaN,
,Kortköp 200999 YOU NEED A BUDGET,05/05/2020,,50.19
,Autogiro K*SomeStore,05/05/2020,,943
,Kortköp 200999 APPLE COM BILL,05/04/2020,,9
,Kortköp 200999 STEAMGAMES COM,05/04/2020,,165
,Vardagspaket Månadspris kort,05/01/2020,,12
,Autogiro K*HEMKOP,04/30/2020,,279.36
,Autogiro K*DISCORD* N,04/29/2020,,50.6

bank2ynab outputs correct numbers so perhaps a number conversion issue in YNAP?

The new format - [SE Nordea - netbank.nordea.se]

Nordea exports Invalid date for transactions that are reserved. bank2ynab skips these transactions but YNAP aborts the whole conversion saying there's an invalid date. Might be better if YNAP would proceed with the export, at most show a warning that some transactions could not be parsed.

Input

Bokföringsdag;Belopp;Avsändare;Mottagare;Namn;Rubrik;Saldo;Valuta
2020-05-05;3000,00;;NAID-SE-SEK-7001011234;;Swish inbetalning JOHN DOE;8778,76;SEK
2020-05-05;-50,19;NAID-SE-SEK-7001011234;;;Kortköp 200501 YOU NEED A BUDGET;5778,76;SEK
2020-05-05;-943,00;NAID-SE-SEK-7001011234;;;Autogiro K*SomeStore;5828,95;SEK
Invalid date;-99,00;NAID-SE-SEK-7001011234;;;Reservation Kortköp Spotify;;SEK
Invalid date;-34,95;NAID-SE-SEK-7001011234;;;Reservation Kortköp HEMKOP;;SEK
2020-05-04;-15,00;NAID-SE-SEK-7001011234;;;Kortköp 200428 PP*0000CODE;6771,95;SEK
2020-05-04;15,00;;NAID-SE-SEK-7001011234;;Återköp 200428 PP*0000CODE;6786,95;SEK

Output

None, an "Invalid date" error toast is shown.

Hey, thanks for your feedback! I somehow didn't get a notification so I only saw it now. I'll see how I can fix these issues, but I already have some ideas in mind. I'll get back to you on Friday :)

Sorry again for the delay. I've updated the algorithm, so invalid numbers should now be ignored instead of leading to an error :)

I'll close this issue for now, but please feel free to re-open it if you have any other issues with your bank's statements.