APIs & services / Reporting datasets (rtld)

Load Unit In-charge details for the analytics dashboard filter.

Endpointtoday's app
Call
GET /rtld/api/dataset/v1/execute?name=PlusOneUnitInchargeInfo
Service
Reporting datasets (rtld)
Features
Analytics dashboard
When
Analytics dashboard filter
Auth
X-SESSIONID set by CoreAPI (dooNowOrThrow)
In the App Service

Use case

Lists the cadres (and their VOs) under a Unit In-charge. DashboardFragment.GetCadareData calls it via IeViewModel/IeRepositoryImpl.getCadreData when the analytics filter bottom sheet opens. The list is cached in SharedPreferences CADRE_DATA and fills the cadre/VO filter. Note: endpoints.json says "profile / farmer screens", but the only live caller is the dashboard filter. On error the filter keeps its progress state and nothing is cached.

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
namequeryYesPlusOneUnitInchargeInfoDataset name. The rtld executor (/rtld/api/dataset/v1/execute) picks the dataset by this query param.
versionqueryYes1Dataset version. Always 1.
formatqueryYesjsonResponse format. Always json, so the body is a JSON array of row objects.
paramsqueryYesUNIT=9XXXXXXXX1Dataset input parameters as KEY=value pairs joined with "--". UNIT = user login before "@@" and before the first "-" (the Unit In-charge login).

Request

No body. cadre params

Response

Example response body (synthetic data)
[
  {
    "VOCode": "VO-ALIAS-001",
    "VOName": "VO A",
    "Unit": "Unit A",
    "Village": "Village A",
    "Habitation": "Habitation A",
    "Unit Incharge": "Unit In-charge A",
    "Final Unit Incharge": "Unit In-charge A",
    "ICRP Name/Responsible Person Name": "Cadre A",
    "CadreLogin": 1000000001
  }
]
FieldTypeRequiredNotes
VOCode, VONamestringVO options in the analytics filter; VOCode is passed as IN_PARAM_VO_CODE to the VO-wise analytics.
ICRP Name/Responsible Person NamestringCadre name shown in the filter (@SerializedName with spaces).
CadreLoginlongCadre login id for the row.
Unit, Village, Habitation, Unit Incharge, Final Unit InchargestringCached with the rest; shown in or used by the filter list.

Errors

StatusWhenWhat the app does
401 / 400Session token expired or rejectedAuthInterceptor refreshes the token and retries once; if the retry also fails, Resource.error; filter list not refreshed. An exception on the executor thread is not caught.
5xxDataset query failed on the serverResource.error; filter list not refreshed. An exception on the executor thread is not caught.
network errorNo connectivity or timeoutResource.error; filter list not refreshed. An exception on the executor thread is not caught.

Source

  • app/src/main/java/org/platformcommons/urvi/datasource/network/retrofit/APIInterface.kt
  • app/src/main/java/org/platformcommons/urvi/datasource/repository/impl/IeRepositoryImpl.kt
  • app/src/main/java/org/platformcommons/urvi/view/ie/IeViewModel.kt
  • app/src/main/java/org/platformcommons/urvi/view/dashboard/DashboardFragment.kt
  • app/src/main/java/org/platformcommons/urvi/datasource/network/responsedto/CadareDta.kt