Database / Farmer

ie

Canonical farmer in the platform API (IE DTO) shape. This is what gets POSTed and PATCHed to the server.

Table factsheetagri_db
Written by
  • Legacy setup (IEDTO, Repo.saveIEList)
  • Add farmer (BridgeSyncHelper.createIE -> Repo.createIE)
  • IE POST response handler (IEFlatPostRH, updateIEIds)
  • IeRepositoryImpl
Read by
  • ATM screens
  • Certification
  • Endorsement
  • Farmer option screen (spouse block, getIeSpouseDetailByIeAliasId)
  • Sync workers IEWorker, IEIconpicWorker
Filled from
POST api/setupdata/v2 (IEDTO)
Sync
appId is a client UUID primary key. syncStatus starts at SYNC_DONE for downloaded rows, becomes SYNC_NOT_INITIALIZED when the row is created or edited on the device, and goes back to SYNC_DONE when the response handler writes the server id. opId holds the id of the last queued library operation. Sync entities IE and IE_ICONPIC.
Source
data/src/main/java/org/mindtree/app/agricultor/data/entity/IE.kt

Columns

ColumnTypeNullKeyMeaning
aliasIdTEXTYesIndexFarmer alias. Unique. Equals ie_flat_entity.uuid. Index: unique.
iconpicTEXTYesProfile photo path/URL.
idTEXTYesServer id (stored as TEXT here).
interestedInTradeINTEGERYes1 if interested in trade.
idStringTEXTYesServer id as string.
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).
iestatus_dataCodeTEXTYesFarmer status code.
onboardedtenant_loginNameTEXTYesOnboarding tenant: login name.
onboardedtenant_idINTEGERYesServer id of the embedded object.
person_idINTEGERYesServer id of the embedded object.
person_notesTEXTYesCurrent farmer category (the part after "/" of the full category), e.g. Farmer, C4 (Non-Agri), C5 (POP).
person_aliasIdTEXTYesSame as ie.aliasId (farmer alias).
person_personprofile_lastNameTEXTYesEverything after the first word of the farmer name.
person_personprofile_occupationTEXTYesOccupation typed on the Add farmer form (defaults to "Farming").
person_personprofile_casteTEXTYesNo description in code.
person_personprofile_noOfChildrenINTEGERYesNumber of children.
person_personprofile_dateOfBirthTEXTYesNo description in code.
person_personprofile_religionTEXTYesNo description in code.
person_personprofile_firstNameTEXTYesFirst word of the farmer name.
person_personprofile_middleNameTEXTYesNo description in code.
person_personprofile_idINTEGERYesServer id of the embedded object.
person_personprofile_ageINTEGERYesAge in years (sent with ageAsOnDate = time of save).
person_personprofile_notesTEXTYesFarmer category as "baseCategory/currentCategory" text, e.g. "C1 (2021–22)/Farmer". The part after "/" drives the C4 / C5 / Farmer checks.
person_personprofile_inActiveReasonTEXTYesWhy the farmer is inactive: an INACTIVE_REASON.* code (e.g. INACTIVE_REASON.DEAD) or free text for "other".
person_personprofile_gapStartDateTEXTYesDate 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.
person_personprofile_lifestatus_dataCodeTEXTYesReference data code.
person_personprofile_gender_dataCodeTEXTYesReference data code.
person_personprofile_disabilitystatus_dataCodeTEXTYesReference data code.
person_personprofile_avgmonthlyincome_idINTEGERYesServer id of the embedded object.
person_personprofile_avgmonthlyincome_valueINTEGERYesNumeric quantity value (flattened embedded quantity).
person_personprofile_avgmonthlyincome_currency_codeTEXTYesReference data code.
person_personprofile_bloodgroup_dataCodeTEXTYesReference data code.
person_personprofile_salutation_dataCodeTEXTYesReference data code.
person_personprofile_maritalstatus_dataCodeTEXTYesReference data code.
person_personprofile_category_dataCodeTEXTYesReference data code.
caretakertenant_loginNameTEXTYesLogin name of the logged-in user's tenant (default "ap.gov").
caretakertenant_idINTEGERYesServer id of the embedded object.

Notes

  • Has six child tables (ie_ietagging, ie_person_*), linked by iEId = ie.appId with no FK and no index.
  • The response handler updates child server ids by matching dataCode.
  • loadAllIEData joins ie to ie_flat_entity on uuid = aliasId but is unused.