Adding ad hoc code to Liam2

19 views
Skip to first unread message

Joe Bosak

unread,
Mar 19, 2015, 4:28:46 PM3/19/15
to liam...@googlegroups.com
There might be times when a specific model has some esoteric requirement that it might not be of wider interest.  Or alternatively one might simply wish to test an idea out.

So my questions are:

- is it possible to extend Liam2 models in an ad hoc way using Python code to directly program entities? 

- if so, what would be involved? 


The background to this question is of course our comparison of Liam2 with our own Genesis system.  Genesis generates SAS code from parameters set up in Excel spreadsheets, but it also contains syntax to incorporate pre-written SAS code files where required [we refer to these pre-written code segments as "static code"].  I would like to understand whether there is a corresponding capability within Liam2.


Alexis EidelMan

unread,
Mar 19, 2015, 7:20:54 PM3/19/15
to liam...@googlegroups.com
for what it's worth you can see some dirty hack of liam2 here: https://github.com/TaxIPP-Life/liam2/tree/til
In the branch Til, you can see a parameter, "legislation" in simulation.py that use an ad hoc python program and an External Process in process.py.
If you need only one Entity to run your code you can create an expression like I did in exprmisc.py for the pension expression.
https://github.com/TaxIPP-Life/liam2/blob/til/src/exprmisc.py

Hope it helps,

Alexis

Gaëtan de Menten

unread,
Mar 20, 2015, 9:34:31 AM3/20/15
to liam...@googlegroups.com

Hi Joe,

 

Out of the box (with an unmodified copy of LIAM2), it is currently not possible. However, adding such functionality should be relatively easy.

 

For example, Alexis has done so with his ExtProcess class in his fork of LIAM2 at: https://github.com/TaxIPP-Life/liam2/blob/til/src/process.py#L46

 

That version is not generic enough to my taste to be included in LIAM2, but it wouldn't be too hard to come up with something more generic. What he has done uses external/"self-contained" python modules, but we could also support inline code (within the .yml file).

 

Hope it helps,

Gaëtan

--
You received this message because you are subscribed to the Google Groups "liam2-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
liam2-dev+...@googlegroups.com.
To post to this group, send email to
liam...@googlegroups.com.
Visit this group at
http://groups.google.com/group/liam2-dev.



Disclaimer: This e-mail may contain confidential information which is intended only for the use of the recipient(s) named above.
If you have received this communication in error, please notify the sender immediately and delete this e-mail from your system.
Please note that e-mail messages cannot be considered as official information from the Federal Planning Bureau.
Reply all
Reply to author
Forward
0 new messages