Skip to content

Uniformise scales and parameters in the Web API #697

@fpagnoux

Description

@fpagnoux

Connected to #677

In YAML parameters, scales are defined this way:

description: Social security contribution tax scale
brackets:
- rate:
    2013-01-01:
      value: 0.03
    2015-01-01:
      value: 0.04
    2017-01-01:
      value: 0.02
  threshold:
    2013-01-01:
      value: 0.0
- rate:
    2013-01-01:
      value: 0.1
    2015-01-01:
      value: 0.12
    2017-01-01:
      value: 0.06
  threshold:
    2013-01-01:
      value: 12000.0
    2014-01-01:
      value: 12100.0
    2015-01-01:
      value: 12200.0
    2016-01-01:
      value: 12300.0
    2017-01-01:
      value: 6000.0
- rate:
    2017-01-01:
      value: 0.12
  threshold:
    2017-01-01:
      value: 12400.0

In the web API, they are represented in a different way:

{
  "brackets": {
    "2013-01-01": {
      "0.0": 0.03, 
      "12000.0": 0.1
    }, 
    "2014-01-01": {
      "0.0": 0.03, 
      "12100.0": 0.1
    }, 
    "2015-01-01": {
      "0.0": 0.04, 
      "12200.0": 0.12
    }, 
    "2016-01-01": {
      "0.0": 0.04, 
      "12300.0": 0.12
    }, 
    "2017-01-01": {
      "0.0": 0.02, 
      "6000.0": 0.06, 
      "12400.0": 0.12
    }
  }, 
  "description": "Social security contribution tax scale", 
  "id": "taxes.social_security_contribution", 
  "metadata": {
    "rate_unit": "/1", 
    "threshold_unit": "currency-EUR"
  }, 
  "source": "https://github.com/openfisca/openfisca-country-template/blob/3.2.2rc0/openfisca_country_template/parameters/taxes/social_security_contribution.yaml"
}

The latter representation is "too compact" to expose the metadata defined in the YAML file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:refactorRefactoring and code cleanup

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions