Skip to main content

collectInputForBln3Score

@nmi-agro/fdm-source


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

Function: collectInputForBln3Score()

collectInputForBln3Score(fdm, principal_id, b_id, timeframe?): Promise<Bln3ScoreCollectedInputs>

Defined in: fdm-calculator/src/bln3/input.ts:37

Collects all field data needed for a BLN3 score calculation from the FDM database.

Fetches field geometry (lat/lon), the most recent soil analysis, cultivations, and adopted BLN measures for the field, then maps them to the shape expected by the NMI BLN3 API. The caller is responsible for adding nmiApiKey before calling getBln3Score.

Parameters

fdm

FdmType

The FDM instance for database interaction.

principal_id

PrincipalId

The principal making the request.

b_id

fieldsTypeSelect

The field ID for which to collect inputs.

timeframe?

any

Optional timeframe applied to soil analyses and measures only. Cultivations are always fetched without a timeframe to cover the full multi-year history needed for the BLN3 calculation.

Returns

Promise<Bln3ScoreCollectedInputs>

A promise resolving to the collected BLN3 score inputs (without nmiApiKey).

Throws

If data collection fails.