From fe257de7b50aae1a0aef1ea1ea0db24b3fbf5970 Mon Sep 17 00:00:00 2001 From: htvenkatesh <68595990+htvenkatesh@users.noreply.github.com> Date: Wed, 19 Jul 2023 12:03:10 +0530 Subject: [PATCH 01/11] Update tsconfig.json --- tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/tsconfig.json b/tsconfig.json index 55f0e1db..6a3d9c1d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,6 +17,7 @@ "moduleResolution": "node", "importHelpers": true, "allowSyntheticDefaultImports": true, + "skipLibCheck": true, "target": "es2020", "module": "es2020", "lib": [ From e03d2328a43259af6988fab226cda5d9089a0c23 Mon Sep 17 00:00:00 2001 From: pandutibil Date: Fri, 13 Oct 2023 19:51:23 +0530 Subject: [PATCH 02/11] PM Shri program reports are added --- src/app/app-routing.module.ts | 8 + src/app/core/config/configMapping.ts | 8 +- .../views/pm-shri/config/pm_shri_config.ts | 135 +++++++++++++++ .../implementation-status-tab.component.html | 25 +++ .../implementation-status-tab.component.scss | 0 ...mplementation-status-tab.component.spec.ts | 23 +++ .../implementation-status-tab.component.ts | 98 +++++++++++ .../bignumber-metrics.component.html | 0 .../bignumber-metrics.component.scss | 0 .../bignumber-metrics.component.spec.ts | 23 +++ .../bignumber-metrics.component.ts | 92 ++++++++++ .../implementation-status.component.html | 9 + .../implementation-status.component.scss | 0 .../implementation-status.component.spec.ts | 23 +++ .../implementation-status.component.ts | 126 ++++++++++++++ .../state-wise-performance.component.html | 9 + .../state-wise-performance.component.scss | 0 .../state-wise-performance.component.spec.ts | 23 +++ .../state-wise-performance.component.ts | 159 ++++++++++++++++++ .../state-wise-performance-tab.component.html | 22 +++ .../state-wise-performance-tab.component.scss | 0 ...ate-wise-performance-tab.component.spec.ts | 23 +++ .../state-wise-performance-tab.component.ts | 94 +++++++++++ .../views/pm-shri/pm-shri-routing.module.ts | 16 ++ src/app/views/pm-shri/pm-shri.component.html | 25 +++ src/app/views/pm-shri/pm-shri.component.scss | 0 .../views/pm-shri/pm-shri.component.spec.ts | 23 +++ src/app/views/pm-shri/pm-shri.component.ts | 83 +++++++++ src/app/views/pm-shri/pm-shri.module.ts | 30 ++++ 29 files changed, 1074 insertions(+), 3 deletions(-) create mode 100644 src/app/views/pm-shri/config/pm_shri_config.ts create mode 100644 src/app/views/pm-shri/pages/implementation-status-tab/implementation-status-tab.component.html create mode 100644 src/app/views/pm-shri/pages/implementation-status-tab/implementation-status-tab.component.scss create mode 100644 src/app/views/pm-shri/pages/implementation-status-tab/implementation-status-tab.component.spec.ts create mode 100644 src/app/views/pm-shri/pages/implementation-status-tab/implementation-status-tab.component.ts create mode 100644 src/app/views/pm-shri/pages/implementation-status-tab/reports/bignumber-metrics/bignumber-metrics.component.html create mode 100644 src/app/views/pm-shri/pages/implementation-status-tab/reports/bignumber-metrics/bignumber-metrics.component.scss create mode 100644 src/app/views/pm-shri/pages/implementation-status-tab/reports/bignumber-metrics/bignumber-metrics.component.spec.ts create mode 100644 src/app/views/pm-shri/pages/implementation-status-tab/reports/bignumber-metrics/bignumber-metrics.component.ts create mode 100644 src/app/views/pm-shri/pages/implementation-status-tab/reports/implementation-status/implementation-status.component.html create mode 100644 src/app/views/pm-shri/pages/implementation-status-tab/reports/implementation-status/implementation-status.component.scss create mode 100644 src/app/views/pm-shri/pages/implementation-status-tab/reports/implementation-status/implementation-status.component.spec.ts create mode 100644 src/app/views/pm-shri/pages/implementation-status-tab/reports/implementation-status/implementation-status.component.ts create mode 100644 src/app/views/pm-shri/pages/state-wise-performance-tab/reports/state-wise-performance/state-wise-performance.component.html create mode 100644 src/app/views/pm-shri/pages/state-wise-performance-tab/reports/state-wise-performance/state-wise-performance.component.scss create mode 100644 src/app/views/pm-shri/pages/state-wise-performance-tab/reports/state-wise-performance/state-wise-performance.component.spec.ts create mode 100644 src/app/views/pm-shri/pages/state-wise-performance-tab/reports/state-wise-performance/state-wise-performance.component.ts create mode 100644 src/app/views/pm-shri/pages/state-wise-performance-tab/state-wise-performance-tab.component.html create mode 100644 src/app/views/pm-shri/pages/state-wise-performance-tab/state-wise-performance-tab.component.scss create mode 100644 src/app/views/pm-shri/pages/state-wise-performance-tab/state-wise-performance-tab.component.spec.ts create mode 100644 src/app/views/pm-shri/pages/state-wise-performance-tab/state-wise-performance-tab.component.ts create mode 100644 src/app/views/pm-shri/pm-shri-routing.module.ts create mode 100644 src/app/views/pm-shri/pm-shri.component.html create mode 100644 src/app/views/pm-shri/pm-shri.component.scss create mode 100644 src/app/views/pm-shri/pm-shri.component.spec.ts create mode 100644 src/app/views/pm-shri/pm-shri.component.ts create mode 100644 src/app/views/pm-shri/pm-shri.module.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 6a9f3cbf..06cd7514 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -173,6 +173,14 @@ routes = [ ), canLoad: [AuthGuard] }, + { + path: 'pmShri', + loadChildren: () => + import('./views/pm-shri/pm-shri.module').then( + (module) => module.PmShriModule + ), + canLoad: [AuthGuard] + }, ], }, ]; diff --git a/src/app/core/config/configMapping.ts b/src/app/core/config/configMapping.ts index a3a22474..833ec696 100644 --- a/src/app/core/config/configMapping.ts +++ b/src/app/core/config/configMapping.ts @@ -14,8 +14,7 @@ import {config as ncf } from '../../views/ncf/config/ncf_config'; import {config as quiz} from '../../views/ncert-quiz/config/quiz_config'; import{config as microImprovement} from '../../views/micro-improvements/config/microimprovements_config'; import {config as nipunBharatConfig } from '../../views/nipun-bharat/config/nipun_bharat_config'; - - +import {config as pmShriConfig } from '../../views/pm-shri/config/pm_shri_config'; export const configFiles = { studentAttendance: studentAttendaceConfig, @@ -33,7 +32,8 @@ export const configFiles = { ncf:ncf, quiz:quiz, microImprovement:microImprovement, - nipunBharat:nipunBharatConfig + nipunBharat:nipunBharatConfig, + pmShri: pmShriConfig }; export const programFolderNames = { @@ -50,6 +50,7 @@ export const programFolderNames = { ncf:'ncf', quiz:'quiz', microImprovement:'microImprovement', + pmShri: 'pm_shri' } export const stateProgramsFolderNames = { @@ -66,4 +67,5 @@ export const stateProgramsFolderNames = { ncf:'', quiz:'', microImprovement:'', + pmShri: '' } diff --git a/src/app/views/pm-shri/config/pm_shri_config.ts b/src/app/views/pm-shri/config/pm_shri_config.ts new file mode 100644 index 00000000..2f4e0a31 --- /dev/null +++ b/src/app/views/pm-shri/config/pm_shri_config.ts @@ -0,0 +1,135 @@ +export const config = { + filters: [ + { + "label": "State Wise Performance", + "name": "Metric", + "labelProp": "category_name", + "valueProp": "category_name", + "id": "metric", + "query": "select category_name from dimensions.categorypmshri where category_name in ('total_schools_having_library', 'total_schools_having_handwash_facility', 'total_schools_having_drinking_water_facility', 'total_schools_having_ramp_facility', 'total_schools_having_playground', 'total_schools_having_internet_facility')" + } + ], + implementation_status: { + "label": "Implementation Status", + "filters": [ + { + "name": "National", + "hierarchyLevel": "0", + "actions": { + "queries": { + "map": "select d.latitude, d.longitude, t.state_id, state_name ,t.status from dimensions.state as d join (select state_id , case when sum > 0 then 'YES' else 'NO' end as status from datasets.pm_shri_started_state) as t on d.state_id = t.state_id order by d.state_name asc" + }, + "level": "state", + "nextLevel": "district" + } + } + ], + "options": { + "downloadConfig": { + "fileName": "Implementation Status", + "excludeColumns": ['indicator', 'tooltip', 'Latitude', 'Longitude'] + }, + "map": { + "metricFilterNeeded": false, + "indicator": "status", + "legend": { + "title": "Implemented PM Shri" + }, + "tooltipMetrics": [ + { + "valuePrefix": "State/ UT Name: ", + "value": "state_name", + "valueSuffix": "\n" + }, + { + "valuePrefix": "Implemented PM Shri: ", + "value": "status", + "valueSuffix": "\n" + } + ] + } + } + }, + state_wise_performance: { + "label": "State Wise Performance", + "filters": + [ + { + "name": "National", + "hierarchyLevel": "0", + "actions": + { + "queries": + { + "map": "select t1.state_id, t1.state_id as level, t2.state_name, t1.category_name, sum(t3.sum) as total_schools, round(cast(sum(t1.sum) / sum(t3.sum) as numeric) * 100, 2) as percentage, t2.latitude, t2.longitude from datasets.pm_shri_pm_shri_category_h21fc2hyav9wqkf0yxrl as t1 join dimensions.state as t2 on t2.state_id = t1.state_id join datasets.pm_shri_total_schools_state as t3 on t3.state_id = t1.state_id where category_name in ('total_schools_having_library', 'total_schools_having_handwash_facility', 'total_schools_having_drinking_water_facility', 'total_schools_having_ramp_facility', 'total_schools_having_playground', 'total_schools_having_internet_facility') group by t1.state_id, t2.state_name, t1.category_name, t2.latitude, t2.longitude" + }, + "level": "state", + "nextLevel": "district" + } + } + ], + "options": + { + "downloadConfig": { + "fileName": "State Wise Performance", + "excludeColumns": ['indicator', 'tooltip', 'category_name', 'level', 'percentage', 'Latitude', 'Longitude'] + }, + "map": + { + "indicatorType": "percent", + "metricLabelProp": "category_name", + "metricValueProp": "percentage", + "groupByColumn": "level", + "metricFilterNeeded": true, + "legend": { "title": "State Wise Performance" }, + "drillDownConfig": { + "enableDrillDown": true, + "allowedLevels": [0] + }, + "tooltipMetrics": [ + { + "valuePrefix": "State/UT name: ", + "value": "state_name", + "valueSuffix": "\n" + }, + { + "valuePrefix": "Total schools: ", + "value": "total_schools", + "valueSuffix": "\n" + }, + { + "valuePrefix": "", + "value": "category_name", + "valueSuffix": "\n" + } + ] + } + } + }, + pmShri_metrics: { + "label": "District Wise Performance", + "filters": [ + { + "name": "National", + "hierarchyLevel": "0", + "actions": { + "queries": { + "bigNumber1": "select SUM(count) as total_states from datasets.pm_shri_started_state", + "bigNumber2": "select SUM(sum) as total_schools from datasets.pm_shri_total_schools_state", + "bigNumber3": "select sum(sum) as only_boys_schools from datasets.pm_shri_pm_shri_category_state0categorypmshri where category_name = 'only_boys_school'", + "bigNumber4": "select sum(sum) as only_girls_schools from datasets.pm_shri_pm_shri_category_state0categorypmshri where category_name = 'only_girls_school'", + "bigNumber5": "select sum(sum) as co_ed_schools from datasets.pm_shri_pm_shri_category_state0categorypmshri where category_name = 'co-ed_school'" + }, + "level": "state" + } + } + ], + "options": { + "bigNumber": { + "title": ['Total states/UTs', 'Total schools', 'Only boys schools', 'Only girls schools', 'Co-ed schools'], + "valueSuffix": ['', '', '', '', ''], + "property": ['total_states', 'total_schools', 'only_boys_schools', 'only_girls_schools', 'co_ed_schools'] + } + } + } +} \ No newline at end of file diff --git a/src/app/views/pm-shri/pages/implementation-status-tab/implementation-status-tab.component.html b/src/app/views/pm-shri/pages/implementation-status-tab/implementation-status-tab.component.html new file mode 100644 index 00000000..fc54a6b1 --- /dev/null +++ b/src/app/views/pm-shri/pages/implementation-status-tab/implementation-status-tab.component.html @@ -0,0 +1,25 @@ +
+
+
+ +
+
+ + +
+
+
+
+
+
+ +
+
+
+
+ +
+
+
\ No newline at end of file diff --git a/src/app/views/pm-shri/pages/implementation-status-tab/implementation-status-tab.component.scss b/src/app/views/pm-shri/pages/implementation-status-tab/implementation-status-tab.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/src/app/views/pm-shri/pages/implementation-status-tab/implementation-status-tab.component.spec.ts b/src/app/views/pm-shri/pages/implementation-status-tab/implementation-status-tab.component.spec.ts new file mode 100644 index 00000000..924d8d7d --- /dev/null +++ b/src/app/views/pm-shri/pages/implementation-status-tab/implementation-status-tab.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ImplementationStatusTabComponent } from './implementation-status-tab.component'; + +describe('ImplementationStatusTabComponent', () => { + let component: ImplementationStatusTabComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ ImplementationStatusTabComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(ImplementationStatusTabComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/views/pm-shri/pages/implementation-status-tab/implementation-status-tab.component.ts b/src/app/views/pm-shri/pages/implementation-status-tab/implementation-status-tab.component.ts new file mode 100644 index 00000000..56427bbc --- /dev/null +++ b/src/app/views/pm-shri/pages/implementation-status-tab/implementation-status-tab.component.ts @@ -0,0 +1,98 @@ +import { AfterViewInit, Component, Input, OnInit, ViewChild } from '@angular/core'; +import { RbacService } from 'src/app/core/services/rbac-service.service'; +import { WrapperService } from 'src/app/core/services/wrapper.service'; +import { config } from '../../config/pm_shri_config'; +import { ImplementationStatusComponent } from './reports/implementation-status/implementation-status.component'; +import { environment } from 'src/environments/environment'; + +@Component({ + selector: 'app-implementation-status-tab', + templateUrl: './implementation-status-tab.component.html', + styleUrls: ['./implementation-status-tab.component.scss'] +}) +export class ImplementationStatusTabComponent implements OnInit { + + bigNumberReports: any = {}; + minYear: any; + maxYear: any; + minMonth: any; + maxMonth: any; + academicYear: any = []; + months: any = []; + filters: any; + reportsToBeShown: any = []; + rbacDetails: any; + reportsData: any = []; + startDate: any; + endDate: any; + defaultSelectedDays: any; + hasTimeSeriesFilters: boolean = false; + hasCommonFilters: boolean = true; + tabLabel: any = "Implementation Status"; + NVSK: boolean = true; + + @ViewChild('implementationStatus') implementationStatus: ImplementationStatusComponent; + @Input() bigNumberMetrics: any = []; + + constructor(private _wrapperService: WrapperService, private _rbacService: RbacService) { + this._rbacService.getRbacDetails().subscribe((rbacDetails: any) => { + this.rbacDetails = rbacDetails; + }) + if(environment.config === 'VSK') { + this.NVSK = false + } + } + + async ngOnInit(): Promise { + // this.renderReports(); + } + + async ngAfterViewInit(): Promise { + if (this.hasCommonFilters) { + this.filters = await this._wrapperService.constructCommonFilters(config.filters, this.tabLabel); + this.implementationStatus?.getReportData({ filterValues: this.filters.map((filter) => { return { ...filter, columnName: filter.valueProp, filterType: filter.id } }) }); + } + if (this.startDate === undefined && this.endDate === undefined && this.hasTimeSeriesFilters) { + let endDate = new Date(); + let days = endDate.getDate() - this.defaultSelectedDays; + let startDate = new Date(); + startDate.setDate(days); + this.implementationStatus?.getReportData({ timeSeriesValues: { startDate: startDate?.toISOString().split('T')[0], endDate: endDate?.toISOString().split('T')[0] } }); + } + } + + checkReport(key: string, reportType: string): Boolean { + let reportConfig = config; + let flag = false; + reportConfig[key]?.filters?.forEach((filter: any) => { + if (Number(filter.hierarchyLevel) === Number(this.rbacDetails?.role) && Object.keys(filter?.actions?.queries).includes(reportType)) { + flag = true + } + }) + return flag + } + + csvDownload(csvData: any) { + if (csvData) { + this.reportsData.push(csvData) + } + } + + filtersUpdated(filters: any) { + this.reportsData = []; + this.implementationStatus?.getReportData({ filterValues: filters.map((filter) => { return { ...filter, columnName: filter.valueProp, filterType: filter.id } }) }); + } + + timeSeriesUpdated(event: any): void { + this.startDate = event?.startDate?.toDate().toISOString().split('T')[0] + this.endDate = event?.endDate?.toDate().toISOString().split('T')[0] + if (event?.startDate !== null && event?.endDate !== null) { + this.reportsData = []; + this.implementationStatus?.getReportData({ timeSeriesValues: { startDate: this.startDate, endDate: this.endDate } }); + } + } + + importBigNumberMetrics(bigNumberMetric: any) { + this.bigNumberMetrics[bigNumberMetric.ind] = bigNumberMetric.data + } +} diff --git a/src/app/views/pm-shri/pages/implementation-status-tab/reports/bignumber-metrics/bignumber-metrics.component.html b/src/app/views/pm-shri/pages/implementation-status-tab/reports/bignumber-metrics/bignumber-metrics.component.html new file mode 100644 index 00000000..e69de29b diff --git a/src/app/views/pm-shri/pages/implementation-status-tab/reports/bignumber-metrics/bignumber-metrics.component.scss b/src/app/views/pm-shri/pages/implementation-status-tab/reports/bignumber-metrics/bignumber-metrics.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/src/app/views/pm-shri/pages/implementation-status-tab/reports/bignumber-metrics/bignumber-metrics.component.spec.ts b/src/app/views/pm-shri/pages/implementation-status-tab/reports/bignumber-metrics/bignumber-metrics.component.spec.ts new file mode 100644 index 00000000..d3062db3 --- /dev/null +++ b/src/app/views/pm-shri/pages/implementation-status-tab/reports/bignumber-metrics/bignumber-metrics.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { BignumberMetricsComponent } from './udise-bignumber-metrics.component'; + +describe('BignumberMetricsComponent', () => { + let component: BignumberMetricsComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ BignumberMetricsComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(BignumberMetricsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/views/pm-shri/pages/implementation-status-tab/reports/bignumber-metrics/bignumber-metrics.component.ts b/src/app/views/pm-shri/pages/implementation-status-tab/reports/bignumber-metrics/bignumber-metrics.component.ts new file mode 100644 index 00000000..762b9377 --- /dev/null +++ b/src/app/views/pm-shri/pages/implementation-status-tab/reports/bignumber-metrics/bignumber-metrics.component.ts @@ -0,0 +1,92 @@ +import { Component, EventEmitter, OnInit, Output } from '@angular/core'; +import { DataService } from 'src/app/core/services/data.service'; +import { RbacService } from 'src/app/core/services/rbac-service.service'; +import { WrapperService } from 'src/app/core/services/wrapper.service'; +import { buildQuery, parseRbacFilter, parseTimeSeriesQuery } from 'src/app/utilities/QueryBuilder'; +import { config } from 'src/app/views/pm-shri/config/pm_shri_config'; + +@Component({ + selector: 'app-bignumber-metrics', + templateUrl: './bignumber-metrics.component.html', + styleUrls: ['./bignumber-metrics.component.scss'] +}) +export class BignumberMetricsComponent implements OnInit { + reportName: string = 'pmShri_metrics'; + filters: any = []; + levels: any; + reportData: any = []; + title: string = '-------to be filled-------' + selectedYear: any; + selectedMonth: any; + startDate: any; + endDate: any; + config: any; + compareDateRange: any = 30; + filterIndex: any; + rbacDetails: any; + + @Output() exportReportData = new EventEmitter(); + + constructor(private readonly _dataService: DataService, private readonly _wrapperService: WrapperService, private _rbacService: RbacService) { + this._rbacService.getRbacDetails().subscribe((rbacDetails: any) => { + this.rbacDetails = rbacDetails; + }) + } + + ngOnInit(): void { + this.getReportData(); + } + + getReportData(values?: any): void { + let { filterValues, timeSeriesValues } = values ?? {}; + this.startDate = timeSeriesValues?.startDate; + this.endDate = timeSeriesValues?.endDate; + let reportConfig = config + + let { timeSeriesQueries, queries, levels, defaultLevel, filters, options } = reportConfig[this.reportName]; + let onLoadQuery; + let currentLevel; + + if (this.rbacDetails?.role !== null && this.rbacDetails.role !== undefined) { + filters.every((filter: any) => { + if (Number(this.rbacDetails?.role) === Number(filter.hierarchyLevel)) { + queries = { ...filter?.actions?.queries } + currentLevel = filter?.actions?.level; + Object.keys(queries).forEach((key) => { + queries[key] = parseRbacFilter(queries[key], this.rbacDetails) + }); + return false + } + return true + }) + } + Object.keys(queries).forEach(async (key: any, index: any) => { + if (key.toLowerCase().includes('comparison')) { + let endDate = new Date(); + let days = endDate.getDate() - this.compareDateRange; + let startDate = new Date(); + startDate.setDate(days) + onLoadQuery = parseTimeSeriesQuery(queries[key], startDate.toISOString().split('T')[0], endDate.toISOString().split('T')[0]) + } + else { + onLoadQuery = queries[key] + } + let query = buildQuery(onLoadQuery, defaultLevel, this.levels, this.filters, this.startDate, this.endDate, key, this.compareDateRange); + + if (query && key.indexOf('bigNumber') > -1) { + let metricOptions = { + bigNumber: { + title: Array.isArray(options?.bigNumber?.title) ? options?.bigNumber?.title?.[index] : options?.bigNumber?.title, + property: Array.isArray(options?.bigNumber?.property) ? options?.bigNumber?.property?.[index] : options?.bigNumber?.property, + valueSuffix: Array.isArray(options?.bigNumber?.valueSuffix) ? options?.bigNumber?.valueSuffix?.[index] : options?.bigNumber?.valueSuffix + } + } + let metricData = await this._dataService.getBigNumberReportData(query, metricOptions, 'averagePercentage', this.reportData); + metricData = { + ...metricData, + } + this.exportReportData.emit({data: metricData, ind: index}) + } + }) + } +} diff --git a/src/app/views/pm-shri/pages/implementation-status-tab/reports/implementation-status/implementation-status.component.html b/src/app/views/pm-shri/pages/implementation-status-tab/reports/implementation-status/implementation-status.component.html new file mode 100644 index 00000000..0957f880 --- /dev/null +++ b/src/app/views/pm-shri/pages/implementation-status-tab/reports/implementation-status/implementation-status.component.html @@ -0,0 +1,9 @@ +
+ +

{{title}}


+ +
+
+ No Data Found +
+
\ No newline at end of file diff --git a/src/app/views/pm-shri/pages/implementation-status-tab/reports/implementation-status/implementation-status.component.scss b/src/app/views/pm-shri/pages/implementation-status-tab/reports/implementation-status/implementation-status.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/src/app/views/pm-shri/pages/implementation-status-tab/reports/implementation-status/implementation-status.component.spec.ts b/src/app/views/pm-shri/pages/implementation-status-tab/reports/implementation-status/implementation-status.component.spec.ts new file mode 100644 index 00000000..c9e8c93b --- /dev/null +++ b/src/app/views/pm-shri/pages/implementation-status-tab/reports/implementation-status/implementation-status.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ImplementationStatusComponent } from './implementation-status.component'; + +describe('ImplementationStatusComponent', () => { + let component: ImplementationStatusComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ ImplementationStatusComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(ImplementationStatusComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/views/pm-shri/pages/implementation-status-tab/reports/implementation-status/implementation-status.component.ts b/src/app/views/pm-shri/pages/implementation-status-tab/reports/implementation-status/implementation-status.component.ts new file mode 100644 index 00000000..4cb688ea --- /dev/null +++ b/src/app/views/pm-shri/pages/implementation-status-tab/reports/implementation-status/implementation-status.component.ts @@ -0,0 +1,126 @@ +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { CommonService } from 'src/app/core/services/common/common.service'; +import { DataService } from 'src/app/core/services/data.service'; +import { RbacService } from 'src/app/core/services/rbac-service.service'; +import { WrapperService } from 'src/app/core/services/wrapper.service'; +import { buildQuery, parseFilterToQuery, parseRbacFilter, parseTimeSeriesQuery } from 'src/app/utilities/QueryBuilder'; +import { config } from 'src/app/views/pm-shri/config/pm_shri_config'; + +@Component({ + selector: 'app-implementation-status', + templateUrl: './implementation-status.component.html', + styleUrls: ['./implementation-status.component.scss'] +}) +export class ImplementationStatusComponent implements OnInit { + reportName: string = 'implementation_status'; + filters: any = []; + levels: any; + reportData: any = { + reportName: "Implementation Status" + }; + title: string = 'Implementation Status' + selectedYear: any; + selectedMonth: any; + startDate: any; + endDate: any; + config: any; + compareDateRange: any = 30; + filterIndex: any; + rbacDetails: any; + + @Output() exportReportData = new EventEmitter(); + + constructor(private readonly _dataService: DataService, private readonly _wrapperService: WrapperService, private _rbacService: RbacService) { + this._rbacService.getRbacDetails().subscribe((rbacDetails: any) => { + this.rbacDetails = rbacDetails; + }) + } + + ngOnInit(): void { + } + + getReportData(values: any): void { + let { filterValues, timeSeriesValues } = values ?? {}; + this.startDate = timeSeriesValues?.startDate; + this.endDate = timeSeriesValues?.endDate; + let reportConfig = config + + let { timeSeriesQueries, queries, levels, defaultLevel, filters, options } = reportConfig[this.reportName]; + let onLoadQuery; + let currentLevel; + + if (this.rbacDetails?.role !== null && this.rbacDetails.role !== undefined) { + filters.every((filter: any) => { + if (Number(this.rbacDetails?.role) === Number(filter.hierarchyLevel)) { + queries = { ...filter?.actions?.queries } + currentLevel = filter?.actions?.level; + this.reportData = { + ...this.reportData, + reportName: `% ${currentLevel[0].toUpperCase() + currentLevel.substring(1)}s which conducted meeting` + } + Object.keys(queries).forEach((key) => { + queries[key] = parseRbacFilter(queries[key], this.rbacDetails) + }); + return false + } + return true + }) + } + + Object.keys(queries).forEach(async (key: any) => { + if (key.toLowerCase().includes('comparison')) { + let endDate = new Date(); + let days = endDate.getDate() - this.compareDateRange; + let startDate = new Date(); + startDate.setDate(days) + onLoadQuery = parseTimeSeriesQuery(queries[key], startDate.toISOString().split('T')[0], endDate.toISOString().split('T')[0]) + } + else { + onLoadQuery = queries[key] + } + let query = buildQuery(onLoadQuery, defaultLevel, this.levels, this.filters, this.startDate, this.endDate, key, this.compareDateRange); + + let metricFilter = [...filterValues].filter((filter: any) => { + return filter.filterType === 'metric' + }) + + filterValues = [...filterValues].filter((filter: any) => { + return filter.filterType !== 'metric' + }) + + filterValues.forEach((filterParams: any) => { + query = parseFilterToQuery(query, filterParams) + }); + + if (query && key === 'table') { + this.reportData = await this._dataService.getTableReportData(query, options); + if (this.reportData?.data?.length > 0) { + let reportsData = { reportData: this.reportData.data, reportType: 'table', reportName: this.title } + this.exportReportData.emit(reportsData) + } + } + else if (query && key === 'bigNumber') { + this.reportData = await this._dataService.getBigNumberReportData(query, options, 'averagePercentage', this.reportData); + } + else if (query && key === 'bigNumberComparison') { + this.reportData = await this._dataService.getBigNumberReportData(query, options, 'differencePercentage', this.reportData); + } + else if (query && key === 'barChart') { + let { reportData, config } = await this._dataService.getBarChartReportData(query, options, filters, defaultLevel); + this.reportData = reportData + this.config = config; + if (this.reportData?.values?.length > 0) { + let reportsData = { reportData: this.reportData.values, reportType: 'dashletBar', reportName: this.title } + this.exportReportData.emit(reportsData) + } + } + else if (query && key === 'map') { + this.reportData = await this._dataService.getMapReportData(query, options, metricFilter) + if (this.reportData?.data?.length > 0) { + let reportsData = { reportData: this.reportData.data, reportType: 'map', reportName: this.title, downloadConfig: options?.downloadConfig } + this.exportReportData.emit(reportsData) + } + } + }) + } +} diff --git a/src/app/views/pm-shri/pages/state-wise-performance-tab/reports/state-wise-performance/state-wise-performance.component.html b/src/app/views/pm-shri/pages/state-wise-performance-tab/reports/state-wise-performance/state-wise-performance.component.html new file mode 100644 index 00000000..db50b5e0 --- /dev/null +++ b/src/app/views/pm-shri/pages/state-wise-performance-tab/reports/state-wise-performance/state-wise-performance.component.html @@ -0,0 +1,9 @@ +
+ +

{{title}}


+ +
+
+ No Data Found +
+
\ No newline at end of file diff --git a/src/app/views/pm-shri/pages/state-wise-performance-tab/reports/state-wise-performance/state-wise-performance.component.scss b/src/app/views/pm-shri/pages/state-wise-performance-tab/reports/state-wise-performance/state-wise-performance.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/src/app/views/pm-shri/pages/state-wise-performance-tab/reports/state-wise-performance/state-wise-performance.component.spec.ts b/src/app/views/pm-shri/pages/state-wise-performance-tab/reports/state-wise-performance/state-wise-performance.component.spec.ts new file mode 100644 index 00000000..9c22c3bc --- /dev/null +++ b/src/app/views/pm-shri/pages/state-wise-performance-tab/reports/state-wise-performance/state-wise-performance.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { StateWisePerformanceComponent } from './state-wise-performance.component'; + +describe('StateWisePerformanceComponent', () => { + let component: StateWisePerformanceComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ StateWisePerformanceComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(StateWisePerformanceComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/views/pm-shri/pages/state-wise-performance-tab/reports/state-wise-performance/state-wise-performance.component.ts b/src/app/views/pm-shri/pages/state-wise-performance-tab/reports/state-wise-performance/state-wise-performance.component.ts new file mode 100644 index 00000000..eff6a10f --- /dev/null +++ b/src/app/views/pm-shri/pages/state-wise-performance-tab/reports/state-wise-performance/state-wise-performance.component.ts @@ -0,0 +1,159 @@ +import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core'; +import { CommonService } from 'src/app/core/services/common/common.service'; +import { DataService } from 'src/app/core/services/data.service'; +import { RbacService } from 'src/app/core/services/rbac-service.service'; +import { ReportDrilldownService } from 'src/app/core/services/report-drilldown/report-drilldown.service'; +import { WrapperService } from 'src/app/core/services/wrapper.service'; +import { buildQuery, parseFilterToQuery, parseRbacFilter, parseTimeSeriesQuery } from 'src/app/utilities/QueryBuilder'; +import { config } from 'src/app/views/pm-shri/config/pm_shri_config'; + + +@Component({ + selector: 'app-state-wise-performance', + templateUrl: './state-wise-performance.component.html', + styleUrls: ['./state-wise-performance.component.scss'] +}) +export class StateWisePerformanceComponent implements OnInit, OnDestroy { + reportName: string = 'state_wise_performance'; + filters: any = []; + levels: any; + reportData: any = { + reportName: "State Wise Performance" + }; + title: string = 'State Wise Performance' + selectedYear: any; + selectedMonth: any; + startDate: any; + endDate: any; + config: any; + compareDateRange: any = 30; + filterIndex: any; + rbacDetails: any; + currentHierarchyLevel: any; + drillDownSubscription: any; + drillDownLevel: any; + drillDownDetails: any; + metricFilter: any; + commonFilter: any; + + @Output() exportReportData = new EventEmitter(); + + constructor(private readonly _dataService: DataService, private readonly _wrapperService: WrapperService, private _rbacService: RbacService, private _drillDownService: ReportDrilldownService) { + this._rbacService.getRbacDetails().subscribe((rbacDetails: any) => { + this.rbacDetails = rbacDetails; + this.currentHierarchyLevel = rbacDetails.role + }) + this.drillDownSubscription = this._drillDownService.drilldownData.subscribe(async (data) => { + if (data && data !== 'reset') { + this.drillDownLevel = data.hierarchyLevel + // this.drilldownData({ + // ...data + // }) + let result: any = await this._drillDownService.drilldown(data, this.rbacDetails, config[this.reportName], this.startDate, this.endDate, this.drillDownDetails, this.metricFilter, this.commonFilter) + this.drillDownDetails = result?.drillDownDetails + this.reportData = result?.reportData + } + }) + } + + ngOnInit(): void { + } + + async getReportData(values: any): Promise { + let { filterValues, timeSeriesValues } = values ?? {}; + this.startDate = timeSeriesValues?.startDate; + this.endDate = timeSeriesValues?.endDate; + let metricFilter = [...filterValues].filter((filter: any) => { + return filter.filterType === 'metric' + }) + this.metricFilter = metricFilter + + filterValues = [...filterValues].filter((filter: any) => { + return filter.filterType !== 'metric' + }) + + this.commonFilter = filterValues + if (this.drillDownDetails !== undefined) { + let result: any = await this._drillDownService.drilldown({ hierarchyLevel: this.drillDownLevel }, this.rbacDetails, config[this.reportName], this.startDate, this.endDate, this.drillDownDetails, this.metricFilter, this.commonFilter) + this.drillDownDetails = result?.drillDownDetails + this.reportData = result?.reportData + } + else { + let reportConfig = config + + let { timeSeriesQueries, queries, levels, defaultLevel, filters, options } = reportConfig[this.reportName]; + let onLoadQuery; + let currentLevel; + + if (this.rbacDetails?.role !== null && this.rbacDetails !== undefined) { + filters.every((filter: any) => { + if (Number(this.rbacDetails?.role) === Number(filter.hierarchyLevel)) { + queries = { ...filter?.actions?.queries } + currentLevel = filter?.actions?.level; + this.reportData = { + ...this.reportData, + reportName: `% ${currentLevel[0].toUpperCase() + currentLevel.substring(1)}s which conducted meeting` + } + Object.keys(queries).forEach((key) => { + queries[key] = parseRbacFilter(queries[key], this.rbacDetails) + }); + return false + } + return true + }) + } + + Object.keys(queries).forEach(async (key: any) => { + if (key.toLowerCase().includes('comparison')) { + let endDate = new Date(); + let days = endDate.getDate() - this.compareDateRange; + let startDate = new Date(); + startDate.setDate(days) + onLoadQuery = parseTimeSeriesQuery(queries[key], startDate.toISOString().split('T')[0], endDate.toISOString().split('T')[0]) + } + else { + onLoadQuery = queries[key] + } + let query = buildQuery(onLoadQuery, defaultLevel, this.levels, this.filters, this.startDate, this.endDate, key, this.compareDateRange); + + filterValues.forEach((filterParams: any) => { + query = parseFilterToQuery(query, filterParams) + }); + + if (query && key === 'table') { + this.reportData = await this._dataService.getTableReportData(query, options); + if (this.reportData?.data?.length > 0) { + let reportsData = { reportData: this.reportData.data, reportType: 'table', reportName: this.title } + this.exportReportData.emit(reportsData) + } + } + else if (query && key === 'bigNumber') { + this.reportData = await this._dataService.getBigNumberReportData(query, options, 'averagePercentage', this.reportData); + } + else if (query && key === 'bigNumberComparison') { + this.reportData = await this._dataService.getBigNumberReportData(query, options, 'differencePercentage', this.reportData); + } + else if (query && key === 'barChart') { + let { reportData, config } = await this._dataService.getBarChartReportData(query, options, filters, defaultLevel); + this.reportData = reportData + this.config = config; + if (this.reportData?.values?.length > 0) { + let reportsData = { reportData: this.reportData.values, reportType: 'dashletBar', reportName: this.title } + this.exportReportData.emit(reportsData) + } + } + else if (query && key === 'map') { + this.reportData = await this._dataService.getMapReportData(query, options, metricFilter) + if (this.reportData?.data?.length > 0) { + let reportsData = { reportData: this.reportData.data, reportType: 'map', reportName: this.title, downloadConfig: options?.downloadConfig } + this.exportReportData.emit(reportsData) + } + } + }) + } + } + ngOnDestroy(): void { + this._drillDownService.emit('reset') + this.drillDownSubscription.unsubscribe() + } +} diff --git a/src/app/views/pm-shri/pages/state-wise-performance-tab/state-wise-performance-tab.component.html b/src/app/views/pm-shri/pages/state-wise-performance-tab/state-wise-performance-tab.component.html new file mode 100644 index 00000000..5b1e7c0e --- /dev/null +++ b/src/app/views/pm-shri/pages/state-wise-performance-tab/state-wise-performance-tab.component.html @@ -0,0 +1,22 @@ +
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+ +
+
+
+
\ No newline at end of file diff --git a/src/app/views/pm-shri/pages/state-wise-performance-tab/state-wise-performance-tab.component.scss b/src/app/views/pm-shri/pages/state-wise-performance-tab/state-wise-performance-tab.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/src/app/views/pm-shri/pages/state-wise-performance-tab/state-wise-performance-tab.component.spec.ts b/src/app/views/pm-shri/pages/state-wise-performance-tab/state-wise-performance-tab.component.spec.ts new file mode 100644 index 00000000..68518df2 --- /dev/null +++ b/src/app/views/pm-shri/pages/state-wise-performance-tab/state-wise-performance-tab.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { StateWisePerformanceTabComponent } from './state-wise-performance-tab.component'; + +describe('StateWisePerformanceTabComponent', () => { + let component: StateWisePerformanceTabComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ StateWisePerformanceTabComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(StateWisePerformanceTabComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/views/pm-shri/pages/state-wise-performance-tab/state-wise-performance-tab.component.ts b/src/app/views/pm-shri/pages/state-wise-performance-tab/state-wise-performance-tab.component.ts new file mode 100644 index 00000000..4b3a02e8 --- /dev/null +++ b/src/app/views/pm-shri/pages/state-wise-performance-tab/state-wise-performance-tab.component.ts @@ -0,0 +1,94 @@ +import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core'; +import { RbacService } from 'src/app/core/services/rbac-service.service'; +import { WrapperService } from 'src/app/core/services/wrapper.service'; +import { config } from '../../config/pm_shri_config'; +import { StateWisePerformanceComponent } from './reports/state-wise-performance/state-wise-performance.component'; + + +@Component({ + selector: 'app-state-wise-performance-tab', + templateUrl: './state-wise-performance-tab.component.html', + styleUrls: ['./state-wise-performance-tab.component.scss'] +}) +export class StateWisePerformanceTabComponent implements OnInit, AfterViewInit { + + bigNumberReports: any = {}; + minYear: any; + maxYear: any; + minMonth: any; + maxMonth: any; + academicYear: any = []; + months: any = []; + filters: any; + reportsToBeShown: any = []; + rbacDetails: any; + reportsData: any = []; + startDate: any; + endDate: any; + defaultSelectedDays: any; + hasTimeSeriesFilters: boolean = false; + hasCommonFilters: boolean = true; + tabLabel: any = "State Wise Performance"; + bigNumberMetrics: any = []; + +@ViewChild('stateWisePerformance') stateWisePerformance: StateWisePerformanceComponent; + +constructor(private _wrapperService: WrapperService, private _rbacService: RbacService) { + this._rbacService.getRbacDetails().subscribe((rbacDetails: any) => { + this.rbacDetails = rbacDetails; + }) + } + + async ngOnInit(): Promise { + // this.renderReports(); + } + + async ngAfterViewInit(): Promise { + if (this.hasCommonFilters) { + this.filters = await this._wrapperService.constructCommonFilters(config.filters, this.tabLabel); + this.stateWisePerformance?.getReportData({ filterValues: this.filters.map((filter) => { return { ...filter, columnName: filter.valueProp, filterType: filter.id} }) }); + } + if (this.startDate === undefined && this.endDate === undefined && this.hasTimeSeriesFilters) { + let endDate = new Date(); + let days = endDate.getDate() - this.defaultSelectedDays; + let startDate = new Date(); + startDate.setDate(days); + this.stateWisePerformance?.getReportData({ timeSeriesValues: { startDate: startDate?.toISOString().split('T')[0], endDate: endDate?.toISOString().split('T')[0] } }); + } + } + + checkReport(key: string, reportType: string): Boolean { + let reportConfig = config; + let flag = false; + reportConfig[key]?.filters?.forEach((filter: any) => { + if (Number(filter.hierarchyLevel) === Number(this.rbacDetails?.role) && Object.keys(filter?.actions?.queries).includes(reportType)) { + flag = true + } + }) + return flag + } + + csvDownload(csvData: any) { + if (csvData) { + this.reportsData.push(csvData) + } + } + + filtersUpdated(filters: any) { + this.reportsData = []; + this.stateWisePerformance?.getReportData({ filterValues: filters.map((filter) => { return { ...filter, columnName: filter.valueProp, filterType: filter.id} }) }); + } + + timeSeriesUpdated(event: any): void { + this.startDate = event?.startDate?.toDate().toISOString().split('T')[0] + this.endDate = event?.endDate?.toDate().toISOString().split('T')[0] + if (event?.startDate !== null && event?.endDate !== null) { + this.reportsData = []; + this.stateWisePerformance?.getReportData({timeSeriesValues: {startDate: this.startDate, endDate: this.endDate}}); + } + } + + importBigNumberMetrics(bigNumberMetric: any) { + this.bigNumberMetrics[bigNumberMetric.ind] = bigNumberMetric.data + } +} diff --git a/src/app/views/pm-shri/pm-shri-routing.module.ts b/src/app/views/pm-shri/pm-shri-routing.module.ts new file mode 100644 index 00000000..ba1a6f45 --- /dev/null +++ b/src/app/views/pm-shri/pm-shri-routing.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; +import { PmShriComponent } from './pm-shri.component'; + +const routes: Routes = [ + { + path:'', + component: PmShriComponent + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class PmShriRoutingModule { } diff --git a/src/app/views/pm-shri/pm-shri.component.html b/src/app/views/pm-shri/pm-shri.component.html new file mode 100644 index 00000000..37e36115 --- /dev/null +++ b/src/app/views/pm-shri/pm-shri.component.html @@ -0,0 +1,25 @@ +
+
+
+

PM Shri

+

PM Shri

+
+
+
+ +
+ +
+ +
+ + + + + + +
+
\ No newline at end of file diff --git a/src/app/views/pm-shri/pm-shri.component.scss b/src/app/views/pm-shri/pm-shri.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/src/app/views/pm-shri/pm-shri.component.spec.ts b/src/app/views/pm-shri/pm-shri.component.spec.ts new file mode 100644 index 00000000..2f09298f --- /dev/null +++ b/src/app/views/pm-shri/pm-shri.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PmShriComponent } from './pm-shri.component'; + +describe('PmShriComponent', () => { + let component: PmShriComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ PmShriComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(PmShriComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/views/pm-shri/pm-shri.component.ts b/src/app/views/pm-shri/pm-shri.component.ts new file mode 100644 index 00000000..ce5ad8f7 --- /dev/null +++ b/src/app/views/pm-shri/pm-shri.component.ts @@ -0,0 +1,83 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import { CommonService } from 'src/app/core/services/common/common.service'; +import { RbacService } from 'src/app/core/services/rbac-service.service'; +import { config } from './config/pm_shri_config'; +import { environment } from 'src/environments/environment'; + +@Component({ + selector: 'app-pm-shri', + templateUrl: './pm-shri.component.html', + styleUrls: ['./pm-shri.component.scss'] +}) +export class PmShriComponent implements OnInit { + + loadTabs = false; + rbacDetails: any; + tabIndex; + selectedTabLabel; + tabs: any = []; + programName: any = 'pm_shri'; + bigNumberMetrics: any = []; + NVSK: boolean = true; + + constructor(private route: ActivatedRoute, private _rbacService: RbacService, private _commonService: CommonService) { + this.route.queryParams.subscribe((param: any) => { + this.tabIndex = param.tab ? Number(param.tab) : 0; + }) + this._rbacService.getRbacDetails().subscribe((rbacDetails: any) => { + this.rbacDetails = rbacDetails; + }) + let allTabs = [...Object.keys(config)] + allTabs.forEach((tab: any) => { + config?.[tab]?.filters?.every((filter) => { + if ((Number(filter?.hierarchyLevel) === this.rbacDetails?.role) || this.rbacDetails?.role === 0) { + if (!(this.tabs.includes(config?.[tab]?.label))) { + this.tabs.push(config?.[tab]?.label) + } + return false + } + return true + }) + }) + if(environment.config === 'VSK') { + this.NVSK = false; + } + } + + ngOnInit(): void { + this._commonService.getMetaData(this.programName).subscribe() + } + + ngAfterViewInit(): void { + setTimeout(() => { + this.selectedTabLabel = this.tabs.length > 0 ? this.tabs[0] : undefined + }); + } + + onTabChanged($event: any): void { + this.selectedTabLabel = $event?.tab?.textLabel; + this.tabIndex = $event.index; + setTimeout(() => { + window.dispatchEvent(new Event('resize')); + console.log('resize'); + }, 100); + } + + checkReport(key: string, reportType: string): Boolean { + let reportConfig = config; + let flag = false; + reportConfig[key]?.filters?.forEach((filter: any) => { + if (Number(filter.hierarchyLevel) === Number(this.rbacDetails?.role) && Object.keys(filter?.actions?.queries).includes(reportType)) { + flag = true; + } + }); + + return flag; + } + + importBigNumberMetrics(bigNumberMetric: any) { + this.bigNumberMetrics[bigNumberMetric.ind] = bigNumberMetric.data + } + +} diff --git a/src/app/views/pm-shri/pm-shri.module.ts b/src/app/views/pm-shri/pm-shri.module.ts new file mode 100644 index 00000000..eb11afc9 --- /dev/null +++ b/src/app/views/pm-shri/pm-shri.module.ts @@ -0,0 +1,30 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { MatTabsModule } from '@angular/material/tabs'; +import { SharedModule } from 'src/app/shared/shared.module'; + +import { PmShriRoutingModule } from './pm-shri-routing.module'; +import { PmShriComponent } from './pm-shri.component'; +import { ImplementationStatusTabComponent } from './pages/implementation-status-tab/implementation-status-tab.component'; +import { ImplementationStatusComponent } from './pages/implementation-status-tab/reports/implementation-status/implementation-status.component'; +import { BignumberMetricsComponent } from './pages/implementation-status-tab/reports/bignumber-metrics/bignumber-metrics.component'; +import { StateWisePerformanceTabComponent } from './pages/state-wise-performance-tab/state-wise-performance-tab.component'; +import { StateWisePerformanceComponent } from './pages/state-wise-performance-tab/reports/state-wise-performance/state-wise-performance.component'; + +@NgModule({ + declarations: [ + PmShriComponent, + ImplementationStatusTabComponent, + ImplementationStatusComponent, + BignumberMetricsComponent, + StateWisePerformanceTabComponent, + StateWisePerformanceComponent + ], + imports: [ + CommonModule, + PmShriRoutingModule, + MatTabsModule, + SharedModule + ] +}) +export class PmShriModule { } From 97cc8a5740f456e6d994ecd05ba85371cf7d6aba Mon Sep 17 00:00:00 2001 From: pandutibil Date: Fri, 13 Oct 2023 19:53:37 +0530 Subject: [PATCH 03/11] Query is updated in pm shri report --- src/app/views/pm-shri/config/pm_shri_config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/views/pm-shri/config/pm_shri_config.ts b/src/app/views/pm-shri/config/pm_shri_config.ts index 2f4e0a31..1fb05c94 100644 --- a/src/app/views/pm-shri/config/pm_shri_config.ts +++ b/src/app/views/pm-shri/config/pm_shri_config.ts @@ -61,7 +61,7 @@ export const config = { { "queries": { - "map": "select t1.state_id, t1.state_id as level, t2.state_name, t1.category_name, sum(t3.sum) as total_schools, round(cast(sum(t1.sum) / sum(t3.sum) as numeric) * 100, 2) as percentage, t2.latitude, t2.longitude from datasets.pm_shri_pm_shri_category_h21fc2hyav9wqkf0yxrl as t1 join dimensions.state as t2 on t2.state_id = t1.state_id join datasets.pm_shri_total_schools_state as t3 on t3.state_id = t1.state_id where category_name in ('total_schools_having_library', 'total_schools_having_handwash_facility', 'total_schools_having_drinking_water_facility', 'total_schools_having_ramp_facility', 'total_schools_having_playground', 'total_schools_having_internet_facility') group by t1.state_id, t2.state_name, t1.category_name, t2.latitude, t2.longitude" + "map": "select t1.state_id, t1.state_id as level, t2.state_name, t1.category_name, sum(t3.sum) as total_schools, round(cast(sum(t1.sum) / sum(t3.sum) as numeric) * 100, 2) as percentage, t2.latitude, t2.longitude from datasets.pm_shri_pm_shri_category_state0categorypmshri as t1 join dimensions.state as t2 on t2.state_id = t1.state_id join datasets.pm_shri_total_schools_state as t3 on t3.state_id = t1.state_id where category_name in ('total_schools_having_library', 'total_schools_having_handwash_facility', 'total_schools_having_drinking_water_facility', 'total_schools_having_ramp_facility', 'total_schools_having_playground', 'total_schools_having_internet_facility') group by t1.state_id, t2.state_name, t1.category_name, t2.latitude, t2.longitude" }, "level": "state", "nextLevel": "district" From 2a7f2589cf4875f9ad19978a6729a5d2fd511d62 Mon Sep 17 00:00:00 2001 From: pandutibil Date: Tue, 17 Oct 2023 15:58:50 +0530 Subject: [PATCH 04/11] PM shri logo and description details are added --- src/app/views/pm-shri/pm-shri.component.html | 4 ++-- src/assets/images/pm_shri.png | Bin 0 -> 20347 bytes 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 src/assets/images/pm_shri.png diff --git a/src/app/views/pm-shri/pm-shri.component.html b/src/app/views/pm-shri/pm-shri.component.html index 37e36115..e773c44a 100644 --- a/src/app/views/pm-shri/pm-shri.component.html +++ b/src/app/views/pm-shri/pm-shri.component.html @@ -1,8 +1,8 @@
-

PM Shri

-

PM Shri

+

PM SHRI

+

PM SHRI initiative is intended to develop schools in which every student feels welcomed and cared for, where a safe and stimulating learning environment exists, where a wide range of learning experiences are offered, and where good physical infrastructure and appropriate resources conducive to learning are available to all students.

diff --git a/src/assets/images/pm_shri.png b/src/assets/images/pm_shri.png new file mode 100644 index 0000000000000000000000000000000000000000..479c7d3948de4047b874e8cfe23847f069a32365 GIT binary patch literal 20347 zcmaI7W0WRAkT&|Zrfv7MHEr9rZCh{Kwr$(CyQgj2wmGfoJGBCrBL-01B{QrXxie z-Tw~iR3KLe5GDZjh*3^qLE@DFV{|HGXn-*+K)rI42@D_^0I>1!79s{z!UL|JB>5l! zYZXabn1HoH+zKc_3uXQbei-6Gg^Df9FE(= z-QEGw!GKMJkRc`|k{R?7adui3397^?n9K|u0D$v0|NAcofBfmm(f*0qsm<-vaN%F; zJ0LM1(f#hdrf9k(8F*T#rMs;58R9LefjtH@22M+z#&s0qo%(o=*z*-&b3x4 z_H+_lh|%u#l;rPdh~HN%<@^ClgANUPKAm9 z8$6&oRK8!X6|!a0rr-Al1T+dkW5E?5;QL4$jRTtiKr&}x@^}RRlKS4_1gJp((`m(r z06_N{mQHyxrpyQw03ebdKvgdY3HKYVx*s9?H(qx?C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utra0&;l^koK4OeFUPw zNf50>9{(LY%=4iqDfma$LAmuS7XAg?YC1%$W)Qz56x`|Hq*r3Dj>mgcL!!vwcLb!1 zC}jV|FklE*+z2yl2K_hS{bm11(1fKJ&)1=2wL-Vq2)*f2h`C1t?w$ecZH2{9R!qv` zuKUQukG%zv_%QT)KSaCPct!%c;072+w&6N~Ygty?urEPmFJg;B?)wP_z77L$nR6^+ zkbVf0x7S2?DEXMHGR#dpO>10KiV{a2jpXyA`2R7yjbI>dV5F$#-zfj@iNlcrzmQH!-A9PXP;gQSDwE_I!vSQsgUeO{VLZe`O^3ev zcL48afp8n4OVoe}O#zaeiTmFKl1+gx<6swX_Ya^R*J83(fnpsDuxqxXaI zq#z=+1LHpj5nv)j3}NXKz$aM~uK~jT9bq0@2I#k#087=gWe}m?7BLiDXc3{)Fz0?y z7^H>5tY$x%JLImlzH!R|{D5LQwFF!QRdXHLrp!JQ9;WAEJ=Y4ITj}YK9o{46Zv0 z@~emdewgzY-eJI>1<~_4AoxOv4VwYLM}WQ8ftdKEZh&a91)^A- za%pishWQhj|IZ*qGr={tK`a^#eM9DS1-{3LASh2m#~BNgXal&`u@L_rfm!>Dc#oTL z{BUsWWdPuDmbfwnKAn$)2+YTKxe@x9j9u2%H{pGrhmJB2^LK`?qrvPw5eRu02ye@Q z#yR!{X=B(bfIK@e5ltm{QwL(J0RXf@zP=oQIS8CEhWGq2WcY Date: Fri, 20 Oct 2023 13:57:32 +0530 Subject: [PATCH 05/11] Static big number metrics are added for PM SHREE --- src/app/core/services/data.service.ts | 32 ++++++++--------- .../big-number/big-number.component.ts | 6 ++-- src/app/utilities/NumberFomatter.ts | 13 +++---- .../views/dashboard/dashboard.component.ts | 36 +++++++++++-------- .../views/pm-shri/config/pm_shri_config.ts | 18 +++++----- .../implementation-status-tab.component.html | 11 +++--- .../bignumber-metrics.component.ts | 3 +- 7 files changed, 65 insertions(+), 54 deletions(-) diff --git a/src/app/core/services/data.service.ts b/src/app/core/services/data.service.ts index ff6e7cdd..261ee484 100644 --- a/src/app/core/services/data.service.ts +++ b/src/app/core/services/data.service.ts @@ -78,35 +78,31 @@ export class DataService { return new Promise((resolve, reject) => { this.spinner.show(); let { bigNumber } = options ?? {}; - let { valueSuffix, property, title } = bigNumber ?? {}; + let { valueSuffix, property, title, formatter } = bigNumber ?? {}; let reportData = { ...prevReportData, - valueSuffix: valueSuffix, - reportName: title + valueSuffix, + reportName: title, + formatter } - if (indicator === 'averagePercentage') { + + if (query === "" || isNaN(Number(query))) { this._commonService.getReportDataNew(query).subscribe((res: any) => { if (res) { let rows = res; reportData = { ...reportData, - averagePercentage: rows[0]?.[property] + [indicator]: rows[0]?.[property] } resolve(reportData) } - }) - } - else if (indicator === 'differencePercentage') { - this._commonService.getReportDataNew(query).subscribe((res: any) => { - if (res) { - let rows = res; - reportData = { - ...reportData, - differencePercentage: rows[0]?.[property] - } - resolve(reportData) - } - }) + }); + } else { + reportData = { + ...reportData, + [indicator]: !isNaN(Number(query)) ? Number(query) : query + } + resolve(reportData) } this.spinner.hide() }); diff --git a/src/app/shared/components/big-number/big-number.component.ts b/src/app/shared/components/big-number/big-number.component.ts index 0aabaeba..dd4e66d8 100644 --- a/src/app/shared/components/big-number/big-number.component.ts +++ b/src/app/shared/components/big-number/big-number.component.ts @@ -13,10 +13,11 @@ export class BigNumberComponent implements OnInit, OnChanges { differenceInPercentage: any; differenceIndicator: any= undefined; valueSuffix: any; + formatter: any; + constructor() { } ngOnInit(): void { - } ngOnChanges(): void { @@ -24,6 +25,7 @@ export class BigNumberComponent implements OnInit, OnChanges { } updateValues(): void { + this.formatter = this.bigNumberReportData?.formatter; this.averagePercentage = this.bigNumberReportData?.averagePercentage; this.valueSuffix = this.bigNumberReportData?.valueSuffix ? this.bigNumberReportData?.valueSuffix : ''; if(this.bigNumberReportData && this.bigNumberReportData.differencePercentage && this.bigNumberReportData.averagePercentage) { @@ -42,7 +44,7 @@ export class BigNumberComponent implements OnInit, OnChanges { } formatNumber(input: any) { - return formatNumberForReport(Number(input)) + return formatNumberForReport(Number(input), this.formatter); } } diff --git a/src/app/utilities/NumberFomatter.ts b/src/app/utilities/NumberFomatter.ts index 5c30cd17..c9695954 100644 --- a/src/app/utilities/NumberFomatter.ts +++ b/src/app/utilities/NumberFomatter.ts @@ -1,9 +1,9 @@ import { environment } from "src/environments/environment"; -function formatNumber(number: number, config: any): string { +function formatNumber(number: number, formatter: any): string { - if (config.format === 'short') { - if (config.locale === 'en-IN') { + if (formatter.format === 'short') { + if (formatter.locale === 'en-IN') { if (number < 1000) { return `${number}`; } else if (number > 999 && number <= 99999) { @@ -26,7 +26,7 @@ function formatNumber(number: number, config: any): string { } } - return new Intl.NumberFormat(config.locale).format(number); + return new Intl.NumberFormat(formatter.locale).format(number); } function numberLabelFormat(number: number, config: any, axisRef?: any): string { @@ -89,8 +89,9 @@ function removeFormat(string, config) { } -export function formatNumberForReport(number: number): string { - return formatNumber(number, environment.numberFormat.reports); +export function formatNumberForReport(number: number, formatter?: any): string { + formatter = formatter ? formatter : environment.numberFormat.reports; + return formatNumber(number, formatter); } export function numberLabelFormatForReport(number: number, axisRef?: any): string { diff --git a/src/app/views/dashboard/dashboard.component.ts b/src/app/views/dashboard/dashboard.component.ts index c9885db8..9f7baf99 100644 --- a/src/app/views/dashboard/dashboard.component.ts +++ b/src/app/views/dashboard/dashboard.component.ts @@ -10,7 +10,7 @@ import { CommonService } from 'src/app/core/services/common/common.service'; import { ConfigService } from 'src/app/core/services/config/config.service'; import { RbacService } from 'src/app/core/services/rbac-service.service'; import { WrapperService } from 'src/app/core/services/wrapper.service'; -import { formatNumberForReport } from 'src/app/utilities/NumberFomatter'; +import { formatNumberForReport, numberLabelFormatForReport } from 'src/app/utilities/NumberFomatter'; import { parseRbacFilter } from 'src/app/utilities/QueryBuilder'; import { environment } from 'src/environments/environment'; @@ -151,20 +151,28 @@ export class DashboardComponent implements OnInit { break; } else if (metricQueriesKeys[k].indexOf('bigNumber') > -1) { - let query = parseRbacFilter(metricQueries[metricQueriesKeys[k]], rbacDetails) - let res = await this._wrapperService.runQuery(query) - if (res && res.length > 0) { - let metricData = { - value: Array.isArray(programConfig[reports[i]]?.options?.bigNumber?.property) ? String(formatNumberForReport(res[0]?.[programConfig[reports[i]]?.options?.bigNumber?.property[k]])) + [programConfig[reports[i]]?.options?.bigNumber?.valueSuffix[k]] : String(formatNumberForReport(res[0]?.[programConfig[reports[i]]?.options?.bigNumber?.property])) + [programConfig[reports[i]]?.options?.bigNumber?.valueSuffix], - name: Array.isArray(programConfig[reports[i]]?.options?.bigNumber?.title) ? programConfig[reports[i]]?.options?.bigNumber?.title[k] : programConfig[reports[i]]?.options?.bigNumber?.title - } - if((Array.isArray(programConfig[reports[i]]?.options?.bigNumber?.property) ? res?.[0]?.[programConfig[reports[i]]?.options?.bigNumber?.property[k]] : res?.[0]?.[programConfig[reports[i]]?.options?.bigNumber?.property]) === null) { - metricData.value = Array.isArray(programConfig[reports[i]]?.options?.bigNumber?.valueSuffix) ? '0' + programConfig[reports[i]]?.options?.bigNumber?.valueSuffix[k] : '0' + programConfig[reports[i]]?.options?.bigNumber?.valueSuffix - } - if (metricData.value !== null && metricData !== undefined) { - metrics.push(metricData) - // console.log(metricData.value) + let query = parseRbacFilter(metricQueries[metricQueriesKeys[k]], rbacDetails); + if (query === "" || isNaN(Number(query))) { + let res = await this._wrapperService.runQuery(query) + if (res && res.length > 0) { + let metricData = { + value: Array.isArray(programConfig[reports[i]]?.options?.bigNumber?.property) ? String(formatNumberForReport(res[0]?.[programConfig[reports[i]]?.options?.bigNumber?.property[k]])) + [programConfig[reports[i]]?.options?.bigNumber?.valueSuffix[k]] : String(formatNumberForReport(res[0]?.[programConfig[reports[i]]?.options?.bigNumber?.property])) + [programConfig[reports[i]]?.options?.bigNumber?.valueSuffix], + name: Array.isArray(programConfig[reports[i]]?.options?.bigNumber?.title) ? programConfig[reports[i]]?.options?.bigNumber?.title[k] : programConfig[reports[i]]?.options?.bigNumber?.title + } + if((Array.isArray(programConfig[reports[i]]?.options?.bigNumber?.property) ? res?.[0]?.[programConfig[reports[i]]?.options?.bigNumber?.property[k]] : res?.[0]?.[programConfig[reports[i]]?.options?.bigNumber?.property]) === null) { + metricData.value = Array.isArray(programConfig[reports[i]]?.options?.bigNumber?.valueSuffix) ? '0' + programConfig[reports[i]]?.options?.bigNumber?.valueSuffix[k] : '0' + programConfig[reports[i]]?.options?.bigNumber?.valueSuffix + } + if (metricData.value !== null && metricData !== undefined) { + metrics.push(metricData) + // console.log(metricData.value) + } } + } else { + const formatter = programConfig[reports[i]]?.options?.bigNumber?.formatter[k] ? programConfig[reports[i]]?.options?.bigNumber?.formatter[k] : programConfig[reports[i]]?.options?.bigNumber?.formatter; + metrics.push({ + value: !isNaN(metricQueries[metricQueriesKeys[k]]) ? formatNumberForReport(metricQueries[metricQueriesKeys[k]], formatter) : metricQueries[metricQueriesKeys[k]], + name: programConfig[reports[i]]?.options?.bigNumber?.title[k] + }); } } } diff --git a/src/app/views/pm-shri/config/pm_shri_config.ts b/src/app/views/pm-shri/config/pm_shri_config.ts index 1fb05c94..b9ba8db8 100644 --- a/src/app/views/pm-shri/config/pm_shri_config.ts +++ b/src/app/views/pm-shri/config/pm_shri_config.ts @@ -114,11 +114,14 @@ export const config = { "hierarchyLevel": "0", "actions": { "queries": { - "bigNumber1": "select SUM(count) as total_states from datasets.pm_shri_started_state", - "bigNumber2": "select SUM(sum) as total_schools from datasets.pm_shri_total_schools_state", - "bigNumber3": "select sum(sum) as only_boys_schools from datasets.pm_shri_pm_shri_category_state0categorypmshri where category_name = 'only_boys_school'", - "bigNumber4": "select sum(sum) as only_girls_schools from datasets.pm_shri_pm_shri_category_state0categorypmshri where category_name = 'only_girls_school'", - "bigNumber5": "select sum(sum) as co_ed_schools from datasets.pm_shri_pm_shri_category_state0categorypmshri where category_name = 'co-ed_school'" + "bigNumber1": "6448", + "bigNumber2": "763", + "bigNumber3": "863", + "bigNumber4": "1533", + "bigNumber5": "1384", + "bigNumber6": "1616", + "bigNumber7": "735", + "bigNumber8": "317" }, "level": "state" } @@ -126,9 +129,8 @@ export const config = { ], "options": { "bigNumber": { - "title": ['Total states/UTs', 'Total schools', 'Only boys schools', 'Only girls schools', 'Co-ed schools'], - "valueSuffix": ['', '', '', '', ''], - "property": ['total_states', 'total_schools', 'only_boys_schools', 'only_girls_schools', 'co_ed_schools'] + "title": ['Total PM SHRI schools', 'Total districts', 'Total districts', 'No. of primary schools', 'No. of upper primary schools', 'No. of secondary schools', 'No. of higher secondary schools', 'KVS', 'NVS'], + "formatter": { locale: 'en-IN', format: "long" } } } } diff --git a/src/app/views/pm-shri/pages/implementation-status-tab/implementation-status-tab.component.html b/src/app/views/pm-shri/pages/implementation-status-tab/implementation-status-tab.component.html index fc54a6b1..3e21fda9 100644 --- a/src/app/views/pm-shri/pages/implementation-status-tab/implementation-status-tab.component.html +++ b/src/app/views/pm-shri/pages/implementation-status-tab/implementation-status-tab.component.html @@ -10,12 +10,13 @@
-
-
- + +
+
+ +
-
+
Date: Fri, 20 Oct 2023 14:38:35 +0530 Subject: [PATCH 06/11] PM SHREE map report indicator updated --- src/app/core/services/data.service.ts | 4 ++++ src/app/views/pm-shri/config/pm_shri_config.ts | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/core/services/data.service.ts b/src/app/core/services/data.service.ts index 261ee484..70861713 100644 --- a/src/app/core/services/data.service.ts +++ b/src/app/core/services/data.service.ts @@ -310,6 +310,10 @@ export class DataService { tooltip: row.tooltip ? row.tooltip : this._wrapperService.constructTooltip(tooltipMetrics, row, metricFilter ? metricFilter.value : indicator) }; + if (indicator) { + row.indicator = Number(row[indicator]); + } + return row; }), options: { diff --git a/src/app/views/pm-shri/config/pm_shri_config.ts b/src/app/views/pm-shri/config/pm_shri_config.ts index b9ba8db8..babb019f 100644 --- a/src/app/views/pm-shri/config/pm_shri_config.ts +++ b/src/app/views/pm-shri/config/pm_shri_config.ts @@ -61,7 +61,7 @@ export const config = { { "queries": { - "map": "select t1.state_id, t1.state_id as level, t2.state_name, t1.category_name, sum(t3.sum) as total_schools, round(cast(sum(t1.sum) / sum(t3.sum) as numeric) * 100, 2) as percentage, t2.latitude, t2.longitude from datasets.pm_shri_pm_shri_category_state0categorypmshri as t1 join dimensions.state as t2 on t2.state_id = t1.state_id join datasets.pm_shri_total_schools_state as t3 on t3.state_id = t1.state_id where category_name in ('total_schools_having_library', 'total_schools_having_handwash_facility', 'total_schools_having_drinking_water_facility', 'total_schools_having_ramp_facility', 'total_schools_having_playground', 'total_schools_having_internet_facility') group by t1.state_id, t2.state_name, t1.category_name, t2.latitude, t2.longitude" + "map": "select t1.state_id, t1.state_id as level, t2.state_name, t1.category_name, sum(t1.sum) as category_value, sum(t3.sum) as total_schools, round(cast(sum(t1.sum) / sum(t3.sum) as numeric) * 100, 2) as percentage, t2.latitude, t2.longitude from datasets.pm_shri_pm_shri_category_state0categorypmshri as t1 join dimensions.state as t2 on t2.state_id = t1.state_id join datasets.pm_shri_total_schools_state as t3 on t3.state_id = t1.state_id where category_name in ('total_schools_having_library', 'total_schools_having_handwash_facility', 'total_schools_having_drinking_water_facility', 'total_schools_having_ramp_facility', 'total_schools_having_playground', 'total_schools_having_internet_facility') group by t1.state_id, t2.state_name, t1.category_name, t2.latitude, t2.longitude" }, "level": "state", "nextLevel": "district" @@ -78,7 +78,8 @@ export const config = { { "indicatorType": "percent", "metricLabelProp": "category_name", - "metricValueProp": "percentage", + "metricValueProp": "category_value", + "indicator": "percentage", "groupByColumn": "level", "metricFilterNeeded": true, "legend": { "title": "State Wise Performance" }, From 40a395a9c964c20bbab5f87fcd59ebbfe0be0f85 Mon Sep 17 00:00:00 2001 From: pandutibil Date: Fri, 20 Oct 2023 15:06:54 +0530 Subject: [PATCH 07/11] Bug fixed in map report data implementation --- src/app/core/services/data.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/core/services/data.service.ts b/src/app/core/services/data.service.ts index 70861713..1621e639 100644 --- a/src/app/core/services/data.service.ts +++ b/src/app/core/services/data.service.ts @@ -311,7 +311,7 @@ export class DataService { }; if (indicator) { - row.indicator = Number(row[indicator]); + row.indicator = isNaN(row[indicator]) ? row[indicator] : Number(row[indicator]); } return row; From a3a9151bcd7abf89824681070b81ebbdaa40a95b Mon Sep 17 00:00:00 2001 From: pandutibil Date: Fri, 20 Oct 2023 15:08:58 +0530 Subject: [PATCH 08/11] PM SHRI label updated in the reports --- src/app/views/pm-shri/config/pm_shri_config.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/views/pm-shri/config/pm_shri_config.ts b/src/app/views/pm-shri/config/pm_shri_config.ts index babb019f..2ad03e70 100644 --- a/src/app/views/pm-shri/config/pm_shri_config.ts +++ b/src/app/views/pm-shri/config/pm_shri_config.ts @@ -33,7 +33,7 @@ export const config = { "metricFilterNeeded": false, "indicator": "status", "legend": { - "title": "Implemented PM Shri" + "title": "Implemented PM SHRI" }, "tooltipMetrics": [ { @@ -42,7 +42,7 @@ export const config = { "valueSuffix": "\n" }, { - "valuePrefix": "Implemented PM Shri: ", + "valuePrefix": "Implemented PM SHRI: ", "value": "status", "valueSuffix": "\n" } From 2516223ed7962ec10c31618d95995b2712fca48b Mon Sep 17 00:00:00 2001 From: pandutibil Date: Wed, 25 Oct 2023 17:01:11 +0530 Subject: [PATCH 09/11] Label changes for fiter panel selector and other configurations changes in pm-shri --- .../filter-panel/filter-panel.component.html | 2 +- .../filter-panel/filter-panel.component.ts | 8 ++++++++ src/app/views/pm-shri/config/pm_shri_config.ts | 14 ++++++++++++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/app/shared/components/filter-panel/filter-panel.component.html b/src/app/shared/components/filter-panel/filter-panel.component.html index 0f853b46..f331a5d4 100644 --- a/src/app/shared/components/filter-panel/filter-panel.component.html +++ b/src/app/shared/components/filter-panel/filter-panel.component.html @@ -8,7 +8,7 @@ [name]="'filter-'+filter.name" [multiple]="isFilterMulti()" [closeOnSelect]="false" placeholder="Select {{filter.name}}" [clearable]="resetOthers" [(ngModel)]="filter.value" (ngModelChange)="onSelectOption($event, i, selectRef)"> - {{ option.label }} + {{ convertNativeMetricLabelToReadable(option.label) }}
diff --git a/src/app/shared/components/filter-panel/filter-panel.component.ts b/src/app/shared/components/filter-panel/filter-panel.component.ts index fbff54ed..5c364093 100644 --- a/src/app/shared/components/filter-panel/filter-panel.component.ts +++ b/src/app/shared/components/filter-panel/filter-panel.component.ts @@ -61,4 +61,12 @@ export class FilterPanelComponent implements OnInit, OnChanges { isFilterMulti(): boolean { return this.isMulti; } + + convertNativeMetricLabelToReadable(label: string): string { + if (typeof label !== 'string') { + return label; + } + + return label.split('_').map(word => word[0]?.toUpperCase() + word?.substring(1).toLowerCase()).join(' ') + } } diff --git a/src/app/views/pm-shri/config/pm_shri_config.ts b/src/app/views/pm-shri/config/pm_shri_config.ts index 2ad03e70..2babb0e6 100644 --- a/src/app/views/pm-shri/config/pm_shri_config.ts +++ b/src/app/views/pm-shri/config/pm_shri_config.ts @@ -61,7 +61,7 @@ export const config = { { "queries": { - "map": "select t1.state_id, t1.state_id as level, t2.state_name, t1.category_name, sum(t1.sum) as category_value, sum(t3.sum) as total_schools, round(cast(sum(t1.sum) / sum(t3.sum) as numeric) * 100, 2) as percentage, t2.latitude, t2.longitude from datasets.pm_shri_pm_shri_category_state0categorypmshri as t1 join dimensions.state as t2 on t2.state_id = t1.state_id join datasets.pm_shri_total_schools_state as t3 on t3.state_id = t1.state_id where category_name in ('total_schools_having_library', 'total_schools_having_handwash_facility', 'total_schools_having_drinking_water_facility', 'total_schools_having_ramp_facility', 'total_schools_having_playground', 'total_schools_having_internet_facility') group by t1.state_id, t2.state_name, t1.category_name, t2.latitude, t2.longitude" + "map": "select t1.state_id, t1.state_id as level, t2.state_name, t1.category_name, t4.sum as total_girls_in_schools, t5.sum as total_boys_in_schools, sum(t1.sum) as category_value, sum(t3.sum) as total_schools, round(cast(sum(t1.sum) / sum(t3.sum) as numeric) * 100, 2) as percentage, t2.latitude, t2.longitude from datasets.pm_shri_pm_shri_category_state0categorypmshri as t1 join dimensions.state as t2 on t2.state_id = t1.state_id join datasets.pm_shri_total_schools_state as t3 on t3.state_id = t1.state_id join datasets.pm_shri_total_boys_in_schools_state as t4 on t4.state_id = t1.state_id join datasets.pm_shri_total_girls_in_schools_state as t5 on t5.state_id = t1.state_id where category_name in ('total_schools_having_library', 'total_schools_having_handwash_facility', 'total_schools_having_drinking_water_facility', 'total_schools_having_ramp_facility', 'total_schools_having_playground', 'total_schools_having_internet_facility') group by t1.state_id, t2.state_name, t1.category_name, t2.latitude, t2.longitude, t4.sum, t5.sum" }, "level": "state", "nextLevel": "district" @@ -98,6 +98,16 @@ export const config = { "value": "total_schools", "valueSuffix": "\n" }, + { + "valuePrefix": "Total Boys in schools: ", + "value": "total_boys_in_schools", + "valueSuffix": "\n" + }, + { + "valuePrefix": "Total Girls in schools: ", + "value": "total_girls_in_schools", + "valueSuffix": "\n" + }, { "valuePrefix": "", "value": "category_name", @@ -130,7 +140,7 @@ export const config = { ], "options": { "bigNumber": { - "title": ['Total PM SHRI schools', 'Total districts', 'Total districts', 'No. of primary schools', 'No. of upper primary schools', 'No. of secondary schools', 'No. of higher secondary schools', 'KVS', 'NVS'], + "title": ['Total PM SHRI schools', 'Total districts', 'No. of primary schools', 'No. of upper primary schools', 'No. of secondary schools', 'No. of higher secondary schools', 'KVS', 'NVS'], "formatter": { locale: 'en-IN', format: "long" } } } From a07dcdbae21ee18b7763364e2df420802a5c8fcd Mon Sep 17 00:00:00 2001 From: pandutibil Date: Thu, 2 Nov 2023 15:58:16 +0530 Subject: [PATCH 10/11] Tooltip and marker issues are fixed in the map and PM SHRI reports --- src/app/core/services/data.service.ts | 19 +++++++++---------- .../views/pm-shri/config/pm_shri_config.ts | 11 ++++++++--- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/app/core/services/data.service.ts b/src/app/core/services/data.service.ts index 1621e639..56bc853b 100644 --- a/src/app/core/services/data.service.ts +++ b/src/app/core/services/data.service.ts @@ -451,9 +451,8 @@ export class DataService { mapGroupBy(data: any, groupByLabel: any, metricLabelProp: string, metricValueProp: string, tooltipMetrics: any, metricFilterValue: any) { let result = _.chain(data).groupBy(groupByLabel).map((objs, key) => { - data = { - [groupByLabel]: key, - } + let row = objs.find(obj => obj.category_name === metricFilterValue) + objs?.forEach((obj: any, index: any) => { let modifiedTooltipMetrics = tooltipMetrics.filter(metric => metricLabelProp === metric.value).map((metric: any) => { return { @@ -462,18 +461,18 @@ export class DataService { value: obj[metricLabelProp] } }) - data = { - ...data, - ...obj, - // district_code: obj['district_id'] ? Number(obj['district_id']) : null, + + row = { + ...row, [obj[metricLabelProp]]: obj[metricValueProp] } + if (index === 0) { - data['tooltip'] = this._wrapperService.constructTooltip(tooltipMetrics.filter(metric => metricLabelProp !== metric.value), data, metricFilterValue) + row['tooltip'] = this._wrapperService.constructTooltip(tooltipMetrics.filter(metric => metricLabelProp !== metric.value), row, metricFilterValue) } - data['tooltip'] += this._wrapperService.constructTooltip(modifiedTooltipMetrics, data, metricFilterValue) + row['tooltip'] += this._wrapperService.constructTooltip(modifiedTooltipMetrics, row, metricFilterValue) }); - return data; + return row; }).value() return result; } diff --git a/src/app/views/pm-shri/config/pm_shri_config.ts b/src/app/views/pm-shri/config/pm_shri_config.ts index 2babb0e6..afba5464 100644 --- a/src/app/views/pm-shri/config/pm_shri_config.ts +++ b/src/app/views/pm-shri/config/pm_shri_config.ts @@ -6,7 +6,7 @@ export const config = { "labelProp": "category_name", "valueProp": "category_name", "id": "metric", - "query": "select category_name from dimensions.categorypmshri where category_name in ('total_schools_having_library', 'total_schools_having_handwash_facility', 'total_schools_having_drinking_water_facility', 'total_schools_having_ramp_facility', 'total_schools_having_playground', 'total_schools_having_internet_facility')" + "query": "select category_name from dimensions.categorypmshri where category_name not in ('total_instructional_classrooms')" } ], implementation_status: { @@ -61,7 +61,7 @@ export const config = { { "queries": { - "map": "select t1.state_id, t1.state_id as level, t2.state_name, t1.category_name, t4.sum as total_girls_in_schools, t5.sum as total_boys_in_schools, sum(t1.sum) as category_value, sum(t3.sum) as total_schools, round(cast(sum(t1.sum) / sum(t3.sum) as numeric) * 100, 2) as percentage, t2.latitude, t2.longitude from datasets.pm_shri_pm_shri_category_state0categorypmshri as t1 join dimensions.state as t2 on t2.state_id = t1.state_id join datasets.pm_shri_total_schools_state as t3 on t3.state_id = t1.state_id join datasets.pm_shri_total_boys_in_schools_state as t4 on t4.state_id = t1.state_id join datasets.pm_shri_total_girls_in_schools_state as t5 on t5.state_id = t1.state_id where category_name in ('total_schools_having_library', 'total_schools_having_handwash_facility', 'total_schools_having_drinking_water_facility', 'total_schools_having_ramp_facility', 'total_schools_having_playground', 'total_schools_having_internet_facility') group by t1.state_id, t2.state_name, t1.category_name, t2.latitude, t2.longitude, t4.sum, t5.sum" + "map": "select t1.state_id, t2.state_name, t1.category_name, SUM(t4.sum) as total_girls_in_schools, SUM(t5.sum) as total_boys_in_schools, SUM(t6.sum) as total_instructional_classrooms, sum(t1.sum) as category_value, sum(t3.sum) as total_schools, round(cast(sum(t1.sum) / sum(t3.sum) as numeric) * 100, 2) as percentage, t2.latitude, t2.longitude from datasets.pm_shri_pm_shri_category_state0categorypmshri as t1 join dimensions.state as t2 on t2.state_id = t1.state_id join datasets.pm_shri_total_schools_state as t3 on t3.state_id = t1.state_id join datasets.pm_shri_total_boys_in_schools_state as t4 on t4.state_id = t1.state_id join datasets.pm_shri_total_girls_in_schools_state as t5 on t5.state_id = t1.state_id join datasets.pm_shri_total_instructional_classrooms_state as t6 on t6.state_id = t1.state_id where category_name not in ('total_instructional_classrooms') group by t1.state_id, t2.state_name, t1.category_name, t2.latitude, t2.longitude" }, "level": "state", "nextLevel": "district" @@ -80,7 +80,7 @@ export const config = { "metricLabelProp": "category_name", "metricValueProp": "category_value", "indicator": "percentage", - "groupByColumn": "level", + "groupByColumn": "state_id", "metricFilterNeeded": true, "legend": { "title": "State Wise Performance" }, "drillDownConfig": { @@ -108,6 +108,11 @@ export const config = { "value": "total_girls_in_schools", "valueSuffix": "\n" }, + { + "valuePrefix": "Total Instructional classrooms: ", + "value": "total_instructional_classrooms", + "valueSuffix": "\n" + }, { "valuePrefix": "", "value": "category_name", From f4f0548a444ac9e762bab407cb9b06d55106ca81 Mon Sep 17 00:00:00 2001 From: pandutibil Date: Fri, 3 Nov 2023 14:21:52 +0530 Subject: [PATCH 11/11] Issue fixed in the map group by in data service --- src/app/core/services/data.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/core/services/data.service.ts b/src/app/core/services/data.service.ts index 56bc853b..cf0108be 100644 --- a/src/app/core/services/data.service.ts +++ b/src/app/core/services/data.service.ts @@ -451,7 +451,7 @@ export class DataService { mapGroupBy(data: any, groupByLabel: any, metricLabelProp: string, metricValueProp: string, tooltipMetrics: any, metricFilterValue: any) { let result = _.chain(data).groupBy(groupByLabel).map((objs, key) => { - let row = objs.find(obj => obj.category_name === metricFilterValue) + let row = objs.find(obj => obj[metricLabelProp] === metricFilterValue) objs?.forEach((obj: any, index: any) => { let modifiedTooltipMetrics = tooltipMetrics.filter(metric => metricLabelProp === metric.value).map((metric: any) => {