Database / Crops & portfolio

harvest_logs

Harvest record for a crop in the portfolio flow: dates, type, quantity and surplus.

Table factsheetagri_db
Written by
  • Harvest (IePortfolioRepositoryImpl, BridgeSyncHelper -> Repo.createHarvestLogs)
  • HarvestPostRH (writes server id)
Read by
  • HarvestWorker (getHarvest by uuid)
Sync
No BaseEntity flags. Queued as sync entity HARVEST via sync_ledger; the server id is written back into the id column.
Source
data/src/main/java/org/mindtree/app/agricultor/data/entity/HarvestLogs.kt

Columns

ColumnTypeNullKeyMeaning
idINTEGERNoPKLocal autoincrement, later overwritten with the server id by updateHarvest(uuid, serverId). Autoincrement.
earlyHarvestReasonTEXTYesReason for harvesting early.
harvestDateTEXTYesHarvest date, yyyy-MM-dd. Set to the end date because the start-date picker was removed.
harvestCompleteDateTEXTYesHarvest end date, yyyy-MM-dd.
portfolioLineItemIdTEXTYesFK → portfolio_portfoliolineitem.idPortfolio line item id. Link by convention only, no FK constraint.
productLineItemIdTEXTYesPPLI server id of the harvested crop (same value as portfolioProductLineItemId).
harvestStatusTEXTYesHARVEST_STATUS.PENDING (continuous harvest) | HARVEST_STATUS.COMPLETED (whole crop).
harvestTypeTEXTYesHARVEST_TYPE.WHOLE | HARVEST_TYPE.CONTINOUS.
portfolioProductLineItemIdTEXTYesFK → portfolio_portfoliolineitem_portfolioproductlineitem.idPortfolio product line item id. Link by convention only, no FK constraint.
genericProductTEXTYesProduct code of the harvested crop (= PPLI genericProduct).
ownerIdTEXTYesFarmer server id.
ownerEntityTypeTEXTYesOwner type, normally the farmer (IE) entity type.
uuidTEXTNoBusiness UUID (no unique index).
interestedInCropMarketingINTEGERYes1 if the farmer wants help marketing the crop. Asked only for whole-crop harvests; null for continuous.
surplusOutput_idINTEGERYesServer id of the embedded object.
surplusOutput_valueREALYesNumeric quantity value (flattened embedded quantity).
surplusOutput_uoM_symbolTEXTYesUnit of measure detail (flattened embedded DTO).
surplusOutput_uoM_codeTEXTYesUnit of measure detail (flattened embedded DTO).
surplusOutput_uoM_unitNameTEXTYesUnit of measure detail (flattened embedded DTO).
surplusOutput_uoM_measurementtype_labelTEXTYesUnit of measure detail (flattened embedded DTO).
surplusOutput_uoM_measurementtype_dataCodeTEXTYesUnit of measure detail (flattened embedded DTO).
surplusOutput_uoM_measurementtype_globalrefclass_classCodeTEXTYesUnit of measure detail (flattened embedded DTO).
surplusOutput_uoM_measurementtype_globalrefclass_nameTEXTYesUnit of measure detail (flattened embedded DTO).
surplusOutput_uoM_measurementtype_language_languageTEXTYesLanguage name.
surplusOutput_uoM_measurementtype_language_languageCodeTEXTYesLanguage code (ENG, TEL, ...).
quantity_idINTEGERYesServer id of the embedded object.
quantity_valueREALYesNumeric quantity value (flattened embedded quantity).
quantity_uoM_symbolTEXTYesUnit of measure detail (flattened embedded DTO).
quantity_uoM_codeTEXTYesUnit of measure detail (flattened embedded DTO).
quantity_uoM_unitNameTEXTYesUnit of measure detail (flattened embedded DTO).
quantity_uoM_measurementtype_labelTEXTYesUnit of measure detail (flattened embedded DTO).
quantity_uoM_measurementtype_dataCodeTEXTYesUnit of measure detail (flattened embedded DTO).
quantity_uoM_measurementtype_globalrefclass_classCodeTEXTYesUnit of measure detail (flattened embedded DTO).
quantity_uoM_measurementtype_globalrefclass_nameTEXTYesUnit of measure detail (flattened embedded DTO).
quantity_uoM_measurementtype_language_languageTEXTYesLanguage name.
quantity_uoM_measurementtype_language_languageCodeTEXTYesLanguage code (ENG, TEL, ...).

Notes

  • Possible bug · unverified id is both a local autoincrement and the server id.
  • Dropped and recreated in migration 14 to 15 (data lost).
  • No unique index on uuid.