Agro-Tech Execution
From scheduled field task through IoT-driven monitoring, harvest scheduling, yield capture, and resource metering — the operational execution pipeline of a growing season.
What this group does
The Agro-Tech Execution group is the field-to-harvest operational pipeline for Agriculture & Agro-Tech Operations. It carries a production cycle from a scheduled field task through IoT-driven monitoring, season and harvest scheduling, yield capture, and resource metering — each screen writing real data forward to the next.
All five screens share one service file, src/services/agroTechExecutionService.ts, so most cross-screen hooks below are real read-modify-write calls against sibling records in the same file rather than simulated hand-offs. A few reach out to harvestSupplyInventoryService.ts and qualityCropHealthService.ts for staging, consumption, WIP, and pre-harvest audit data.
1. Field/Greenhouse Orders
Purpose: Schedule and execute the four core field tasks — plowing, fertigation, pesticide spraying, and pruning — against a specific field or greenhouse, and log what actually happened once the crew is done.
Key features
- Task types —
plowing,fertigation,pesticide_spraying,pruning, each order (FOD-2026-XXXX) targeting aProductionAreaItemfield/greenhouse code. - Order lifecycle —
draft → scheduled → in_progress → completed → qa_on_hold, tracked viaFieldOrderStatusbadges. - Execution log — actual start/end times, fuel/energy consumed, operator observations, materials used (planned vs. actual rate per material), hours worked, and a crop-health-anomaly flag the field crew can raise directly from the execution form.
- Assignment — links the order to an assigned workforce member (
Employee.uid) and, optionally, an assigned equipment asset.
Integration triggers
| Action | What it does |
|---|---|
syncOrderMaterialsToConsumption | On save when status transitions to completed with materials logged: deducts the matching SKU's on-hand quantity in Agro-Input Staging (deductStagingStock) and writes a consumption record into Agro-Material Consumption for each material used — see Harvest & Supply Inventory. |
updateAssetOperatingHours | Intended to roll logged hours worked into the assigned asset's cumulative operating hours to trigger Preventive Maintenance scheduling. Currently a no-op stub — no maintenance screen exists yet in this add-on to receive the update (see Agro-Equipment Maintenance). |
flagCropHealthAnomaly | Intended to open an alert directly in Pest & Disease Alerts when the crew reports a crop-health anomaly during execution. Currently a no-op stub — kept with the exact call signature the screen already uses, pending wiring to qualityCropHealthService.ts's alert store. |
2. Season & Harvest Scheduling
Purpose: Plan a crop's full season — planting through harvest window — against a target harvest and a target field/greenhouse, track milestones, and reserve downstream storage capacity.
Key features
- Schedule codes —
HSC-2026-XXXX, each linked to aTargetHarvestItemand aProductionAreaItem. - Status lifecycle —
planned → maturing → ready_for_harvest → active_harvesting → completed. - Milestones — a checklist of dated milestones (label, target date, completed flag) tracked per schedule.
- Harvest Readiness Score — computed by
computeHarvestReadinessScore()from accumulated Growing Degree Days (GDD) against a maturity target, blended 70/30 with soil moisture health. - Silo reservation — a target silo and expected volume can be set on the schedule; reserving capacity calls into the Silo & Storage Management registry.
- Pre-harvest clearance gate —
preHarvestClearanceApprovedandharvestLockoutActiveflags block harvest authorization until a Crop Health Checklist pre-harvest audit passes and any active PHI (Pre-Harvest Interval) window from Agro-Chemical Analytics has cleared.
Integration triggers
| Action | What it does |
|---|---|
syncScheduleToWIP | When a schedule is locked in, instantiates an active crop-cycle batch (GrowingCropWIPRecord, status germination) in Growing Crop Tracking WIP — see Harvest & Supply Inventory. |
reserveStorageCapacity | Adds the schedule's expected harvest volume to the target silo's reservedTons in the Silo & Storage Management registry (owned by harvestSupplyInventoryService.ts, re-exported here — see the implementation note in Harvest & Supply Inventory). |
schedulePreHarvestQualityAudit | Dispatches a mandatory pre_harvest_audit inspection request into Crop Health Checklist, status requires_attention, linked back to this schedule — see Quality & Crop Health Operations. |
3. IoT Climate & Soil Monitor
Purpose: Monitor live telemetry from field/greenhouse sensor nodes — temperature, humidity, soil moisture, EC, pH, VPD — and automatically respond when readings cross configured thresholds.
Key features
- Node codes —
IOT-2026-XXXX, each targeting aProductionAreaItemand optionally anAgronomicSopItem. - Sensor status —
optimal,warning_dry_soil,critical_high_temp,sensor_offline. - Telemetry fields — ambient temp (°C), relative humidity (%), soil moisture (%), soil EC, soil pH, VPD (kPa), battery (%), signal strength (%), last ping timestamp.
- Microclimate Health Score — computed by
computeMicroclimateHealthScore(), comparing ambient temp/humidity/pH against the crop recipe's target growth-stage parameters. - Configurable thresholds — per-node min/max bounds for temp, humidity, and soil moisture (
IoTThresholdConfig) drive the automated triggers below.
Integration triggers
| Action | What it does |
|---|---|
triggerAutomatedFieldOrder | When soil moisture drops below the node's configured threshold, generates an emergency fertigation field order (status scheduled) directly into Field/Greenhouse Orders' ledger — both screens share this same service file. |
createMaintenanceWorkOrder | When a node pings offline or reports corrupt values, dispatches a hardware maintenance work order via maintenanceWorkOrderService (the domain-agnostic engine already used elsewhere in TotalApp). |
4. Crop Yield Dashboard
Purpose: Capture the actual harvest outcome per batch — yield per hectare, quality grade, weighbridge reading, defects — and compare it against the target baseline.
Key features
- Yield records —
YLD-2026-XXXX, linked to a harvest batch code, an optional harvest schedule, and aTargetHarvestItem. - Quality grades —
grade_a_premium,grade_b_industrial,grade_c_waste. - Yield variance —
computeYieldVariancePercent()comparesactualYieldPerHaagainsttargetYieldBaselinePerHa; positive means the harvest outperformed baseline. - Defect tracking — a list of defect entries (reason, percent of loss) plus an overall percent loss/waste figure.
- Weighbridge reading & silo receipt — actual tonnage from the weighbridge and a silo receipt certificate URL for the batch.
Integration triggers
| Action | What it does |
|---|---|
publishYieldToTraceability | Once a yield record is validated, generates a serialized lot (LOT-2026-XXXX) directly in the Farm-to-Fork Traceability store, carrying origin field, harvest batch code, and a link back to this yield record — see Quality & Crop Health Operations. |
syncYieldVarianceToTargetHarvests | Folds the actual yield into Target Harvests' running ML baseline average for that crop product (updateMlBaselineYield in targetHarvestService). |
logInboundStorageBatch | Creates an unverified intake lot directly in the Silo & Storage Management registry when a harvest batch is reconciled — see Harvest & Supply Inventory. |
5. Resource Counters
Purpose: Meter utility consumption — irrigation water, electricity, diesel, natural gas — per field/greenhouse zone against a daily quota, and post the observed cost downstream.
Key features
- Counter codes —
CTR-2026-XXXX, resource typesirrigation_water_m3,electricity_kwh,diesel_liters,natural_gas_m3. - Counter status —
normal,threshold_exceeded,possible_leak_overuse,uncalibrated. - Net usage & quota —
computeNetUsage()clamps previous-vs-current reading to a non-negative delta (so a meter rollover never reports negative usage);computeDailyQuotaPercent()shows percent of the daily limit allowance consumed. - Leak/surge flags —
leakFlaggedandpowerSurgeFlaggedbooleans, plus a photo-proof URL and last calibration date per counter. - SOP cost attribution — each counter can be linked to an
AgronomicSopItemso its usage cost rolls into that SOP's running cost basis.
Integration triggers
| Action | What it does |
|---|---|
postResourceToMaterialConsumption | Posts the counter's net usage and total cost into Agro-Material Consumption's ledger, mapped to the matching source category (water_utilities, power_electricity, or fuel) — see Harvest & Supply Inventory. |
flagEquipmentPipeLeak | Dispatches an emergency maintenance work order ("Abnormal Utility Surge / Leak") via the same createMaintenanceWorkOrder helper used by IoT Climate & Soil Monitor. |
recalculateSopCostBasis | Folds the counter's observed utility cost into the linked SOP's running cost-basis average (updateUtilityCostBasis in agronomicSopService). |
End-to-end data flow
| Source screen / function | Writes | Target screen / record |
|---|---|---|
Field/Greenhouse Orders — syncOrderMaterialsToConsumption | Deducts staging stock; new consumption record | Agro-Input Staging + Agro-Material Consumption |
Season & Harvest Scheduling — syncScheduleToWIP | New GrowingCropWIPRecord (germination stage) | Growing Crop Tracking WIP |
Season & Harvest Scheduling — reserveStorageCapacity | Increments reservedTons on target silo | Silo & Storage Management registry |
Season & Harvest Scheduling — schedulePreHarvestQualityAudit | New pre_harvest_audit checklist | Crop Health Checklist |
IoT Climate & Soil Monitor — triggerAutomatedFieldOrder | New fertigation field order | Field/Greenhouse Orders |
IoT Climate & Soil Monitor — createMaintenanceWorkOrder | New maintenance work order | maintenanceWorkOrderService (domain-agnostic) |
Crop Yield Dashboard — publishYieldToTraceability | New serialized lot (LOT-2026-XXXX) | Farm-to-Fork Traceability |
Crop Yield Dashboard — syncYieldVarianceToTargetHarvests | Updates ML baseline yield average | Target Harvests |
Crop Yield Dashboard — logInboundStorageBatch | New unverified intake lot | Silo & Storage Management registry |
Resource Counters — postResourceToMaterialConsumption | New consumption record (utility category) | Agro-Material Consumption |
Resource Counters — flagEquipmentPipeLeak | New maintenance work order | maintenanceWorkOrderService (domain-agnostic) |
Resource Counters — recalculateSopCostBasis | Updates SOP running cost basis | Agronomic SOPs |
Pages in this section
Frequently Asked Questions
triggerAutomatedFieldOrder creates the order with empty assignedWorkforceId/assignedWorkforceCode fields — it's a scheduling placeholder that still needs a human to assign a crew from Field/Greenhouse Orders before it can move past scheduled.flagCropHealthAnomaly is currently a no-op stub in agroTechExecutionService.ts — the anomaly flag is saved on the order's execution log, but the automatic escalation into Pest & Disease Alerts is not yet wired.computeHarvestReadinessScore() whenever the schedule's telemetry-fed fields change.active_harvesting while a PHI window is still active?harvestLockoutActive is set by Agro-Chemical Analytics whenever a Pre-Harvest Interval is still counting down on that field, and it blocks harvest authorization until the interval clears. See Quality & Crop Health Operations for the PHI mechanics.computeNetUsage() clamps the previous-vs-current delta at zero, so a counter rollover or hardware reset is reported as zero usage for that reading rather than a nonsensical negative number.syncOrderMaterialsToConsumption writes the consumption record with unitCost/totalCost at zero — pricing is applied afterward in Agro-Material Consumption itself, which owns the ledger. See Harvest & Supply Inventory.