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 (
updateProductLineItemsetsharvestStatus,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
| Column | Type | Null | Key | Meaning |
|---|---|---|---|---|
portfolioLineItemId | TEXT | Yes | FK → portfolio_portfoliolineitem.appId | Portfolio line item id. Link by convention only, no FK constraint. Index: unique composite (portfolioLineItemId, uuid). |
id | INTEGER | Yes | Server id. Null or 0 until the row is synced. | |
uuid | TEXT | Yes | Index | Stable business UUID, also sent to the server. Index: unique composite (portfolioLineItemId, uuid). |
genericProduct | TEXT | Yes | FK → product.productCode | Crop product code. Link by convention only, no FK constraint. |
plannedStartDate | TEXT | Yes | Season start date from the portfolio tab config, yyyy-MM-dd. | |
plannedEndDate | TEXT | Yes | Season end date from the portfolio tab config, yyyy-MM-dd. | |
actualStartDate | TEXT | Yes | Same as plannedStartDate when the PLI type is SEASON_ACTUAL, else null. yyyy-MM-dd. | |
actualEndDate | TEXT | Yes | Same as plannedEndDate when the PLI type is SEASON_ACTUAL, else null. yyyy-MM-dd. | |
cropChangeReason | TEXT | Yes | Why the crop was changed. | |
isMajorCrop | INTEGER | Yes | 1 = main crop. | |
cropType | TEXT | Yes | Role of the crop in the plan, e.g. CROP_TYPE.BIO_DIVERSITY_CROP | CROP_TYPE.ASSOCIATED_CROP. | |
harvestStatus | TEXT | Yes | Harvest state. | |
harvestStartDateTime | TEXT | Yes | Harvest date copied from the harvest log (yyyy-MM-dd). | |
harvestCompleteDateTime | TEXT | Yes | Harvest end date from the harvest log (yyyy-MM-dd). | |
appCreatedAt | TEXT | Yes | Created on device (epoch millis). Type differs between tables (TEXT vs INTEGER). | |
appLastModifiedAt | TEXT | Yes | Last modified on device (epoch millis). | |
createdAt | TEXT | Yes | Created time from the server. | |
lastModifiedAt | TEXT | Yes | Last modified time from the server. | |
ppliCropType | TEXT | Yes | Crop group: Agriculture | Horticulture | Polycropping | PMDS | RDS | A Grade | No NF CROP. | |
expectedHarvestDate | TEXT | Yes | Expected harvest date, yyyy-MM-dd. Used to warn about early harvest. | |
seedSource | TEXT | Yes | Always sent as null by the app. | |
seedVariety | TEXT | Yes | Seed variety code picked on the portfolio form (from the bundled seed variety list). | |
interestedInCropMarketing | INTEGER | Yes | 1 if the farmer wants marketing support. | |
sowingDate | TEXT | Yes | Sowing date picked on the portfolio form, yyyy-MM-dd. | |
appId | TEXT | No | PK | Client-side UUID. Defaults to a random UUID when the object is built, including when server JSON is parsed. |
opId | TEXT | Yes | Id of the last queued operation in the library queue (SYNC_QUEUE_DB). | |
syncStatus | TEXT | No | SYNC_NOT_INITIALIZED | IN_SYNC_QUEUE | SYNC_DONE (default). | |
assetproportion_id | INTEGER | Yes | Server id of the embedded object. | |
assetproportion_value | REAL | Yes | Share of the land area used by this crop. | |
assetproportion_uom_code | TEXT | Yes | Unit of measure detail (flattened embedded DTO). | |
assetproportion_uom_description | TEXT | Yes | Unit of measure detail (flattened embedded DTO). | |
assetproportion_uom_name | TEXT | Yes | Unit of measure detail (flattened embedded DTO). | |
assetproportion_uom_symbol | TEXT | Yes | Unit of measure detail (flattened embedded DTO). | |
assetproportion_uom_measurementtype_code | TEXT | Yes | Unit of measure detail (flattened embedded DTO). | |
assetproportion_uom_measurementtype_description | TEXT | Yes | Unit of measure detail (flattened embedded DTO). | |
assetproportion_uom_measurementtype_name | TEXT | Yes | Unit of measure detail (flattened embedded DTO). | |
assetproportion_uom_measurementtype_measurementtype_globalrefclass_code | TEXT | Yes | Unit of measure detail (flattened embedded DTO). | |
assetproportion_uom_measurementtype_measurementtype_globalrefclass_description | TEXT | Yes | Unit of measure detail (flattened embedded DTO). | |
assetproportion_uom_measurementtype_measurementtype_globalrefclass_name | TEXT | Yes | Unit of measure detail (flattened embedded DTO). |
Notes
- Unique index on (portfolioLineItemId, uuid) also serves lookups by PLI.