Skip to content

Add deterministic gross-margin scenario calculation #8

Description

@unes07

Problem

Fertilizer cost alone does not show whether a crop scenario is economically attractive. A transparent deterministic calculation is required before any prediction is introduced.

Status: Blocked

Blocked by:

Implementation must not start until product, observed-price, crop-price, and optimizer contracts are published.

Inputs

  • Field area, expected yield, crop price, and selected fertilizer plan
  • Seed, irrigation, labor, fuel, machinery, transport, and other supplied variable costs
  • Source, date, freshness, currency, and unit metadata for every price

Outputs

  • Revenue and variable cost per hectare and for the full field
  • Fertilizer-cost contribution
  • Gross margin per hectare and total
  • Break-even crop price and yield
  • Low, base, and high price/yield scenarios
  • Complete source and freshness metadata

Acceptance criteria

  • Use transparent arithmetic with no trained model.
  • Support observed or user-supplied prices without requiring forecasts.
  • Validate area, yield, currency, mass, and price units before calculation.
  • Handle negative margins, missing costs, stale prices, mixed units, and zero-area inputs explicitly.
  • Preserve scenario inputs and intermediate calculations for auditability.
  • Call the result gross margin, not net profit, unless fixed, financing, tax, and capital costs are supplied.
  • Preserve results and metadata through Python, JSON, CSV, and batch workflows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions