Farmer hub (option tiles)
The per-farmer menu of tiles (Profile, Land, Livestock, Crop Plan, Surveys, KAP, Annual plan, Crop Actual, ATM, Kitchen Garden, Certification, Comments, Inventory). Access depends on profile completeness, land, farmer category (C4/C5/Farmer), land authentication, role and server switches.
FactsheetFarmer profile
- Who uses it
- CadreUnit In-Charge / FMT L1HAN
- How you get here
- Tap a farmer in the farmer list, tap a farmer notification, or Side menu > My Plan & Profile (user mode).
- Tables
ie_flat_entity,farmerassets,portfolio,portfolio_portfoliolineitem,farming_model,sync_error_logs,endorsement_entity- APIs
- 7 calls today, 5 App Service operations
- Offline
- Works offline once the farmer's data is downloaded; the missing-data top-up needs internet.
Screens
| Screen | What it does | Source |
|---|---|---|
| Farmer hub | Header with farmer name and IE id, banners and tiles grouped as Action plan, Monthly progress and Others. | app/src/main/java/org/platformcommons/urvi/view/option/OptionFragment.kt |
Rules
Conditions from the code, rewritten as plain decision rules.
| When | Then |
|---|---|
| Opened in user mode (My Plan & Profile) | Header reads "My Plan & Profile" with the user's name and email; Profile is hidden; Crop Plan is always greyed; category checks are skipped. |
| The farmer profile is incomplete | Show "Profile incomplete. Please update farmer profile to continue." with Details (missing fields) and Visit; only Profile opens, other tiles show the incomplete dialog. |
| Profile is complete, the farmer has no land and is not C4/C5 | Show "Add land to enable data capture against farmer."; only Profile and Land open. |
| Land, crop plans or ATM have not been downloaded for this farmer | Show "Please click here to fetch missing data: …"; tapping downloads just this farmer's assets, portfolio and farming model with attachments. |
| The farmer has a FARMER_ASSET sync error | Show a sync-error icon on Land. |
| The farmer is inactive (lifeStatus not ACTIVE or empty) | All tiles are disabled. |
| The user has a HAN role | Land, Livestock, Comments, Crops, Crop Plan, Survey, Crop Actual and Certification are disabled and the profile is read-only. |
| CROP_PLAN_EXTERNAL_SWITCH is not 1 | Hide Crop Plan. |
| SURVEYS_ACTION_PLAN_EXTERNAL_SWITCH is not 1 | Hide the action-plan Survey. |
| SURVEYS_MONTHLY_PROGRESS_EXTERNAL_SWITCH is not 1 | Hide the monthly Survey. |
| CERTIFICATION_EXTERNAL_SWITCH is not 1 | Hide Certification. |
| The user is Unit | Hide Comments. |
| Profile is tapped and PROFILE_EXTERNAL_SWITCH = 0 | Toast "No entries allowed"; otherwise open the farmer profile. |
| Land is tapped | LAND_EXTERNAL_SWITCH = 0 → "No entries allowed"; no category → "Please Update Your current category status."; C4 or C5 → "Since you are C4 member, you have no access to this module" (or C5); else open Land. |
| Cattle/Livestock is tapped | No category → update-category toast; else open Livestock. |
| Crop Plan is tapped | No category → toast; C4 or C5 → no access; season & survey disabled config = 1 → "No more entries in Annual Crop Plan is allowed until further notice."; else open Crop Plan (PLANNED). |
| Survey (action plan) is tapped | No category → toast; season/survey disabled → "2023 - 24 Monthly surveys have been disabled!"; farmer not yet on the server (no IE id and no queued operation) → "Assessment is not allowed at this moment"; else open assessments. |
| KAP 25–26 is tapped | KAP_25_26_EXTERNAL_SWITCH = 0 → no entries; no category → toast; C4 → no access; not C5 and land not authenticated → "Please authenticate land"; no server IE id → "please sync the farmer data before accessing KAP"; else open KAP. |
| Annual plan is tapped | No category → toast; no server IE id → "Please sync farmer data before accessing Annual Plan"; C4 or C5 → open; others need authenticated land, otherwise "Please authenticate land". |
| Crop Actual is tapped | Only allowed if the running versionName_versionCode is listed in CROP_ACTUAL_EXCEPTION_EXTERNAL_SWITCH, otherwise "No entries allowed". User mode → open. No category → toast. Category last updated before FARMING_CATEGORY_LAST_MANDATORY_UPDATE_DATE (unless Farmer with authenticated land) → change-category dialog. C4 or C5 → no access. Land not authenticated → "Please authenticate land". Else open Crop Actual (SEASON_ACTUAL). |
| Monthly Survey is tapped | User mode → assessments; no category → toast; else assessments with sub-type actual. |
| ATM is tapped | ATM_EXTERNAL_SWITCH = 0 → no entries; no category → toast; C4 → no access; C5 → open; land not authenticated → toast; else open ATM. |
| Kitchen Garden is tapped | Always open the 365 DKG screen. |
| Certification is tapped | No category → toast; C4 or C5 → no access; else open Certification. |
| Comments is tapped | Category not in x/y form → toast; C4 → no access; no endorsement status → "no comments is added to this farmer"; else open the resolve-comments sheet, which updates endorsement fields locally. |
| Inventory is tapped | No category → toast; C4 or C5 → no access; else open My crops. |
API contracts
Each call opens to its use case, headers, request and response bodies, and errors.
| App Service v2: operation | Use |
|---|---|
GET /config | Typed config bundle (ETag) |
GET /farmers/snapshot | Cursor-paged hydrated farmer snapshot |
GET /farmers/changes | Delta sync: upserts and tombstones since a cursor |
GET /farmers/{farmerId} | One hydrated farmer (get-or-create) |
GET /farmers/{farmerId}/abstract | Farmer abstract for a season |
Behaviour notes
- A farmer has a category only if the text after the last / in categoryName is C4, C5 or Farmer (or the Telugu word రైతు).
- "Auth land" means at least one land asset is authenticated, or the farmer has no land assets at all.
- The change-category dialog body is commented out, so that step currently does nothing visible.
- Messages such as "2023 - 24 Monthly surveys have been disabled!" are stale; some are hard-coded English.
- Exact base paths for the top-up endpoints are abbreviated in the source report; verify against the Retrofit interfaces.
Improve in the rewrite
- Show why a tile is blocked (badge or subtitle) instead of greying with alpha and showing surprise toasts.
- Express tile access as one declarative rule table driven by category, role and config.
- Read config switches through a typed config object instead of string codes.