State DSS - mCollect
Technical Doc
Technical Doc
DSS has two sides to it. One is the process in which the Data is pooled into ElasticSearch and the other is the way it is fetched, aggregated, computed, transformed and sent across.
As this revolves around a variety of data sets, there is a need for making this configurable. So that, tomorrow, given a new scenario is introduced, it is just a configuration away from getting the newly introduced scenario involved in this flow of the process.
This document explains the steps on how to define the configurations for the analytics side of DSS for W&S.
What is analytics?
Analytics: Micro Service which is responsible for building, fetching, aggregating and computing the Data on ElasticSearch to a consumable Data Response. Which shall be later used for visualizations and graphical representations.
Analytics Configurations: Analytics contains multiple configurations. we need to add the changes related to mCollect in this dashboard analytics.
Here is the location : configs/egov-dss-dashboards/dashboard-analytics at qa · egovernments/configs
Below is a list of configurations that need to be changed to run W&S successfully.
Chart API Configuration
Master Dashboard Configuration
Role Dashboard Mappings Configuration
Chart API Configuration
Each visualization has its own properties. Each visualization comes from different data sources (Sometimes it is a combination of different data sources).
In order to configure each visualization and its properties, we have a Chart API Configuration Document.
In this, the visualization code, which happens to be the key, will have its properties configured as a part of the configuration and are easily changeable.
Here is the sample ChartApiConfiguration.json data for the mCollect.
"mcTodaysCollection": {
"chartName": "DSS_TOTAL_COLLECTION_TODAY",
"queries": [
{
"module": "COMMON",
"dateRefField": "",
"requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.paymentDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.city.districtCode\"}",
"indexName": "dss-collection_v2",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"terms\":{\"dataObject.tenantId.keyword\":[\"pb.testing\",\"pb\"]}},{\"terms\":{\"dataObject.paymentDetails.bill.status.keyword\":[\"Cancelled\"]}},{\"terms\":{\"dataObject.paymentDetails.businessService.keyword\":[\"TL\",\"PT\"]}}],\"must\":[{\"range\":{\"dataObject.paymentDetails.receiptDate\":{\"gte\":\"now-1d\",\"lte\":\"now\"}}}] }},\"aggs\":{\"Todays Collection\":{\"sum\":{\"field\":\"dataObject.paymentDetails.totalAmountPaid\"}}}}}}"
}
],
"chartType": "metric",
"valueType": "Amount",
"drillChart": "none",
"documentType": "_doc",
"action": "",
"aggregationPaths": [
"Todays Collection"
],
"insight": {},
"_comment": " "
},
"mcTotalCollection": {
"chartName": "DSS_TOTAL_COLLECTION",
"queries": [
{
"module": "COMMON",
"dateRefField": "dataObject.paymentDetails.receiptDate",
"requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.paymentDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.city.districtCode\"}",
"indexName": "dss-collection_v2",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"terms\":{\"dataObject.tenantId.keyword\":[\"pb.testing\",\"pb\"]}},{\"terms\":{\"dataObject.paymentDetails.bill.status.keyword\":[\"Cancelled\"]}},{\"terms\":{\"dataObject.paymentDetails.businessService.keyword\":[\"TL\",\"PT\"]}}]}},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.paymentDetails.totalAmountPaid\"}}}}}}"
}
],
"chartType": "metric",
"valueType": "Amount",
"drillChart": "none",
"documentType": "_doc",
"action": "",
"aggregationPaths": [
"Total Collection"
],
"insight": {
"chartResponseMap" : "mcTotalCollection",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "year"
},
"_comment": " "
},
"mcCumulativeCollection": {
"chartName": "DSS_TOTAL_CUMULATIVE_COLLECTION",
"queries": [
{
"module": "COMMON",
"dateRefField": "dataObject.paymentDetails.receiptDate",
"requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\r\n \"module\" : \"dataObject.paymentDetails.businessService.keyword\", \n\"tenantId\" : \"dataObject.tenantId\"}",
"indexName": "dss-collection_v2",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"terms\":{\"dataObject.tenantId.keyword\":[\"pb.testing\",\"pb\"]}},{\"terms\":{\"dataObject.bill.status.keyword\":[\"Cancelled\"]}},{\"terms\":{\"dataObject.paymentDetails.businessService.keyword\":[\"TL\",\"PT\"]}}]}},\"aggs\":{\"Collections\":{\"date_histogram\":{\"field\":\"dataObject.paymentDetails.receiptDate\",\"interval\":\"intervalvalue\"},\"aggs\":{\"Sum\":{\"sum\":{\"field\":\"dataObject.paymentDetails.totalAmountPaid\"}}}}}}}}"
}
],
"chartType": "line",
"valueType": "amount",
"action": "",
"drillChart": "none",
"documentType": "_doc",
"aggregationPaths": [
"Collections"
],
"isCumulative": true,
"interval": "month",
"insight": {},
"_comment": " "
},
"mcTargetAchieved": {
"chartName": "DSS_TARGET_ACHIEVED",
"queries": [
{
"module": "COMMON",
"requestQueryMap": "{\r\n \"module\" : \"businessService.keyword\", \n\"tenantId\" : \"tenantIdForMunicipalCorporation\"}",
"dateRefField": "",
"indexName": "dss-target_v1",
"aggrQuery": "{\"aggs\":{\"Actual collection\":{\"sum\":{\"field\":\"budgetProposedForMunicipalCorporation\"}}}}"
},
{
"module": "COMMON",
"requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\r\n \"district\" : \"dataObject.tenantData.city.districtCode\", \"module\" : \"dataObject.paymentDetails.businessService.keyword\", \n\"tenantId\" : \"dataObject.tenantId\"}",
"dateRefField": "dataObject.paymentDetails.receiptDate",
"indexName": "dss-collection_v2",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"terms\":{\"dataObject.tenantId.keyword\":[\"pb.testing\",\"pb\"]}},{\"terms\":{\"dataObject.bill.status.keyword\":[\"Cancelled\"]}},{\"terms\":{\"dataObject.paymentDetails.businessService.keyword\":[\"TL\",\"PT\"]}}]}},\"aggs\":{\"Total Collection3\":{\"sum\":{\"field\":\"dataObject.paymentDetails.totalAmountPaid\"}}}}}}"
}
],
"chartType": "metric",
"valueType": "percentage",
"drillChart": "none",
"documentType": "_doc",
"action": "percentage",
"aggregationPaths": [
"Total Collection3",
"Actual collection"
],
"insight": {
"chartResponseMap": "targetAchieved",
"action": "differenceOfNumbers",
"upwardIndicator": "positive",
"downwardIndicator": "negative",
"textMessage": "$indicator$value% than last $insightInterval",
"colorCode": "#228B22",
"insightInterval": "month"
},
"_comment": " "
},
"mcTotalCollectionCategoryWise": {
"chartName": "DSS_MC_COLLECTION_CATEGORY_WISE",
"queries": [
{
"module": "COMMON",
"requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\"}",
"dateRefField": "dataObject.paymentDetails.receiptDate",
"indexName": "dss-collection_v2",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"terms\":{\"dataObject.tenantId.keyword\":[\"pb.testing\",\"pb\"]}},{\"terms\":{\"dataObject.bill.status.keyword\":[\"Cancelled\"]}},{\"terms\":{\"dataObject.paymentDetails.businessService.keyword\":[\"PT\",\"TL\"]}}]}},\"aggs\":{\"Business Service\":{\"terms\":{\"field\":\"dataObject.paymentDetails.businessService.keyword\",\"order\":{\"total\":\"desc\"}},\"aggs\":{\"total\":{\"sum\":{\"field\":\"dataObject.paymentDetails.totalAmountPaid\"}}}}}}}}"
}
],
"chartType": "pie",
"valueType": "amount",
"action": "",
"documentType": "_doc",
"drillChart": "none",
"aggregationPaths": [
"Business Service"
],
"insight": {},
"_comment": " "
},
"mcCollectionByPaymentType": {
"chartName": "DSS_MC_COLLECTION_BY_PAYMENT_TYPE",
"queries": [
{
"module": "COMMON",
"requestQueryMap": "{\"module\" : \"dataObject.paymentDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\"}",
"dateRefField": "dataObject.paymentDetails.receiptDate",
"indexName": "dss-collection_v2",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"terms\":{\"dataObject.tenantId.keyword\":[\"pb.testing\",\"pb\"]}},{\"terms\":{\"dataObject.bill.status.keyword\":[\"Cancelled\"]}},{\"terms\":{\"dataObject.paymentDetails.businessService.keyword\":[\"TL\",\"PT\"]}}]}},\"aggs\":{\"Payment Mode\":{\"terms\":{\"field\":\"dataObject.paymentMode.keyword\"},\"aggs\":{\"Total collection\":{\"sum\":{\"field\":\"dataObject.paymentDetails.totalAmountPaid\"}}}}}}}}"
}
],
"chartType": "pie",
"valueType": "amount",
"action": "",
"documentType": "_doc",
"drillChart": "none",
"aggregationPaths": [
"Payment Mode"
],
"insight": {},
"_comment": ""
},
"totalmcDDRRevenue": {
"chartName": "DSS_MC_KEY_FY_INDICATORS",
"queries": [
{
"module": "COMMON",
"requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\"}",
"dateRefField": "dataObject.paymentDetails.receiptDate",
"indexName": "dss-collection_v2",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"terms\":{\"dataObject.tenantId.keyword\":[\"pb.testing\",\"pb\"]}},{\"terms\":{\"dataObject.paymentDetails.bill.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.paymentDetails.totalAmountPaid\"}},\"Transactions\":{\"value_count\":{\"field\":\"dataObject.transactionNumber.keyword\"}}}}}}"
},
{
"module": "COMMON",
"requestQueryMap": "{\"module\" : \"businessService.keyword\", \"tenantId\" : \"tenantIdForMunicipalCorporation.keyword\"}",
"dateRefField": "",
"indexName": "dss-target_v1",
"aggrQuery": "{\"aggs\":{\"Target Collection\":{\"sum\":{\"field\":\"budgetProposedForMunicipalCorporation\"}}}}}}"
}
],
"isMdmsEnabled": true,
"filterKeys": [
{
"key": "Business Service",
"column": "Business Service"
}
],
"isPostResponseHandler": true,
"postAggregationTheory": "repsonseToDifferenceOfDates",
"chartType": "table",
"valueType": "number",
"drillChart": "totalmcBoundaryRevenue",
"documentType": "_doc",
"action": "",
"plotLabel": "Business Service",
"aggregationPaths": [
"Total Collection",
"Transactions",
"Target Collection"
],
"pathDataTypeMapping": [
{
"Total Collection": "amount"
},
{
"Transactions": "number"
},
{
"Target Collection": "amount"
}
],
"insight": {},
"_comment": ""
},
"totalmcBoundaryRevenue": {
"chartName": "DSS_MC_DEMAND_COLLECTION_BOUNDARY",
"queries": [
{
"module": "COMMON",
"requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\"}",
"dateRefField": "dataObject.paymentDetails.receiptDate",
"indexName": "dss-collection_v2",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"terms\":{\"dataObject.tenantId.keyword\":[\"pb.testing\",\"pb\"]}},{\"terms\":{\"dataObject.paymentDetails.bill.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"Business Service \":{\"terms\":{\"field\":\"dataObject.paymentDetails.businessService.keyword\",\"size\":2000,\"order\":{\"total\":\"asc\"}},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.paymentDetails.totalAmountPaid\"}},\"Transactions\":{\"value_count\":{\"field\":\"dataObject.transactionNumber.keyword\"}}}}}}}}"
},
{
"module": "COMMON",
"requestQueryMap": "{\"module\" : \"businessService.keyword\", \"tenantId\" : \"tenantIdForMunicipalCorporation.keyword\"}",
"dateRefField": "",
"indexName": "dss-target_v1",
"aggrQuery": "{\"aggs\":{\"Business Service \":{\"terms\":{\"field\":\"tenantIdForMunicipalCorporation.keyword\",\"size\":1000},\"aggs\":{\"Target Collection\":{\"sum\":{\"field\":\"budgetProposedForMunicipalCorporation\"}}}}}}"
}
],
"filterKeys": [
{
"key": "Business Service",
"column": "Business Service"
}
],
"postAggregationTheory": "repsonseToDifferenceOfDates",
"chartType": "table",
"valueType": "number",
"drillChart": "totalmcBoundaryDrillDown",
"documentType": "_doc",
"action": "",
"plotLabel": "Business Service",
"aggregationPaths": [
"Total Collection",
"Transactions",
"Target Collection"
],
"pathDataTypeMapping": [
{
"Total Collection": "amount"
},
{
"Transactions": "number"
},
{
"Target Collection": "amount"
}
],
"insight": {},
"_comment": ""
},
"totalmcBoundaryDrillDown": {
"chartName": "DSS_MC_DEMAND_COLLECTION_BOUNDARYDDR",
"queries": [
{
"module": "MC",
"requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\"}",
"dateRefField": "dataObject.paymentDetails.receiptDate",
"indexName": "dss-collection_v2",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"terms\":{\"dataObject.tenantId.keyword\":[\"pb.testing\",\"pb\"]}},{\"terms\":{\"dataObject.paymentDetails.bill.status.keyword\":[\"Cancelled\"]}},{\"terms\":{\"dataObject.paymentDetails.businessService.keyword\":[\"TL\",\"PT\"]}}]}},\"aggs\":{\"Business Service \":{\"terms\":{\"field\":\"dataObject.paymentDetails.businessService.keyword\",\"size\":200,\"order\":{\"Total Collection\":\"desc\"}},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.paymentDetails.totalAmountPaid\"}},\"Transactions\":{\"value_count\":{\"field\":\"dataObject.transactionNumber.keyword\"}}}}}}}}"
}
],
"postAggregationTheory": "repsonseToDifferenceOfDates",
"filterKeys": [
{"key": "businessService", "column": "Business Service"}
],
"chartType": "xtable",
"valueType": "number",
"drillChart": "none",
"documentType": "_doc",
"plotLabel": "Boundary",
"action": "",