Trade License - 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 the Trade License module.
Analytics: Microservice responsible for building, fetching, aggregating and computing the data on ElasticSearch into a consumable data response. This is used for visualizations and graphical representations.
Analytics Configurations: Analytics contains multiple configurations. Add the changes related to OBPS in this dashboard analytics.
Configuration file path: 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 data is fetched from different sources. In some cases, it is a combination of different data sources. The Chart API configuration document is used to configure each visualization and its properties.
The visualization code is the key whose properties are configured here. These properties are easily changeable.
Below is the sample ChartApiConfiguration.json data for the Trade License.
"tradeLicenseTodaysCollectionv2": {
"chartName": "DSS_TODAYS_COLLECTION",
"queries": [
{
"module": "COMMON",
"dateRefField": "date",
"requestQueryMap": "{\"state\" : \"state.keyword\",\"ulb\" : \"ulb.keyword\"}",
"indexName": "tl-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must\":[{\"range\":{\"date\":{\"gt\":\"now-1d\/d\",\"lte\":\"now\"}}}]}},\"aggs\":{\"Todays Collection\":{\"sum\":{\"field\":\"todaysCollectionForTradeType\"}}}}}}"
}
],
"chartType": "metric",
"valueType": "Amount",
"drillChart": "none",
"documentType": "_doc",
"action": "",
"aggregationPaths": [
"Todays Collection"
],
"insight": {
"chartResponseMap" : "tradeLicenseTodaysCollectionv2",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "month"
},
"_comment": " "
},
"tradeLicenseTotalCollectionv2": {
"chartName": "DSS_TOTAL_COLLECTION",
"queries": [
{
"module": "COMMON",
"dateRefField": "date",
"requestQueryMap": "{\"state\" : \"state.keyword\",\"tenantId\" : \"ulb.keyword\"}",
"indexName": "tl-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{}},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"todaysCollectionForTradeType\"}}}}}}"
}
],
"chartType": "metric",
"valueType": "Amount",
"drillChart": "none",
"documentType": "_doc",
"action": "",
"aggregationPaths": [
"Total Collection"
],
"insight": {
"chartResponseMap" : "tradeLicenseTotalCollectionv2",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "year"
},
"_comment": " "
},
"totalLicensesIssuedv2": {
"chartName": "DSS_TOTAL_LICENSES",
"queries": [
{
"module": "COMMON",
"dateRefField": "date",
"requestQueryMap": "{\"state\" : \"state.keyword\",\"tenantId\" : \"ulb.keyword\"}",
"indexName": "tl-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{}},\"aggs\":{\"Total Licenses\":{\"sum\":{\"field\":\"todaysTradeLicensesForStatus\"}}}}}}"
}
],
"chartType": "metric",
"valueType": "number",
"drillChart": "none",
"documentType": "_doc",
"action": "",
"aggregationPaths": [
"Total Licenses"
],
"insight": {
"chartResponseMap" : "totalLicensesIssuedv2",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "year"
}
},
"tlMonthlyCumulativeCollectionv2": {
"chartName": "DSS_TL_MONTHLY_CUMULATIVE",
"queries": [
{
"module": "COMMON",
"dateRefField": "date",
"requestQueryMap": "{\"state\" : \"state.keyword\",\"tenantId\" : \"ulb.keyword\"}",
"indexName": "tl-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[]}},\"aggs\":{\"Collections\":{\"date_histogram\":{\"field\":\"date\",\"interval\":\"month\"},\"aggs\":{\"Sum\":{\"sum\":{\"field\":\"todaysCollectionForTradeType\"}}}}}}}}"
}
],
"chartType": "line",
"valueType": "amount",
"action": "",
"drillChart": "none",
"documentType": "_doc",
"aggregationPaths": [
"Collections"
],
"isCumulative": true,
"interval": "month",
"insight": {},
"_comment": " "
},
"totalTransactionsv2": {
"chartName": "DSS_TOTAL_TRANSACTIONS",
"queries": [
{
"module": "COMMON",
"dateRefField": "date",
"requestQueryMap": "{\"state\" : \"state.keyword\",\"tenantId\" : \"ulb.keyword\"}",
"indexName": "tl-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{}},\"aggs\":{\"state\":{\"terms\":{\"field\":\"state.keyword\"},\"aggs\":{\"intermediateAggrULB\":{\"terms\":{\"field\":\"ulb.keyword\"},\"aggs\":{\"intermediateAggrWard\":{\"terms\":{\"field\":\"ward.keyword\"},\"aggs\":{\"days\":{\"terms\":{\"field\":\"date\"},\"aggs\":{\"applications\":{\"avg\":{\"field\":\"transactions\"}}}},\"wardapplications\":{\"sum_bucket\":{\"buckets_path\":\"days.applications\"}}}},\"ulbApplications\":{\"sum_bucket\":{\"buckets_path\":\"intermediateAggrWard.wardapplications\"}}}},\"stateApplications\":{\"sum_bucket\":{\"buckets_path\":\"intermediateAggrULB.ulbApplications\"}}}},\"Total Transactions\":{\"sum_bucket\":{\"buckets_path\":\"state.stateApplications\"}}}}}}"
}
],
"chartType": "metric",
"valueType": "number",
"drillChart": "none",
"documentType": "_doc",
"action": "",
"aggregationPaths": [
"Total Transactions"
],
"insight": {
"chartResponseMap" : "totalTransactionsv2",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "year"
}
},
"totalApplicationsv2": {
"chartName": "DSS_TOTAL_APPLICATIONS",
"queries": [
{
"module": "COMMON",
"dateRefField": "date",
"requestQueryMap": "{\"state\" : \"state.keyword\",\"tenantId\" : \"ulb.keyword\"}",
"indexName": "tl-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{}},\"aggs\":{\"state\":{\"terms\":{\"field\":\"state.keyword\"},\"aggs\":{\"intermediateAggrULB\":{\"terms\":{\"field\":\"ulb.keyword\"},\"aggs\":{\"intermediateAggrWard\":{\"terms\":{\"field\":\"ward.keyword\"},\"aggs\":{\"days\":{\"terms\":{\"field\":\"date\"},\"aggs\":{\"applications\":{\"avg\":{\"field\":\"todaysApplications\"}}}},\"wardapplications\":{\"sum_bucket\":{\"buckets_path\":\"days.applications\"}}}},\"ulbApplications\":{\"sum_bucket\":{\"buckets_path\":\"intermediateAggrWard.wardapplications\"}}}},\"stateApplications\":{\"sum_bucket\":{\"buckets_path\":\"intermediateAggrULB.ulbApplications\"}}}},\"Total Applications\":{\"sum_bucket\":{\"buckets_path\":\"state.stateApplications\"}}}}}}"
}
],
"chartType": "metric",
"valueType": "number",
"drillChart": "none",
"documentType": "_doc",
"action": "",
"aggregationPaths": [
"Total Applications"
],
"insight": {
"chartResponseMap" : "totalApplicationsv2",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "year"
}
},
"tlCollectionByTradeTypev2": {
"chartName": "DSS_TL_COLLECTION_BY_TRADE_TYPE",
"queries": [
{
"module": "COMMON",
"dateRefField": "date",
"requestQueryMap": "{\"state\" : \"state.keyword\",\"tenantId\" : \"ulb.keyword\"}",
"indexName": "tl-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[]}},\"aggs\":{\"Trade Type\":{\"terms\":{\"field\":\"tradeType.keyword\"},\"aggs\":{\"Total collection\":{\"sum\":{\"field\":\"todaysCollectionForTradeType\"}}}}}}}}"
}
],
"chartType": "pie",
"valueType": "amount",
"drillChart": "none",
"documentType": "_doc",
"action": "",
"aggregationPaths": [
"Trade Type"
],
"insight": {
},
"_comment": " "
},
"tlTradeLicenseByStatusv2": {
"chartName": "DSS_TL_COLLECTION_BY_TRADE_TYPE",
"queries": [
{
"module": "COMMON",
"dateRefField": "date",
"requestQueryMap": "{\"state\" : \"state.keyword\",\"tenantId\" : \"ulb.keyword\"}",
"indexName": "tl-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[]}},\"aggs\":{\"Status\":{\"terms\":{\"field\":\"status.keyword\"},\"aggs\":{\"Total Licenses\":{\"sum\":{\"field\":\"todaysTradeLicensesForStatus\"}}}}}}}}"
}
],
"chartType": "pie",
"valueType": "number",
"drillChart": "none",
"documentType": "_doc",
"action": "",
"aggregationPaths": [
"Status"
],
"insight": {
},
"_comment": " "
},
"tlTargetAchieved": {
"chartName": "DSS_TARGET_ACHIEVED",
"queries": [
{
"module": "COMMON",
"requestQueryMap": "{\"state\" : \"state.keyword\",\"ulb\" : \"ulb.keyword\"}",
"dateRefField": "date",
"indexName": "master-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"term\":{\"module.keyword\":\"TL\"}},\"aggs\":{\"Target Collection\":{\"sum\":{\"field\":\"budgetProposedForMunicipalCorporation\"}}}}}}"
},
{
"module": "COMMON",
"dateRefField": "date",
"requestQueryMap": "{\"state\" : \"state.keyword\",\"ulb\" : \"ulb.keyword\"}",
"indexName": "tl-national-dashboard",
"aggrQuery": "{\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"todaysCollectionForTradeType\"}}}}"
}
],
"chartType": "metric",
"valueType": "percentage",
"drillChart": "none",
"documentType": "_doc",
"action": "percentage",
"isRoundOff": true,
"preActionTheory":{
"Target Collection":"repsonseToDifferenceOfDates"
},
"aggregationPaths": [
"Total Collection",
"Target Collection"
],
"insight": {
"chartResponseMap" : "tlTargetAchieved",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "year",
"isRoundOff": true
},
"_comment": " "
},
"tlTargetCollection": {
"chartName": "DSS_TARGET_COLLECTION",
"queries": [
{
"module": "COMMON",
"requestQueryMap": "{\"state\" : \"state.keyword\", \"ulb\" : \"ulb.keyword\"}",
"dateRefField": "date",
"indexName": "master-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"term\":{\"module.keyword\":\"TL\"}},\"aggs\":{\"Target Collection\":{\"sum\":{\"field\":\"budgetProposedForMunicipalCorporation\"}}}}}}"
}
],
"chartType": "metric",
"valueType": "amount",
"action": "",
"drillChart": "none",
"documentType": "_doc",
"aggregationPaths": [
"Target Collection"
],
"isDayUnit": true,
"postAggregationTheory" : "repsonseToDifferenceOfDates",
"insight": {
},
"_comment": " "
},
"tlTopPerformingUlbs": {