From a04be57bac6a50ab40860f21cb9974b76422322b Mon Sep 17 00:00:00 2001 From: Nikhil Woodruff <35577657+nikhilwoodruff@users.noreply.github.com> Date: Fri, 22 Sep 2023 11:02:07 +0100 Subject: [PATCH 1/3] Add support for enhanced CPS --- changelog_entry.yaml | 4 ++++ policyengine_api/endpoints/economy/single_economy.py | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29b..aef6906e 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: minor + changes: + added: + - Support for the enhanced CPS in the US. diff --git a/policyengine_api/endpoints/economy/single_economy.py b/policyengine_api/endpoints/economy/single_economy.py index 4084add5..0e20ff87 100644 --- a/policyengine_api/endpoints/economy/single_economy.py +++ b/policyengine_api/endpoints/economy/single_economy.py @@ -199,6 +199,12 @@ def compute_economy( time_period, original_household_weight * in_nyc, ) + elif region == "enhanced_us": + simulation: Microsimulation = country.country_package.Microsimulation( + reform=reform, + dataset="enhanced_cps_2023", + ) + simulation.default_calculation_period = time_period else: region_values = simulation.calculate("state_code_str").values simulation.set_input( From 8b85465a1b900909c9d95303d6fe7f7c1cd418e3 Mon Sep 17 00:00:00 2001 From: Nikhil Woodruff <35577657+nikhilwoodruff@users.noreply.github.com> Date: Fri, 22 Sep 2023 11:03:59 +0100 Subject: [PATCH 2/3] Add enhanced CPS option --- policyengine_api/country.py | 1 + 1 file changed, 1 insertion(+) diff --git a/policyengine_api/country.py b/policyengine_api/country.py index 8a0717f9..18d0763f 100644 --- a/policyengine_api/country.py +++ b/policyengine_api/country.py @@ -79,6 +79,7 @@ def build_microsimulation_options(self) -> dict: elif self.country_id == "us": region = [ dict(name="us", label="the US"), + dict(name="enhanced_us", label="the US (enhanced CPS)"), dict(name="al", label="Alabama"), dict(name="ak", label="Alaska"), dict(name="az", label="Arizona"), From 6d58a5dced3d374a029ce27184654e5571dccf53 Mon Sep 17 00:00:00 2001 From: Nikhil Woodruff <35577657+nikhilwoodruff@users.noreply.github.com> Date: Fri, 22 Sep 2023 13:52:05 +0100 Subject: [PATCH 3/3] Update PolicyEngine US to 0.472.0 --- policyengine_api/endpoints/economy/single_economy.py | 8 +++++--- setup.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/policyengine_api/endpoints/economy/single_economy.py b/policyengine_api/endpoints/economy/single_economy.py index 0e20ff87..695477b6 100644 --- a/policyengine_api/endpoints/economy/single_economy.py +++ b/policyengine_api/endpoints/economy/single_economy.py @@ -200,9 +200,11 @@ def compute_economy( original_household_weight * in_nyc, ) elif region == "enhanced_us": - simulation: Microsimulation = country.country_package.Microsimulation( - reform=reform, - dataset="enhanced_cps_2023", + simulation: Microsimulation = ( + country.country_package.Microsimulation( + reform=reform, + dataset="enhanced_cps_2023", + ) ) simulation.default_calculation_period = time_period else: diff --git a/setup.py b/setup.py index 0ee38681..c4c84c71 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ "policyengine-ng==0.5.1", "policyengine-il==0.1.0", "policyengine_uk==0.55.2", - "policyengine_us==0.471.1", + "policyengine_us==0.472.0", "pymysql", "redis", "rq",