APIs & services / commons-report-service

SHG-wise totals for a Unit In-charge.

Endpointtoday's app
Call
GET /gateway/commons-report-service/api/v1/datasets/name/PlusOneCadreAnalyticsSHGWiseSum/execute
Service
commons-report-service
Features
Analytics dashboard
When
Periodic 12 h and on demand (UIC)
Auth
X-SESSIONID set by CoreAPI (dooNowOrThrow)
In the App Service

Use case

Used when a Unit In-charge filters the dashboard by SHG (worker input IS_SHG = true). FetchAnalyticsDataWorker sends the selected SHG codes and stores the totals in KEY_ANALYTICS_DATA for the dashboard. A failure caches an empty list.

Headers

HeaderValueNotes
X-SESSIONID<session token>Not set by the call site. AuthInterceptor (OkHttpClientInterceptor) adds it from AndroidSessionManager. On a 401 or 400 it invalidates the token, gets a fresh one and retries once.

Parameters

ParamInRequiredExampleNotes
datasetNamepathYesPlusOneCadreAnalyticsSHGWiseSumDataset name in the path of commons-report-service /api/v1/datasets/name/{name}/execute.
versionqueryYes1Dataset version. Always 1.
formatqueryYesjsonResponse format. Always json, so the body is a JSON array of row objects.
paramsqueryYesIN_PARAM_SHG_CODE=SHG-ALIAS-001,SHG-ALIAS-002Dataset input parameters as KEY=value pairs joined with "--". IN_PARAM_SHG_CODE = comma-separated SHG codes selected in the dashboard filter.

Request

No body. SHG params

Response

Example response body (synthetic data)
[
  {
    "FarmersSurveyedTillDate": "40",
    "TotalAcerage": 80.5,
    "FarmersSurveyedUnderMIS": "38",
    "SHGCovered": "2",
    "SHGTarget": "2",
    "TotalFarmersC1C3": "50",
    "TotalC1Farmers": "20",
    "S2SFarmers": "12",
    "FarmersToBeSurveyedC1": "20",
    "FarmersToBeSurveyedS2S": "12",
    "FarmersToBeSurveyedPMDS": "10",
    "FarmersToBeSurveyedS2SW": "3",
    "FarmersToBeSurveyed365DKG": "15",
    "C1Acreage": "30.0",
    "S2SAcreage": "12.0",
    "PMDSAcreage": "10.0",
    "S2SWAcreage": "3.0",
    "FarmersSurveyedTodayCount": "1",
    "FarmersSurveyedTodayC1Count": "1",
    "FarmersSurveyedTodayC1Acreage": 1.5,
    "FarmersSurveyedThisMonthC1Count": "4",
    "FarmersSurveyedThisMonthC1Acreage": 6,
    "FarmersSurveyedOverallC1Count": "18",
    "FarmersSurveyedOverallC1Acreage": 27,
    "FarmersSurveyedOverallC1TargetAcreage": 30
  }
]
FieldTypeRequiredNotes
FarmersSurveyedTillDate, FarmersSurveyedUnderMIS, SHGCovered, SHGTarget, TotalAcerage, TotalC1Farmers, TotalFarmersC1C3, S2SFarmersnumberHeadline tiles on the analytics dashboard.
FarmersSurveyedToday{C1,S2S,PMDS,S2SW,RDS,365DKG}{Count,Acreage}numberDaily figures per model (C1, S2S, PMDS, S2SW, RDS, 365-day kitchen garden).
FarmersSurveyedThisMonth{model}{Count,Acreage}numberMonthly figures per model.
FarmersSurveyedOverall{model}{Count,Acreage,TargetAcreage}numberSeason-to-date figures and targets per model.
FarmersToBeSurveyed{model}, {C1,S2S,PMDS,S2SW}AcreagenumberTarget farmer counts and acreage per model.
Type differencesnoteMisDataDtoItemForSHG: counts are strings and acreages are Double; there are no CadreLogin/VOCode or farmer-id CSV fields.

Errors

StatusWhenWhat the app does
401 / 400Session token expired or rejectedAuthInterceptor refreshes the token and retries once; if the retry also fails, Empty list cached; dashboard shows zeros.
5xxDataset query failed on the serverEmpty list cached; dashboard shows zeros.
network errorNo connectivity or timeoutEmpty list cached; dashboard shows zeros.

Source

  • app/src/main/java/org/platformcommons/urvi/datasource/network/retrofit/APIInterface.kt
  • app/src/main/java/org/platformcommons/urvi/datasource/service/FetchAnalyticsDataWorker.kt
  • app/src/main/java/org/platformcommons/urvi/datasource/network/responsedto/MisDataDtoItemForSHG.kt