APIs & services / commons-report-service

Get each farmer's farming-category last update (gap start) date.

Endpointtoday's app
Call
GET /gateway/commons-report-service/api/v1/datasets/name/PLUS_ONE_FARMING_CATEGORY_LAST_UPDATE_DATE/execute
Service
commons-report-service
Features
Farmer category (Farmer/C4/C5), VO / SHG / Farmer endorsement
When
Background data download; endorsement screens
Auth
X-SESSIONID header (AuthInterceptor adds it; re-auth on 401/400)
In the App Service

Use case

The background download (Setup.fetchGapStartDate) sends farmer ids in chunks of 50 and saves each farmer's gapStartDate, which sets when the member category can next be changed. On the endorsement Resolve Comments screen, EndorsementRepositoryImpl.checkIfCategoryIsFreezed saves gap date and category for the given farmers and returns the ids whose category is not frozen. Failures are logged (worker) or shown as an error (screen).

Headers

HeaderValueNotes
X-SESSIONID<session token>Passed explicitly as @Header from AndroidSessionManager.sessionId. AuthInterceptor still retries once with a fresh token on 401 or 400.

Parameters

ParamInRequiredExampleNotes
datasetNamepathYesPLUS_ONE_FARMING_CATEGORY_LAST_UPDATE_DATEDataset name in the path of commons-report-service /api/v1/datasets/name/{name}/execute.
versionqueryYes1Hard-coded in the @GET path.
formatqueryYesjsonHard-coded in the @GET path.
paramsqueryYesIN_PARAM_IEID_LIST=100001,100002Dataset input parameters as KEY=value pairs joined with "--". IN_PARAM_IEID_LIST = comma-separated IE ids (50 per call from the worker).

Request

No body. IN_PARAM_IEID_LIST

Response

Example response body (synthetic data)
[
  {
    "Id": "100001",
    "gapStartDate": "1719792000000",
    "FarmingCategory": "C1",
    "currentCategoryFormatted": "Farmer/C1"
  },
  {
    "Id": "100002",
    "gapStartDate": null,
    "FarmingCategory": "C3",
    "currentCategoryFormatted": "Farmer/C3"
  }
]
FieldTypeRequiredNotes
IdstringIE id the row belongs to.
gapStartDatestringLast category change (epoch millis as string); saved in ie_flat_entity.gapStartDate and checked by AppUtils.checkCategoryUpdateStatus.
FarmingCategorystringCurrent category; saved on the endorsement path (updateCategoryAndGapStartDate).
currentCategoryFormattedstringDisplay form of the category; saved on the endorsement path.

Errors

StatusWhenWhat the app does
401 / 400Session token expired or rejectedAuthInterceptor refreshes the token and retries once; if the retry also fails, Worker: Crashlytics log, 401 triggers a session refresh, chunk skipped. Screen: Resource.error "Some error occurred".
5xxDataset query failed on the serverWorker: Crashlytics log, 401 triggers a session refresh, chunk skipped. Screen: Resource.error "Some error occurred".
network errorNo connectivity or timeoutWorker: Crashlytics log, 401 triggers a session refresh, chunk skipped. Screen: Resource.error "Some error occurred".

Source

  • app/src/main/java/org/platformcommons/urvi/datasource/network/retrofit/APIInterface.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/setup/SetupService.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/setup/Setup.kt
  • app/src/main/java/org/platformcommons/urvi/datasource/repository/impl/EndorsementRepositoryImpl.kt
  • app/src/main/java/org/platformcommons/urvi/view/endorsements/comment/ResolveCommentsFragment.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/utils/FarmingCategoryLastUpdateDTO.kt