Accounting API python application using ledger

Joar Wandborg joar at wandborg.se
Thu Dec 12 16:24:40 EST 2013


I have started work on a proof-of-concept ledger-cli-powered accounting 
API. The results can be followed at
https://gitorious.org/conservancy/accounting-api/ and some documentation 
is available at
http://npoacct.sfconservancy.org/accounting-api/.

-- Some notes --

The application does not support concurrency at all. I think it could be 
done in a safe way, but ledger-cli would need to be restarted anytime 
the data file is changed.

ledger-cli is able to take multiple quieries per run, this means that 
queries could be performed without a ledger-cli respawn as long as the 
data file stays the same.

Simple runtime caching based on a hash of the data file could be used to 
speed up reads from the application, as long as the reads have already 
been made using the same version of the data file. This could be a major 
benefit for read-intensive mostly-static applications like public 
websites, but I don't think it will help much in this case.

Performance-wise, I'm not sure about what the next step would be.

The application uses type-hinted JSON as the transport, this means that 
the client can decode the JSON directly into native objects. Some notes 
about this approach:

  - The JSON does not look like the JSON some are used to and consuming 
it without the automatic deserialization into native objects may be 
painful, this means that client libraries would need to be constructed 
for each language. See the bullet about JSON-RPC.
  - To keep stable serialization/deserialization the API would need to 
be strictly versioned (it would probably be needed without the 
type-hinting too, it's just more apparent now).
  - Perhaps something like JSON-RPC would be better, instead of my 
homemade accounting transport protocol. I'll gladly take feedback on this.

Feature-wise the application could be expanded with filtering, 
documentation and proper metadata inserts.

- joar


More information about the npo-accounting mailing list