ie_flat_entity
The main farmer list. One flat, denormalised row per farmer with geography, demographics, endorsement state and many UI flags. Mirrors server report datasets such as PlusOneWorkNodeFarmerListGeoWise.
Table factsheetagri_db
- Written by
- Data down-sync screens (
DataSetupViewModel,UnitDataSetupViewModel) SetupIeFlatSchemaData/SetupIeFlatSchemaPieData/SetupForUnitInChargeLogin- Add farmer (
BridgeSyncHelper.createIE->Repo.createFlatIe) - Portfolio save (
IEPortfolioDao.savePortfolioChildEntitiessetshasAGrade,hasCompactBlock,lastPortfolio*) - Farming model download (sets
hasATM) - Endorsement screens (bulk status updates)
- Per-farmer fetch workers (fetch flags)
- Data down-sync screens (
- Read by
- Farmer list (
IeFragment,IeViewModel,IeAdapter) - VO/SHG filters
- Endorsements (view/endorsements/*)
- Compact block farmer picker (
CompactBlockViewModel) - Land asset (
LandAssetViewModel) - Farmer detail (
OptionFragment, via uuid) - Data-setup workers (pending fetch queries)
- Farmer list (
- Filled from
GET gateway/commons-report-service/api/v1/datasets/name/PlusOneWorkNodeFarmerListGeoWise[Unit]/executeGET .../datasets/name/PlusOneWorkNodeFarmerListGeoWiseCount[Unit]/executeGET rtld/api/dataset/v1/execute (endorsement for VO)Dataset AAP2024_25 and AAP2025_26 (AAP JSON columns)Dataset PLUS_ONE_FARMING_CATEGORY_LAST_UPDATE_DATE- Sync
- Has opId and syncStatus (no appId). A farmer added on the device is queued as sync entity IE_FLAT. Separate flags (hasSyncErrors, isLandAssetFetched, isPortfolioFetched, isATMFetched, assessmentFetchStatus, isAllDataLoaded) track per-farmer download progress and errors.
- Source
- data/src/main/java/org/mindtree/app/agricultor/data/entity/IEFlatEntity.kt
Columns
| Column | Type | Null | Key | Meaning |
|---|---|---|---|---|
uniqueIdentifier | INTEGER | No | PK | Local autoincrement primary key. Changes when the row is replaced by insertIEList. Autoincrement. |
vOId | TEXT | Yes | Alias id of the farmer's VO WorkNode. Used as the VO code/entity id in endorsements and analytics. | |
remark | TEXT | Yes | Data-quality remark from the server dataset, e.g. ERROR | CORRECTED | MEPMA-ERROR. Shown as a coloured chip. | |
villagePhase | TEXT | Yes | Programme phase of the village. | |
uuid | TEXT | No | Index | Farmer alias. Equals ie.aliasId and legacy ie.aliasId. Unique. Index: unique. |
districtName | TEXT | Yes | District name from the server farmer dataset. | |
mandalOLTPId | TEXT | Yes | Server (OLTP) id of the farmer's mandal, from the farmer dataset. Not read by the app. | |
maritalStatusCode | TEXT | Yes | Reference data code. | |
dOB | TEXT | Yes | Date of birth from the server farmer dataset (text). Not read by the app. | |
panchayatOLTPId | TEXT | Yes | Server (OLTP) id of the farmer's panchayat, from the farmer dataset. Not read by the app. | |
id | INTEGER | Yes | Server row id. Null for farmers not yet synced. | |
sHGOLTPId | TEXT | Yes | Server (OLTP) id of the farmer's Self-Help Group, from the farmer dataset. Not read by the app. | |
districtOLTPId | TEXT | Yes | Server (OLTP) id of the farmer's district, from the farmer dataset. Not read by the app. | |
relationshipCode | TEXT | Yes | Reference data code. | |
memberRegDate | TEXT | Yes | Farmer registration date, yyyy-MM-dd. Compared with the new-farmer cut-off date. | |
husbandFatherNameSurname | TEXT | Yes | Surname of the husband/father. Merged into husbandFatherName and cleared on download. | |
educationalQualificationCode | TEXT | Yes | Reference data code. | |
memberID | TEXT | Yes | Programme member id. | |
districtCode | TEXT | Yes | Reference data code. | |
mandalCode | TEXT | Yes | Reference data code. | |
memberAge | TEXT | Yes | Age in years (text). | |
maritualStatus | TEXT | Yes | Marital status label from the server dataset (column name typo). | |
habitationCode | TEXT | Yes | Alias id of the farmer's habitation WorkNode (= ie.habitatAliasId). | |
memberPhno | TEXT | Yes | Phone number. PII. | |
memberName | TEXT | Yes | First name of the farmer (first word of the full name). | |
villageCode | TEXT | Yes | Alias id of the farmer's village WorkNode (= ie.villageAliasId). | |
educationalQualification | TEXT | Yes | Education label from the server dataset. | |
iSActive | TEXT | Yes | Active flag from the dataset (text). | |
villageName | TEXT | Yes | Name of the farmer's village (copied to ie.village). | |
categoryID | TEXT | Yes | No description in code. | |
sHGID | TEXT | Yes | Id of the farmer's SHG. Used as the SHG entity id in endorsements. | |
iEOLTPId | TEXT | Yes | Server IE id. The real join key: equals owningEntityId in assets, portfolio and farming_model, entityId in endorsement_entity, iEId in sync_errors. | |
panchayatCode | TEXT | Yes | Reference data code. | |
vOOLTPId | TEXT | Yes | Server (OLTP) id of the farmer's VO, from the farmer dataset. Not read by the app. | |
memberGender | TEXT | Yes | Gender: "M" / "F" from the dataset, or GENDER.MALE | GENDER.FEMALE | GENDER.TRANSGENDER for app-created farmers. | |
iSDisabled | TEXT | Yes | Disability flag (text). | |
panchayatName | TEXT | Yes | Panchayat name from the server farmer dataset. | |
habitationName | TEXT | Yes | Name of the farmer's habitation (= ie.workNodeHabitat). | |
memberSurname | TEXT | Yes | Rest of the farmer name after the first word. | |
categoryCode | TEXT | Yes | Reference data code. | |
categoryName | TEXT | Yes | Farmer category as "baseCategory/currentCategory" text, e.g. "C1 (2021–22)/Farmer". The part after "/" drives the C4 / C5 / Farmer checks. | |
aadharNo | TEXT | Yes | Aadhaar number. PII, stored unencrypted. | |
sHGName | TEXT | Yes | SHG name; "Non-SHG" when the farmer has no SHG. | |
wellbeingCode | TEXT | Yes | Wellbeing category code. | |
rationCardNumber | TEXT | Yes | Ration card number. PII. | |
habitationOLTPId | TEXT | Yes | Server (OLTP) id of the farmer's habitation, from the farmer dataset. Not read by the app. | |
mandalName | TEXT | Yes | Mandal name from the server farmer dataset. | |
vOName | TEXT | Yes | Name of the farmer's VO. | |
vOFormationDate | TEXT | Yes | VO formation date from the server farmer dataset (text). Not read by the app. | |
villageOLTPId | TEXT | Yes | Server (OLTP) id of the farmer's village, from the farmer dataset. Not read by the app. | |
sHGRegistrationDate | TEXT | Yes | SHG registration date from the server farmer dataset (text). Not read by the app. | |
husbandFatherName | TEXT | Yes | Spouse name when married, otherwise father name (surname merged in on download). | |
lifeStatus | TEXT | Yes | LIFE_STATUS.ACTIVE | LIFE_STATUS.INACTIVE. | |
inActiveReason | TEXT | Yes | Reason given when the row was deactivated. | |
annualActionPlanData | TEXT | Yes | JSON blob: AAP 2024-25 data. | |
annualActionPlanData2526 | TEXT | Yes | JSON blob: AAP 2025-26 data (year-specific column). | |
NFCategory2526 | TEXT | Yes | JSON: natural farming category 2025-26. | |
NFJourney | TEXT | Yes | JSON: natural farming journey. | |
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). | |
interestedInTrade | INTEGER | Yes | 1 if interested in trade. | |
currentCategory | TEXT | Yes | Current farming category. | |
endorsementStatus | TEXT | Yes | null = not endorsed; PENDING | ENDORSED | FLAGGED | FOR_REVIEW. | |
endorsedBy | TEXT | Yes | Who endorsed the farmer. | |
endorsedTime | INTEGER | Yes | When endorsed (epoch millis). | |
hasATM | INTEGER | Yes | 1 when any ATM farming model exists. | |
hasAGrade | INTEGER | Yes | 1 if any PLI has practice AP-GOV-KAP-A_GRADE. | |
hasCompactBlock | INTEGER | Yes | Follows PLI.isLinkedToCompactBlock (last PLI wins). | |
hasSyncErrors | INTEGER | Yes | 1 when the farmer has unprocessed sync_errors (red badge). | |
appCreatedAt | TEXT | Yes | Created on device (epoch millis). Type differs between tables (TEXT vs INTEGER). | |
lastPortfolioCreatedData | TEXT | Yes | Date of last portfolio (column name typo for "Date"). | |
lastPortfolioCreatedSeason | TEXT | Yes | Season of last portfolio. | |
enteredPortfolioMonths | TEXT | Yes | Months with portfolio entries, joined with " , ". | |
gapStartDate | TEXT | Yes | Date the current farmer category was last changed, ISO-8601 local time "yyyy-MM-ddTHH:mm:ss". Reset when the category changes on the Add farmer screen. | |
lastPortfolioSwipeRefreshAt | TEXT | Yes | Last pull-to-refresh of the portfolio. | |
isLandAssetFetched | INTEGER | Yes | 0 = land assets not yet downloaded. | |
isPortfolioFetched | INTEGER | Yes | 0 = portfolio not yet downloaded. | |
isATMFetched | INTEGER | Yes | 0 = farming models not yet downloaded. | |
assessmentDone | INTEGER | No | 1 when an assessment exists. | |
hasPortfolio | INTEGER | No | 1 when the farmer has a portfolio. | |
assessmentFetchStatus | INTEGER | No | 0 = assessment not yet downloaded. | |
isAllDataLoaded | INTEGER | No | 1 when all per-farmer data is downloaded. |
Notes
- Joined to other tables only by convention: uuid = ie.aliasId, iEOLTPId = owningEntityId elsewhere. No foreign keys.
- Two insert paths: insertFlatSchemaData uses IGNORE on conflict (never refreshes), insertIEList uses REPLACE (deletes and recreates the row).
- About 30 single-column UPDATE queries keep the derived flags in step.
- getFarmerByComposite: farmers in a VO whose SHG id and name are in the selected lists (or have no SHG), synced only. Feeds the compact-block farmer picker.
- getVoByUniqueIdandName returns one row per VO by MIN(id).
- getIeIdsOfPendingLandAssetFetch / PortfolioFetch / ATMFetch select farmers whose per-farmer download is not finished.
- updateEndorsementFieldsForVo / ForSHG stamp the status on every synced farmer of a VO or SHG.
- Possible bug · unverified hasCompactBlock loops over all PLIs and the last one wins, so a linked PLI followed by an unlinked one resets it to 0.
- Possible bug · unverified insertIEList (REPLACE) wipes device-only columns (hasATM, hasAGrade, hasCompactBlock, fetch flags, AAP JSON) and changes uniqueIdentifier.
- Possible bug · unverified getVoByUniqueIdandName drops farmers that are not yet synced (id is null).
- Possible bug · unverified queries compare iEOLTPId (TEXT) with 0 (integer).
- Missing indexes on iEOLTPId, sHGID, vOId, sHGName.