compareFields
@nmi-agro/fdm-source / fdm-rvo/src / compareFields
Function: compareFields()
compareFields(
localFields,rvoFields,calendar?,cultivationsCatalogue?):RvoImportReviewItem<Field>[]
Defined in: fdm-rvo/src/compare.ts:45
Compares a list of local fields against a list of RVO fields to determine their import status.
The matching strategy operates in two tiers:
- Tier 1: ID Match: Checks if
localField.b_id_sourcematchesrvoField.CropFieldID. This is the most reliable method for fields that have been synced before. - Tier 2: Spatial Match: For fields unmatched by ID, it calculates the spatial overlap (IoU).
If the overlap exceeds
IOU_THRESHOLD(0.99), they are considered the same field.
Parameters
localFields
any[]
Array of fields currently in the local database.
rvoFields
infer<any>[]
Array of fields retrieved from the RVO webservice.
calendar?
number = ...
cultivationsCatalogue?
CultivationCatalogue[] = []
Returns
RvoImportReviewItem<Field>[]
An array of RvoImportReviewItem objects, each representing a field and its status (MATCH, CONFLICT, NEW_REMOTE, NEW_LOCAL).