State DSS - OBPS
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 OBPS.
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 OBPS 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 OBPS successfully.
Chart API Configuration
Master Dashboard Configuration
Role Dashboard Mappings 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, visualization code, which happens to be the key, will have its properties configured as a part of the configuration and easily changeable.
Below is the sample ChartApiConfiguration.json data for the OBPS.
"bpaTodaysCollection": {
"chartName": "DSS_BPA_TODAYS_COLLECTION",
"queries": [
{
"module": "BPA",
"indexName": "dss-collection_v2",
"aggrQuery": "{ \"aggs\": { \"AGGR\": { \"filter\": { \"bool\": { \"must\": [ { \"range\": { \"dataObject.paymentDetails.receiptDate\": { \"gte\": \"now-24h\", \"lte\": \"now\" } } }, { \"terms\": { \"dataObject.paymentDetails.businessService.keyword\": [ \"BPA.LOW_RISK_PERMIT_FEE\",\"BPA.NC_APP_FEE\",\"BPA.NC_OC_APP_FEE\" ] } } ], \"must_not\": [ { \"term\": { \"dataObject.tenantId.keyword\": \"pb.testing\" } }, { \"term\": { \"dataObject.paymentStatus.keyword\": \"Cancelled\" } } ] } }, \"aggs\": { \"Today's Collection\": { \"sum\": { \"field\": \"dataObject.paymentDetails.totalAmountPaid\" } } } } } }",
"requestQueryMap":"{\"wardId\" : \"dataObject.ward.name.keyword\",\"module\" : \"dataObject.paymentDetails.businessService.keyword\",\"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.city.districtCode\" }",
"dateRefField": ""
}
],
"chartType": "metric",
"valueType": "amount",
"action": "",
"drillChart": "none",
"aggregationPaths": [
"Today's Collection"
],
"insight": {
},
"_comment": "BPA Today's collections "
},
"bpaTotalCollection": {
"chartName": "DSS_BPA_TOTAL_COLLECTION",
"queries": [
{
"module": "BPA",
"indexName": "dss-collection_v2",
"aggrQuery": " { \"aggs\": { \"AGGR\": { \"filter\": { \"bool\": { \"must\": [ { \"terms\": { \"dataObject.paymentDetails.businessService.keyword\": [ \"BPA.LOW_RISK_PERMIT_FEE\",\"BPA.NC_APP_FEE\",\"BPA.NC_OC_APP_FEE\" ] } } ], \"must_not\": [ { \"term\": { \"dataObject.tenantId.keyword\": \"pb.testing\" } }, { \"term\": { \"dataObject.paymentStatus.keyword\": \"Cancelled\" } } ] } }, \"aggs\": { \"Total Collection\": { \"sum\": { \"field\": \"dataObject.paymentDetails.totalAmountPaid\" } } } } } } ",
"requestQueryMap":"{\"wardId\" : \"dataObject.ward.name.keyword\",\"module\" : \"dataObject.paymentDetails.businessService.keyword\",\"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.city.districtCode\" }",
"dateRefField": "dataObject.paymentDetails.receiptDate"
}
],
"translateTenantCode": false,
"chartType": "metric",
"valueType": "amount",
"action": "",
"drillChart": "none",
"aggregationPaths": [
"Total Collection"
],
"insight": {
"chartResponseMap" : "bpaTotalCollection",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "year",
"isRoundOff": true
},
"_comment": "BPA total collections "
},
"bpaTotalPlansScrutinized": {
"chartName": "DSS_BPA_TOTAL_PLANS_SCRUTINIZED",
"queries": [
{
"module": "OBPS",
"requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\",\"tenantId\" : \"Data.tenantId\" \r\n}",
"dateRefField": "Data.@timestamp",
"indexName": "edcr-index",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}],\"must\":[{\"terms\":{\"Data.applicationType.keyword\":[\"PERMIT\",\"OCCUPANCY_CERTIFICATE\"]}}]}},\"aggs\":{\"Total Plans Scrutnized\":{\"value_count\":{\"field\":\"Data.dcrNumber.keyword\"}}}}}}"
}
],
"chartType": "metric",
"valueType": "number",
"drillChart": "none",
"documentType": "_doc",
"action": "",
"aggregationPaths": [
"Total Plans Scrutnized"
],
"insight": {
"chartResponseMap" : "bpaTotalPlansScrutinized",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "year",
"isRoundOff": true
},
"_comment": " Total Number of Complaints "
},
"bpaTotalApplicationsSubmitted": {
"chartName": "DSS_BPA_TOTAL_APPLICATIONS_SUBMITTED",
"queries": [
{
"module": "OBPS",
"indexName": "bpa-index",
"aggrQuery": "{ \"aggs\": { \"AGGR\": { \"filter\": { \"bool\": { \"must_not\": [ { \"term\": { \"Data.tenantId.keyword\": \"pb.testing\" } } ], \"must\": [ { \"terms\": { \"Data.businessService.keyword\": [\"BPA\",\"BPA_LOW\"] } } ] } }, \"aggs\": { \"Total Applications\": { \"value_count\": { \"field\": \"Data.applicationNo.keyword\" } } } } }} ",
"requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\",\"tenantId\" : \"Data.tenantId\" \r\n}",
"dateRefField": "Data.@timestamp"
}
],
"translateTenantCode": false,
"chartType": "metric",
"valueType": "number",
"action": "",
"drillChart": "none",
"aggregationPaths": [
"Total Applications"
],
"insight": {
"chartResponseMap" : "bpaTotalApplicationsSubmitted",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "year",
"isRoundOff": true
},
"_comment": "BPA Total Applications"
},
"bpaTotalPermitsIssued": {
"chartName": "DSS_BPA_TOTAL_PERMITS_ISSUED",
"queries": [
{
"module": "OBPS",
"indexName": "bpa-index",
"requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\",\"tenantId\" : \"Data.tenantId\" \r\n}",
"aggrQuery": "{ \"aggs\": { \"AGGR\": { \"filter\": { \"bool\": { \"must_not\": [ { \"term\": { \"Data.tenantId.keyword\": \"pb.testing\" } } ], \"must\": [ { \"term\": { \"Data.status.keyword\": \"APPROVED\" } }, { \"terms\": { \"Data.businessService.keyword\": [\"BPA\",\"BPA_LOW\"] } } ] } }, \"aggs\": { \"Total Permits Issued\": { \"value_count\": { \"field\": \"Data.applicationNo.keyword\" } } } } } }",
"dateRefField": "Data.@timestamp"
}
],
"translateTenantCode": false,
"chartType": "metric",
"valueType": "number",
"action": "",
"drillChart": "none",
"aggregationPaths": [
"Total Permits Issued"
],
"insight": {
"chartResponseMap" : "bpaTotalPermitsIssued",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "year",
"isRoundOff": true
},
"_comment": "Total Permits Issued"
},
"bpaTotalLandApplied": {
"chartName": "DSS_BPA_TOTAL_LAND_APPLIED",
"queries": [
{
"module": "OBPS",
"indexName": "bpa-index",
"requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\",\"tenantId\" : \"Data.tenantId\" \r\n}",
"aggrQuery":"{ \"aggs\": { \"AGGR\": { \"filter\": { \"bool\": { \"must_not\": [ { \"term\": { \"Data.tenantId.keyword\": \"pb.testing\" } } ], \"must\": [ { \"terms\": { \"Data.businessService.keyword\": [\"BPA\",\"BPA_LOW\",\"BPA_OC\"] } } ] } }, \"aggs\": { \"Total Land Applied\": { \"sum\": { \"field\": \"Data.plotArea\" } } } } } }",
"dateRefField": "Data.@timestamp"
}
],
"translateTenantCode": false,
"chartType": "metric",
"valueType": "number",
"action": "",
"drillChart": "none",
"aggregationPaths": [
"Total Land Applied"
],
"insight": {
"chartResponseMap" : "bpaTotalLandApplied",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "year",
"isRoundOff": true
},
"_comment": "Total Land Applied"
},
"bpaAverageDaysToIssuePermit": {
"chartName": "DSS_BPA_AVERAGE_DAYS_ISSUE_PERMIT",
"queries": [
{
"module": "OBPS",
"indexName": "bpa-index",
"requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\",\"tenantId\" : \"Data.tenantId\" \r\n}",
"aggrQuery":"{ \"aggs\": { \"BPA\": { \"filter\": { \"bool\": { \"must_not\": [ { \"term\": { \"Data.tenantId.keyword\": \"pb.testing\" } } ] } }, \"aggs\": { \"Average days to issue Permit\": { \"filter\": { \"bool\": { \"must\": [ { \"terms\": { \"Data.businessService.keyword\": [\"BPA\",\"BPA_LOW\"] } }, { \"term\": { \"Data.status.keyword\": \"APPROVED\" } } ] } }, \"aggs\": { \"average_days\": { \"avg\": { \"script\": { \"source\": \"(doc['Data.auditDetails.lastModifiedTime'].value-doc['Data.auditDetails.createdTime'].value)/(86400*1000)\" } } } } } } } } }",
"dateRefField": "Data.@timestamp"
}
],
"translateTenantCode": false,
"chartType": "metric",
"valueType": "number",
"action": "",
"drillChart": "none",
"aggregationPaths": [
"Average days to issue Permit"
],
"insight": {
"chartResponseMap" : "bpaAverageDaysToIssuePermit",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "year",
"isRoundOff": true
},
"_comment": "Average days to issue Permit"
},
"bpaSLACompliance": {
"chartName": "DSS_BPA_SLA_COMPLIANCE",
"queries": [
{
"module": "OBPS",
"indexName": "bpa-index",
"requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\",\"tenantId\" : \"Data.tenantId\" \r\n}",
"aggrQuery":"{ \"aggs\": { \"BPA\": { \"filter\": { \"bool\": { \"must_not\": [ { \"term\": { \"Data.tenantId.keyword\": \"pb.testing\" } } ] } }, \"aggs\": { \"SLA Compliance Permit\": { \"filter\": { \"bool\": { \"must\": [ { \"terms\": { \"Data.businessService.keyword\": [\"BPA\",\"BPA_LOW\"] } }, { \"term\": { \"Data.status.keyword\": \"APPROVED\" } }, { \"script\": { \"script\": { \"source\": \"doc['Data.auditDetails.lastModifiedTime'].value-doc['Data.auditDetails.createdTime'].value<params.threshold\", \"lang\": \"painless\", \"params\": { \"threshold\": 172800000 } } } } ] } } } } } } }",
"dateRefField": "Data.@timestamp"
}
],
"translateTenantCode": false,
"chartType": "metric",
"valueType": "number",
"action": "",
"drillChart": "none",
"aggregationPaths": [
"SLA Compliance Permit"
],
"insight": {
"chartResponseMap" : "bpaSLACompliance",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "year",
"isRoundOff": true
},
"_comment": "SLA Compliance (Permit)"
},
"bpaAverageDaysToIssueOC": {
"chartName": "DSS_BPA_AVERAGE_DAYS_ISSUE_OC",
"queries": [
{
"module": "OBPS",
"indexName": "bpa-index",
"requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\",\"tenantId\" : \"Data.tenantId\" \r\n}",
"aggrQuery":"{ \"aggs\": { \"BPA\": { \"filter\": { \"bool\": { \"must_not\": [ { \"term\": { \"Data.tenantId.keyword\": \"pb.testing\" } } ] } }, \"aggs\": { \"Average days to issue OC\": { \"filter\": { \"bool\": { \"must\": [ { \"term\": { \"Data.businessService.keyword\": \"BPA_OC\" } }, { \"term\": { \"Data.status.keyword\": \"APPROVED\" } } ] } }, \"aggs\": { \"average_days\": { \"avg\": { \"script\": { \"source\": \"(doc['Data.auditDetails.lastModifiedTime'].value-doc['Data.auditDetails.createdTime'].value)/(86400*1000)\" } } } } } } } } }",
"dateRefField": "Data.@timestamp"
}
],
"translateTenantCode": false,
"chartType": "metric",
"valueType": "number",
"action": "",
"drillChart": "none",
"aggregationPaths": [
"Average days to issue OC"
],
"insight": {
"chartResponseMap" : "bpaAverageDaysToIssueOC",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "year",
"isRoundOff": true
},
"_comment": "Average days to issue OC"
},
"bpaSLAComplianceOC": {
"chartName": "DSS_BPA_SLA_COMPLIANCE_OC",
"queries": [
{
"module": "OBPS",
"indexName": "bpa-index",
"requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\",\"tenantId\" : \"Data.tenantId\" \r\n}",
"aggrQuery":"{ \"aggs\": { \"BPA\"