policyengine-core 2.8.2__tar.gz → 2.9.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. {policyengine-core-2.8.2/policyengine_core.egg-info → policyengine-core-2.9.0}/PKG-INFO +1 -1
  2. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/charts/__init__.py +2 -1
  3. policyengine-core-2.9.0/policyengine_core/charts/api.py +228 -0
  4. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/charts/formatting.py +20 -8
  5. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/reforms/reform.py +81 -0
  6. {policyengine-core-2.8.2 → policyengine-core-2.9.0/policyengine_core.egg-info}/PKG-INFO +1 -1
  7. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core.egg-info/SOURCES.txt +1 -0
  8. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/setup.py +1 -1
  9. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/LICENSE +0 -0
  10. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/MANIFEST.in +0 -0
  11. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/README.md +0 -0
  12. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/__init__.py +0 -0
  13. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/charts/bar.py +0 -0
  14. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/commons/__init__.py +0 -0
  15. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/commons/formulas.py +0 -0
  16. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/commons/misc.py +0 -0
  17. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/commons/rates.py +0 -0
  18. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/__init__.py +0 -0
  19. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/constants.py +0 -0
  20. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/data/__init__.py +0 -0
  21. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/data/datasets/__init__.py +0 -0
  22. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/data/datasets/country_template_dataset.py +0 -0
  23. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/entities.py +0 -0
  24. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/modelled_policies.yaml +0 -0
  25. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/parameters/benefits/basic_income.yaml +0 -0
  26. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/parameters/benefits/housing_allowance.yaml +0 -0
  27. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/parameters/benefits/index.yaml +0 -0
  28. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/parameters/benefits/parenting_allowance/amount.yaml +0 -0
  29. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/parameters/benefits/parenting_allowance/income_threshold.yaml +0 -0
  30. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/parameters/general/age_of_majority.yaml +0 -0
  31. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/parameters/general/age_of_retirement.yaml +0 -0
  32. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/parameters/taxes/housing_tax.yaml +0 -0
  33. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/parameters/taxes/income_tax_rate.yaml +0 -0
  34. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/parameters/taxes/social_security_contribution.yaml +0 -0
  35. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/reforms/__init__.py +0 -0
  36. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/reforms/add_dynamic_variable.py +0 -0
  37. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/reforms/add_new_tax.py +0 -0
  38. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/reforms/flat_social_security_contribution.py +0 -0
  39. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/reforms/modify_social_security_taxation.py +0 -0
  40. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/reforms/removal_basic_income.py +0 -0
  41. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/situation_examples/__init__.py +0 -0
  42. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/situation_examples/couple.json +0 -0
  43. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/situation_examples/housing.json +0 -0
  44. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/situation_examples/single.json +0 -0
  45. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/tests/age.yaml +0 -0
  46. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/tests/basic_income.yaml +0 -0
  47. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/tests/disposable_income.yaml +0 -0
  48. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/tests/housing_allowance.yaml +0 -0
  49. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/tests/housing_tax.yaml +0 -0
  50. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/tests/income_tax.yaml +0 -0
  51. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/tests/reforms/add_dynamic_variable.yaml +0 -0
  52. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/tests/reforms/add_new_tax.yaml +0 -0
  53. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/tests/reforms/modify_social_security_taxation.yaml +0 -0
  54. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/tests/situations/income_tax.yaml +0 -0
  55. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/tests/situations/parenting_allowance.yaml +0 -0
  56. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/tests/social_security_contribution.yaml +0 -0
  57. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/tests/test_microsimulation.py +0 -0
  58. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/variables/__init__.py +0 -0
  59. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/variables/benefits.py +0 -0
  60. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/variables/demographics.py +0 -0
  61. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/variables/housing.py +0 -0
  62. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/variables/ids.py +0 -0
  63. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/variables/income.py +0 -0
  64. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/variables/stats.py +0 -0
  65. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/country_template/variables/taxes.py +0 -0
  66. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/data/__init__.py +0 -0
  67. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/data/dataset.py +0 -0
  68. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/data_storage/__init__.py +0 -0
  69. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/data_storage/in_memory_storage.py +0 -0
  70. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/data_storage/on_disk_storage.py +0 -0
  71. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/data_structures/__init__.py +0 -0
  72. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/data_structures/parameter_metadata.py +0 -0
  73. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/data_structures/parameter_node_metadata.py +0 -0
  74. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/data_structures/reference.py +0 -0
  75. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/data_structures/unit.py +0 -0
  76. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/entities/__init__.py +0 -0
  77. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/entities/entity.py +0 -0
  78. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/entities/group_entity.py +0 -0
  79. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/entities/helpers.py +0 -0
  80. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/entities/role.py +0 -0
  81. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/enums/__init__.py +0 -0
  82. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/enums/config.py +0 -0
  83. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/enums/enum.py +0 -0
  84. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/enums/enum_array.py +0 -0
  85. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/errors/__init__.py +0 -0
  86. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/errors/cycle_error.py +0 -0
  87. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/errors/empty_argument_error.py +0 -0
  88. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/errors/nan_creation_error.py +0 -0
  89. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/errors/parameter_not_found_error.py +0 -0
  90. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/errors/parameter_parsing_error.py +0 -0
  91. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/errors/period_mismatch_error.py +0 -0
  92. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/errors/situation_parsing_error.py +0 -0
  93. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/errors/spiral_error.py +0 -0
  94. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/errors/variable_name_conflict_error.py +0 -0
  95. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/errors/variable_not_found_error.py +0 -0
  96. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/experimental/__init__.py +0 -0
  97. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/experimental/memory_config.py +0 -0
  98. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/extension_template/__init__.py +0 -0
  99. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/extension_template/local_benefit.py +0 -0
  100. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/extension_template/parameters/local_town/child_allowance/amount.yaml +0 -0
  101. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/extension_template/parameters/local_town/child_allowance/index.yaml +0 -0
  102. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/extension_template/parameters/local_town/index.yaml +0 -0
  103. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/extension_template/tests/local_benefit.yaml +0 -0
  104. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/holders/__init__.py +0 -0
  105. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/holders/helpers.py +0 -0
  106. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/holders/holder.py +0 -0
  107. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/model_api.py +0 -0
  108. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/parameters/__init__.py +0 -0
  109. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/parameters/at_instant_like.py +0 -0
  110. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/parameters/config.py +0 -0
  111. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/parameters/helpers.py +0 -0
  112. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/parameters/operations/__init__.py +0 -0
  113. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/parameters/operations/get_parameter.py +0 -0
  114. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/parameters/operations/homogenize_parameters.py +0 -0
  115. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/parameters/operations/interpolate_parameters.py +0 -0
  116. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/parameters/operations/propagate_parameter_metadata.py +0 -0
  117. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/parameters/operations/uprate_parameters.py +0 -0
  118. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/parameters/parameter.py +0 -0
  119. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/parameters/parameter_at_instant.py +0 -0
  120. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/parameters/parameter_node.py +0 -0
  121. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/parameters/parameter_node_at_instant.py +0 -0
  122. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/parameters/parameter_scale.py +0 -0
  123. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/parameters/parameter_scale_bracket.py +0 -0
  124. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/parameters/vectorial_parameter_node_at_instant.py +0 -0
  125. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/periods/__init__.py +0 -0
  126. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/periods/config.py +0 -0
  127. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/periods/helpers.py +0 -0
  128. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/periods/instant_.py +0 -0
  129. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/periods/period_.py +0 -0
  130. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/populations/__init__.py +0 -0
  131. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/populations/config.py +0 -0
  132. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/populations/group_population.py +0 -0
  133. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/populations/population.py +0 -0
  134. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/projectors/__init__.py +0 -0
  135. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/projectors/entity_to_person_projector.py +0 -0
  136. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/projectors/first_person_to_entity_projector.py +0 -0
  137. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/projectors/helpers.py +0 -0
  138. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/projectors/projector.py +0 -0
  139. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/projectors/unique_role_to_entity_projector.py +0 -0
  140. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/reforms/__init__.py +0 -0
  141. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/scripts/__init__.py +0 -0
  142. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/scripts/assets/__init__.py +0 -0
  143. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/scripts/assets/index.html +0 -0
  144. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/scripts/policyengine_command.py +0 -0
  145. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/scripts/run_data.py +0 -0
  146. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/scripts/run_test.py +0 -0
  147. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/scripts/simulation_generator.py +0 -0
  148. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/simulations/__init__.py +0 -0
  149. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/simulations/helpers.py +0 -0
  150. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/simulations/individual_sim.py +0 -0
  151. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/simulations/microsimulation.py +0 -0
  152. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/simulations/simulation.py +0 -0
  153. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/simulations/simulation_builder.py +0 -0
  154. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/taxbenefitsystems/__init__.py +0 -0
  155. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/taxbenefitsystems/tax_benefit_system.py +0 -0
  156. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/taxscales/__init__.py +0 -0
  157. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/taxscales/abstract_rate_tax_scale.py +0 -0
  158. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/taxscales/abstract_tax_scale.py +0 -0
  159. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/taxscales/amount_tax_scale_like.py +0 -0
  160. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/taxscales/helpers.py +0 -0
  161. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/taxscales/linear_average_rate_tax_scale.py +0 -0
  162. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/taxscales/marginal_amount_tax_scale.py +0 -0
  163. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/taxscales/marginal_rate_tax_scale.py +0 -0
  164. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/taxscales/rate_tax_scale_like.py +0 -0
  165. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/taxscales/single_amount_tax_scale.py +0 -0
  166. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/taxscales/tax_scale_like.py +0 -0
  167. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/tools/__init__.py +0 -0
  168. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/tools/simulation_dumper.py +0 -0
  169. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/tools/test_runner.py +0 -0
  170. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/tracers/__init__.py +0 -0
  171. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/tracers/computation_log.py +0 -0
  172. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/tracers/flat_trace.py +0 -0
  173. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/tracers/full_tracer.py +0 -0
  174. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/tracers/performance_log.py +0 -0
  175. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/tracers/simple_tracer.py +0 -0
  176. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/tracers/trace_node.py +0 -0
  177. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/tracers/tracing_parameter_node_at_instant.py +0 -0
  178. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/types/__init__.py +0 -0
  179. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/types/data_types/__init__.py +0 -0
  180. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/types/data_types/arrays.py +0 -0
  181. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/variables/__init__.py +0 -0
  182. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/variables/config.py +0 -0
  183. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/variables/defined_for.py +0 -0
  184. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/variables/helpers.py +0 -0
  185. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/variables/typing.py +0 -0
  186. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/variables/variable.py +0 -0
  187. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/warnings/__init__.py +0 -0
  188. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/warnings/libyaml_warning.py +0 -0
  189. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/warnings/memory_config_warning.py +0 -0
  190. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core/warnings/tempfile_warning.py +0 -0
  191. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core.egg-info/dependency_links.txt +0 -0
  192. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core.egg-info/entry_points.txt +0 -0
  193. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core.egg-info/requires.txt +0 -0
  194. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/policyengine_core.egg-info/top_level.txt +0 -0
  195. {policyengine-core-2.8.2 → policyengine-core-2.9.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: policyengine-core
3
- Version: 2.8.2
3
+ Version: 2.9.0
4
4
  Summary: Core microsimulation engine enabling country-specific policy models.
5
5
  Home-page: https://github.com/policyengine/policyengine-core
6
6
  Author: PolicyEngine
@@ -1,6 +1,6 @@
1
1
  from .formatting import (
2
2
  BLUE,
3
- BLUE_COLOR_SCALE,
3
+ BLUE_COLOUR_SCALE,
4
4
  DARK_GREEN,
5
5
  LIGHT_GREEN,
6
6
  DARK_GRAY,
@@ -12,3 +12,4 @@ from .formatting import (
12
12
  )
13
13
 
14
14
  from .bar import *
15
+ from .api import *
@@ -0,0 +1,228 @@
1
+ import requests
2
+ import time
3
+ import plotly.graph_objects as go
4
+ from .formatting import (
5
+ DARK_GRAY,
6
+ MEDIUM_DARK_GRAY,
7
+ WHITE,
8
+ BLUE_LIGHT,
9
+ BLUE_PRIMARY,
10
+ format_fig,
11
+ )
12
+
13
+
14
+ def get_api_chart_data(
15
+ country_id: str,
16
+ reform_policy_id: int,
17
+ chart_key: str,
18
+ region: str,
19
+ time_period: str,
20
+ baseline_policy_id: int = None,
21
+ version: str = None,
22
+ ) -> dict:
23
+ if baseline_policy_id is None or version is None:
24
+ response = requests.get(
25
+ f"https://api.policyengine.org/{country_id}/metadata"
26
+ )
27
+ result = response.json().get("result", {})
28
+ baseline_policy_id = result.get("current_law_id")
29
+ version = result.get("version")
30
+ url = f"https://api.policyengine.org/{country_id}/economy/{reform_policy_id}/over/{baseline_policy_id}?region={region}&time_period={time_period}&version={version}"
31
+ response = requests.get(url)
32
+ if not response.ok:
33
+ raise ValueError(response.text)
34
+ json = response.json()
35
+ while json.get("status") == "computing":
36
+ time.sleep(1)
37
+ response = requests.get(url)
38
+ if not response.ok:
39
+ raise ValueError(response.text)
40
+ json = response.json()
41
+ return json.get("result", {}).get(chart_key)
42
+
43
+
44
+ # Specific chart definitions
45
+
46
+
47
+ def intra_decile_chart(
48
+ country_id: str,
49
+ reform_policy_id: int,
50
+ region: str,
51
+ time_period: str,
52
+ baseline_policy_id: int = None,
53
+ ) -> go.Figure:
54
+ impact = get_api_chart_data(
55
+ country_id=country_id,
56
+ reform_policy_id=reform_policy_id,
57
+ chart_key="intra_decile",
58
+ baseline_policy_id=baseline_policy_id,
59
+ region=region,
60
+ time_period=time_period,
61
+ )
62
+ impact = {"intra_decile": impact}
63
+
64
+ decile_numbers = list(range(1, 11))
65
+ outcome_labels = [
66
+ "Gain more than 5%",
67
+ "Gain less than 5%",
68
+ "No change",
69
+ "Lose less than 5%",
70
+ "Lose more than 5%",
71
+ ]
72
+ outcome_colours = [
73
+ DARK_GRAY,
74
+ MEDIUM_DARK_GRAY,
75
+ WHITE,
76
+ BLUE_LIGHT,
77
+ BLUE_PRIMARY,
78
+ ][::-1]
79
+
80
+ data = []
81
+
82
+ for outcome_label, outcome_colour in zip(outcome_labels, outcome_colours):
83
+ data.append(
84
+ {
85
+ "type": "bar",
86
+ "y": ["All"],
87
+ "x": [impact["intra_decile"]["all"][outcome_label]],
88
+ "name": outcome_label,
89
+ "legendgroup": outcome_label,
90
+ "offsetgroup": outcome_label,
91
+ "marker": {
92
+ "color": outcome_colour,
93
+ },
94
+ "orientation": "h",
95
+ "text": [
96
+ f"{impact['intra_decile']['all'][outcome_label] * 100:.0f}%"
97
+ ],
98
+ "textposition": "inside",
99
+ "textangle": 0,
100
+ "xaxis": "x",
101
+ "yaxis": "y",
102
+ "showlegend": False,
103
+ "hoverinfo": "none",
104
+ }
105
+ )
106
+
107
+ for outcome_label, outcome_colour in zip(outcome_labels, outcome_colours):
108
+ data.append(
109
+ {
110
+ "type": "bar",
111
+ "y": decile_numbers,
112
+ "x": impact["intra_decile"]["deciles"][outcome_label],
113
+ "name": outcome_label,
114
+ "marker": {
115
+ "color": outcome_colour,
116
+ },
117
+ "orientation": "h",
118
+ "text": [
119
+ f"{value * 100:.0f}%"
120
+ for value in impact["intra_decile"]["deciles"][
121
+ outcome_label
122
+ ]
123
+ ],
124
+ "textposition": "inside",
125
+ "textangle": 0,
126
+ "xaxis": "x2",
127
+ "yaxis": "y2",
128
+ "hoverinfo": "none",
129
+ }
130
+ )
131
+
132
+ layout = {
133
+ "barmode": "stack",
134
+ "grid": {
135
+ "rows": 2,
136
+ "columns": 1,
137
+ },
138
+ "yaxis": {
139
+ "title": "",
140
+ "tickvals": ["All"],
141
+ "domain": [0.91, 1],
142
+ },
143
+ "xaxis": {
144
+ "title": "",
145
+ "tickformat": ".0%",
146
+ "anchor": "y",
147
+ "matches": "x2",
148
+ "showgrid": False,
149
+ "showticklabels": False,
150
+ },
151
+ "xaxis2": {
152
+ "title": "Population share",
153
+ "tickformat": ".0%",
154
+ "anchor": "y2",
155
+ },
156
+ "yaxis2": {
157
+ "title": "Income decile",
158
+ "tickvals": decile_numbers,
159
+ "anchor": "x2",
160
+ "domain": [0, 0.85],
161
+ },
162
+ "uniformtext": {
163
+ "mode": "hide",
164
+ "minsize": 10,
165
+ },
166
+ }
167
+
168
+ return format_fig(go.Figure(data=data, layout=layout)).update_traces(
169
+ marker_line_width=0,
170
+ width=[0.9] * 10,
171
+ )
172
+
173
+
174
+ def decile_chart(
175
+ country_id: str,
176
+ reform_policy_id: int,
177
+ region: str,
178
+ time_period: str,
179
+ baseline_policy_id: int = None,
180
+ ) -> go.Figure:
181
+ impact = get_api_chart_data(
182
+ country_id=country_id,
183
+ reform_policy_id=reform_policy_id,
184
+ chart_key="decile",
185
+ baseline_policy_id=baseline_policy_id,
186
+ region=region,
187
+ time_period=time_period,
188
+ )
189
+ impact = {"decile": impact}
190
+
191
+ decile_numbers = list(range(1, 11))
192
+ # Sort deciles by key order 1 to 10
193
+ decile_values = []
194
+ for i in decile_numbers:
195
+ decile_values.append(impact["decile"]["relative"][str(i)])
196
+
197
+ data = [
198
+ {
199
+ "x": decile_numbers,
200
+ "y": decile_values,
201
+ "type": "bar",
202
+ "marker": {
203
+ "color": [
204
+ DARK_GRAY if value < 0 else BLUE_PRIMARY
205
+ for value in decile_values
206
+ ],
207
+ },
208
+ "text": [f"{value:+.1%}" for value in decile_values],
209
+ "textangle": 0,
210
+ }
211
+ ]
212
+
213
+ layout = {
214
+ "xaxis": {
215
+ "title": "Income decile",
216
+ "tickvals": decile_numbers,
217
+ },
218
+ "yaxis": {
219
+ "title": "Relative change",
220
+ "tickformat": "+,.0%",
221
+ },
222
+ "uniformtext": {
223
+ "mode": "hide",
224
+ "minsize": 8,
225
+ },
226
+ }
227
+
228
+ return format_fig(go.Figure(data=data, layout=layout))
@@ -2,18 +2,30 @@ import plotly.graph_objects as go
2
2
  from IPython.display import HTML
3
3
 
4
4
 
5
- WHITE = "#FFF"
6
- BLUE = "#2C6496"
7
- GRAY = "#BDBDBD"
8
- MEDIUM_DARK_GRAY = "#D2D2D2"
9
- DARK_GRAY = "#616161"
10
5
  GREEN = "#29d40f"
11
- LIGHT_GRAY = "#F2F2F2"
12
6
  LIGHT_GREEN = "#C5E1A5"
13
7
  DARK_GREEN = "#558B2F"
14
- BLACK = "#000"
8
+ BLUE_LIGHT = "#D8E6F3"
9
+ BLUE_PRIMARY = BLUE = "#2C6496"
10
+ BLUE_PRESSED = "#17354F"
11
+ BLUE_98 = "#F7FAFD"
12
+ TEAL_LIGHT = "#D7F4F2"
13
+ TEAL_ACCENT = "#39C6C0"
14
+ TEAL_PRESSED = "#227773"
15
+ DARKEST_BLUE = "#0C1A27"
16
+ DARK_GRAY = "#616161"
17
+ GRAY = "#808080"
18
+ LIGHT_GRAY = "#F2F2F2"
19
+ MEDIUM_DARK_GRAY = "#D2D2D2"
20
+ WHITE = "#FFFFFF"
21
+ TEAL_98 = "#F7FDFC"
22
+ BLACK = "#000000"
15
23
 
16
- BLUE_COLOR_SCALE = [BLUE, "#265782", "#20496E", "#1A3C5A"]
24
+ BLUE_COLOUR_SCALE = [
25
+ BLUE_LIGHT,
26
+ BLUE_PRIMARY,
27
+ BLUE_PRESSED,
28
+ ]
17
29
 
18
30
 
19
31
  def format_fig(fig: go.Figure) -> go.Figure:
@@ -5,6 +5,17 @@ from typing import Callable, Union
5
5
 
6
6
  from policyengine_core.parameters import ParameterNode, Parameter
7
7
  from policyengine_core.taxbenefitsystems import TaxBenefitSystem
8
+ from policyengine_core.periods import period as period_
9
+
10
+ import requests
11
+
12
+
13
+ class classproperty(object):
14
+ def __init__(self, f):
15
+ self.f = f
16
+
17
+ def __get__(self, obj, owner):
18
+ return self.f(owner)
8
19
 
9
20
 
10
21
  class Reform(TaxBenefitSystem):
@@ -37,6 +48,13 @@ class Reform(TaxBenefitSystem):
37
48
  """
38
49
 
39
50
  name: str = None
51
+ """The name of the reform. This is used to identify the reform in the UI."""
52
+
53
+ country_id: str = None
54
+ """The country id of the reform. This is used to inform any calls to the PolicyEngine API."""
55
+
56
+ parameter_values: dict = None
57
+ """The parameter values of the reform. This is used to inform any calls to the PolicyEngine API."""
40
58
 
41
59
  def __init__(self, baseline: TaxBenefitSystem):
42
60
  """
@@ -94,6 +112,69 @@ class Reform(TaxBenefitSystem):
94
112
  self.parameters = reform_parameters
95
113
  self._parameters_at_instant_cache = {}
96
114
 
115
+ @staticmethod
116
+ def from_dict(
117
+ parameter_values: dict,
118
+ country_id: str = None,
119
+ name: str = None,
120
+ ) -> Reform:
121
+ """Create a reform from a dictionary of parameters.
122
+
123
+ Args:
124
+ parameters: A dictionary of parameter -> { period -> value } pairs.
125
+
126
+ Returns:
127
+ A reform.
128
+ """
129
+
130
+ class reform(Reform):
131
+ def apply(self):
132
+ for path, period_values in parameter_values.items():
133
+ for period, value in period_values.items():
134
+ self.modify_parameters(
135
+ set_parameter(
136
+ path, value, period, return_modifier=True
137
+ )
138
+ )
139
+
140
+ reform.country_id = country_id
141
+ reform.parameter_values = parameter_values
142
+ reform.name = name
143
+
144
+ return reform
145
+
146
+ @classproperty
147
+ def api_id(self):
148
+ if self.country_id is None:
149
+ raise ValueError(
150
+ "`country_id` is not set. This is required to use the API."
151
+ )
152
+ if self.parameter_values is None:
153
+ raise ValueError(
154
+ "`parameter_values` is not set. This is required to use the API."
155
+ )
156
+
157
+ sanitised_parameter_values = {}
158
+
159
+ for path, period_values in self.parameter_values.items():
160
+ sanitised_period_values = {}
161
+ for period, value in period_values.items():
162
+ period = period_(period)
163
+ sanitised_period_values[
164
+ f"{period.start}.{period.stop}"
165
+ ] = value
166
+ sanitised_parameter_values[path] = sanitised_period_values
167
+
168
+ response = requests.post(
169
+ f"https://api.policyengine.org/{self.country_id}/policy",
170
+ json={
171
+ "data": sanitised_parameter_values,
172
+ "name": self.name,
173
+ },
174
+ )
175
+
176
+ return response.json().get("result", {}).get("policy_id")
177
+
97
178
 
98
179
  def set_parameter(
99
180
  path: Union[Parameter, str],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: policyengine-core
3
- Version: 2.8.2
3
+ Version: 2.9.0
4
4
  Summary: Core microsimulation engine enabling country-specific policy models.
5
5
  Home-page: https://github.com/policyengine/policyengine-core
6
6
  Author: PolicyEngine
@@ -11,6 +11,7 @@ policyengine_core.egg-info/entry_points.txt
11
11
  policyengine_core.egg-info/requires.txt
12
12
  policyengine_core.egg-info/top_level.txt
13
13
  policyengine_core/charts/__init__.py
14
+ policyengine_core/charts/api.py
14
15
  policyengine_core/charts/bar.py
15
16
  policyengine_core/charts/formatting.py
16
17
  policyengine_core/commons/__init__.py
@@ -48,7 +48,7 @@ dev_requirements = [
48
48
 
49
49
  setup(
50
50
  name="policyengine-core",
51
- version="2.8.2",
51
+ version="2.9.0",
52
52
  author="PolicyEngine",
53
53
  author_email="hello@policyengine.org",
54
54
  classifiers=[