FactsheetFarming models & harvest
Who uses it Field staff / CRP (regular cadre) How you get here ATM list > ATM card > Harvest (only when HARVEST_ATM_EXTERNAL_SWITCH = 1 and the ATM has a server id). Tables farming_model_harvest, farming_model APIs 1 calls today, 7 App Service operations Offline Saved locally in farming_model_harvest and sent through the retrying operation queue (dooWithRetry), not the sync ledger, so it does not appear in Pending Sync and has no dependency on the ATM POST. Screens What it captures Rules API contracts Behaviour notes Improve in the rewrite Screens Screen What it does Source ATM harvest Choose harvest type, pick crops, enter output per crop, capture photo and location. app/src/main/java/org/platformcommons/urvi/view/atm/harvest/AtmHarvestActivity.kt
What it captures Field Type Required Validation Options from Harvest type Radio: Continuous Harvesting (default) / Whole Crop Harvesting Yes Whole selects every crop and locks the list; Continuous clears the selection for manual picks. Fixed options Crop list Checkbox list Yes Continuous: at least 1 crop. Whole: all crops. All vegetable and pulse line items of the ATM Total Output (Quintal) Decimal, per crop Yes Must be greater than 0. User input Surplus Output (Quintal) Decimal, per crop Yes Must be less than or equal to total output. User input Harvest Date Date (dd/MM/yyyy), per crop Yes No future dates. The hidden start date is set to the same value. Date picker Photo Camera If Whole Crop Harvesting Optional for Continuous. Device camera Location GPS (auto + Capture Location button) Yes Device GPS
Rules Conditions from the code, rewritten as plain decision rules.
When Then ATM has no server id Harvest cannot open: "Please sync ATM before adding harvest data". Harvest is submitted One FarmingModelHarvest record per crop with unit UOM.WEIGHT.QUINTAL, harvestType HARVEST_TYPE.CONTINOUS or WHOLE_CROP, geotag "lat,lng". Harvest type is Continuous harvestStatus = PENDING. Harvest type is Whole Crop harvestStatus = COMPLETED; every line item becomes COMPLETED so the ATM disappears from the ATM list. Harvest is saved locally Every line item of the ATM (not only the selected crops) gets the new status and type; each crop's harvest date becomes harvestCompleteDateTime.
API contracts Each call opens to its use case, headers, request and response bodies, and errors.
Behaviour notes Possible bug · unverified farmingModelLineItemId is set as `if (id == 0) id else null`, so the real line-item id is never sent. Possible bug · unverified the photo (currentPhotoPath) is required for whole crop but never saved or uploaded. Possible bug · unverified a continuous harvest of one crop marks all ATM crops PENDING; only harvested crops should change. Possible bug · unverified bypasses the sync ledger, so failures are invisible to the user. Improve in the rewrite Share one harvest component with Crop Actual harvest (same units, date rules, photo/location). Route through the sync ledger with a dependency on the ATM POST. Either upload the photo and geotag or stop requiring them. Move hard-coded English labels into string resources.