Database / Crops & portfolio

portfolio_portfoliolineitem_portfolioproductlineitem

Portfolio product line item (PPLI): one crop inside a PLI, with dates, area share and harvest status.

Table factsheetagri_db
Written by
  • Saved with the PLI
  • Harvest flow (updateProductLineItem sets harvestStatus, harvestCompleteDateTime)
Read by
  • Portfolio screens
  • Harvest
  • Compact block crop pickers
Filled from
GET /gateway/portfolio-service/api/v1/portfolios/ownerEntities
Sync
Has BaseEntity flags; sent as part of the PLI payload.
Source
data/src/main/java/org/mindtree/app/agricultor/data/entity/PortfolioLineItem.kt

Columns

ColumnTypeNullKeyMeaning
portfolioLineItemIdTEXTYesFK → portfolio_portfoliolineitem.appIdPortfolio line item id. Link by convention only, no FK constraint. Index: unique composite (portfolioLineItemId, uuid).
idINTEGERYesServer id. Null or 0 until the row is synced.
uuidTEXTYesIndexStable business UUID, also sent to the server. Index: unique composite (portfolioLineItemId, uuid).
genericProductTEXTYesFK → product.productCodeCrop product code. Link by convention only, no FK constraint.
plannedStartDateTEXTYesSeason start date from the portfolio tab config, yyyy-MM-dd.
plannedEndDateTEXTYesSeason end date from the portfolio tab config, yyyy-MM-dd.
actualStartDateTEXTYesSame as plannedStartDate when the PLI type is SEASON_ACTUAL, else null. yyyy-MM-dd.
actualEndDateTEXTYesSame as plannedEndDate when the PLI type is SEASON_ACTUAL, else null. yyyy-MM-dd.
cropChangeReasonTEXTYesWhy the crop was changed.
isMajorCropINTEGERYes1 = main crop.
cropTypeTEXTYesRole of the crop in the plan, e.g. CROP_TYPE.BIO_DIVERSITY_CROP | CROP_TYPE.ASSOCIATED_CROP.
harvestStatusTEXTYesHarvest state.
harvestStartDateTimeTEXTYesHarvest date copied from the harvest log (yyyy-MM-dd).
harvestCompleteDateTimeTEXTYesHarvest end date from the harvest log (yyyy-MM-dd).
appCreatedAtTEXTYesCreated on device (epoch millis). Type differs between tables (TEXT vs INTEGER).
appLastModifiedAtTEXTYesLast modified on device (epoch millis).
createdAtTEXTYesCreated time from the server.
lastModifiedAtTEXTYesLast modified time from the server.
ppliCropTypeTEXTYesCrop group: Agriculture | Horticulture | Polycropping | PMDS | RDS | A Grade | No NF CROP.
expectedHarvestDateTEXTYesExpected harvest date, yyyy-MM-dd. Used to warn about early harvest.
seedSourceTEXTYesAlways sent as null by the app.
seedVarietyTEXTYesSeed variety code picked on the portfolio form (from the bundled seed variety list).
interestedInCropMarketingINTEGERYes1 if the farmer wants marketing support.
sowingDateTEXTYesSowing date picked on the portfolio form, yyyy-MM-dd.
appIdTEXTNoPKClient-side UUID. Defaults to a random UUID when the object is built, including when server JSON is parsed.
opIdTEXTYesId of the last queued operation in the library queue (SYNC_QUEUE_DB).
syncStatusTEXTNoSYNC_NOT_INITIALIZED | IN_SYNC_QUEUE | SYNC_DONE (default).
assetproportion_idINTEGERYesServer id of the embedded object.
assetproportion_valueREALYesShare of the land area used by this crop.
assetproportion_uom_codeTEXTYesUnit of measure detail (flattened embedded DTO).
assetproportion_uom_descriptionTEXTYesUnit of measure detail (flattened embedded DTO).
assetproportion_uom_nameTEXTYesUnit of measure detail (flattened embedded DTO).
assetproportion_uom_symbolTEXTYesUnit of measure detail (flattened embedded DTO).
assetproportion_uom_measurementtype_codeTEXTYesUnit of measure detail (flattened embedded DTO).
assetproportion_uom_measurementtype_descriptionTEXTYesUnit of measure detail (flattened embedded DTO).
assetproportion_uom_measurementtype_nameTEXTYesUnit of measure detail (flattened embedded DTO).
assetproportion_uom_measurementtype_measurementtype_globalrefclass_codeTEXTYesUnit of measure detail (flattened embedded DTO).
assetproportion_uom_measurementtype_measurementtype_globalrefclass_descriptionTEXTYesUnit of measure detail (flattened embedded DTO).
assetproportion_uom_measurementtype_measurementtype_globalrefclass_nameTEXTYesUnit of measure detail (flattened embedded DTO).

Notes

  • Unique index on (portfolioLineItemId, uuid) also serves lookups by PLI.