Features / Onboarding & setup

Data download (Unit / FMT)

For Unit In-Charge and FMT L1 users, downloads master data plus farmers, land, crop plans and compact blocks for every VO assigned to them. No VO selection is needed.

FactsheetOnboarding & setup
Who uses it
Unit In-Charge / FMT L1
How you get here
Automatically after role detection for Unit users; in load-more mode via Settings > Load more data.
Tables
sync_status, ie_flat_entity, cropdata, practicemaster, farmerassets, portfolio, portfolio_portfoliolineitem, compact_block, compact_block_member
APIs
11 calls today, 3 App Service operations
Offline
Needs internet. Offline, items end in ERROR with Retry.

Screens

ScreenWhat it doesSource
Unit Data SetupList of 8 download items with status and Retry/Refresh.app/src/main/java/org/platformcommons/urvi/view/datasetup/UnitDataSetupActivity.kt

Rules

Conditions from the code, rewritten as plain decision rules.

WhenThen
Downloads runItems: App Configs, Product Master, Practice Master, Farmers, Farmer Assets, Portfolio, Portfolio Attachments, Compact Block. Assets and Portfolio run in parallel.
Downloading farmersEach VO in the downloaded hierarchy (MAJOR_TYPE.VO) is counted and paged separately, with progress saved per VO.
Every VO's farmers are fully downloadedAll per-VO progress is reset so the next run is a full refresh.
An error occurs and some farmers are already storedFarmers is PARTIAL_SUCCESS.
Downloading compact blocksEach VO is paged (size 100) with per-VO progress and the same reset-when-all-done rule.
All four mandatory items succeeded and every item finishedGo to Home in Unit mode and set KEY_IS_UNIT_LOGIN, setupStatus and isLanguageSelected.
In load-more modeDownloads do not auto-start and the app does not move to Home by itself.
Settings > Load more data is tapped and any queued item has never been attemptedBlock with "Please sync before loading more data." and a Force sync button.

API contracts

Each call opens to its use case, headers, request and response bodies, and errors.

Today: callUseReplaced by
GET /gateway/portfolio-service/api/v1/ref-data/class/CLASS.PORTFOLIO_APP_CONFIG?page&size=100&direction=ASCLoad app config: feature flags, current season, retry delay, pagination and chunk sizes.
GET /ie-registration/assets/json/inventory/crops-list.jsonLoad the static crop list.
GET /gateway/portfolio-service/api/v1/practices/active?direction=ASC&page=1&size=100Load the active farming practices master.
GET /gateway/commons-report-service/api/v1/datasets/name/PlusOneWorkNodeFarmerListGeoWiseCountUnit/executeCount farmers across VOs for a Unit In-charge / FMT.
GET /gateway/commons-report-service/api/v1/datasets/name/PlusOneWorkNodeFarmerListGeoWiseUnit/executeDownload the farmer list for a Unit In-charge / FMT.
GET /gateway/asset-service/api/v1/assets/ownerEntities?ownerEntityIdList=&ownerEntityType=OWNER_ENTITY.IEDownload land and cattle assets for a chunk of farmers (or the cadre, with OWNER_ENTITY.BRIDGE_USER).
GET /gateway/portfolio-service/api/v1/portfolios/ownerEntities?ownerEntityIdList=&ownerEntityType=ENTITY_TYPE.IEDownload crop plans (portfolios with line items) for a chunk of farmers.
GET /gateway/portfolio-service/api/v1/portfolios/line-items/portfoliosForLineItemIds?portfolioLineItemIds=&returnAllMimeType=trueDownload crop line-item attachments (photos, geofences) in bulk.
GET /gateway/portfolio-service/api/v1/portfolios/attachment/bulk?portfolioAttachmentIds=Download portfolio attachments by id (Unit In-charge setup).
GET /gateway/portfolio-service/api/v1/compact-block/filter?cbmOwningEntityIds=Download compact blocks that include the given farmers.
GET /gateway/portfolio-service/api/v1/compact-block?direction=desc&page&size&voIds=Download compact blocks for the selected VOs, paged.
App Service v2: operationUse
GET /configTyped config bundle (ETag)
GET /farmers/snapshotCursor-paged hydrated farmer snapshot
GET /compact-blocksCompact blocks for VOs

Behaviour notes

  • Mandatory items: App Configs, Product Master, Practice Master, Farmers.
  • Unlike Cadre there is no IE Role Map, no asset attachments and no farming model download.
  • Progress keys: totalIEPages / pulledIEPages for farmers, totalCBPages / pulledCBPages for compact blocks.

Improve in the rewrite

  • Share one download engine with the Cadre flow.
  • Consider downloading only changed records instead of a full refresh after every complete run.