Skip to main content

collectInputForNitrogenBalance

@svenvw/fdm-source


@svenvw/fdm-source / fdm-calculator/src / collectInputForNitrogenBalance

Function: collectInputForNitrogenBalance()

collectInputForNitrogenBalance(fdm, principal_id, b_id_farm, timeframe, fdmPublicDataUrl): Promise<NitrogenBalanceInput>

Defined in: fdm-calculator/src/balance/nitrogen/input.ts:36

Alpha

Collects necessary input data from a FDM instance for calculating the nitrogen balance.

This function orchestrates the retrieval of data related to fields, cultivations, harvests, soil analyses, fertilizer applications, fertilizer details, and cultivation details within a specified farm and timeframe. It fetches data from the FDM database and structures it into a NitrogenBalanceInput object.

Parameters

fdm

FdmType

The FDM instance for database interaction.

principal_id

PrincipalId

The ID of the principal (user or service) initiating the data collection.

b_id_farm

farmsTypeSelect

The ID of the farm for which to collect the nitrogen balance input.

timeframe

Timeframe

The timeframe for which to collect the data.

fdmPublicDataUrl

string

The base URL for accessing FDM public data.

Returns

Promise<NitrogenBalanceInput>

A promise that resolves with a NitrogenBalanceInput object containing all the necessary data.

Throws

  • Throws an error if data collection or processing fails.