centreformicrosimulation / SimPaths

SimPaths is an open-source microsimulation framework for life course analysis, developed and maintained by CeMPA at the University of Essex
European Union Public License 1.2
7 stars 17 forks source link

Don't automatically rebuild EUROMODpolicySchedule file and check for valid file. #45

Closed andrewbaxter439 closed 11 months ago

andrewbaxter439 commented 11 months ago

Closes #44 by adding an option to not rebuild Excel file and exit with error if no file found.

andrewbaxter439 commented 11 months ago

Hi @pbronka - have tested this out and it should work smoothly to fix my accidentally introduced bug. SimPathsStart accepts a new command-line argument:

usage: SimPathsStart [-c <CC>] [-s <year>] [-Setup] [-r] [-g <true/false>]
       [-h]
SimPathsStart will start the SimPaths run. When using the argument
`Setup`, this will create the population database and exit before starting
the first run. It takes the following options:

...
 -r,--rewrite-policy-schedule   Re-write policy schedule from detected
                                policy files

This will mean that it defaults to false - not overwriting the 'EUROMODpolicySchedule.xlsx' file. But I've added a check to see if the file exists and exit with message if both missing and no-rewrite. The rewrite option (-r) will instead not check for an existing file, will read the contents of 'input/EUROMODoutput' directory and will attempt to automatically match year by filename. The user can thus customise their run by providing either a set of output files with non-overlapping year values in filenames or a pre-set 'EUROMODpolicySchedule.xlsx' file to specify which file/year combinations to use.

This pull request also makes some small additional changes:

As an aside, I think a potential wiki page could cover "Customising your SimPaths run" to outline best practices for using features to make SimPaths fit user purpose (summarising the above bit clearly and adding in other parts such as customising config file). I'll aim to make a draft at some point.

pbronka commented 11 months ago

Thank you @andrewbaxter439 . A wiki page sounds like a great idea to me. I'm not sure if you can currently edit it - if not, please let me know and we will figure it out.

andrewbaxter439 commented 11 months ago

As a brief side point - apologies @pbronka if you get a stream of notification emails every time I do a pull request with a GitHub Actions run that fails! I might start test-pull-requests to my own repo first as they can get quite annoying if they keep crashing!