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, then 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 FireNoc.
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, has its properties configured as a part of the configuration and are easily changeable.
Here is the sample ChartApiConfiguration.json data for the FireNoc.
Copy "nocTodaysCollection": {
"chartName": "DSS_NOC_TODAYS_COLLECTION",
"queries": [
{
"module": "FIRENOC",
"indexName": "dss-collection_v2",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must\":[{\"terms\":{\"dataObject.paymentDetails.businessService.keyword\":[\"FIRENOC\"]}},{\"range\":{\"dataObject.paymentDetails.receiptDate\":{\"gte\":\"now-24h\",\"lte\":\"now\"}}}],\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"term\":{\"dataObject.paymentStatus.keyword\":\"Cancelled\"}}]}},\"aggs\":{\"Todays 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": [
"Todays Collection"
],
"insight": {
},
"_comment": "FIRE NOC todays collections "
},
"nocTotalCollection": {
"chartName": "DSS_NOC_TOTAL_COLLECTION",
"queries": [
{
"module": "FIRENOC",
"indexName": "dss-collection_v2",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must\":[{\"terms\":{\"dataObject.paymentDetails.businessService.keyword\":[\"FIRENOC\"]}}],\"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"
}
],
"chartType": "metric",
"valueType": "amount",
"action": "",
"drillChart": "none",
"aggregationPaths": [
"Total Collection"
],
"insight": {
"chartResponseMap" : "nocTotalCollection",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "year",
"isRoundOff": true
},
"_comment": "FIRE NOC total collections "
},
"nocTotalApplications": {
"chartName": "DSS_NOC_TOTAL_APPLICATIONS",
"queries": [
{
"module": "FIRENOC",
"indexName": "firenoc-services",
"aggrQuery": "{\"aggs\":{\"FireNOC\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Total Applications\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}}}}",
"requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\",\"tenantId\" : \"Data.tenantId\", \"district\" : \"Data.tenantData.city.districtCode\"}",
"dateRefField": "Data.auditDetails.createdTime"
}
],
"chartType": "metric",
"valueType": "number",
"action": "",
"drillChart": "none",
"aggregationPaths": [
"Total Applications"
],
"insight": {
"chartResponseMap" : "nocTotalApplications",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "year"
},
"_comment": "FIRE NOC total applications "
},
"nocProvisionalIssued": {
"chartName": "DSS_NOC_PROVISIONAL_ISSUED",
"queries": [
{
"module": "FIRENOC",
"indexName": "firenoc-services",
"aggrQuery": "{\"aggs\":{\"FireNOC\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Provisional Fire Nocs issued\":{\"filter\":{\"bool\":{\"must\":[{\"term\":{\"Data.fireNOCDetails.fireNOCType.keyword\":\"PROVISIONAL\"}}]}}}}}}}",
"requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\",\"tenantId\" : \"Data.tenantId\", \"district\" : \"Data.tenantData.city.districtCode\"}",
"dateRefField": "Data.auditDetails.createdTime"
}
],
"chartType": "metric",
"valueType": "number",
"action": "",
"drillChart": "none",
"aggregationPaths": [
"Provisional Fire Nocs issued"
],
"insight": {
"chartResponseMap" : "nocProvisionalIssued",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "year"
},
"_comment": "FIRE NOC Provisional Issued"
},
"nocActualIssued": {
"chartName": "DSS_NOC_ACTUAL_ISSUED",
"queries": [
{
"module": "FIRENOC",
"indexName": "firenoc-services",
"aggrQuery": "{\"aggs\":{\"FireNOC\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Actual Fire Nocs issued\":{\"filter\":{\"bool\":{\"must\":[{\"term\":{\"Data.fireNOCDetails.fireNOCType.keyword\":\"NEW\"}}]}}}}}}}",
"requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\",\"tenantId\" : \"Data.tenantId\", \"district\" : \"Data.tenantData.city.districtCode\"}",
"dateRefField": "Data.auditDetails.createdTime"
}
],
"chartType": "metric",
"valueType": "number",
"action": "",
"drillChart": "none",
"aggregationPaths": [
"Actual Fire Nocs issued"
],
"insight": {
"chartResponseMap" : "nocActualIssued",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "year"
},
"_comment": "Actual fire nocs Issued"
},
"nocAverageDaysToIssueProvisional": {
"chartName": "DSS_NOC_AVERAGE_DAYS_TO_ISSUE_PROVISIONAL",
"queries": [
{
"module": "FIRENOC",
"indexName": "firenoc-services",
"aggrQuery": "{\"aggs\":{\"FireNOC\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Average days to issue Provisional NOC\":{\"filter\":{\"bool\":{\"must\":[{\"term\":{\"Data.fireNOCDetails.fireNOCType.keyword\":\"PROVISIONAL\"}},{\"term\":{\"Data.fireNOCDetails.status.keyword\":\"APPROVED\"}}]}},\"aggs\":{\"average_days\":{\"avg\":{\"script\":{\"source\":\"(doc['Data.auditDetails.lastModifiedTime'].value-doc['Data.auditDetails.createdTime'].value)\/(86400*1000)\"}}}}}}}}}",
"requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\",\"tenantId\" : \"Data.tenantId\", \"district\" : \"Data.tenantData.city.districtCode\"}",
"dateRefField": "Data.auditDetails.createdTime"
}
],
"chartType": "metric",
"valueType": "number",
"action": "",
"drillChart": "none",
"aggregationPaths": [
"Average days to issue Provisional NOC"
],
"insight": {
"chartResponseMap" : "nocAvgDayToIssueProvisional",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "year"
},
"_comment": "FIRE Avg. days to issue Provisional"
},
"nocSLAComplianceProvisional": {
"chartName": "DSS_NOC_SLA_COMPLIANCE_PROVISIONAL",
"queries": [
{
"module": "FIRENOC",
"indexName": "firenoc-services",
"aggrQuery": "{\"aggs\":{\"FireNOC\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"SLA Compliance (Provisional NOC)\":{\"filter\":{\"bool\":{\"must\":[{\"term\":{\"Data.fireNOCDetails.fireNOCType.keyword\":\"PROVISIONAL\"}},{\"term\":{\"Data.fireNOCDetails.status.keyword\":\"APPROVED\"}},{\"script\":{\"script\":{\"source\":\"doc['Data.auditDetails.lastModifiedTime'].value-doc['Data.auditDetails.createdTime'].value<params.threshold\",\"lang\":\"painless\",\"params\":{\"threshold\":172800000}}}}]}}}}}}}",
"requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\",\"tenantId\" : \"Data.tenantId\", \"district\" : \"Data.tenantData.city.districtCode\"}",
"dateRefField": "Data.auditDetails.createdTime"
}
],
"chartType": "metric",
"valueType": "percentage",
"action": "percentage",
"drillChart": "none",
"aggregationPaths": [
"SLA Compliance (Provisional NOC)"
],
"insight": {
"chartResponseMap" : "slaCompliance",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "year"
},
"_comment": "FIRE NOC SLA Compliance Provisional"
},
"nocAverageDaysToIssueActual": {
"chartName": "DSS_NOC_AVERAGE_DAYS_TO_ISSUE_ACTUAL",
"queries": [
{
"module": "FIRENOC",
"indexName": "firenoc-services",
"aggrQuery": "{\"aggs\":{\"FireNOC\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Average days to issue Actual NOC\":{\"filter\":{\"bool\":{\"must\":[{\"term\":{\"Data.fireNOCDetails.fireNOCType.keyword\":\"NEW\"}},{\"term\":{\"Data.fireNOCDetails.status.keyword\":\"APPROVED\"}}]}},\"aggs\":{\"average_days\":{\"avg\":{\"script\":{\"source\":\"(doc['Data.auditDetails.lastModifiedTime'].value-doc['Data.auditDetails.createdTime'].value)\/(86400*1000)\"}}}}}}}}}",
"requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\",\"tenantId\" : \"Data.tenantId\", \"district\" : \"Data.tenantData.city.districtCode\"}",
"dateRefField": "Data.auditDetails.createdTime"
}
],
"chartType": "metric",
"valueType": "number",
"action": "",
"drillChart": "none",
"aggregationPaths": [
"Average days to issue Actual NOC"
],
"insight": {
"chartResponseMap" : "nocAvgDayToIssueActual",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "year"
},
"_comment": "FIRE Avg. days to issue Actual"
},
"nocSLAComplianceActual": {
"chartName": "DSS_NOC_SLA_COMPLIANCE_ACTUAL",
"queries": [
{
"module": "FIRENOC",
"indexName": "firenoc-services",
"aggrQuery": "{\"aggs\":{\"FireNOC\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"SLA Compliance (Actual NOC)\":{\"filter\":{\"bool\":{\"must\":[{\"term\":{\"Data.fireNOCDetails.fireNOCType.keyword\":\"NEW\"}},{\"term\":{\"Data.fireNOCDetails.status.keyword\":\"APPROVED\"}},{\"script\":{\"script\":{\"source\":\"doc['Data.auditDetails.lastModifiedTime'].value-doc['Data.auditDetails.createdTime'].value<params.threshold\",\"lang\":\"painless\",\"params\":{\"threshold\":172800000}}}}]}}}}}}}",
"requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\",\"tenantId\" : \"Data.tenantId\", \"district\" : \"Data.tenantData.city.districtCode\"}",
"dateRefField": "Data.auditDetails.createdTime"
}
],