Skip to main content

requestDyna

@nmi-agro/fdm-source


@nmi-agro/fdm-source / fdm-calculator/src / requestDyna

Function: requestDyna()

requestDyna(input): Promise<DynaResult>

Defined in: fdm-calculator/src/mineralization/dyna.ts:66

Calls POST /bemestingsplan/dyna with the pre-built request body and returns the parsed DYNA simulation result as a DynaResult.

This is the uncached version. In most cases you should use getDyna which adds DB-backed caching via withCalculationCache.

The response body uses snake_case field names which are transformed to camelCase by dynaResponseDataSchema during validation.

Error handling:

HTTP statusThrown error
400NmiApiError(400, "Er is een fout opgetreden bij de DYNA-berekening. ...") — e.g. duplicate year or missing b_lu
422NmiApiError(422, "Onvoldoende gegevens voor DYNA-berekening.")
503NmiApiError(503, "NMI API is tijdelijk niet beschikbaar.")
other 4xx/5xxNmiApiError(status, "Er is een fout opgetreden...")
invalid JSONError("Ongeldig DYNA-antwoord van NMI API: ...")

Parameters

input

DynaComputeInput

Pre-assembled input bundle: field id, API key, and the fully-formed DYNA request body (built by buildDynaRequest).

Returns

Promise<DynaResult>

A DynaResult with daily simulation data, nitrogen balance, and optional recommendations.

Throws

NmiApiError on API or HTTP errors.

Throws

Error if the response body fails Zod validation.