Skip to content

Commit 4147797

Browse files
authored
Merge pull request #343 from policy-design-lab/342-release-0250
Release 0.25.0
2 parents 63cee7e + 00b9d74 commit 4147797

File tree

6 files changed

+78
-4
lines changed

6 files changed

+78
-4
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.25.0] - 2025-08-20
8+
9+
### Changed
10+
- Change all programs key from YY-YY format (start and end years) to YYYY-YYYY format. [#272](https://github.com/policy-design-lab/pdl-api/issues/272)
11+
12+
### Added
13+
- Add endpoint for ARC PLC reconciliation policy. [#332](https://github.com/policy-design-lab/pdl-api/issues/332)
14+
715
## [0.24.0] - 2025-07-31
816

917
### Changed
@@ -247,6 +255,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
247255
### Fixed
248256
- Open API specification file. [#50](https://github.com/policy-design-lab/pdl-api/issues/50)
249257

258+
[0.25.0]: https://github.com/policy-design-lab/pdl-api/compare/0.24.0...0.25.0
250259
[0.24.0]: https://github.com/policy-design-lab/pdl-api/compare/0.23.0...0.24.0
251260
[0.23.0]: https://github.com/policy-design-lab/pdl-api/compare/0.22.0...0.23.0
252261
[0.22.0]: https://github.com/policy-design-lab/pdl-api/compare/0.21.0...0.22.0
5.41 MB
Binary file not shown.
4.97 MB
Binary file not shown.

app/controllers/pdl.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
COMMOD_STATE_DISTRIBUTION_DATA_JSON = "commodities_state_distribution_data.json"
3333
COMMOD_SUBPROGRAMS_DATA_JSON = "commodities_subprograms_data.json"
3434
ARC_PLC_DATA_JSON = "arc_plc_payments_current.json.gz"
35+
ARC_PLC_CURRENT_OBBBA_DATA_JSON = "arc_plc_payments_current_obbba.json.gz" # These variable namings will need to be updated the naming once we finalize the scenario names.
36+
ARC_PLC_PROPOSED_OBBBA_DATA_JSON = "arc_plc_payments_proposed_obbba.json.gz"
3537
I_PROPOSALS_SUBTITLE_A_DATA_PATH = os.path.join(TITLE_I_DATA_PATH, "proposals", "subtitle-a")
3638
ARC_PLC_PROPOSAL_DATA_JSON = "arc_plc_payments_proposed.json.gz"
3739
I_SUBTITLE_D_DATA_PATH = os.path.join(TITLE_I_DATA_PATH, "subtitle-d")
@@ -460,6 +462,29 @@ def titles_title_i_subtitles_subtitle_a_arc_plc_payments_current_search():
460462
response.headers['Content-Encoding'] = 'gzip'
461463
return response
462464

465+
# /pdl/titles/title-i/subtitles/subtitle-a/arc-plc-payments/baseline
466+
def titles_title_i_subtitles_subtitle_a_arc_plc_payments_baseline_search():
467+
# set the file path
468+
arc_plc_current_obbba_data = os.path.join(I_SUBTITLE_A_DATA_PATH, ARC_PLC_CURRENT_OBBBA_DATA_JSON)
469+
470+
with open(arc_plc_current_obbba_data, 'rb') as current_obbba_data:
471+
file_data = current_obbba_data.read()
472+
473+
response = Response(file_data, mimetype='application/json')
474+
response.headers['Content-Encoding'] = 'gzip'
475+
return response
476+
477+
# /pdl/titles/title-i/subtitles/subtitle-a/arc-plc-payments/obbba
478+
def titles_title_i_subtitles_subtitle_a_arc_plc_payments_obbba_search():
479+
# set the file path
480+
arc_plc_proposed_obbba_data = os.path.join(I_PROPOSALS_SUBTITLE_A_DATA_PATH, ARC_PLC_PROPOSED_OBBBA_DATA_JSON)
481+
482+
with open(arc_plc_proposed_obbba_data, 'rb') as proposed_obbba_data:
483+
file_data = proposed_obbba_data.read()
484+
485+
response = Response(file_data, mimetype='application/json')
486+
response.headers['Content-Encoding'] = 'gzip'
487+
return response
463488

464489
# /pdl/titles/title-i/subtitles/subtitle-a/arc-plc-payments/proposed
465490
def titles_title_i_subtitles_subtitle_a_arc_plc_payments_proposed_search():
@@ -1243,7 +1268,7 @@ def generate_allprograms_response(start_year, end_year):
12431268
SUM(CASE WHEN t.name = 'Title II: Conservation' AND p.year BETWEEN {start_year} AND {end_year} AND (sub_program_id IN (SELECT id FROM pdl.sub_programs WHERE pdl.sub_programs.name = 'Total CRP') OR sub_program_id IS NULL) THEN p.payment ELSE 0 END) AS "Title II Total",
12441269
SUM(CASE WHEN t.name = 'Title IV: Nutrition' AND p.year BETWEEN {start_year} AND {end_year} THEN p.payment ELSE 0 END) AS "SNAP Total",
12451270
SUM(CASE WHEN t.name = 'Title IX: Crop Insurance' AND p.year BETWEEN {start_year} AND {end_year} THEN p.net_farmer_benefit_amount ELSE 0 END) AS "Crop Insurance Total",
1246-
SUM(CASE WHEN (sub_program_id IN (SELECT id FROM pdl.sub_programs WHERE pdl.sub_programs.name IN ('Total CRP', 'Agriculture Risk Coverage County Option (ARC-CO)', 'Agriculture Risk Coverage Individual Coverage (ARC-IC)')) OR sub_program_id IS NULL) THEN COALESCE(p.payment, 0) + COALESCE(p.net_farmer_benefit_amount, 0) ELSE 0 END) AS "{str(start_year)[-2:]}-{str(end_year)[-2:]} All Programs Total"
1271+
SUM(CASE WHEN (sub_program_id IN (SELECT id FROM pdl.sub_programs WHERE pdl.sub_programs.name IN ('Total CRP', 'Agriculture Risk Coverage County Option (ARC-CO)', 'Agriculture Risk Coverage Individual Coverage (ARC-IC)')) OR sub_program_id IS NULL) THEN COALESCE(p.payment, 0) + COALESCE(p.net_farmer_benefit_amount, 0) ELSE 0 END) AS "{str(start_year)}-{str(end_year)} All Programs Total"
12471272
"""
12481273

12491274
# Combine the query of non-dynamic part
@@ -1268,7 +1293,7 @@ def generate_allprograms_response(start_year, end_year):
12681293

12691294
state_data = []
12701295
total_row = {"State": "Total"}
1271-
start_to_end_years_total_key = str(start_year)[-2:] + "-" + str(end_year)[-2:] + " All Programs Total"
1296+
start_to_end_years_total_key = str(start_year) + "-" + str(end_year) + " All Programs Total"
12721297

12731298
# Initialize total_row with zero values for all keys in the desired order
12741299
for year in range(start_year, end_year + 1):

app/pdl.yaml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ openapi: 3.0.0
22
info:
33
title: Policy Design Lab API
44
description: Policy Design Lab API Documentation
5-
version: 0.23.0
5+
version: 0.25.0
66
servers:
77
- url: https://localhost
88
description: Production server
@@ -389,6 +389,46 @@ paths:
389389
description: Unauthorized
390390
500:
391391
description: Internal error
392+
/pdl/titles/title-i/subtitles/subtitle-a/arc-plc-payments/obbba:
393+
get:
394+
tags:
395+
- "Title I: Commodities - Subtitle A"
396+
summary: Gets the Title I Subtitle A commodities payment distribution for ARC and PLC based on OBBBA.
397+
description: |
398+
Returns the Title I Subtitle A commodities payment distribution data for ARC and PLC based on OBBBA in JSON format.
399+
responses:
400+
200:
401+
description: Ok
402+
content:
403+
application/json:
404+
schema:
405+
type: string
406+
400:
407+
description: Bad request
408+
401:
409+
description: Unauthorized
410+
500:
411+
description: Internal error
412+
/pdl/titles/title-i/subtitles/subtitle-a/arc-plc-payments/baseline:
413+
get:
414+
tags:
415+
- "Title I: Commodities - Subtitle A"
416+
summary: Gets the baseline Title I Subtitle A commodities payment distribution for ARC and PLC based on OBBBA.
417+
description: |
418+
Returns the baseline Title I Subtitle A commodities payment distribution data for ARC and PLC based on OBBBA in JSON format.
419+
responses:
420+
200:
421+
description: Ok
422+
content:
423+
application/json:
424+
schema:
425+
type: string
426+
400:
427+
description: Bad request
428+
401:
429+
description: Unauthorized
430+
500:
431+
description: Internal error
392432
/pdl/titles/title-i/subtitles/subtitle-a/arc-plc-payments/proposed:
393433
get:
394434
tags:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "pdl-api"
3-
version = "0.24.0"
3+
version = "0.25.0"
44
description = ""
55
authors = ["Yong Wook Kim <[email protected]>"]
66
readme = "README.md"

0 commit comments

Comments
 (0)