Problem
Issue #2 and PR #3 make Fertimap's generic-formula products, quantities, and quoted cost available as structured data. That quoted cost is not enough for a price-aware recommendation: the upstream response does not include a price date, supplier, location-specific availability, transport cost, or pricing methodology.
Turba should be able to compare valid fertilizer product combinations against dated local prices and explain the economic trade-offs to a farmer.
Proposed v1
Add a deterministic constrained optimizer that receives:
- required N, P2O5, and K2O in kg/ha
- field area and optional budget
- fertilizer product grades and bag sizes
- dated prices with currency, unit, supplier, and location
- product availability and minimum-order constraints
- optional transport and application costs
The optimizer should minimize total delivered and applied cost while meeting nutrient requirements. It should support bag-size rounding, place explicit limits on nutrient surplus, and never hide an unmet nutrient constraint.
Data prerequisites
Define versioned records for:
- fertilizer products and N/P2O5/K2O composition
- package or bag size
- supplier and geographic coverage
- observed price, currency, price unit, and observation date
- availability window and source provenance
- transport and application-cost assumptions
Training or forecasting should remain out of scope until Turba has a sufficiently long and representative price history. The first implementation should be reproducible optimization over supplied observations.
Outputs
Return ranked feasible plans containing:
- product quantities in kg/ha and bags/ha
- total quantities for the field
- nutrients supplied, surplus, and any explicit shortfall
- fertilizer, transport, application, per-hectare, and total cost
- price observation date, supplier, location, and source
- alternatives for unavailable products or a constrained budget
Acceptance criteria
- documented product and price input schema with provenance
- deterministic cost-minimizing optimizer with unit tests
- valid handling of infeasible, missing-price, unavailable-product, and budget-constrained scenarios
- ranked alternatives with transparent nutrient and cost calculations
- no claim that the result is a live price recommendation when observations are stale or incomplete
Related to #2 and #3.
Problem
Issue #2 and PR #3 make Fertimap's generic-formula products, quantities, and quoted cost available as structured data. That quoted cost is not enough for a price-aware recommendation: the upstream response does not include a price date, supplier, location-specific availability, transport cost, or pricing methodology.
Turba should be able to compare valid fertilizer product combinations against dated local prices and explain the economic trade-offs to a farmer.
Proposed v1
Add a deterministic constrained optimizer that receives:
The optimizer should minimize total delivered and applied cost while meeting nutrient requirements. It should support bag-size rounding, place explicit limits on nutrient surplus, and never hide an unmet nutrient constraint.
Data prerequisites
Define versioned records for:
Training or forecasting should remain out of scope until Turba has a sufficiently long and representative price history. The first implementation should be reproducible optimization over supplied observations.
Outputs
Return ranked feasible plans containing:
Acceptance criteria
Related to #2 and #3.