Ejemplo n.º 1
0
def validate_inputs(meta_param_dict, adjustment, errors_warnings):
    '''
    Validates user inputs for parameters
    '''
    # Validate meta parameter inputs
    meta_params = MetaParams()
    meta_params.adjust(meta_param_dict, raise_errors=False)
    errors_warnings["Business Tax Parameters"]["errors"].update(
      meta_params.errors)
    # Validate CCC parameter inputs
    params = Specification()
    params.adjust(adjustment["Business Tax Parameters"],
                  raise_errors=False)
    errors_warnings["Business Tax Parameters"]["errors"].update(
        params.errors)
    # Validate TC parameter inputs
    iit_adj = cs2tc.convert_policy_adjustment(
        adjustment["Individual and Payroll Tax Parameters"])

    iit_params = Policy()
    iit_params.adjust(iit_adj, raise_errors=False, ignore_warnings=True)
    errors_warnings["Individual and Payroll Tax Parameters"][
        "errors"].update(iit_params.errors)

    return {"errors_warnings": errors_warnings}
Ejemplo n.º 2
0
def update_policy(
    policy_obj: tc.Policy,
    reform: Union[TaxcalcReform, ParamToolsAdjustment],
    **kwargs
):
    """
    Convenience method that updates the Policy object with the reform
    dict using the appropriate method, given the reform format.

    Parameters
    ----------
    policy_obj: Tax-Calculator Policy class object
        Policy object for tax parameterization used for analysis
    reform: str or dict
        parameters for tax policy

    Returns
    -------
    None
        modifies the Policy object
    """
    if is_paramtools_format(reform):
        policy_obj.adjust(reform, **kwargs)
    else:
        policy_obj.implement_reform(reform, **kwargs)
Ejemplo n.º 3
0
def validate_inputs(meta_params_dict, adjustment, errors_warnings):
    params = CruncherParams()
    params.adjust(adjustment["Tax Information"], raise_errors=False)
    errors_warnings["Tax Information"]["errors"].update(params.errors)

    policy_adj = inputs.convert_policy_adjustment(adjustment["Policy"])

    policy_params = Policy()
    policy_params.adjust(policy_adj, raise_errors=False, ignore_warnings=True)
    errors_warnings["Policy"]["errors"].update(policy_params.errors)

    return {"errors_warnings": errors_warnings}