PolicyEngine / openfisca-tools

Python tools for enhancing OpenFisca country packages.
1 stars 1 forks source link

Nesting #17

Closed nikhilwoodruff closed 2 years ago

nikhilwoodruff commented 2 years ago

Adds automatic nesting based on breakdowns

nikhilwoodruff commented 2 years ago

I think this is finished; here's an example: Input

value_by_country_and_region:
  England:
    North East:
      1:
        2021-01-01: 1

Output

value_by_country_and_region:
  England:
    East Midlands:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    East of England:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    London:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    North East:
      1:
        2021-01-01: 1
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    North West:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    Northern Ireland:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    Scotland:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    South East:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    South West:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    Wales:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    West Midlands:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    Yorkshire and The Humber:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
  Northern Ireland:
    East Midlands:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    East of England:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    London:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    North East:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    North West:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    Northern Ireland:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    Scotland:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    South East:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    South West:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    Wales:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    West Midlands:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    Yorkshire and The Humber:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
  Scotland:
    East Midlands:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    East of England:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    London:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    North East:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    North West:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    Northern Ireland:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    Scotland:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    South East:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    South West:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    Wales:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    West Midlands:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    Yorkshire and The Humber:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
  Wales:
    East Midlands:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    East of England:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    London:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    North East:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    North West:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    Northern Ireland:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    Scotland:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    South East:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    South West:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    Wales:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    West Midlands:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0
    Yorkshire and The Humber:
      1:
        2000-01-01: 0
      2:
        2000-01-01: 0
      3:
        2000-01-01: 0