State DSS - Finance Technical Documentation
Finance-State DSS Documentation
DSS has two sides to it. One being the process in which the Data is pooled to ElasticSearch and the other being the way it is fetched, aggregated, computed, transformed and sent across.
As this revolves around a variety of Data Set, 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 process.
This document explains the steps on how to define the configurations for Analytics Side Of DSS for Finance.
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 finance in this dashboard-analytics.
Here is the location : https://github.com/egovernments/configs/tree/qa/egov-dss-dashboards/dashboard-analytics
Below is a list of configurations that need to be changed to run finance successfully.
Chart API Configuration
Master Dashboard Configuration
Role Dashboard Mappings Configuration
Description :
Chart API 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 their properties, we have a Chart API Configuration Document.
In this, Visualization Code, which happens to be the key, will be having its properties configured as a part of configuration and are easily changeable.
Here is the sample ChartApiConfiguration.json data for the finance.
"financeTotalCollection": {
"chartName": "DSS_FINANCE_TOTAL_COLLECTION",
"queries": [
{
"module": "FINANCE",
"dateRefField": "",
"requestQueryMap": "{\"region\" : \"regionname.keyword\",\"district\" : \"districtname.keyword\", \"tenantId\" : \"ulbname.keyword\"}",
"indexName": "financeindex-v1",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[],\"must\":[]}},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"totalreceiptvoucheramounts\"}}}}}}"
}
],
"translateTenantCode": true,
"chartType": "metric",
"valueType": "amount",
"drillChart": "none",
"documentType": "_doc",
"action": "",
"aggregationPaths": [
"Total Collection"
],
"insight": {
"chartResponseMap" : "financeTotalCollection",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "month"
},
"_comment": " "
},
"financeTotalBillAmount": {
"chartName": "DSS_FINANCE_TOTAL_BILL_AMOUNT",
"queries": [
{
"module": "FINANCE",
"dateRefField": "",
"requestQueryMap": "{\"region\" : \"regionname.keyword\",\"district\" : \"districtname.keyword\", \"tenantId\" : \"ulbname.keyword\"}",
"indexName": "financeindex-v1",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[],\"must\":[]}},\"aggs\":{\"Total Bill Amount\":{\"sum\":{\"field\":\"totalbillamounts\"}}}}}}"
}
],
"translateTenantCode": true,
"chartType": "metric",
"valueType": "amount",
"drillChart": "none",
"documentType": "_doc",
"action": "",
"aggregationPaths": [
"Total Bill Amount"
],
"insight": {
"chartResponseMap" : "financeTotalBillAmount",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "month"
},
"_comment": " "
},
"financeTotalPaidAmount": {
"chartName": "DSS_FINANCE_TOTAL_PAID_AMOUNT",
"queries": [
{
"module": "FINANCE",
"dateRefField": "",
"requestQueryMap": "{\"region\" : \"regionname.keyword\",\"district\" : \"districtname.keyword\", \"tenantId\" : \"ulbname.keyword\"}",
"indexName": "financeindex-v1",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[],\"must\":[]}},\"aggs\":{\"Total Paid Amount\":{\"sum\":{\"field\":\"totalpaymentamounts\"}}}}}}"
}
],
"translateTenantCode": true,
"chartType": "metric",
"valueType": "amount",
"drillChart": "none",
"documentType": "_doc",
"action": "",
"aggregationPaths": [
"Total Paid Amount"
],
"insight": {
"chartResponseMap" : "financeTotalPaidAmount",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "month"
},
"_comment": " "
},
"financeTotalBillsGenerated": {
"chartName": "DSS_FINANCE_TOTAL_BILLS_GENERATED",
"queries": [
{
"module": "FINANCE",
"dateRefField": "",
"requestQueryMap": "{\"region\" : \"regionname.keyword\",\"district\" : \"districtname.keyword\", \"tenantId\" : \"ulbname.keyword\"}",
"indexName": "financeindex-v1",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[],\"must\":[]}},\"aggs\":{\"Bills Generated\":{\"sum\":{\"field\":\"numberofbills\"}}}}}}"
}
],
"chartType": "metric",
"valueType": "number",
"drillChart": "none",
"documentType": "_doc",
"action": "",
"aggregationPaths": [
"Bills Generated"
],
"insight": {
"chartResponseMap" : "financeTotalBillsGenerated",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "month"
},
"_comment": " "
},
"financeTotalPayments": {
"chartName": "DSS_FINANCE_TOTAL_PAYMENTS",
"queries": [
{
"module": "FINANCE",
"dateRefField": "",
"requestQueryMap": "{\"region\" : \"regionname.keyword\",\"district\" : \"districtname.keyword\", \"tenantId\" : \"ulbname.keyword\"}",
"indexName": "financeindex-v1",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[],\"must\":[]}},\"aggs\":{\"Total Payments\":{\"sum\":{\"field\":\"numberofpayments\"}}}}}}"
}
],
"chartType": "metric",
"valueType": "number",
"drillChart": "none",
"documentType": "_doc",
"action": "",
"aggregationPaths": [
"Total Payments"
],
"insight": {
"chartResponseMap" : "financeTotalPayments",
"action" : "differenceOfNumbers",
"upwardIndicator" : "positive",
"downwardIndicator" : "negative",
"textMessage" : "$indicator$value% than last $insightInterval",
"colorCode" : "#228B22",
"insightInterval" : "month"
},
"_comment": " "
},
"financeInsights": {
"chartName": "DSS_FINANCE_BOUNDARY",
"queries": [
{
"module": "FINANCE",
"dateRefField": "",
"requestQueryMap": "{\"region\" : \"regionname.keyword\",\"district\" : \"districtname.keyword\", \"tenantId\" : \"ulbname.keyword\"}",
"indexName": "financeindex-v1",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[]}},\"aggs\":{\"City Name\":{\"terms\":{\"field\":\"ulbname.keyword\"}},\"Total Bills Generated\":{\"sum\":{\"field\":\"numberofbills\"}},\"Total Vouchers Generated\":{\"sum\":{\"field\":\"numberofvouchersforbill\"}},\"Total Billed Amount\":{\"sum\":{\"field\":\"totalbillamounts\"}},\"Bills Paid\":{\"sum\":{\"field\":\"numberofbillspaid\"}},\"Payments Done\":{\"sum\":{\"field\":\"numberofpayments\"}},\"Bill Amount Paid\":{\"sum\":{\"field\":\"billamountpaid\"}},\"Receipt Vouchers Passed\":{\"sum\":{\"field\":\"numberofreceiptvoucher\"}},\"Vendors\":{\"sum\":{\"field\":\"numberofcontractorsuppliers\"}},\"Bank Accounts\":{\"sum\":{\"field\":\"numberofbankaccounts\"}},\"Finance Collection\":{\"sum\":{\"field\":\"totalreceiptvoucheramounts\"}}}}}}"
}
],
"isMdmsEnabled": true,
"translateTenantCode": true,
"filterKeys": [
{"key": "tenantId", "column": "DDRs"}
],
"chartType": "xtable",
"valueType": "number",
"action": "",
"plotLabel": "DDRs",
"isPostResponseHandler": true,
"postAggregationTheory" : "repsonseToDifferenceOfDates",
"documentType": "_doc",
"drillChart": "financeInsightsUlbDrilldown",
"aggregationPaths": [
"Total Bills Generated",
"Total Vouchers Generated",
"Total Billed Amount",
"Bills Paid",
"Payments Done",
"Bill Amount Paid",
"Receipt Vouchers Passed",
"Finance Collection",
"Vendors",
"Bank Accounts"
],
"pathDataTypeMapping": [
{
"Total Bills Generated": "number"
},
{
"Total Vouchers Generated": "number"
},
{
"Total Billed Amount": "amount"
},
{
"Bills Paid": "number"
},
{
"Payments Done": "number"
},
{
"Bill Amount Paid": "amount"
},
{
"Receipt Vouchers Passed": "number"
},
{
"Finance Collection": "amount"
},
{
"Vendors": "number"
},
{
"Bank Accounts": "number"
}
],
"insight": {},
"_comment": ""
},
"financeInsightsUlbDrilldown": {
"chartName": "DSS_FINANCE_BOUNDARY_ULB_DRILLDOWN",
"queries": [
{
"module": "FINANCE",
"dateRefField": "",
"requestQueryMap": "{\"region\" : \"regionname.keyword\",\"district\" : \"districtname.keyword\", \"tenantId\" : \"ulbname.keyword\"}",
"indexName": "financeindex-v1",
"aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[]}},\"aggs\":{\"ULBs\":{\"terms\":{\"field\":\"ulbname.keyword\"},\"aggs\":{\"City Name\":{\"terms\":{\"field\":\"ulbname.keyword\"}},\"Total Bills Generated\":{\"sum\":{\"field\":\"numberofbills\"}},\"Total Vouchers Generated\":{\"sum\":{\"field\":\"numberofvouchersforbill\"}},\"Total Billed Amount\":{\"sum\":{\"field\":\"totalbillamounts\"}},\"Bills Paid\":{\"sum\":{\"field\":\"numberofbillspaid\"}},\"Payments Done\":{\"sum\":{\"field\":\"numberofpayments\"}},\"Bill Amount Paid\":{\"sum\":{\"field\":\"billamountpaid\"}},\"Receipt Vouchers Passed\":{\"sum\":{\"field\":\"numberofreceiptvoucher\"}},\"Vendors\":{\"sum\":{\"field\":\"numberofcontractorsuppliers\"}},\"Bank Accounts\":{\"sum\":{\"field\":\"numberofbankaccounts\"}},\"Finance Collection\":{\"sum\":{\"field\":\"totalreceiptvoucheramounts\"}}}}}}}}"
}
],
"isMdmsEnabled": false,
"translateTenantCode": true,
"filterKeys": [
{"key": "tenantId", "column": "ULBs"}
],
"chartType": "table",
"valueType": "number",
"action": "",
"plotLabel": "ULBs",
"isPostResponseHandler": true,
"postAggregationTheory" : "repsonseToDifferenceOfDates",
"documentType": "_doc",
"drillChart": "none",
"aggregationPaths": [
"Total Bills Generated",
"Total Vouchers Generated",
"Total Billed Amount",
"Bills Paid",
"Payments Done",
"Bill Amount Paid",
"Receipt Vouchers Passed",
"Finance Collection",
"Vendors",
"Bank Accounts"
],
"pathDataTypeMapping": [
{
"Total Bills Generated": "number"
},
{
"Total Vouchers Generated": "number"
},
{
"Total Billed Amount": "amount"
},
{
"Bills Paid": "number"
},
{
"Payments Done": "number"
},
{
"Bill Amount Paid": "amount"
},
{
"Receipt Vouchers Passed": "number"
},
{
"Finance Collection": "amount"
},
{
"Vendors": "number"
},
{
"Bank Accounts": "number"
}
],
"insight": {},
"_comment": ""
}
Click here to check the complete configuration
Master Dashboard Configuration:
Master Dashboard Configuration is the main configuration which defines as which are the Dashboards which are to be painted on screen.
It includes all the Visualizations, their groups, the charts which comes within them and even their dimensions as what should be their height and width.
{
"name": "DSS_FINANCE_DASHBOARD",
"id": "finance",
"isActive": "",
"style": "linear",
"visualizations": [
{
"row": 1,
"name": "DSS_FINANCE",
"vizArray": [
{
"id": 411,
"name": "DSS_FINANCE_OVERVIEW",
"dimensions": {
"height": 200,
"width": 12
},
"vizType": "collection",
"label": "DSS_FINANCE_OVERVIEW",
"noUnit": true,
"isCollapsible": false,
"charts": [
{
"id": "financeTotalCollection",
"name": "DSS_FINANCE_TOTAL_COLLECTION",
"code": "",
"chartType": "metric",
"filter": "",
"headers": []
},
{
"id": "financeTotalBillAmount",
"name": "DSS_FINANCE_TOTAL_BILL_AMOUNT",
"code": "",
"chartType": "metric",
"filter": "",
"headers": []
},
{
"id": "financeTotalPaidAmount",
"name": "DSS_FINANCE_TOTAL_PAID_AMOUNT",
"code": "",
"chartType": "metric",
"filter": "",
"headers": []
}
]
}
]
},
{
"row": 2,
"name": "DSS_FINANCE",
"vizArray": [
{
"id": 423,
"name": "DSS_FINANCE_INSIGHTS",
"dimensions": {
"height": 350,
"width": 12
},
"vizType": "chart",
"label": "",
"noUnit": false,
"isCollapsible": false,
"charts": [
{
"id": "financeInsights",
"name": "DSS_FINANCE_BOUNDARY",
"code": "",
"chartType": "table",
"filter": "",
"headers": [],
"tabName": "Boundary"
}
]
}
]
}
]
}
]
}
Click here for the complete configuration
Role Dashboard Mappings Configuration:
Master Dashboard Configuration which was explained earlier hold the list of Dashboards which are available.
Given the instance where Role Action Mapping is not maintained in the Application Service, this configuration will act as Role - Dashboard Mapping Configuration
In this, each Role is mapped against the Dashboard which they are authorized to see
This was used earlier when the Role Action Mapping of eGov was not integrated.
Later, when the Role Action Mapping started controlling the Dashboards to be seen on the client side, this configuration was just used to enable the Dashboards for viewing.
{
"_comment": "Holds mapping for each role with and its associated dashboards",
"roles" : [
{
"_comment":"This role is super role which can access all the available dashboards: [other/new roles are suppose to be added]",
"roleId": 6,
"roleName" : "Admin",
"isSuper" : "",
"orgId": "",
"dashboards": [
{
"name": "Finance",
"id": "finance"
}
]
}
]
}
Click here to check the configuration
MDMS Configuration to be added:
common-masters/uiCommonConstants.json
Click here to check the complete configuration
roleaction.json
Click here to check the complete configuration
Action test.json:
Click here to check the complete configuration
Finance - State DSS Consists of multiple graphs which represent the data of Finance. Each graph has its own configuration which will describe the chart and its type.
State DSS Consists of following charts in Finance:
Finance Page :
Overview
Finance Insights
Overview:
Overview graph contains multiple data information as below in the selected time period.
Total Collections : This represents the sum of revenue collected.
Total Bill amount : This represents the sum of bill collected.
Total Paid Amount : This represents the total amount paid.
Finance Insights: This tabular chart representation graph shows multiple information like No. of Bills Generated, No. of Vouchers Generated, Total Billed Amount, No. of Bills Paid, No. of Payments Done, Amount Paid Against Bills, No. of Receipt Vouchers Passed, Finance Collection, No. of Vendors, No. of Bank Accounts . And this table shows the data in DDR level and also has the drill down chart for each state to ulb.
xtable type allows to add multiple computed fields with the aggregated fields dynamically added.
To add multiple computed columns, computedFields [] where actionName (IComputedField<T> interface), fields [] names as in exist in query key, newField as name to appear for computation must be defined.
On click of any DDR name will enter into drill down charts, which will represents that specific state data.
Newly introduced property:
isRoundOff: This property is introduced to round off the decimal values. Ex: if the value is 25.43 by using isRoundOff property in configuration we will get it as 25. if value is 22.56 round of value will be 23.
This can be used for insights configuration as well for overview graph.
Common Properties available:
Key(eg: fsmTotalrequest) : This is the Visualization Code. This key will be referred to in further visualization configurations.
This is the key which will be used by the client application to indicate which visualization is needed for display.
chartName : The name of the Chart which has to be used as a label on the Dashboard. The name of the Chart will be a detailed name.
In this configuration, the Name of the Chart will be the code of Localization which will be used by Client Side.
queries : Some visualizations are derived from a specific data source. While some others are derived from different data sources and are combined together to get a meaningful representation.
The queries of aggregation which are to be used to fetch out the right data in the right aggregated format are configured here.
queries.module : The module / domain level, on which the query should be applied on Finance is FINANCE.
queries.indexName : The name of the index upon which the query has to be executed is configured here.
queries.aggrQuery : The aggregation query in itself is added here. Based on the Module and the Index name specified, this query is attached to the filter part of the complete search request and then executed against that index
queries.requestQueryMap : Client Request would carry certain fields which are to be filtered. The parameters specified in the Client Request are different from the parameters in each of these indexed documents.
In order to map the parameters of the request to the parameters of the ElasticSearch Document, this mapping is maintained.
queries.dateRefField : Each of these modules have separate indexes. And all of them have their own date fields.
When there is a date filter applied against these visualizations, each of them has to apply it against their own date reference fields.
In order to maintain what is the date field in which index, we have this configured in this configuration parameter.
chartType : As there are different types of visualizations, this field defines what is the type of chart / visualization that this data should be used to represent.
Chart types available are:
metric - this represents the aggregated amount/value for records filter by the aggregate es query
pie - this represents the aggregated data on grouping. This is can be used to represent any line graph, bar graph, pie chart or donuts
line - this graph/chart is data representation on date histograms or date groupings
perform - this chart represents groping data as performance wise.
table - represents a form of plots and value with headers as grouped on and list of its key, values pairs.
xtable - represents a advanced feature of table, it has addition capabilities for dynamic adding header values.
valueType : In any case of data, the values which are sent to plot, might be a percentage, sometimes an amount and sometimes it is just a count.
In order to represent them and differentiate the numbers from amount from percentage, this field is used to indicate the type of value that this Visualization will be sending.
action : Some of the visualizations are not just aggregation on data source. There might be some cases where we have to do a post aggregation computation.
For Example, in the case of Top 3 Performing ULBs, the Target and Total Collection is obtained and then the percentage is calculated. In these kinds of cases, what is the action that has to be performed on that data obtained is defined in this parameter.
documentType : The type of document upon which the query has to be executed is defined here.
drillChart : If there is a drill down on the visualization, then the code of the Drill Down Visualization is added here. This will be used by Client Service to manage drill downs.
aggregationPaths : All the queries will be having Aggregation names in it. In order to fetch the value out of each Aggregation Responses, the name of the aggregation in the query will be an easy bet. These aggregation paths will have the names of Aggregation in it.
insights : It is to show the data with the comparison of last year with arrow symbols, it will show the data in how much % is increased or decreased.
_comment : In order to display information on the “i” symbol of each visualization, Visualization Information is maintained in this field.
Index Properties of State Finance- Dss:
The index that contains data for State- financeindex-v1
The mapping for this index is:
Finance :
Every hour the job scheduler runs every day for pushing the data to finance index