Add fertilizer to input-cost tools (regional $/ton, USDA AgTransport)
CI / test (push) Successful in 17s
CI / build-push (push) Successful in 30s

input_cost_trend/input_cost_series now accept six fertilizers (urea, uan,
anhydrous, dap, map, potash) alongside diesel, with an optional `geo` region
(default Cornbelt). Real $/ton + MoM/YoY change + seasonal context.

- client: pass geo through; add input_cost_geographies
- server: expand VALID_INPUTS; geo param + docstrings
- format already unit-aware ($/ton) and geo-aware
- README tools table now lists the reference/trend + input-cost tools
- CHANGELOG: regional fertilizer input-cost release notes
- tests: fertilizer $/ton + region formatting

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-30 15:59:33 -04:00
parent a0e36996c4
commit 03c6c540ef
5 changed files with 104 additions and 19 deletions
+15
View File
@@ -131,6 +131,21 @@ def test_fmt_input_cost_payload_shape():
assert "+58.2%" in out # YoY surfaced
def test_fmt_input_cost_fertilizer_ton_and_region():
# Fertilizer payload carries item + geo (region) + $/ton.
payload = {"item": "urea", "geo": "Cornbelt", "label": "urea", "unit": "$/ton",
"source": "USDA AgTransport",
"trend": {"period": "2026-03-01", "value_cents": 69812, "prev_cents": 51812,
"change_cents": 18000, "change_pct": 34.7, "yoy_cents": 45500,
"yoy_change_cents": 24312, "yoy_pct": 53.4, "seasonal": None,
"recent_direction": "up", "baseline_years": 10, "points": 39}}
out = fmt.fmt_price_trend(payload)
assert "urea — Cornbelt — urea" in out # item, region, label all present
assert "$698.12/ton" in out
assert "USDA AgTransport" in out
assert "Mar 2026" in out # monthly period rendered as month
def test_fmt_inputs_lime_table():
payload = {
"product": "lime", "count": 2,