mCollect National Dashboard
Technical Doc
Technical Doc
NDSS has two sides to it. One is the process in which the data is pooled to the 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. This ensures that the process can be configured easily in case a new scenario is introduced.
This document walks us through the steps on how to define the configurations for DSS analytics for mCollect module.
Analytics: Microservice responsible for building, fetching, aggregating and computing the data on ElasticSearch into consumable data Response. This is used for visualizations and graphical representations.
Analytics Configurations: Analytics contains multiple configurations. Add the changes related to National-Dashboard in the dashboard-analytics configuration here. 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 the National Dashboard successfully.
Chart API Configuration
Master Dashboard Configuration
Role Dashboard Mappings Configuration
Chart API Configuration: Each Visualization has its own properties. The visualization is assembled from different data sources (Sometimes it is a combination of multiple data sources).
The Chart API configuration document is used to configure each visualisation and its properties.
In this, Visualisation Code, which happens to be the key, will be having its properties configured as a part of the configuration and are easily changeable.
Sample ChartApiConfiguration.json data for mCollect
"mCollectTodaysCollectionv2": {
"chartName": "DSS_TODAYS_COLLECTION",
"queries": [
{
"module": "COMMON",
"dateRefField": "",
"requestQueryMap": "{\"state\" : \"state.keyword\",\"ulb\" : \"ulb.keyword\"}",
"indexName": "mcollect-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must\":[{\"range\":{\"date\":{\"gt\":\"now-1d\/d\",\"lte\":\"now\"}}}]}},\"aggs\":{\"Todays Collection\":{\"sum\":{\"field\":\"todaysCollectionForPaymentMode\"}}}}}}"
}
],
"chartType": "metric",
"valueType": "Amount",
"drillChart": "none",
"documentType": "_doc",
"action": "",
"aggregationPaths": [
"Todays Collection"
],
"insight": {
"chartResponseMap" : "mCollectTodaysCollectionv2",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "month"
},
"_comment": " "
},
"mCollectTotalCollectionv2": {
"chartName": "DSS_TOTAL_COLLECTION",
"queries": [
{
"module": "COMMON",
"dateRefField": "date",
"requestQueryMap": "{\"state\" : \"state.keyword\",\"tenantId\" : \"ulb.keyword\"}",
"indexName": "mcollect-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{}},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"todaysCollectionForPaymentMode\"}}}}}}"
}
],
"chartType": "metric",
"valueType": "Amount",
"drillChart": "none",
"documentType": "_doc",
"action": "",
"aggregationPaths": [
"Total Collection"
],
"insight": {
"chartResponseMap" : "mCollectTotalCollectionv2",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "year"
},
"_comment": " "
},
"mCollectTotalChallansv2": {
"chartName": "DSS_TOTAL_CHALLANS",
"queries": [
{
"module": "COMMON",
"dateRefField": "date",
"requestQueryMap": "{\"state\" : \"state.keyword\",\"tenantId\" : \"ulb.keyword\"}",
"indexName": "mcollect-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{}},\"aggs\":{\"Total Challans\":{\"sum\":{\"field\":\"numberOfChallansForChallanStatus\"}}}}}}"
}
],
"chartType": "metric",
"valueType": "number",
"drillChart": "none",
"documentType": "_doc",
"action": "",
"aggregationPaths": [
"Total Challans"
],
"insight": {
"chartResponseMap" : "mCollectTotalChallansv2",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "year"
},
"_comment": " "
},
"mCollectTotalReceiptsv2": {
"chartName": "DSS_TOTAL_RECEIPTS",
"queries": [
{
"module": "COMMON",
"dateRefField": "date",
"requestQueryMap": "{\"state\" : \"state.keyword\",\"tenantId\" : \"ulb.keyword\"}",
"indexName": "mcollect-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{}},\"aggs\":{\"Total Receipts\":{\"sum\":{\"field\":\"numberOfReceiptsForPaymentMode\"}}}}}}"
}
],
"chartType": "metric",
"valueType": "number",
"drillChart": "none",
"documentType": "_doc",
"action": "",
"aggregationPaths": [
"Total Receipts"
],
"insight": {
"chartResponseMap" : "mCollectTotalReceiptsv2",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "year"
},
"_comment": " "
},
"mCollectTotalCategoriesv2": {
"chartName": "DSS_TOTAL_CATEGORIES",
"queries": [
{
"module": "COMMON",
"dateRefField": "date",
"requestQueryMap": "{\"state\" : \"state.keyword\",\"tenantId\" : \"ulb.keyword\"}",
"indexName": "mcollect-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{}},\"aggs\":{\"Total Categories\":{\"cardinality\":{\"field\":\"category.keyword\"}}}}}}"
}
],
"chartType": "metric",
"valueType": "number",
"drillChart": "none",
"documentType": "_doc",
"action": "",
"aggregationPaths": [
"Total Categories"
],
"insight": {
"chartResponseMap" : "mCollectTotalCategoriesv2",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "month"
},
"_comment": " "
},
"mcCollectionByPaymentModev2": {
"chartName": "DSS_MC_COLLECTION_BY_PAYMENT_MODE",
"queries": [
{
"module": "COMMON",
"dateRefField": "date",
"requestQueryMap": "{\"state\" : \"state.keyword\",\"tenantId\" : \"ulb.keyword\"}",
"indexName": "mcollect-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[]}},\"aggs\":{\"Payment Mode\":{\"terms\":{\"field\":\"paymentMode.keyword\"},\"aggs\":{\"Total collection\":{\"sum\":{\"field\":\"todaysCollectionForPaymentMode\"}}}}}}}}"
}
],
"chartType": "pie",
"valueType": "amount",
"drillChart": "none",
"documentType": "_doc",
"action": "",
"aggregationPaths": [
"Payment Mode"
],
"insight": {
},
"_comment": " "
},
"mcRceiptsByPaymentModev2": {
"chartName": "DSS_MC_RECEIPTS_BY_PAYMENT_MODE",
"queries": [
{
"module": "COMMON",
"dateRefField": "date",
"requestQueryMap": "{\"state\" : \"state.keyword\",\"tenantId\" : \"ulb.keyword\"}",
"indexName": "mcollect-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[]}},\"aggs\":{\"Payment Mode\":{\"terms\":{\"field\":\"paymentMode.keyword\"},\"aggs\":{\"Total Receipts\":{\"sum\":{\"field\":\"numberOfReceiptsForPaymentMode\"}}}}}}}}"
}
],
"chartType": "pie",
"valueType": "number",
"drillChart": "none",
"documentType": "_doc",
"action": "",
"aggregationPaths": [
"Payment Mode"
],
"insight": {
},
"_comment": " "
},
"mcMonthlyCumulativeCollectionv2": {
"chartName": "DSS_MC_MONTHLY_CUMULATIVE",
"queries": [
{
"module": "COMMON",
"dateRefField": "date",
"requestQueryMap": "{\"state\" : \"state.keyword\",\"tenantId\" : \"ulb.keyword\"}",
"indexName": "mcollect-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[]}},\"aggs\":{\"Collections\":{\"date_histogram\":{\"field\":\"date\",\"interval\":\"intervalvalue\"},\"aggs\":{\"Sum\":{\"sum\":{\"field\":\"todaysCollectionForPaymentMode\"}}}}}}}}"
}
],
"chartType": "line",
"valueType": "amount",
"action": "",
"drillChart": "none",
"documentType": "_doc",
"aggregationPaths": [
"Collections"
],
"isCumulative": true,
"interval": "month",
"insight": {},
"_comment": " "
},
"mcCollectionByStatusv2": {
"chartName": "DSS_MC_COLLECTION_BY_STATUS",
"queries": [
{
"module": "COMMON",
"dateRefField": "date",
"requestQueryMap": "{\"state\" : \"state.keyword\",\"tenantId\" : \"ulb.keyword\"}",
"indexName": "mcollect-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[]}},\"aggs\":{\"Collection Status\":{\"terms\":{\"field\":\"status.keyword\"},\"aggs\":{\"Total collection\":{\"sum\":{\"field\":\"todaysCollectionForStatus\"}}}}}}}}"
}
],
"chartType": "pie",
"valueType": "amount",
"drillChart": "none",
"documentType": "_doc",
"action": "",
"aggregationPaths": [
"Collection Status"
],
"insight": {
},
"_comment": " "
},
"mcChallanByStatusv2": {
"chartName": "DSS_MC_CHALLAN_BY_STATUS",
"queries": [
{
"module": "COMMON",
"dateRefField": "date",
"requestQueryMap": "{\"state\" : \"state.keyword\",\"tenantId\" : \"ulb.keyword\"}",
"indexName": "mcollect-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[]}},\"aggs\":{\"Challan Status\":{\"terms\":{\"field\":\"challanStatus.keyword\"},\"aggs\":{\"Total collection\":{\"sum\":{\"field\":\"numberOfChallansForChallanStatus\"}}}}}}}}"
}
],
"chartType": "pie",
"valueType": "number",
"drillChart": "none",
"documentType": "_doc",
"action": "",
"aggregationPaths": [
"Challan Status"
],
"insight": {
},
"_comment": " "
},
"mcReceiptsByStatusv2": {
"chartName": "DSS_MC_RECEIPTS_BY_STATUS",
"queries": [
{
"module": "COMMON",
"dateRefField": "date",
"requestQueryMap": "{\"state\" : \"state.keyword\",\"tenantId\" : \"ulb.keyword\"}",
"indexName": "mcollect-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[]}},\"aggs\":{\"Receipts Status\":{\"terms\":{\"field\":\"status.keyword\"},\"aggs\":{\"Total collection\":{\"sum\":{\"field\":\"numberOfReceiptsForStatus\"}}}}}}}}"
}
],
"chartType": "pie",
"valueType": "number",
"drillChart": "none",
"documentType": "_doc",
"action": "",
"aggregationPaths": [
"Receipts Status"
],
"insight": {
},
"_comment": " "
},
"mcCollectionCategoryWisev2": {
"chartName": "DSS_MC_COLLECTION_CATEGORY_WISE",
"queries": [
{
"module": "COMMON",
"dateRefField": "date",
"requestQueryMap": "{\"state\" : \"state.keyword\",\"tenantId\" : \"ulb.keyword\"}",
"indexName": "mcollect-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[]}},\"aggs\":{\"Business Service\":{\"terms\":{\"field\":\"category.keyword\",\"order\":{\"total\":\"desc\"}},\"aggs\":{\"total\":{\"sum\":{\"field\":\"todaysCollectionForCategory\"}}}}}}}}"
}
],
"chartType": "pie",
"valueType": "amount",
"action": "",
"documentType": "_doc",
"drillChart": "none",