Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PolicyBrain API #352

Closed
hdoupe opened this issue Mar 2, 2018 · 2 comments
Closed

PolicyBrain API #352

hdoupe opened this issue Mar 2, 2018 · 2 comments

Comments

@hdoupe
Copy link
Contributor

hdoupe commented Mar 2, 2018

This issue outlines an interface that would ease the integration of OG-USA onto PolicyBrain:

  1. JSON document containing model specifications (see taxcalc/current_law_policy.json for examples)
    a. long name, parameter description to be displayed in the hover over box on PB, needs default value, type hints--integer_value or boolean_value (assumed to be float otherwise), range : {'min': min value, 'max': max value}, action on validating range--either stop or warn, warning message on violating
  2. default_data -- returns a python dictionary containing the contents of the JSON document containing the model specifications (see taxcalc/parameters.default_data)
  3. read_json_param_objects: final specification formatting (see taxcalc/calculator.read_json_param_objects)
    a. PoliyBrain converts this dictionary {'param_name': 'raw input data', ...} to {'param_name': {'YEAR_i': 'parsed val_i', 'YEAR_j': 'parsed val_j', ...}, ...}. This dictionary is passed to read_json_param_objects for final formatting
  4. reform_warnings_errors: provides error and warning messages given the parsed user input
    a. takes input from read_json_param_objects and returns dictionary {'errors': 'new line separated error messages', 'warnings': 'new line separated warning messages'} (see taxcalc/tbi/tbi.reform_warnings_errors)

@jdebacker , if you can open up a PR for creating the JSON specifications object, we can work out how the different specifications can be mapped to the OG-USA parameters. Once this is set up, we can take a look at extending the taxcalc/parameters.py module to work with this document. My hunch is that once we get that connection setup the final formatting and warning/error handling will fall into place as we can borrow parts of the taxcalc warning and error handling code.

Also, the API endpoint names are flexible. These are just taken from Tax-Calculator for simplicity.

@martinholmer
Copy link

@hdoupe said in issue #352:

This issue outlines an interface that would ease the integration of OG-USA onto PolicyBrain

The general approach Hank is suggesting here seems very reasonable.
If you can do something like this, the OG-USA code and PolicyBrain code will be much simpler.

@jdebacker
Copy link
Member

OG-USA has these features for loading parameters as of PR #421.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants