Features / Farming models & harvest

Crop Actual harvest

Logs a harvest for one crop on a Crop Actual (portfolio) tile: output, surplus, date and harvest type. It is separate from ATM harvest.

FactsheetFarming models & harvest
Who uses it
Field staff / CRP (regular cadre)
How you get here
Crop Actual (Add/Edit portfolio) screen > tap harvest on a crop chip.
Tables
harvest_logs
APIs
1 calls today, 7 App Service operations
Offline
Offline-first: saved to harvest_logs and uploaded by HarvestWorker when online.

Screens

ScreenWhat it doesSource
Select harvest bottom sheetHarvest form for a single crop.app/src/main/java/org/platformcommons/urvi/view/harvest/SelectHarvestBottomSheet.kt
Add portfolio (host)Crop Actual screen that opens the harvest dialog.app/src/main/java/org/platformcommons/urvi/view/portfolio/AddPortfolioActivity.kt

What it captures

FieldTypeRequiredValidationOptions from
Harvest typeRadio: Continuous / Whole cropYesEach option shows only if remote config's enabled-versions list contains the current versionName_versionCode.Remote config
Early Harvest ReasonTextIf current month is before the month of the crop's expected harvest dateHidden otherwise.User input
Total output (quintals)DecimalYes0-999.99 (up to 3 whole digits, 2 decimals).User input
Surplus for sale (quintals)DecimalYes0-999.99 and less than or equal to total output.User input
Interested in marketing with RySSCheckboxNoShown only for Whole crop when surplus > 0.User input
Harvest dateDate (yyyy-MM-dd)YesLatest = today. Earliest = crop's previous harvest end date + 1 day.Date picker
PhotoCameraIf Whole cropLocation must be captured first.Device camera
LocationGPSYesDevice GPS

Rules

Conditions from the code, rewritten as plain decision rules.

WhenThen
Form is valid and confirmedA harvest_logs row is written (quantity, surplus, harvest date as complete date, status, type, PLI id, product line item id, earlyHarvestReason, interestedInCropMarketing), the portfolio product's harvest status and complete date update, and sync is triggered.
HarvestWorker runsHarvest log is POSTed for the owner.

API contracts

Each call opens to its use case, headers, request and response bodies, and errors.

Today: callUseReplaced by
POST /gateway/portfolio-service/api/v1/portfolios/harvest/{id}/ENTITY_TYPE.IERecord a crop harvest. Sent through the queue or online.
App Service v2: operationUse
GET /configTyped config bundle (ETag)
GET /farmers/snapshotCursor-paged hydrated farmer snapshot
GET /farmers/{farmerId}/crop-blocksA farmer's Crop Actual blocks for a season / month
POST /sync/batchApply an ordered batch of offline mutations
POST /filesCreate a file upload (resumable or single-shot)
PATCH /files/{fileId}Append a chunk to a resumable upload
HEAD /files/{fileId}Current offset of a resumable upload

Behaviour notes

  • Possible bug · unverified photo and GPS are required to pass validation but are not stored in harvest_logs or sent (not confirmed against the server payload).

Improve in the rewrite

  • Merge with ATM harvest into one component with consistent date rules and limits.
  • Persist and upload photo and geotag, or drop the requirement.
  • Replace version-list feature gating with a simple per-option flag.