Comments (5)
You're right. For some files this is indeed not a usable situation. Option 2 is quite involved so I've opted for adding a transformer to take care of option 1. I'm still finalizing the code so the tests keep on working without issues but the current develop branch shows the new behaviour.
from mt940.
The new release is online. Every transaction should have the relevant transaction_reference
now. If you want to add more fields you can do so using the post processors:
Lines 264 to 267 in 026859d
from mt940.
There should be a transaction_reference
available for a :20:
:
Line 135 in 2b8b865
We can see an example with this sta file here:
Which generates this data:
Do you have a specific example where this is not working?
from mt940.
You can find the transaction reference as follow:
transactions = mt940.parse('test.sta')
print(transactions.data['transaction_reference'])
But for instance my bank exports several transaction references at the same time (one for each account). And with the print
above you would get only the last transaction reference.
Try with this example:
:20:STARTUMSE
:25:12345678/1020304050
:28C:00000/001
:60F:C160229EUR1200,00
:61:1602300301DR6,00N024NONREF
:86:805?00ENTGELTABSCHLUSS?106666?20Pauschalen?3012345678?1122334
45566?602017-01-01T13
:12:11
:62F:C160301EUR1194,00
:20:STARTUMSE2
:25:12345678/1020304050
:28C:00000/001
:60F:C160229EUR1200,00
:61:1602300301DR6,00N024NONREF
:86:805?00ENTGELTABSCHLUSS?106666?20Pauschalen?3012345678?1122334
45566?602017-01-01T13
:12:11
:62F:C160301EUR1194,00
I think this is a bug and I see 2 solutions:
- add a 'transaction_reference' key to every transaction objects or
- group the objects by 'transaction_reference'
from mt940.
Amazing fix! This same issue happens when a single mt940 file contains transactions for several bank accounts. The account_identification
field in transactions.data
would have the value of the last tag 25
. So it was impossible to track after transaction parsing what bank account the transaction belonged to.
I implemented a more complex workaround to separate the transactions per bank account. But with this post processor, it's possible to include that information in the transaction data itself. So the parsing becomes much easier.
Now don't forget that the global transactions.data
gets overwritten with each new transaction, otherwise this feature doesn't work anymore.
from mt940.
Related Issues (20)
- Parsing transactions : key 64 HOT 8
- Multiple accounts in one file HOT 7
- Parser doesn't show running balance or opening/closing balance at transaction level HOT 2
- Status and Fund code , when Currency ends with a D HOT 2
- Getting only single account data instead of multiple accounts HOT 1
- Non-numeric statement number HOT 2
- Exporting to tabular format HOT 1
- cannot run for citibank? HOT 1
- Single "account_identification" field HOT 2
- Statement line is parsed incorrectly for customer/bank reference HOT 2
- MT940 Issues parsing with :61: HOT 4
- AttributeError: module 'mt940' has no attribute 'parse' HOT 5
- Missing essential documentation for Transaction fields. HOT 2
- Dropping Transaction Data? HOT 1
- First intermediate_opening_balance line missing HOT 5
- AttributeError: 'NoneType' object has no attribute 'encoding' HOT 1
- How to read closing, opening and available balances HOT 3
- Minor parsing errors
- New transaction is only created on `:61:` tag (statement) and not `:20:` tag (transaction reference number)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mt940.