From 35d3fb753bc01b7c7010af299a54343ddca34a2a Mon Sep 17 00:00:00 2001
From: Darshan Nagesh <darshan.nagesh@tarento.com>
Date: Fri, 25 Mar 2022 16:19:50 +0530
Subject: [PATCH] Adding visualizations

---
 .../resources/schema/SMF_ChartApiConfig.json  | 89 ++++++++++++++++++-
 .../schema/SMF_MasterDashboardConfig.json     | 60 ++++++++++++-
 2 files changed, 147 insertions(+), 2 deletions(-)

diff --git a/src/main/resources/schema/SMF_ChartApiConfig.json b/src/main/resources/schema/SMF_ChartApiConfig.json
index 83eb8ec..49f7532 100644
--- a/src/main/resources/schema/SMF_ChartApiConfig.json
+++ b/src/main/resources/schema/SMF_ChartApiConfig.json
@@ -41,7 +41,7 @@
       }
     ],
     "chartType": "line",
-    "resultType": "value",
+    "resultType": "doc_count",
     "valueType": "number",
     "isDecimal": true,
     "action": "",
@@ -56,5 +56,92 @@
     "alwaysView": "",
     "insight": {},
     "_comment": " "
+  },
+  "totalApplications": {
+    "chartName": "Total Applications",
+    "queries": [
+      {
+        "module": "COMMON",
+        "requestQueryMap": "{\r\n  \"ts\" : \"timestamp\"}",
+        "dateRefField": "timestamp",
+        "indexName": "fs-forms-data",
+        "esInstance": "QUADNARY",
+        "aggrQuery": "{\"aggs\":{\"Total Applications\":{\"cardinality\":{\"field\":\"_id\"}}}}"
+      }
+    ],
+    "chartType": "metric",
+    "resultType": "value",
+    "valueType": "number",
+    "isDecimal": false,
+    "action": "",
+    "filter": "",
+    "drillChart": "none",
+    "documentType": "_doc",
+    "aggregationPaths": [
+      "Total Applications"
+    ],
+    "isCumulative": false,
+    "interval": "day",
+    "alwaysView": "",
+    "insight": {},
+    "_comment": " "
+  },
+  "performingLeadInspectors": {
+    "chartName": "Performing Lead Inspectors",
+    "queries": [
+      {
+        "module": "COMMON",
+        "requestQueryMap": "{\r\n  \"ts\" : \"timestamp\"}",
+        "dateRefField": "timestamp",
+        "indexName": "fs-forms-data",
+        "esInstance": "QUADNARY",
+        "aggrQuery": "{\"aggs\":{\"Inspection Completed\":{\"filter\":{\"bool\":{\"filter\":[{\"terms\":{\"status.keyword\":[\"INSCOMPLETED\"],\"boost\":1}}],\"adjust_pure_negative\":true,\"boost\":1}},\"aggs\":{\"Performing Lead Inspectors\":{\"terms\":{\"field\":\"inspection.leadInspector\"}}}}}}"
+      }
+    ],
+    "chartType": "bar",
+    "resultType": "",
+    "valueType": "number",
+    "isDecimal": true,
+    "action": "",
+    "filter": "",
+    "drillChart": "none",
+    "documentType": "_doc",
+    "aggregationPaths": [
+      "Performing Lead Inspectors"
+    ],
+    "isCumulative": false,
+    "interval": "day",
+    "alwaysView": "",
+    "insight": {},
+    "_comment": " "
+  },
+  "pendingApprovedRejected": {
+    "chartName": "Total Pending, Approved and Rejected Applications",
+    "queries": [
+      {
+        "module": "COMMON",
+        "requestQueryMap": "{\r\n  \"ts\" : \"timestamp\"}",
+        "dateRefField": "timestamp",
+        "indexName": "fs-forms-data",
+        "esInstance": "QUADNARY",
+        "aggrQuery": "{\"aggs\":{\"Only New Approved Rejected\":{\"filter\":{\"bool\":{\"filter\":[{\"terms\":{\"status.keyword\":[\"NEW\",\"APPROVED\",\"REJECTED\"],\"boost\":1}}],\"adjust_pure_negative\":true,\"boost\":1}},\"aggs\":{\"Application Status\":{\"terms\":{\"field\":\"status.keyword\",\"size\":10},\"aggs\":{\"Count of Applications\":{\"cardinality\":{\"field\":\"_id\"}}}}}}}}"
+      }
+    ],
+    "chartType": "pie",
+    "resultType": "doc_count",
+    "valueType": "number",
+    "isDecimal": true,
+    "action": "",
+    "filter": "",
+    "drillChart": "none",
+    "documentType": "_doc",
+    "aggregationPaths": [
+      "Application Status"
+    ],
+    "isCumulative": false,
+    "interval": "day",
+    "alwaysView": "",
+    "insight": {},
+    "_comment": " "
   }
 }
\ No newline at end of file
diff --git a/src/main/resources/schema/SMF_MasterDashboardConfig.json b/src/main/resources/schema/SMF_MasterDashboardConfig.json
index 34e327e..b7fe7fc 100644
--- a/src/main/resources/schema/SMF_MasterDashboardConfig.json
+++ b/src/main/resources/schema/SMF_MasterDashboardConfig.json
@@ -19,7 +19,17 @@
           ]
         }
       ],
-      "widgetCharts": [],
+      "widgetCharts": [
+      	{
+          "id": "totalApplications",
+          "name": "Total Applications",
+          "code": "",
+          "chartType": "metric",
+          "order": 1,
+          "filter": "",
+          "headers": []
+        }      
+      ],
       "visualizations": [
         {
           "row": 1,
@@ -66,6 +76,54 @@
                   "headers": []
                 }
               ]
+            },
+            {
+              "id": 111,
+              "name": "Performing Lead Inspectors",
+              "dimensions": {
+                "height": 250,
+                "width": 4
+              },
+              "vizType": "chart",
+              "noUnit": true,
+              "isCollapsible": false,
+              "charts": [
+                {
+                  "id": "performingLeadInspectors",
+                  "name": "Performing Lead Inspectors",
+                  "code": "",
+                  "chartType": "bar",
+                  "filter": "",
+                  "headers": []
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "row": 2,
+          "name": "Application Status Count",
+          "vizArray": [
+            {
+              "id": 111,
+              "name": "Pending Approved and Rejected",
+              "dimensions": {
+                "height": 250,
+                "width": 4
+              },
+              "vizType": "chart",
+              "noUnit": true,
+              "isCollapsible": false,
+              "charts": [
+                {
+                  "id": "pendingApprovedRejected",
+                  "name": "Pending Approved and Rejected",
+                  "code": "",
+                  "chartType": "pie",
+                  "filter": "",
+                  "headers": []
+                }
+              ]
             }
           ]
         }
-- 
GitLab