From a8a2c1c7f867d990f7eb589f5436f68f45b25923 Mon Sep 17 00:00:00 2001 From: Nikhil Woodruff <35577657+nikhilwoodruff@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:13:03 +0100 Subject: [PATCH] Remove survey enhance as a dependency (#949) * Add back MANIFES.in * Format * Remove Survey-Enhanced dependency * Fix Restrict Winter Fuel Payment to recipients of means-tested benefits #936 * Add comparison step * Bump data * Bump UK data * Bump data yet again * Add microdf as dep --- .github/compare_psnd.py | 18 ++++++++++++++++++ .github/workflows/pr.yml | 4 ++++ CHANGELOG.md | 3 +++ Makefile | 1 + changelog.yaml | 5 +++++ .../eligibility/require_benefits.yaml | 2 +- policyengine_uk/utils/psnd.py | 4 +++- setup.py | 6 +++--- 8 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 .github/compare_psnd.py diff --git a/.github/compare_psnd.py b/.github/compare_psnd.py new file mode 100644 index 000000000..1d619f7d5 --- /dev/null +++ b/.github/compare_psnd.py @@ -0,0 +1,18 @@ +import pandas as pd + +psnd_old = pd.read_csv("psnd_old.csv") +psnd_new = pd.read_csv("psnd_new.csv") + +df = pd.DataFrame( + { + "year": psnd_old["year"], + "OBR": psnd_old["OBR"], + "PE_current": psnd_old["PE"], + "PE_new": psnd_new["PE"], + } +) +df["change"] = df["PE_new"] - df["PE_current"] +df["percent_change"] = (df["change"] / df["PE_current"] * 100).round(1) + +print("Projection for public sector net debt (PSND):") +print(df.to_markdown(index=False)) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 5dd64f004..63bd2d4ea 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -34,3 +34,7 @@ jobs: run: make documentation env: POLICYENGINE_GITHUB_MICRODATA_AUTH_TOKEN: ${{ secrets.POLICYENGINE_GITHUB_MICRODATA_AUTH_TOKEN}} + - name: Compare baseline change + run: make compare_psnd + env: + POLICYENGINE_GITHUB_MICRODATA_AUTH_TOKEN: ${{ secrets.POLICYENGINE_GITHUB_MICRODATA_AUTH_TOKEN}} diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c7575f92..e69e9b03f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.1.1] - 2024-09-18 11:12:23 + ## [2.1.0] - 2024-09-18 11:04:12 ### Fixed @@ -1486,6 +1488,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 +[2.1.1]: https://github.com/PolicyEngine/openfisca-uk/compare/2.1.0...2.1.1 [2.1.0]: https://github.com/PolicyEngine/openfisca-uk/compare/2.0.0...2.1.0 [2.0.0]: https://github.com/PolicyEngine/openfisca-uk/compare/1.8.0...2.0.0 [1.8.0]: https://github.com/PolicyEngine/openfisca-uk/compare/1.7.4...1.8.0 diff --git a/Makefile b/Makefile index b4a61f501..d34abb228 100644 --- a/Makefile +++ b/Makefile @@ -33,3 +33,4 @@ compare_psnd: pip install -e . cd policyengine_uk/utils && python psnd.py mv policyengine_uk/utils/psnd.csv psnd_new.csv + python .github/compare_psnd.py \ No newline at end of file diff --git a/changelog.yaml b/changelog.yaml index 857f600ce..d3c46224b 100644 --- a/changelog.yaml +++ b/changelog.yaml @@ -1244,3 +1244,8 @@ fixed: - Add back recursive-include. date: 2024-09-18 11:04:12 +- bump: patch + changes: + removed: + - Survey-Enhance as a dependency. + date: 2024-09-18 11:12:23 diff --git a/policyengine_uk/parameters/gov/dwp/winter_fuel_payment/eligibility/require_benefits.yaml b/policyengine_uk/parameters/gov/dwp/winter_fuel_payment/eligibility/require_benefits.yaml index 363f87554..a218fad01 100644 --- a/policyengine_uk/parameters/gov/dwp/winter_fuel_payment/eligibility/require_benefits.yaml +++ b/policyengine_uk/parameters/gov/dwp/winter_fuel_payment/eligibility/require_benefits.yaml @@ -1,6 +1,6 @@ description: Whether receipt of means-tested benefits is required to qualify for the Winter Fuel Payment. values: - 2000-01-01: false + 2000-01-01: true metadata: unit: bool label: Winter Fuel Payment means-tested benefits requirement diff --git a/policyengine_uk/utils/psnd.py b/policyengine_uk/utils/psnd.py index 979f51bf3..55c4dce83 100644 --- a/policyengine_uk/utils/psnd.py +++ b/policyengine_uk/utils/psnd.py @@ -21,6 +21,7 @@ def project_psnd(): "housing_benefit", "pip", "dla", + "winter_fuel_allowance", ] tax_ben_revenues = ( tax_ben[tax_ben.name.isin(REVENUES)].set_index("name").loc[REVENUES] @@ -42,6 +43,7 @@ def project_psnd(): "housing_benefit", "pip", "dla", + "winter_fuel_allowance", ] baseline = Microsimulation() @@ -74,7 +76,7 @@ def project_psnd(): } ) - df["PE"] = df["PE"].round().astype(int) + df["PE"] = df["PE"].round(1) df.to_csv("psnd.csv", index=False) diff --git a/setup.py b/setup.py index 64d9bdc3f..fe91be890 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setup( name="PolicyEngine-UK", - version="2.1.0", + version="2.1.1", author="PolicyEngine", author_email="nikhil@policyengine.org", classifiers=[ @@ -27,7 +27,8 @@ ], install_requires=[ "PolicyEngine-Core>=3.6.4", - "PolicyEngine-UK-Data>=1.2.1,<1.3", + "PolicyEngine-UK-Data>=1.2.5,<1.3", + "microdf_python", ], extras_require={ "dev": [ @@ -41,7 +42,6 @@ "setuptools", "sphinx-argparse>=0.3.2,<1", "sphinx-math-dollar>=1.2.1,<2", - "survey-enhance", "wheel", "yaml-changelog>=0.1.7", ]