qif2json icon indicating copy to clipboard operation
qif2json copied to clipboard

Account support v0.3.1?

Open gustawdaniel opened this issue 6 years ago • 4 comments

Lets consider these files (1):

!Type:Bank
D03/03/10
T-379.00
PCITY OF SPRINGFIELD
^
D03/04/10
T-20.28
PYOUR LOCAL SUPERMARKET
^
D03/03/10
T-421.35
PSPRINGFIELD WATER UTILITY

For this file library works:

{ transactions:
   [ { date: '2010-03-03',
       amount: -379,
       payee: 'CITY OF SPRINGFIELD' },
     { date: '2010-04-03',
       amount: -20.28,
       payee: 'YOUR LOCAL SUPERMARKET' },
     { date: '2010-03-03',
       amount: -421.35,
       payee: 'SPRINGFIELD WATER UTILITY' } ],
  type: 'Bank' }

But lets consider this file

!Account
NAlior GBP
TBank
^
!Type:Bank
D03/03/10
T-379.00
PCITY OF SPRINGFIELD
^
D03/04/10
T-20.28
PYOUR LOCAL SUPERMARKET
^
D03/03/10
T-421.35
PSPRINGFIELD WATER UTILITY

there is error

Error: File does not appear to be a valid qif file: !Account
    at Object.exports.parse (/home/daniel/pro/open_cash_manager/local/node_modules/qif2json/lib/qif2json.js:47:15)
    at Object.exports.parseInput (/home/daniel/pro/open_cash_manager/local/node_modules/qif2json/lib/qif2json.js:138:27)
    at /home/daniel/pro/open_cash_manager/local/node_modules/qif2json/lib/qif2json.js:169:17
    at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)

But

!Account 

is described in specification there

https://en.wikipedia.org/wiki/Quicken_Interchange_Format

How it is parsed in other languages. For example for script

https://www.w3.org/2000/10/swap/pim/qif2n3.py

execution of this script on second file gives

# n3  Personal and confidential. Not for distrbution.
# From Quicken data in  backup2.qif
# Extracted by $Id: qif2n3.py,v 1.8 2012-12-05 18:29:21 timbl Exp $ 


    @prefix : <#>.
    @prefix d: <#>.
    @prefix s: <http://www.w3.org/2000/01/rdf-schema#> .
    @prefix log: <http://www.w3.org/2000/10/swap/log#>.
    @prefix qu:  <http://www.w3.org/2000/10/swap/pim/qif#>.
#    @prefix acc: <../../../Financial/Data/accounts.n3#>.
#    @prefix cat: <categories.n3#>.
#    @prefix cla: <classes.n3#>.
    


# Account information:
acc:Alior_GBP a qu:Account; s:label "Alior GBP"; qu:type "Bank"; qu:accordingTo <>; .
<#id1> qu:date "1910-03-03"; qu:amount "-379.00"; qu:payee "CITY OF SPRINGFIELD"; qu:accordingTo <>; qu:toAccount  acc:alior_gbp .
<#id2> qu:date "1910-03-04"; qu:amount "-20.28"; qu:payee "YOUR LOCAL SUPERMARKET"; qu:accordingTo <>; qu:toAccount  acc:alior_gbp .
<#id3> qu:date "1910-03-03"; qu:amount "-421.35"; qu:payee "SPRINGFIELD WATER UTILITY"; . 

#ends

But for first file

# n3  Personal and confidential. Not for distrbution.
# From Quicken data in  simple.qif
# Extracted by $Id: qif2n3.py,v 1.8 2012-12-05 18:29:21 timbl Exp $ 


    @prefix : <#>.
    @prefix d: <#>.
    @prefix s: <http://www.w3.org/2000/01/rdf-schema#> .
    @prefix log: <http://www.w3.org/2000/10/swap/log#>.
    @prefix qu:  <http://www.w3.org/2000/10/swap/pim/qif#>.
#    @prefix acc: <../../../Financial/Data/accounts.n3#>.
#    @prefix cat: <categories.n3#>.
#    @prefix cla: <classes.n3#>.
    


# List of Bank

<#id1> qu:date "1910-03-03"; qu:amount "-379.00"; qu:payee "CITY OF SPRINGFIELD"; qu:accordingTo <>; qu:toAccount <accouts.n3#Default>; .
<#id2> qu:date "1910-03-04"; qu:amount "-20.28"; qu:payee "YOUR LOCAL SUPERMARKET"; qu:accordingTo <>; qu:toAccount <accouts.n3#Default>; .
<#id3> qu:date "1910-03-03"; qu:amount "-421.35"; qu:payee "SPRINGFIELD WATER UTILITY"; .     acc:Default s:label "DEFAULT". 


#ends

So differences are in lines

acc:Alior_GBP a qu:Account; s:label "Alior GBP"; qu:type "Bank"; qu:accordingTo <>; .

and property

acc:alior_gbp

insetead

<accouts.n3#Default>

Is this feature worth to consider? Should be implemented? If yes I propose the following format:

{ accounts: [ { name: 'Alior GBP', type: 'Bank' } ],
transactions:
   [ { date: '2010-03-03',
       amount: -379,
       payee: 'CITY OF SPRINGFIELD', account: 'Alior GBP' },
     { date: '2010-04-03',
       amount: -20.28,
       payee: 'YOUR LOCAL SUPERMARKET', account: 'Alior GBP' },
     { date: '2010-03-03',
       amount: -421.35,
       payee: 'SPRINGFIELD WATER UTILITY', account: 'Alior GBP' } ],
}

if accounts are defined in file

  • type: 'Bank' should be removed, because of any transaction has his own account and account has type
  • accounts array should be added
  • names of account should be considered as uniquer, if not throw exception
  • any transaction should have his own property - account name

Question

Is community developing this package interested in implementing this feature?

gustawdaniel avatar Jan 26 '19 00:01 gustawdaniel

Hi @rwilliams-scottlogic! :)

I created pull request that solves this problem.

gustawdaniel avatar May 01 '20 16:05 gustawdaniel

@spmason can you accept this pull request and pull requests with updates of dependencies?

gustawdaniel avatar Oct 12 '20 21:10 gustawdaniel

hey guys, any chance we can get this PR merged? Happy to help to tidy things up if needed

nagliyvred avatar May 29 '24 01:05 nagliyvred

Yeah, go for it. For some reason I've not been getting notified of activity on this repo but I'll try and keep an eye on things (@ me if I don't respond)

spmason avatar May 29 '24 06:05 spmason