DSS has two sides to it. One is the process in which the data is pooled to 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 state analytics for the Fire NOC module.
The Visualization Code, which happens to be the key, has its properties configured as a part of the configuration and are easily changeable.
Copy "nssNOCTodaysCollection": {
"chartName": "NSS_NOC_TODAYS_COLLECTION",
"queries": [
{
"module": "FIRENOC",
"dateRefField": "",
"requestQueryMap": "{\"ward\" : \"ward.keyword\",\"ulb\" : \"ulb.keyword\"}",
"indexName": "firenoc-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",
"action": "",
"drillChart": "none",
"aggregationPaths": [
"Todays Collection"
],
"insight": {
},
"_comment": "NSS FIRE NOC todays collections "
},
"nssNOCTotalCollection": {
"chartName": "NSS_NOC_TOTAL_COLLECTION",
"queries": [
{
"module": "FIRENOC",
"dateRefField": "date",
"requestQueryMap": "{\"ward\" : \"ward.keyword\", \"ulb\" : \"ulb.keyword\"}",
"indexName": "firenoc-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{}},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"todaysCollectionForPaymentMode\"}}}}}}"
}
],
"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"
},
"_comment": "NSS FIRE NOC Total collections "
},
"nssNOCTotalApplications": {
"chartName": "NSS_NOC_TOTAL_APPLICATIONS",
"queries": [
{
"module": "FIRENOC",
"dateRefField": "date",
"requestQueryMap": "{\"ward\" : \"ward.keyword\",\"ulb\" : \"ulb.keyword\"}",
"indexName": "firenoc-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{}},\"aggs\":{\"Total applications\":{\"sum\":{\"field\":\"todaysApplicationsForApplicationType\"}}}}}}"
}
],
"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": "NSS FIRE NOC Total applications "
},
"nssNOCActualIssued": {
"chartName": "NSS_NOC_ACTUAL_ISSUED",
"queries": [
{
"module": "FIRENOC",
"dateRefField": "date",
"requestQueryMap": "{\"ward\" : \"ward.keyword\",\"ulb\" : \"ulb.keyword\"}",
"indexName": "firenoc-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must\":[{\"term\":{\"applicationType.keyword\":\"NEW\"}}]}},\"aggs\":{\"Actual Noc's Issued\":{\"sum\":{\"field\":\"todaysApplicationsForApplicationType\"}}}}}}"
}
],
"chartType": "metric",
"valueType": "number",
"action": "",
"drillChart": "none",
"aggregationPaths": [
"Actual Noc's Issued"
],
"insight": {
"chartResponseMap" : "nocActualIssued",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "year"
},
"_comment": "NSS FIRE NOC Actual Issued "
},
"nssNOCCumulativeCollection": {
"chartName": "NSS_NOC_TOTAL_CUMULATIVE_COLLECTION",
"queries": [
{
"module": "FIRENOC",
"dateRefField": "date",
"requestQueryMap": "{\"ward\" : \"ward.keyword\",\"ulb\" : \"ulb.keyword\"}",
"indexName": "firenoc-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{}},\"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": "NSS FIRE NOC Total cumulative collections "
},
"nssNOCAverageDaysToIssueProvisional": {
"chartName": "NSS_NOC_AVERAGE_DAYS_TO_ISSUE_PROVISIONAL",
"queries": [
{
"module": "FIRENOC",
"dateRefField": "date",
"requestQueryMap": "{\"ward\" : \"ward.keyword\",\"ulb\" : \"ulb.keyword\"}",
"indexName": "firenoc-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{}},\"aggs\":{\"Average days to issue Provisional NOC\":{\"sum\":{\"field\":\"avgDaysToIssueProvisionalNOCForDepartment\"}}}}}}"
}
],
"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": "Average days to issue Provisional NOC"
},
"nssNOCAverageDaysToIssueActual": {
"chartName": "NSS_NOC_AVERAGE_DAYS_TO_ISSUE_ACTUAL",
"queries": [
{
"module": "FIRENOC",
"dateRefField": "date",
"requestQueryMap": "{\"ward\" : \"ward.keyword\",\"ulb\" : \"ulb.keyword\"}",
"indexName": "firenoc-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{}},\"aggs\":{\"Average days to issue Actual NOC\":{\"sum\":{\"field\":\"avgDaysToIssueActualNOCForDepartment\"}}}}}}"
}
],
"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": "Average days to issue Actual NOC"
},
"nssNOCSLAComplianceProvisional": {
"chartName": "NSS_NOC_SLA_COMPLIANCE_PROVISIONAL",
"queries": [
{
"module": "FIRENOC",
"dateRefField": "date",
"requestQueryMap": "{\"ward\" : \"ward.keyword\",\"ulb\" : \"ulb.keyword\"}",
"indexName": "firenoc-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{}},\"aggs\":{\"SLA Compliance (Provisional NOC)\":{\"terms\":{\"field\":\"date\",\"size\":\"1\",\"order\":{\"_key\":\"desc\"}},\"aggs\":{\"Sum\":{\"sum\":{\"field\":\"slaComplianceProvisionalForDepartment\"}}}}}}}}"
}
],
"chartType": "metric",
"valueType": "percentage",
"action": "",
"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",
"isRoundOff": true
},
"_comment": "SLA Compliance (Provisional NOC)"
},
"nssNOCSLAComplianceActual": {
"chartName": "NSS_NOC_SLA_COMPLIANCE_ACTUAL",
"queries": [
{
"module": "FIRENOC",
"dateRefField": "date",
"requestQueryMap": "{\"ward\" : \"ward.keyword\",\"ulb\" : \"ulb.keyword\"}",
"indexName": "firenoc-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{}},\"aggs\":{\"SLA Compliance (Actual NOC)\":{\"terms\":{\"field\":\"date\",\"size\":\"1\",\"order\":{\"_key\":\"desc\"}},\"aggs\":{\"Sum\":{\"sum\":{\"field\":\"slaComplianceActualForDepartment\"}}}}}}}}"
}
],
"chartType": "metric",
"valueType": "percentage",
"action": "",
"drillChart": "none",
"aggregationPaths": [
"SLA Compliance (Actual NOC)"
],
"insight": {
"chartResponseMap" : "slaCompliance",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "year",
"isRoundOff": true
},
"_comment": "SLA Compliance (Actual NOC)"
},
"nssNOCProvisionalIssued": {
"chartName": "NSS_NOC_PROVISIONAL_ISSUED",
"queries": [
{
"module": "FIRENOC",
"dateRefField": "date",
"requestQueryMap": "{\"ward\" : \"ward.keyword\",\"ulb\" : \"ulb.keyword\"}",
"indexName": "firenoc-national-dashboard",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must\":[{\"term\":{\"applicationType.keyword\":\"PROVISIONAL\"}}]}},\"aggs\":{\"Provisional Noc's Issued\":{\"sum\":{\"field\":\"todaysApplicationsForApplicationType\"}}}}}}"
}
],
"chartType": "metric",
"valueType": "number",
"action": "",
"drillChart": "none",
"aggregationPaths": [
"Provisional Noc's Issued"
],
"insight": {
"chartResponseMap" : "nocProvisionalIssued",