Skip to content

bug: legacy soil‑depth definition does not handle custom intervals #251

@jjmaynard

Description

@jjmaynard

Description

The SoilID API’s legacy depth‐handling logic only requires a bottom_depth (e.g. 1 for the 0–1 cm interval, 10 for the 1–10 cm interval, …) and infers the top_depth automatically. The new LandPKS app offers three soil depth interval options—legacy (BLM), NRCS/FAO standard, or custom intervals—but the API still expects only bottom depth ('horizonDepth'). As a result, custom intervals can’t be processed correctly because their top_depth cannot be correctly derived.


Steps to Reproduce

  1. In the LandPKS app, select Custom depth intervals.
  2. Define a set of custom intervals, for example:
    [
      { "bottom_depth": 5 },
      { "bottom_depth": 20 }
    ]
  3. Submit these intervals in a call to the SoilID API endpoint (e.g. POST /rank_soils).
  4. Observe that the API either:
    • Returns a malformed result (missing or incorrect interval boundaries), or
    • Silently ignores the custom depths and falls back to legacy defaults.

Expected behavior

  • The API should require both top_depth and bottom_depth for all depth intervals.
  • If either boundary is missing for an interval, the API should return a clear validation error, e.g.:
    HTTP/1.1 400 Bad Request
    {
      "error": "`top_depth` and `bottom_depth` are required for custom intervals"
    }

Actual behavior

  • Custom intervals sent with only bottom_depth are processed using legacy defaults, leading to incorrect or missing soil‐ranking results.
  • No validation error is returned to inform the client that top_depth is missing.

Additional Notes

*It is unclear to me whether this issue has already been addressed in the production code currently used to support the new app.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions