APIs & services / commons-report-service

VO-wise totals for a Unit In-charge.

Endpointtoday's app
Call
GET /gateway/commons-report-service/api/v1/datasets/name/PlusOneCadreAnalyticsVOWiseSum/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

VO-level dashboard totals from FetchAnalyticsDataWorker. A Unit In-charge gets totals for the selected VOs, or for all distinct local VOs when none are selected. A cadre who filtered by VO gets totals for those VOs. The rows replace KEY_ANALYTICS_DATA in SharedPreferences. 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
datasetNamepathYesPlusOneCadreAnalyticsVOWiseSumDataset 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_VO_CODE=VO-ALIAS-001,VO-ALIAS-002Dataset input parameters as KEY=value pairs joined with "--". IN_PARAM_VO_CODE = comma-separated VO aliases (selected in the dashboard filter, or every distinct ie_flat_entity.vOId for a UIC with no selection).

Request

No body. VO params

Response

Example response body (synthetic data)
[
  {
    "CadreLogin": 1000000001,
    "VOCode": "VO-ALIAS-001",
    "FarmersSurveyedTillDate": 120,
    "FarmersSurveyedUnderMIS": 110,
    "SHGCovered": 8,
    "SHGTarget": 10,
    "TotalAcerage": 240.5,
    "TotalC1Farmers": 60,
    "TotalFarmersC1C3": 150,
    "S2SFarmers": 40,
    "FarmersSurveyedTodayCount": 3,
    "FarmersSurveyedTodayC1Count": 2,
    "FarmersSurveyedTodayC1Acreage": 3.5,
    "FarmersSurveyedTodayS2SCount": 1,
    "FarmersSurveyedTodayS2SAcreage": 1,
    "FarmersSurveyedTodayPMDSCount": 1,
    "FarmersSurveyedTodayPMDSAcreage": 1.5,
    "FarmersSurveyedTodayS2SWCount": 0,
    "FarmersSurveyedTodayS2SWAcreage": 0,
    "FarmersSurveyedTodayRDSCount": 0,
    "FarmersSurveyedTodayRDSAcreage": 0,
    "FarmersSurveyedToday365DKGCount": 1,
    "FarmersToBeSurveyedC1": 60,
    "FarmersToBeSurveyedS2S": 40,
    "FarmersToBeSurveyedPMDS": 30,
    "FarmersToBeSurveyedS2SW": 10,
    "FarmersToBeSurveyedRDS": 5,
    "FarmersToBeSurveyed365DKG": 50,
    "C1Acreage": 90,
    "S2SAcreage": 40,
    "PMDSAcreage": 30,
    "S2SWAcreage": 10,
    "FarmersSurveyedThisMonthC1Count": 12,
    "FarmersSurveyedThisMonthC1Acreage": 18,
    "FarmersSurveyedThisMonthS2SCount": 6,
    "FarmersSurveyedThisMonthS2SAcreage": 6.5,
    "FarmersSurveyedThisMonthPMDSCount": 5,
    "FarmersSurveyedThisMonthPMDSAcreage": 7,
    "FarmersSurveyedThisMonthS2SWCount": 1,
    "FarmersSurveyedThisMonthS2SWAcreage": 1,
    "FarmersSurveyedThisMonthRDSCount": 0,
    "FarmersSurveyedThisMonthRDSAcreage": 0,
    "FarmersSurveyedThisMonth365DKGCount": 4,
    "FarmersSurveyedOverallC1Count": "55",
    "FarmersSurveyedOverallC1Acreage": 80,
    "FarmersSurveyedOverallC1TargetAcreage": 90,
    "FarmersSurveyedOverallS2SCount": "35",
    "FarmersSurveyedOverallS2SAcreage": 36,
    "FarmersSurveyedOverallS2STargetAcreage": 40,
    "FarmersSurveyedOverallPMDSCount": "28",
    "FarmersSurveyedOverallPMDSAcreage": 27,
    "FarmersSurveyedOverallPMDSTargetAcreage": 30,
    "FarmersSurveyedOverallS2SWCount": "8",
    "FarmersSurveyedOverallS2SWAcreage": 8,
    "FarmersSurveyedOverallS2SWTargetAcreage": 10,
    "FarmersSurveyedOverallRDSCount": 4,
    "FarmersSurveyedOverallRDSAcreage": 3,
    "FarmersSurveyedOverallRDSTargetAcreage": 5,
    "FarmersSurveyedOverall365DKGCount": 45
  }
]
FieldTypeRequiredNotes
CadreLoginstringCadre login the row belongs to.
VOCodestringVO alias for VO-wise rows.
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 differencesnoteMisDataDtoItemNew: most counts are Double, CadreLogin is Long, and FarmersSurveyedOverall{C1,PMDS,S2S,S2SW}Count are strings.

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/MisDataDtoItemNew.kt