From 0f9f49e94562e4057dcb575b7453fc9a878a3562 Mon Sep 17 00:00:00 2001 From: Alfred-Mutai Date: Thu, 23 May 2024 09:56:13 +0300 Subject: [PATCH 1/4] POC-737: Development of MOH Registers --- .../hiv/data-analytics-hiv.module.ts | 22 ++- .../hiv/data-analytics-hiv.routes.ts | 100 +++++++++++ .../anc-register/anc-register.component.css | 0 .../anc-register/anc-register.component.html | 54 ++++++ .../anc-register.component.spec.ts | 24 +++ .../anc-register/anc-register.component.ts | 161 ++++++++++++++++++ .../cntdaily-register.component.css | 0 .../cntdaily-register.component.html | 54 ++++++ .../cntdaily-register.component.spec.ts | 24 +++ .../cntdaily-register.component.ts | 161 ++++++++++++++++++ .../defaultertracing-register.component.css | 0 .../defaultertracing-register.component.html | 54 ++++++ ...efaultertracing-register.component.spec.ts | 24 +++ .../defaultertracing-register.component.ts | 161 ++++++++++++++++++ .../hei-register/hei-register.component.css | 0 .../hei-register/hei-register.component.html | 54 ++++++ .../hei-register.component.spec.ts | 24 +++ .../hei-register/hei-register.component.ts | 161 ++++++++++++++++++ .../htsrefferallinkage-register.component.css | 0 ...htsrefferallinkage-register.component.html | 54 ++++++ ...refferallinkage-register.component.spec.ts | 24 +++ .../htsrefferallinkage-register.component.ts | 161 ++++++++++++++++++ .../maternity-register.component.css | 0 .../maternity-register.component.html | 54 ++++++ .../maternity-register.component.spec.ts | 24 +++ .../maternity-register.component.ts | 161 ++++++++++++++++++ .../nutrition-register.component.css | 0 .../nutrition-register.component.html | 54 ++++++ .../nutrition-register.component.spec.ts | 24 +++ .../nutrition-register.component.ts | 161 ++++++++++++++++++ .../pnc-register/pnc-register.component.css | 0 .../pnc-register/pnc-register.component.html | 54 ++++++ .../pnc-register.component.spec.ts | 24 +++ .../pnc-register/pnc-register.component.ts | 161 ++++++++++++++++++ .../prepdaily-register.component.css | 0 .../prepdaily-register.component.html | 54 ++++++ .../prepdaily-register.component.spec.ts | 24 +++ .../prepdaily-register.component.ts | 161 ++++++++++++++++++ .../hiv/registers/registers.component.css | 0 .../hiv/registers/registers.component.html | 27 +++ .../hiv/registers/registers.component.spec.ts | 24 +++ .../hiv/registers/registers.component.ts | 79 +++++++++ .../schema/analytics.dashboard.conf.json | 6 + 43 files changed, 2408 insertions(+), 1 deletion(-) create mode 100644 src/app/data-analytics-dashboard/hiv/registers/anc-register/anc-register.component.css create mode 100644 src/app/data-analytics-dashboard/hiv/registers/anc-register/anc-register.component.html create mode 100644 src/app/data-analytics-dashboard/hiv/registers/anc-register/anc-register.component.spec.ts create mode 100644 src/app/data-analytics-dashboard/hiv/registers/anc-register/anc-register.component.ts create mode 100644 src/app/data-analytics-dashboard/hiv/registers/cntdaily-register/cntdaily-register.component.css create mode 100644 src/app/data-analytics-dashboard/hiv/registers/cntdaily-register/cntdaily-register.component.html create mode 100644 src/app/data-analytics-dashboard/hiv/registers/cntdaily-register/cntdaily-register.component.spec.ts create mode 100644 src/app/data-analytics-dashboard/hiv/registers/cntdaily-register/cntdaily-register.component.ts create mode 100644 src/app/data-analytics-dashboard/hiv/registers/defaultertracing-register/defaultertracing-register.component.css create mode 100644 src/app/data-analytics-dashboard/hiv/registers/defaultertracing-register/defaultertracing-register.component.html create mode 100644 src/app/data-analytics-dashboard/hiv/registers/defaultertracing-register/defaultertracing-register.component.spec.ts create mode 100644 src/app/data-analytics-dashboard/hiv/registers/defaultertracing-register/defaultertracing-register.component.ts create mode 100644 src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.css create mode 100644 src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.html create mode 100644 src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.spec.ts create mode 100644 src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.ts create mode 100644 src/app/data-analytics-dashboard/hiv/registers/htsrefferallinkage-register/htsrefferallinkage-register.component.css create mode 100644 src/app/data-analytics-dashboard/hiv/registers/htsrefferallinkage-register/htsrefferallinkage-register.component.html create mode 100644 src/app/data-analytics-dashboard/hiv/registers/htsrefferallinkage-register/htsrefferallinkage-register.component.spec.ts create mode 100644 src/app/data-analytics-dashboard/hiv/registers/htsrefferallinkage-register/htsrefferallinkage-register.component.ts create mode 100644 src/app/data-analytics-dashboard/hiv/registers/maternity-register/maternity-register.component.css create mode 100644 src/app/data-analytics-dashboard/hiv/registers/maternity-register/maternity-register.component.html create mode 100644 src/app/data-analytics-dashboard/hiv/registers/maternity-register/maternity-register.component.spec.ts create mode 100644 src/app/data-analytics-dashboard/hiv/registers/maternity-register/maternity-register.component.ts create mode 100644 src/app/data-analytics-dashboard/hiv/registers/nutrition-register/nutrition-register.component.css create mode 100644 src/app/data-analytics-dashboard/hiv/registers/nutrition-register/nutrition-register.component.html create mode 100644 src/app/data-analytics-dashboard/hiv/registers/nutrition-register/nutrition-register.component.spec.ts create mode 100644 src/app/data-analytics-dashboard/hiv/registers/nutrition-register/nutrition-register.component.ts create mode 100644 src/app/data-analytics-dashboard/hiv/registers/pnc-register/pnc-register.component.css create mode 100644 src/app/data-analytics-dashboard/hiv/registers/pnc-register/pnc-register.component.html create mode 100644 src/app/data-analytics-dashboard/hiv/registers/pnc-register/pnc-register.component.spec.ts create mode 100644 src/app/data-analytics-dashboard/hiv/registers/pnc-register/pnc-register.component.ts create mode 100644 src/app/data-analytics-dashboard/hiv/registers/prepdaily-register/prepdaily-register.component.css create mode 100644 src/app/data-analytics-dashboard/hiv/registers/prepdaily-register/prepdaily-register.component.html create mode 100644 src/app/data-analytics-dashboard/hiv/registers/prepdaily-register/prepdaily-register.component.spec.ts create mode 100644 src/app/data-analytics-dashboard/hiv/registers/prepdaily-register/prepdaily-register.component.ts create mode 100644 src/app/data-analytics-dashboard/hiv/registers/registers.component.css create mode 100644 src/app/data-analytics-dashboard/hiv/registers/registers.component.html create mode 100644 src/app/data-analytics-dashboard/hiv/registers/registers.component.spec.ts create mode 100644 src/app/data-analytics-dashboard/hiv/registers/registers.component.ts diff --git a/src/app/data-analytics-dashboard/hiv/data-analytics-hiv.module.ts b/src/app/data-analytics-dashboard/hiv/data-analytics-hiv.module.ts index f0664f9b7..d370a3a9e 100644 --- a/src/app/data-analytics-dashboard/hiv/data-analytics-hiv.module.ts +++ b/src/app/data-analytics-dashboard/hiv/data-analytics-hiv.module.ts @@ -44,6 +44,16 @@ import { TxMmdReportComponent } from './datim-reports/tx-mmd-report.component'; import { TxRttReportComponent } from './datim-reports/tx-rtt-report.component'; import { AhdReportComponent } from './ahd-report/ahd-report.component'; import { PlhivNcdV2ReportComponent } from './plhiv-ncd-v2-report/plhiv-ncd-v2-report.component'; +import { RegistersComponent } from './registers/registers.component'; +import { HeiRegisterComponent } from './registers/hei-register/hei-register.component'; +import { AncRegisterComponent } from './registers/anc-register/anc-register.component'; +import { NutritionRegisterComponent } from './registers/nutrition-register/nutrition-register.component'; +import { MaternityRegisterComponent } from './registers/maternity-register/maternity-register.component'; +import { HtsrefferallinkageRegisterComponent } from './registers/htsrefferallinkage-register/htsrefferallinkage-register.component'; +import { PncRegisterComponent } from './registers/pnc-register/pnc-register.component'; +import { DefaultertracingRegisterComponent } from './registers/defaultertracing-register/defaultertracing-register.component'; +import { PrepdailyRegisterComponent } from './registers/prepdaily-register/prepdaily-register.component'; +import { CntdailyRegisterComponent } from './registers/cntdaily-register/cntdaily-register.component'; @NgModule({ imports: [ @@ -97,7 +107,17 @@ import { PlhivNcdV2ReportComponent } from './plhiv-ncd-v2-report/plhiv-ncd-v2-re TxMmdReportComponent, TxRttReportComponent, PlhivNcdV2ReportComponent, - AhdReportComponent + AhdReportComponent, + RegistersComponent, + HeiRegisterComponent, + AncRegisterComponent, + NutritionRegisterComponent, + MaternityRegisterComponent, + HtsrefferallinkageRegisterComponent, + PncRegisterComponent, + DefaultertracingRegisterComponent, + PrepdailyRegisterComponent, + CntdailyRegisterComponent ], providers: [ DataAnalyticsDashboardService, diff --git a/src/app/data-analytics-dashboard/hiv/data-analytics-hiv.routes.ts b/src/app/data-analytics-dashboard/hiv/data-analytics-hiv.routes.ts index e9e7a5919..cd482d7c5 100644 --- a/src/app/data-analytics-dashboard/hiv/data-analytics-hiv.routes.ts +++ b/src/app/data-analytics-dashboard/hiv/data-analytics-hiv.routes.ts @@ -57,6 +57,16 @@ import { AhdReportComponent } from './ahd-report/ahd-report.component'; import { AhdMonthlyReportPatientlistComponent } from 'src/app/hiv-care-lib/ahd-monthly-report/ahd-monthly-report-patientlist/ahd-monthly-report-patientlist.component'; import { PlhivNcdV2ReportPatientListComponent } from 'src/app/hiv-care-lib/plhiv-ncd-v2-report/plhiv-ncd-v2-report-patient-list/plhiv-ncd-v2-report-patient-list.component'; import { PlhivNcdV2ReportComponent } from './plhiv-ncd-v2-report/plhiv-ncd-v2-report.component'; +import { RegistersComponent } from './registers/registers.component'; +import { HeiRegisterComponent } from './registers/hei-register/hei-register.component'; +import { AncRegisterComponent } from './registers/anc-register/anc-register.component'; +import { NutritionRegisterComponent } from './registers/nutrition-register/nutrition-register.component'; +import { MaternityRegisterComponent } from './registers/maternity-register/maternity-register.component'; +import { HtsrefferallinkageRegisterComponent } from './registers/htsrefferallinkage-register/htsrefferallinkage-register.component'; +import { PncRegisterComponent } from './registers/pnc-register/pnc-register.component'; +import { DefaultertracingRegisterComponent } from './registers/defaultertracing-register/defaultertracing-register.component'; +import { PrepdailyRegisterComponent } from './registers/prepdaily-register/prepdaily-register.component'; +import { CntdailyRegisterComponent } from './registers/cntdaily-register/cntdaily-register.component'; const routes: Routes = [ { @@ -285,6 +295,96 @@ const routes: Routes = [ } ] }, + { + path: 'registers', + children: [ + { + path: '', + component: RegistersComponent + }, + { + path: 'hei-register', + children: [ + { + path: '', + component: HeiRegisterComponent + } + ] + }, + { + path: 'anc-register', + children: [ + { + path: '', + component: AncRegisterComponent + } + ] + }, + { + path: 'nutrition-register', + children: [ + { + path: '', + component: NutritionRegisterComponent + } + ] + }, + { + path: 'maternity-register', + children: [ + { + path: '', + component: MaternityRegisterComponent + } + ] + }, + { + path: 'htsrefferallinkage-register', + children: [ + { + path: '', + component: HtsrefferallinkageRegisterComponent + } + ] + }, + { + path: 'pnc-register', + children: [ + { + path: '', + component: PncRegisterComponent + } + ] + }, + { + path: 'defaultertracing-register', + children: [ + { + path: '', + component: DefaultertracingRegisterComponent + } + ] + }, + { + path: 'prepdaily-register', + children: [ + { + path: '', + component: PrepdailyRegisterComponent + } + ] + }, + { + path: 'cntdaily-register', + children: [ + { + path: '', + component: CntdailyRegisterComponent + } + ] + } + ] + }, { path: 'datim-report', children: [ diff --git a/src/app/data-analytics-dashboard/hiv/registers/anc-register/anc-register.component.css b/src/app/data-analytics-dashboard/hiv/registers/anc-register/anc-register.component.css new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/data-analytics-dashboard/hiv/registers/anc-register/anc-register.component.html b/src/app/data-analytics-dashboard/hiv/registers/anc-register/anc-register.component.html new file mode 100644 index 000000000..40a18d212 --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/anc-register/anc-register.component.html @@ -0,0 +1,54 @@ +

+ {{ reportName }} +

+ +
+ Loading... +
+ + +
+ + + + +
+
+ +
+ × +

+ An + error occurred while trying to load the report. Please try again. +

+

+ {{ errorMessage }} +

+
+
+ Viewing a Draft Version of the Report for the chosen month. + This report is likely to change without warning. +
+
+ + + + + +
diff --git a/src/app/data-analytics-dashboard/hiv/registers/anc-register/anc-register.component.spec.ts b/src/app/data-analytics-dashboard/hiv/registers/anc-register/anc-register.component.spec.ts new file mode 100644 index 000000000..dc9a601fd --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/anc-register/anc-register.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AncRegisterComponent } from './anc-register.component'; + +describe('AncRegisterComponent', () => { + let component: AncRegisterComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [AncRegisterComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AncRegisterComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/data-analytics-dashboard/hiv/registers/anc-register/anc-register.component.ts b/src/app/data-analytics-dashboard/hiv/registers/anc-register/anc-register.component.ts new file mode 100644 index 000000000..661cc2895 --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/anc-register/anc-register.component.ts @@ -0,0 +1,161 @@ +import { Component, OnInit, Output } from '@angular/core'; +import { Router, ActivatedRoute } from '@angular/router'; +import * as _ from 'lodash'; +import * as Moment from 'moment'; +@Component({ + selector: 'app-anc-register', + templateUrl: './anc-register.component.html', + styleUrls: ['./anc-register.component.css'] +}) +export class AncRegisterComponent implements OnInit { + @Output() + public params: any; + public indicators: string; + public selectedIndicators = []; + public txnewReportSummaryData: any = []; + public columnDefs: any = []; + public reportName = 'ANC Register'; + public currentView = 'monthly'; + public currentViewBelow = 'pdf'; + public month: string; + public year: number; + public quarter: string; + public eDate: string; + public sDate: string; + + public statusError = false; + public errorMessage = ''; + public showInfoMessage = false; + public isLoading = false; + public reportHead: any; + public enabledControls = 'locationControl,monthControl'; + public pinnedBottomRowData: any = []; + public _month: string; + public isReleased = true; + + public _locationUuids: any = []; + public get locationUuids(): Array { + return this._locationUuids; + } + + public set locationUuids(v: Array) { + const locationUuids = []; + _.each(v, (location: any) => { + if (location.value) { + locationUuids.push(location); + } + }); + this._locationUuids = locationUuids; + } + + constructor(public router: Router, public route: ActivatedRoute) { + this.route.queryParams.subscribe((data) => { + data.month === undefined + ? (this._month = Moment() + .subtract(1, 'M') + .endOf('month') + .format('YYYY-MM-DD')) + : (this._month = data.month); + + this.showDraftReportAlert(this._month); + }); + } + + ngOnInit() {} + + public onMonthChange(value): any { + this._month = Moment(value).endOf('month').format('YYYY-MM-DD'); + } + + public generateReport(): any { + this.route.parent.parent.params.subscribe((params: any) => { + this.storeParamsInUrl(params.location_uuid); + }); + this.txnewReportSummaryData = []; + // this.getTxNewReport(this.params); + } + + public storeParamsInUrl(param) { + this.params = { + locationUuids: param, + _month: Moment(this._month).endOf('month').format('YYYY-MM-DD'), + month: Moment(this._month).endOf('month').format('YYYY-MM-DD'), + reportName: this.reportName, + _date: Moment(this._month).format('DD-MM-YYYY') + }; + this.router.navigate([], { + relativeTo: this.route, + queryParams: this.params + }); + } + + // public getTxNewReport(params: any) { + // this.isLoading = true; + // this.txnewReport.getTxNewReport(params).subscribe((data) => { + // if (data.error) { + // this.showInfoMessage = true; + // this.errorMessage = `There has been an error while loading the report, please retry again`; + // this.isLoading = false; + // } else { + // this.showInfoMessage = false; + // this.columnDefs = data.sectionDefinitions; + // this.txnewReportSummaryData = data.result; + // this.calculateTotalSummary(); + // this.isLoading = false; + // this.showDraftReportAlert(this._month); + // } + // }); + // } + + public calculateTotalSummary() { + const totalsRow = []; + if (this.txnewReportSummaryData.length > 0) { + const totalObj = { + location: 'Totals' + }; + _.each(this.txnewReportSummaryData, (row) => { + Object.keys(row).map((key) => { + if (Number.isInteger(row[key]) === true) { + if (totalObj[key]) { + totalObj[key] = row[key] + totalObj[key]; + } else { + totalObj[key] = row[key]; + } + } else { + if (Number.isNaN(totalObj[key])) { + totalObj[key] = 0; + } + if (totalObj[key] === null) { + totalObj[key] = 0; + } + totalObj[key] = 0 + totalObj[key]; + } + }); + }); + totalObj.location = 'Totals'; + totalsRow.push(totalObj); + this.pinnedBottomRowData = totalsRow; + } + } + public onIndicatorSelected(value) { + this.router.navigate(['patient-list'], { + relativeTo: this.route, + queryParams: { + indicators: value.field, + indicatorHeader: value.headerName, + indicatorGender: value.gender, + month: this._month, + locationUuids: value.location, + currentView: this.currentView + } + }); + } + + public showDraftReportAlert(date) { + if (date != null && date >= Moment().endOf('month').format('YYYY-MM-DD')) { + this.isReleased = false; + } else { + this.isReleased = true; + } + } +} diff --git a/src/app/data-analytics-dashboard/hiv/registers/cntdaily-register/cntdaily-register.component.css b/src/app/data-analytics-dashboard/hiv/registers/cntdaily-register/cntdaily-register.component.css new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/data-analytics-dashboard/hiv/registers/cntdaily-register/cntdaily-register.component.html b/src/app/data-analytics-dashboard/hiv/registers/cntdaily-register/cntdaily-register.component.html new file mode 100644 index 000000000..40a18d212 --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/cntdaily-register/cntdaily-register.component.html @@ -0,0 +1,54 @@ +

+ {{ reportName }} +

+ +
+ Loading... +
+ + +
+ + + + +
+
+ +
+ × +

+ An + error occurred while trying to load the report. Please try again. +

+

+ {{ errorMessage }} +

+
+
+ Viewing a Draft Version of the Report for the chosen month. + This report is likely to change without warning. +
+
+ + + + + +
diff --git a/src/app/data-analytics-dashboard/hiv/registers/cntdaily-register/cntdaily-register.component.spec.ts b/src/app/data-analytics-dashboard/hiv/registers/cntdaily-register/cntdaily-register.component.spec.ts new file mode 100644 index 000000000..afa8dd874 --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/cntdaily-register/cntdaily-register.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CntdailyRegisterComponent } from './cntdaily-register.component'; + +describe('CntdailyRegisterComponent', () => { + let component: CntdailyRegisterComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [CntdailyRegisterComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CntdailyRegisterComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/data-analytics-dashboard/hiv/registers/cntdaily-register/cntdaily-register.component.ts b/src/app/data-analytics-dashboard/hiv/registers/cntdaily-register/cntdaily-register.component.ts new file mode 100644 index 000000000..ac6aed7de --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/cntdaily-register/cntdaily-register.component.ts @@ -0,0 +1,161 @@ +import { Component, OnInit, Output } from '@angular/core'; +import { Router, ActivatedRoute } from '@angular/router'; +import * as _ from 'lodash'; +import * as Moment from 'moment'; +@Component({ + selector: 'app-cntdaily-register', + templateUrl: './cntdaily-register.component.html', + styleUrls: ['./cntdaily-register.component.css'] +}) +export class CntdailyRegisterComponent implements OnInit { + @Output() + public params: any; + public indicators: string; + public selectedIndicators = []; + public txnewReportSummaryData: any = []; + public columnDefs: any = []; + public reportName = 'Care and Treatment Daily Activity'; + public currentView = 'monthly'; + public currentViewBelow = 'pdf'; + public month: string; + public year: number; + public quarter: string; + public eDate: string; + public sDate: string; + + public statusError = false; + public errorMessage = ''; + public showInfoMessage = false; + public isLoading = false; + public reportHead: any; + public enabledControls = 'locationControl,monthControl'; + public pinnedBottomRowData: any = []; + public _month: string; + public isReleased = true; + + public _locationUuids: any = []; + public get locationUuids(): Array { + return this._locationUuids; + } + + public set locationUuids(v: Array) { + const locationUuids = []; + _.each(v, (location: any) => { + if (location.value) { + locationUuids.push(location); + } + }); + this._locationUuids = locationUuids; + } + + constructor(public router: Router, public route: ActivatedRoute) { + this.route.queryParams.subscribe((data) => { + data.month === undefined + ? (this._month = Moment() + .subtract(1, 'M') + .endOf('month') + .format('YYYY-MM-DD')) + : (this._month = data.month); + + this.showDraftReportAlert(this._month); + }); + } + + ngOnInit() {} + + public onMonthChange(value): any { + this._month = Moment(value).endOf('month').format('YYYY-MM-DD'); + } + + public generateReport(): any { + this.route.parent.parent.params.subscribe((params: any) => { + this.storeParamsInUrl(params.location_uuid); + }); + this.txnewReportSummaryData = []; + // this.getTxNewReport(this.params); + } + + public storeParamsInUrl(param) { + this.params = { + locationUuids: param, + _month: Moment(this._month).endOf('month').format('YYYY-MM-DD'), + month: Moment(this._month).endOf('month').format('YYYY-MM-DD'), + reportName: this.reportName, + _date: Moment(this._month).format('DD-MM-YYYY') + }; + this.router.navigate([], { + relativeTo: this.route, + queryParams: this.params + }); + } + + // public getTxNewReport(params: any) { + // this.isLoading = true; + // this.txnewReport.getTxNewReport(params).subscribe((data) => { + // if (data.error) { + // this.showInfoMessage = true; + // this.errorMessage = `There has been an error while loading the report, please retry again`; + // this.isLoading = false; + // } else { + // this.showInfoMessage = false; + // this.columnDefs = data.sectionDefinitions; + // this.txnewReportSummaryData = data.result; + // this.calculateTotalSummary(); + // this.isLoading = false; + // this.showDraftReportAlert(this._month); + // } + // }); + // } + + public calculateTotalSummary() { + const totalsRow = []; + if (this.txnewReportSummaryData.length > 0) { + const totalObj = { + location: 'Totals' + }; + _.each(this.txnewReportSummaryData, (row) => { + Object.keys(row).map((key) => { + if (Number.isInteger(row[key]) === true) { + if (totalObj[key]) { + totalObj[key] = row[key] + totalObj[key]; + } else { + totalObj[key] = row[key]; + } + } else { + if (Number.isNaN(totalObj[key])) { + totalObj[key] = 0; + } + if (totalObj[key] === null) { + totalObj[key] = 0; + } + totalObj[key] = 0 + totalObj[key]; + } + }); + }); + totalObj.location = 'Totals'; + totalsRow.push(totalObj); + this.pinnedBottomRowData = totalsRow; + } + } + public onIndicatorSelected(value) { + this.router.navigate(['patient-list'], { + relativeTo: this.route, + queryParams: { + indicators: value.field, + indicatorHeader: value.headerName, + indicatorGender: value.gender, + month: this._month, + locationUuids: value.location, + currentView: this.currentView + } + }); + } + + public showDraftReportAlert(date) { + if (date != null && date >= Moment().endOf('month').format('YYYY-MM-DD')) { + this.isReleased = false; + } else { + this.isReleased = true; + } + } +} diff --git a/src/app/data-analytics-dashboard/hiv/registers/defaultertracing-register/defaultertracing-register.component.css b/src/app/data-analytics-dashboard/hiv/registers/defaultertracing-register/defaultertracing-register.component.css new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/data-analytics-dashboard/hiv/registers/defaultertracing-register/defaultertracing-register.component.html b/src/app/data-analytics-dashboard/hiv/registers/defaultertracing-register/defaultertracing-register.component.html new file mode 100644 index 000000000..40a18d212 --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/defaultertracing-register/defaultertracing-register.component.html @@ -0,0 +1,54 @@ +

+ {{ reportName }} +

+ +
+ Loading... +
+ + +
+ + + + +
+
+ +
+ × +

+ An + error occurred while trying to load the report. Please try again. +

+

+ {{ errorMessage }} +

+
+
+ Viewing a Draft Version of the Report for the chosen month. + This report is likely to change without warning. +
+
+ + + + + +
diff --git a/src/app/data-analytics-dashboard/hiv/registers/defaultertracing-register/defaultertracing-register.component.spec.ts b/src/app/data-analytics-dashboard/hiv/registers/defaultertracing-register/defaultertracing-register.component.spec.ts new file mode 100644 index 000000000..85c755813 --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/defaultertracing-register/defaultertracing-register.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { DefaultertracingRegisterComponent } from './defaultertracing-register.component'; + +describe('DefaultertracingRegisterComponent', () => { + let component: DefaultertracingRegisterComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [DefaultertracingRegisterComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(DefaultertracingRegisterComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/data-analytics-dashboard/hiv/registers/defaultertracing-register/defaultertracing-register.component.ts b/src/app/data-analytics-dashboard/hiv/registers/defaultertracing-register/defaultertracing-register.component.ts new file mode 100644 index 000000000..83b012c91 --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/defaultertracing-register/defaultertracing-register.component.ts @@ -0,0 +1,161 @@ +import { Component, OnInit, Output } from '@angular/core'; +import { Router, ActivatedRoute } from '@angular/router'; +import * as _ from 'lodash'; +import * as Moment from 'moment'; +@Component({ + selector: 'app-defaultertracing-register', + templateUrl: './defaultertracing-register.component.html', + styleUrls: ['./defaultertracing-register.component.css'] +}) +export class DefaultertracingRegisterComponent implements OnInit { + @Output() + public params: any; + public indicators: string; + public selectedIndicators = []; + public txnewReportSummaryData: any = []; + public columnDefs: any = []; + public reportName = 'Defaulter Tracing Register'; + public currentView = 'monthly'; + public currentViewBelow = 'pdf'; + public month: string; + public year: number; + public quarter: string; + public eDate: string; + public sDate: string; + + public statusError = false; + public errorMessage = ''; + public showInfoMessage = false; + public isLoading = false; + public reportHead: any; + public enabledControls = 'locationControl,monthControl'; + public pinnedBottomRowData: any = []; + public _month: string; + public isReleased = true; + + public _locationUuids: any = []; + public get locationUuids(): Array { + return this._locationUuids; + } + + public set locationUuids(v: Array) { + const locationUuids = []; + _.each(v, (location: any) => { + if (location.value) { + locationUuids.push(location); + } + }); + this._locationUuids = locationUuids; + } + + constructor(public router: Router, public route: ActivatedRoute) { + this.route.queryParams.subscribe((data) => { + data.month === undefined + ? (this._month = Moment() + .subtract(1, 'M') + .endOf('month') + .format('YYYY-MM-DD')) + : (this._month = data.month); + + this.showDraftReportAlert(this._month); + }); + } + + ngOnInit() {} + + public onMonthChange(value): any { + this._month = Moment(value).endOf('month').format('YYYY-MM-DD'); + } + + public generateReport(): any { + this.route.parent.parent.params.subscribe((params: any) => { + this.storeParamsInUrl(params.location_uuid); + }); + this.txnewReportSummaryData = []; + // this.getTxNewReport(this.params); + } + + public storeParamsInUrl(param) { + this.params = { + locationUuids: param, + _month: Moment(this._month).endOf('month').format('YYYY-MM-DD'), + month: Moment(this._month).endOf('month').format('YYYY-MM-DD'), + reportName: this.reportName, + _date: Moment(this._month).format('DD-MM-YYYY') + }; + this.router.navigate([], { + relativeTo: this.route, + queryParams: this.params + }); + } + + // public getTxNewReport(params: any) { + // this.isLoading = true; + // this.txnewReport.getTxNewReport(params).subscribe((data) => { + // if (data.error) { + // this.showInfoMessage = true; + // this.errorMessage = `There has been an error while loading the report, please retry again`; + // this.isLoading = false; + // } else { + // this.showInfoMessage = false; + // this.columnDefs = data.sectionDefinitions; + // this.txnewReportSummaryData = data.result; + // this.calculateTotalSummary(); + // this.isLoading = false; + // this.showDraftReportAlert(this._month); + // } + // }); + // } + + public calculateTotalSummary() { + const totalsRow = []; + if (this.txnewReportSummaryData.length > 0) { + const totalObj = { + location: 'Totals' + }; + _.each(this.txnewReportSummaryData, (row) => { + Object.keys(row).map((key) => { + if (Number.isInteger(row[key]) === true) { + if (totalObj[key]) { + totalObj[key] = row[key] + totalObj[key]; + } else { + totalObj[key] = row[key]; + } + } else { + if (Number.isNaN(totalObj[key])) { + totalObj[key] = 0; + } + if (totalObj[key] === null) { + totalObj[key] = 0; + } + totalObj[key] = 0 + totalObj[key]; + } + }); + }); + totalObj.location = 'Totals'; + totalsRow.push(totalObj); + this.pinnedBottomRowData = totalsRow; + } + } + public onIndicatorSelected(value) { + this.router.navigate(['patient-list'], { + relativeTo: this.route, + queryParams: { + indicators: value.field, + indicatorHeader: value.headerName, + indicatorGender: value.gender, + month: this._month, + locationUuids: value.location, + currentView: this.currentView + } + }); + } + + public showDraftReportAlert(date) { + if (date != null && date >= Moment().endOf('month').format('YYYY-MM-DD')) { + this.isReleased = false; + } else { + this.isReleased = true; + } + } +} diff --git a/src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.css b/src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.css new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.html b/src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.html new file mode 100644 index 000000000..40a18d212 --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.html @@ -0,0 +1,54 @@ +

+ {{ reportName }} +

+ +
+ Loading... +
+ + +
+ + + + +
+
+ +
+ × +

+ An + error occurred while trying to load the report. Please try again. +

+

+ {{ errorMessage }} +

+
+
+ Viewing a Draft Version of the Report for the chosen month. + This report is likely to change without warning. +
+
+ + + + + +
diff --git a/src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.spec.ts b/src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.spec.ts new file mode 100644 index 000000000..19143ac64 --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { HeiRegisterComponent } from './hei-register.component'; + +describe('HeiRegisterComponent', () => { + let component: HeiRegisterComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [HeiRegisterComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(HeiRegisterComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.ts b/src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.ts new file mode 100644 index 000000000..2a9de1b47 --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.ts @@ -0,0 +1,161 @@ +import { Component, OnInit, Output } from '@angular/core'; +import { Router, ActivatedRoute } from '@angular/router'; +import * as _ from 'lodash'; +import * as Moment from 'moment'; +@Component({ + selector: 'app-hei-register', + templateUrl: './hei-register.component.html', + styleUrls: ['./hei-register.component.css'] +}) +export class HeiRegisterComponent implements OnInit { + @Output() + public params: any; + public indicators: string; + public selectedIndicators = []; + public txnewReportSummaryData: any = []; + public columnDefs: any = []; + public reportName = 'HEI Register'; + public currentView = 'monthly'; + public currentViewBelow = 'pdf'; + public month: string; + public year: number; + public quarter: string; + public eDate: string; + public sDate: string; + + public statusError = false; + public errorMessage = ''; + public showInfoMessage = false; + public isLoading = false; + public reportHead: any; + public enabledControls = 'locationControl,monthControl'; + public pinnedBottomRowData: any = []; + public _month: string; + public isReleased = true; + + public _locationUuids: any = []; + public get locationUuids(): Array { + return this._locationUuids; + } + + public set locationUuids(v: Array) { + const locationUuids = []; + _.each(v, (location: any) => { + if (location.value) { + locationUuids.push(location); + } + }); + this._locationUuids = locationUuids; + } + + constructor(public router: Router, public route: ActivatedRoute) { + this.route.queryParams.subscribe((data) => { + data.month === undefined + ? (this._month = Moment() + .subtract(1, 'M') + .endOf('month') + .format('YYYY-MM-DD')) + : (this._month = data.month); + + this.showDraftReportAlert(this._month); + }); + } + + ngOnInit() {} + + public onMonthChange(value): any { + this._month = Moment(value).endOf('month').format('YYYY-MM-DD'); + } + + public generateReport(): any { + this.route.parent.parent.params.subscribe((params: any) => { + this.storeParamsInUrl(params.location_uuid); + }); + this.txnewReportSummaryData = []; + // this.getTxNewReport(this.params); + } + + public storeParamsInUrl(param) { + this.params = { + locationUuids: param, + _month: Moment(this._month).endOf('month').format('YYYY-MM-DD'), + month: Moment(this._month).endOf('month').format('YYYY-MM-DD'), + reportName: this.reportName, + _date: Moment(this._month).format('DD-MM-YYYY') + }; + this.router.navigate([], { + relativeTo: this.route, + queryParams: this.params + }); + } + + // public getTxNewReport(params: any) { + // this.isLoading = true; + // this.txnewReport.getTxNewReport(params).subscribe((data) => { + // if (data.error) { + // this.showInfoMessage = true; + // this.errorMessage = `There has been an error while loading the report, please retry again`; + // this.isLoading = false; + // } else { + // this.showInfoMessage = false; + // this.columnDefs = data.sectionDefinitions; + // this.txnewReportSummaryData = data.result; + // this.calculateTotalSummary(); + // this.isLoading = false; + // this.showDraftReportAlert(this._month); + // } + // }); + // } + + public calculateTotalSummary() { + const totalsRow = []; + if (this.txnewReportSummaryData.length > 0) { + const totalObj = { + location: 'Totals' + }; + _.each(this.txnewReportSummaryData, (row) => { + Object.keys(row).map((key) => { + if (Number.isInteger(row[key]) === true) { + if (totalObj[key]) { + totalObj[key] = row[key] + totalObj[key]; + } else { + totalObj[key] = row[key]; + } + } else { + if (Number.isNaN(totalObj[key])) { + totalObj[key] = 0; + } + if (totalObj[key] === null) { + totalObj[key] = 0; + } + totalObj[key] = 0 + totalObj[key]; + } + }); + }); + totalObj.location = 'Totals'; + totalsRow.push(totalObj); + this.pinnedBottomRowData = totalsRow; + } + } + public onIndicatorSelected(value) { + this.router.navigate(['patient-list'], { + relativeTo: this.route, + queryParams: { + indicators: value.field, + indicatorHeader: value.headerName, + indicatorGender: value.gender, + month: this._month, + locationUuids: value.location, + currentView: this.currentView + } + }); + } + + public showDraftReportAlert(date) { + if (date != null && date >= Moment().endOf('month').format('YYYY-MM-DD')) { + this.isReleased = false; + } else { + this.isReleased = true; + } + } +} diff --git a/src/app/data-analytics-dashboard/hiv/registers/htsrefferallinkage-register/htsrefferallinkage-register.component.css b/src/app/data-analytics-dashboard/hiv/registers/htsrefferallinkage-register/htsrefferallinkage-register.component.css new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/data-analytics-dashboard/hiv/registers/htsrefferallinkage-register/htsrefferallinkage-register.component.html b/src/app/data-analytics-dashboard/hiv/registers/htsrefferallinkage-register/htsrefferallinkage-register.component.html new file mode 100644 index 000000000..40a18d212 --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/htsrefferallinkage-register/htsrefferallinkage-register.component.html @@ -0,0 +1,54 @@ +

+ {{ reportName }} +

+ +
+ Loading... +
+ + +
+ + + + +
+
+ +
+ × +

+ An + error occurred while trying to load the report. Please try again. +

+

+ {{ errorMessage }} +

+
+
+ Viewing a Draft Version of the Report for the chosen month. + This report is likely to change without warning. +
+
+ + + + + +
diff --git a/src/app/data-analytics-dashboard/hiv/registers/htsrefferallinkage-register/htsrefferallinkage-register.component.spec.ts b/src/app/data-analytics-dashboard/hiv/registers/htsrefferallinkage-register/htsrefferallinkage-register.component.spec.ts new file mode 100644 index 000000000..925245470 --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/htsrefferallinkage-register/htsrefferallinkage-register.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { HtsrefferallinkageRegisterComponent } from './htsrefferallinkage-register.component'; + +describe('HtsrefferallinkageRegisterComponent', () => { + let component: HtsrefferallinkageRegisterComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [HtsrefferallinkageRegisterComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(HtsrefferallinkageRegisterComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/data-analytics-dashboard/hiv/registers/htsrefferallinkage-register/htsrefferallinkage-register.component.ts b/src/app/data-analytics-dashboard/hiv/registers/htsrefferallinkage-register/htsrefferallinkage-register.component.ts new file mode 100644 index 000000000..503ec25fc --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/htsrefferallinkage-register/htsrefferallinkage-register.component.ts @@ -0,0 +1,161 @@ +import { Component, OnInit, Output } from '@angular/core'; +import { Router, ActivatedRoute } from '@angular/router'; +import * as _ from 'lodash'; +import * as Moment from 'moment'; +@Component({ + selector: 'app-htsrefferallinkage-register', + templateUrl: './htsrefferallinkage-register.component.html', + styleUrls: ['./htsrefferallinkage-register.component.css'] +}) +export class HtsrefferallinkageRegisterComponent implements OnInit { + @Output() + public params: any; + public indicators: string; + public selectedIndicators = []; + public txnewReportSummaryData: any = []; + public columnDefs: any = []; + public reportName = 'HTS Lab Refferal & Linkage Register'; + public currentView = 'monthly'; + public currentViewBelow = 'pdf'; + public month: string; + public year: number; + public quarter: string; + public eDate: string; + public sDate: string; + + public statusError = false; + public errorMessage = ''; + public showInfoMessage = false; + public isLoading = false; + public reportHead: any; + public enabledControls = 'locationControl,monthControl'; + public pinnedBottomRowData: any = []; + public _month: string; + public isReleased = true; + + public _locationUuids: any = []; + public get locationUuids(): Array { + return this._locationUuids; + } + + public set locationUuids(v: Array) { + const locationUuids = []; + _.each(v, (location: any) => { + if (location.value) { + locationUuids.push(location); + } + }); + this._locationUuids = locationUuids; + } + + constructor(public router: Router, public route: ActivatedRoute) { + this.route.queryParams.subscribe((data) => { + data.month === undefined + ? (this._month = Moment() + .subtract(1, 'M') + .endOf('month') + .format('YYYY-MM-DD')) + : (this._month = data.month); + + this.showDraftReportAlert(this._month); + }); + } + + ngOnInit() {} + + public onMonthChange(value): any { + this._month = Moment(value).endOf('month').format('YYYY-MM-DD'); + } + + public generateReport(): any { + this.route.parent.parent.params.subscribe((params: any) => { + this.storeParamsInUrl(params.location_uuid); + }); + this.txnewReportSummaryData = []; + // this.getTxNewReport(this.params); + } + + public storeParamsInUrl(param) { + this.params = { + locationUuids: param, + _month: Moment(this._month).endOf('month').format('YYYY-MM-DD'), + month: Moment(this._month).endOf('month').format('YYYY-MM-DD'), + reportName: this.reportName, + _date: Moment(this._month).format('DD-MM-YYYY') + }; + this.router.navigate([], { + relativeTo: this.route, + queryParams: this.params + }); + } + + // public getTxNewReport(params: any) { + // this.isLoading = true; + // this.txnewReport.getTxNewReport(params).subscribe((data) => { + // if (data.error) { + // this.showInfoMessage = true; + // this.errorMessage = `There has been an error while loading the report, please retry again`; + // this.isLoading = false; + // } else { + // this.showInfoMessage = false; + // this.columnDefs = data.sectionDefinitions; + // this.txnewReportSummaryData = data.result; + // this.calculateTotalSummary(); + // this.isLoading = false; + // this.showDraftReportAlert(this._month); + // } + // }); + // } + + public calculateTotalSummary() { + const totalsRow = []; + if (this.txnewReportSummaryData.length > 0) { + const totalObj = { + location: 'Totals' + }; + _.each(this.txnewReportSummaryData, (row) => { + Object.keys(row).map((key) => { + if (Number.isInteger(row[key]) === true) { + if (totalObj[key]) { + totalObj[key] = row[key] + totalObj[key]; + } else { + totalObj[key] = row[key]; + } + } else { + if (Number.isNaN(totalObj[key])) { + totalObj[key] = 0; + } + if (totalObj[key] === null) { + totalObj[key] = 0; + } + totalObj[key] = 0 + totalObj[key]; + } + }); + }); + totalObj.location = 'Totals'; + totalsRow.push(totalObj); + this.pinnedBottomRowData = totalsRow; + } + } + public onIndicatorSelected(value) { + this.router.navigate(['patient-list'], { + relativeTo: this.route, + queryParams: { + indicators: value.field, + indicatorHeader: value.headerName, + indicatorGender: value.gender, + month: this._month, + locationUuids: value.location, + currentView: this.currentView + } + }); + } + + public showDraftReportAlert(date) { + if (date != null && date >= Moment().endOf('month').format('YYYY-MM-DD')) { + this.isReleased = false; + } else { + this.isReleased = true; + } + } +} diff --git a/src/app/data-analytics-dashboard/hiv/registers/maternity-register/maternity-register.component.css b/src/app/data-analytics-dashboard/hiv/registers/maternity-register/maternity-register.component.css new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/data-analytics-dashboard/hiv/registers/maternity-register/maternity-register.component.html b/src/app/data-analytics-dashboard/hiv/registers/maternity-register/maternity-register.component.html new file mode 100644 index 000000000..40a18d212 --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/maternity-register/maternity-register.component.html @@ -0,0 +1,54 @@ +

+ {{ reportName }} +

+ +
+ Loading... +
+ + +
+ + + + +
+
+ +
+ × +

+ An + error occurred while trying to load the report. Please try again. +

+

+ {{ errorMessage }} +

+
+
+ Viewing a Draft Version of the Report for the chosen month. + This report is likely to change without warning. +
+
+ + + + + +
diff --git a/src/app/data-analytics-dashboard/hiv/registers/maternity-register/maternity-register.component.spec.ts b/src/app/data-analytics-dashboard/hiv/registers/maternity-register/maternity-register.component.spec.ts new file mode 100644 index 000000000..1a50a56fd --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/maternity-register/maternity-register.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { MaternityRegisterComponent } from './maternity-register.component'; + +describe('MaternityRegisterComponent', () => { + let component: MaternityRegisterComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [MaternityRegisterComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(MaternityRegisterComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/data-analytics-dashboard/hiv/registers/maternity-register/maternity-register.component.ts b/src/app/data-analytics-dashboard/hiv/registers/maternity-register/maternity-register.component.ts new file mode 100644 index 000000000..8fe1183d4 --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/maternity-register/maternity-register.component.ts @@ -0,0 +1,161 @@ +import { Component, OnInit, Output } from '@angular/core'; +import { Router, ActivatedRoute } from '@angular/router'; +import * as _ from 'lodash'; +import * as Moment from 'moment'; +@Component({ + selector: 'app-maternity-register', + templateUrl: './maternity-register.component.html', + styleUrls: ['./maternity-register.component.css'] +}) +export class MaternityRegisterComponent implements OnInit { + @Output() + public params: any; + public indicators: string; + public selectedIndicators = []; + public txnewReportSummaryData: any = []; + public columnDefs: any = []; + public reportName = 'Martenity Register'; + public currentView = 'monthly'; + public currentViewBelow = 'pdf'; + public month: string; + public year: number; + public quarter: string; + public eDate: string; + public sDate: string; + + public statusError = false; + public errorMessage = ''; + public showInfoMessage = false; + public isLoading = false; + public reportHead: any; + public enabledControls = 'locationControl,monthControl'; + public pinnedBottomRowData: any = []; + public _month: string; + public isReleased = true; + + public _locationUuids: any = []; + public get locationUuids(): Array { + return this._locationUuids; + } + + public set locationUuids(v: Array) { + const locationUuids = []; + _.each(v, (location: any) => { + if (location.value) { + locationUuids.push(location); + } + }); + this._locationUuids = locationUuids; + } + + constructor(public router: Router, public route: ActivatedRoute) { + this.route.queryParams.subscribe((data) => { + data.month === undefined + ? (this._month = Moment() + .subtract(1, 'M') + .endOf('month') + .format('YYYY-MM-DD')) + : (this._month = data.month); + + this.showDraftReportAlert(this._month); + }); + } + + ngOnInit() {} + + public onMonthChange(value): any { + this._month = Moment(value).endOf('month').format('YYYY-MM-DD'); + } + + public generateReport(): any { + this.route.parent.parent.params.subscribe((params: any) => { + this.storeParamsInUrl(params.location_uuid); + }); + this.txnewReportSummaryData = []; + // this.getTxNewReport(this.params); + } + + public storeParamsInUrl(param) { + this.params = { + locationUuids: param, + _month: Moment(this._month).endOf('month').format('YYYY-MM-DD'), + month: Moment(this._month).endOf('month').format('YYYY-MM-DD'), + reportName: this.reportName, + _date: Moment(this._month).format('DD-MM-YYYY') + }; + this.router.navigate([], { + relativeTo: this.route, + queryParams: this.params + }); + } + + // public getTxNewReport(params: any) { + // this.isLoading = true; + // this.txnewReport.getTxNewReport(params).subscribe((data) => { + // if (data.error) { + // this.showInfoMessage = true; + // this.errorMessage = `There has been an error while loading the report, please retry again`; + // this.isLoading = false; + // } else { + // this.showInfoMessage = false; + // this.columnDefs = data.sectionDefinitions; + // this.txnewReportSummaryData = data.result; + // this.calculateTotalSummary(); + // this.isLoading = false; + // this.showDraftReportAlert(this._month); + // } + // }); + // } + + public calculateTotalSummary() { + const totalsRow = []; + if (this.txnewReportSummaryData.length > 0) { + const totalObj = { + location: 'Totals' + }; + _.each(this.txnewReportSummaryData, (row) => { + Object.keys(row).map((key) => { + if (Number.isInteger(row[key]) === true) { + if (totalObj[key]) { + totalObj[key] = row[key] + totalObj[key]; + } else { + totalObj[key] = row[key]; + } + } else { + if (Number.isNaN(totalObj[key])) { + totalObj[key] = 0; + } + if (totalObj[key] === null) { + totalObj[key] = 0; + } + totalObj[key] = 0 + totalObj[key]; + } + }); + }); + totalObj.location = 'Totals'; + totalsRow.push(totalObj); + this.pinnedBottomRowData = totalsRow; + } + } + public onIndicatorSelected(value) { + this.router.navigate(['patient-list'], { + relativeTo: this.route, + queryParams: { + indicators: value.field, + indicatorHeader: value.headerName, + indicatorGender: value.gender, + month: this._month, + locationUuids: value.location, + currentView: this.currentView + } + }); + } + + public showDraftReportAlert(date) { + if (date != null && date >= Moment().endOf('month').format('YYYY-MM-DD')) { + this.isReleased = false; + } else { + this.isReleased = true; + } + } +} diff --git a/src/app/data-analytics-dashboard/hiv/registers/nutrition-register/nutrition-register.component.css b/src/app/data-analytics-dashboard/hiv/registers/nutrition-register/nutrition-register.component.css new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/data-analytics-dashboard/hiv/registers/nutrition-register/nutrition-register.component.html b/src/app/data-analytics-dashboard/hiv/registers/nutrition-register/nutrition-register.component.html new file mode 100644 index 000000000..40a18d212 --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/nutrition-register/nutrition-register.component.html @@ -0,0 +1,54 @@ +

+ {{ reportName }} +

+ +
+ Loading... +
+ + +
+ + + + +
+
+ +
+ × +

+ An + error occurred while trying to load the report. Please try again. +

+

+ {{ errorMessage }} +

+
+
+ Viewing a Draft Version of the Report for the chosen month. + This report is likely to change without warning. +
+
+ + + + + +
diff --git a/src/app/data-analytics-dashboard/hiv/registers/nutrition-register/nutrition-register.component.spec.ts b/src/app/data-analytics-dashboard/hiv/registers/nutrition-register/nutrition-register.component.spec.ts new file mode 100644 index 000000000..02a62ca91 --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/nutrition-register/nutrition-register.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { NutritionRegisterComponent } from './nutrition-register.component'; + +describe('NutritionRegisterComponent', () => { + let component: NutritionRegisterComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [NutritionRegisterComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(NutritionRegisterComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/data-analytics-dashboard/hiv/registers/nutrition-register/nutrition-register.component.ts b/src/app/data-analytics-dashboard/hiv/registers/nutrition-register/nutrition-register.component.ts new file mode 100644 index 000000000..3240e3fd1 --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/nutrition-register/nutrition-register.component.ts @@ -0,0 +1,161 @@ +import { Component, OnInit, Output } from '@angular/core'; +import { Router, ActivatedRoute } from '@angular/router'; +import * as _ from 'lodash'; +import * as Moment from 'moment'; +@Component({ + selector: 'app-nutrition-register', + templateUrl: './nutrition-register.component.html', + styleUrls: ['./nutrition-register.component.css'] +}) +export class NutritionRegisterComponent implements OnInit { + @Output() + public params: any; + public indicators: string; + public selectedIndicators = []; + public txnewReportSummaryData: any = []; + public columnDefs: any = []; + public reportName = 'Nutrition Service Register'; + public currentView = 'monthly'; + public currentViewBelow = 'pdf'; + public month: string; + public year: number; + public quarter: string; + public eDate: string; + public sDate: string; + + public statusError = false; + public errorMessage = ''; + public showInfoMessage = false; + public isLoading = false; + public reportHead: any; + public enabledControls = 'locationControl,monthControl'; + public pinnedBottomRowData: any = []; + public _month: string; + public isReleased = true; + + public _locationUuids: any = []; + public get locationUuids(): Array { + return this._locationUuids; + } + + public set locationUuids(v: Array) { + const locationUuids = []; + _.each(v, (location: any) => { + if (location.value) { + locationUuids.push(location); + } + }); + this._locationUuids = locationUuids; + } + + constructor(public router: Router, public route: ActivatedRoute) { + this.route.queryParams.subscribe((data) => { + data.month === undefined + ? (this._month = Moment() + .subtract(1, 'M') + .endOf('month') + .format('YYYY-MM-DD')) + : (this._month = data.month); + + this.showDraftReportAlert(this._month); + }); + } + + ngOnInit() {} + + public onMonthChange(value): any { + this._month = Moment(value).endOf('month').format('YYYY-MM-DD'); + } + + public generateReport(): any { + this.route.parent.parent.params.subscribe((params: any) => { + this.storeParamsInUrl(params.location_uuid); + }); + this.txnewReportSummaryData = []; + // this.getTxNewReport(this.params); + } + + public storeParamsInUrl(param) { + this.params = { + locationUuids: param, + _month: Moment(this._month).endOf('month').format('YYYY-MM-DD'), + month: Moment(this._month).endOf('month').format('YYYY-MM-DD'), + reportName: this.reportName, + _date: Moment(this._month).format('DD-MM-YYYY') + }; + this.router.navigate([], { + relativeTo: this.route, + queryParams: this.params + }); + } + + // public getTxNewReport(params: any) { + // this.isLoading = true; + // this.txnewReport.getTxNewReport(params).subscribe((data) => { + // if (data.error) { + // this.showInfoMessage = true; + // this.errorMessage = `There has been an error while loading the report, please retry again`; + // this.isLoading = false; + // } else { + // this.showInfoMessage = false; + // this.columnDefs = data.sectionDefinitions; + // this.txnewReportSummaryData = data.result; + // this.calculateTotalSummary(); + // this.isLoading = false; + // this.showDraftReportAlert(this._month); + // } + // }); + // } + + public calculateTotalSummary() { + const totalsRow = []; + if (this.txnewReportSummaryData.length > 0) { + const totalObj = { + location: 'Totals' + }; + _.each(this.txnewReportSummaryData, (row) => { + Object.keys(row).map((key) => { + if (Number.isInteger(row[key]) === true) { + if (totalObj[key]) { + totalObj[key] = row[key] + totalObj[key]; + } else { + totalObj[key] = row[key]; + } + } else { + if (Number.isNaN(totalObj[key])) { + totalObj[key] = 0; + } + if (totalObj[key] === null) { + totalObj[key] = 0; + } + totalObj[key] = 0 + totalObj[key]; + } + }); + }); + totalObj.location = 'Totals'; + totalsRow.push(totalObj); + this.pinnedBottomRowData = totalsRow; + } + } + public onIndicatorSelected(value) { + this.router.navigate(['patient-list'], { + relativeTo: this.route, + queryParams: { + indicators: value.field, + indicatorHeader: value.headerName, + indicatorGender: value.gender, + month: this._month, + locationUuids: value.location, + currentView: this.currentView + } + }); + } + + public showDraftReportAlert(date) { + if (date != null && date >= Moment().endOf('month').format('YYYY-MM-DD')) { + this.isReleased = false; + } else { + this.isReleased = true; + } + } +} diff --git a/src/app/data-analytics-dashboard/hiv/registers/pnc-register/pnc-register.component.css b/src/app/data-analytics-dashboard/hiv/registers/pnc-register/pnc-register.component.css new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/data-analytics-dashboard/hiv/registers/pnc-register/pnc-register.component.html b/src/app/data-analytics-dashboard/hiv/registers/pnc-register/pnc-register.component.html new file mode 100644 index 000000000..40a18d212 --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/pnc-register/pnc-register.component.html @@ -0,0 +1,54 @@ +

+ {{ reportName }} +

+ +
+ Loading... +
+ + +
+ + + + +
+
+ +
+ × +

+ An + error occurred while trying to load the report. Please try again. +

+

+ {{ errorMessage }} +

+
+
+ Viewing a Draft Version of the Report for the chosen month. + This report is likely to change without warning. +
+
+ + + + + +
diff --git a/src/app/data-analytics-dashboard/hiv/registers/pnc-register/pnc-register.component.spec.ts b/src/app/data-analytics-dashboard/hiv/registers/pnc-register/pnc-register.component.spec.ts new file mode 100644 index 000000000..bc56e4b5d --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/pnc-register/pnc-register.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PncRegisterComponent } from './pnc-register.component'; + +describe('PncRegisterComponent', () => { + let component: PncRegisterComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [PncRegisterComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(PncRegisterComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/data-analytics-dashboard/hiv/registers/pnc-register/pnc-register.component.ts b/src/app/data-analytics-dashboard/hiv/registers/pnc-register/pnc-register.component.ts new file mode 100644 index 000000000..160dead32 --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/pnc-register/pnc-register.component.ts @@ -0,0 +1,161 @@ +import { Component, OnInit, Output } from '@angular/core'; +import { Router, ActivatedRoute } from '@angular/router'; +import * as _ from 'lodash'; +import * as Moment from 'moment'; +@Component({ + selector: 'app-pnc-register', + templateUrl: './pnc-register.component.html', + styleUrls: ['./pnc-register.component.css'] +}) +export class PncRegisterComponent implements OnInit { + @Output() + public params: any; + public indicators: string; + public selectedIndicators = []; + public txnewReportSummaryData: any = []; + public columnDefs: any = []; + public reportName = 'PNC Register'; + public currentView = 'monthly'; + public currentViewBelow = 'pdf'; + public month: string; + public year: number; + public quarter: string; + public eDate: string; + public sDate: string; + + public statusError = false; + public errorMessage = ''; + public showInfoMessage = false; + public isLoading = false; + public reportHead: any; + public enabledControls = 'locationControl,monthControl'; + public pinnedBottomRowData: any = []; + public _month: string; + public isReleased = true; + + public _locationUuids: any = []; + public get locationUuids(): Array { + return this._locationUuids; + } + + public set locationUuids(v: Array) { + const locationUuids = []; + _.each(v, (location: any) => { + if (location.value) { + locationUuids.push(location); + } + }); + this._locationUuids = locationUuids; + } + + constructor(public router: Router, public route: ActivatedRoute) { + this.route.queryParams.subscribe((data) => { + data.month === undefined + ? (this._month = Moment() + .subtract(1, 'M') + .endOf('month') + .format('YYYY-MM-DD')) + : (this._month = data.month); + + this.showDraftReportAlert(this._month); + }); + } + + ngOnInit() {} + + public onMonthChange(value): any { + this._month = Moment(value).endOf('month').format('YYYY-MM-DD'); + } + + public generateReport(): any { + this.route.parent.parent.params.subscribe((params: any) => { + this.storeParamsInUrl(params.location_uuid); + }); + this.txnewReportSummaryData = []; + // this.getTxNewReport(this.params); + } + + public storeParamsInUrl(param) { + this.params = { + locationUuids: param, + _month: Moment(this._month).endOf('month').format('YYYY-MM-DD'), + month: Moment(this._month).endOf('month').format('YYYY-MM-DD'), + reportName: this.reportName, + _date: Moment(this._month).format('DD-MM-YYYY') + }; + this.router.navigate([], { + relativeTo: this.route, + queryParams: this.params + }); + } + + // public getTxNewReport(params: any) { + // this.isLoading = true; + // this.txnewReport.getTxNewReport(params).subscribe((data) => { + // if (data.error) { + // this.showInfoMessage = true; + // this.errorMessage = `There has been an error while loading the report, please retry again`; + // this.isLoading = false; + // } else { + // this.showInfoMessage = false; + // this.columnDefs = data.sectionDefinitions; + // this.txnewReportSummaryData = data.result; + // this.calculateTotalSummary(); + // this.isLoading = false; + // this.showDraftReportAlert(this._month); + // } + // }); + // } + + public calculateTotalSummary() { + const totalsRow = []; + if (this.txnewReportSummaryData.length > 0) { + const totalObj = { + location: 'Totals' + }; + _.each(this.txnewReportSummaryData, (row) => { + Object.keys(row).map((key) => { + if (Number.isInteger(row[key]) === true) { + if (totalObj[key]) { + totalObj[key] = row[key] + totalObj[key]; + } else { + totalObj[key] = row[key]; + } + } else { + if (Number.isNaN(totalObj[key])) { + totalObj[key] = 0; + } + if (totalObj[key] === null) { + totalObj[key] = 0; + } + totalObj[key] = 0 + totalObj[key]; + } + }); + }); + totalObj.location = 'Totals'; + totalsRow.push(totalObj); + this.pinnedBottomRowData = totalsRow; + } + } + public onIndicatorSelected(value) { + this.router.navigate(['patient-list'], { + relativeTo: this.route, + queryParams: { + indicators: value.field, + indicatorHeader: value.headerName, + indicatorGender: value.gender, + month: this._month, + locationUuids: value.location, + currentView: this.currentView + } + }); + } + + public showDraftReportAlert(date) { + if (date != null && date >= Moment().endOf('month').format('YYYY-MM-DD')) { + this.isReleased = false; + } else { + this.isReleased = true; + } + } +} diff --git a/src/app/data-analytics-dashboard/hiv/registers/prepdaily-register/prepdaily-register.component.css b/src/app/data-analytics-dashboard/hiv/registers/prepdaily-register/prepdaily-register.component.css new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/data-analytics-dashboard/hiv/registers/prepdaily-register/prepdaily-register.component.html b/src/app/data-analytics-dashboard/hiv/registers/prepdaily-register/prepdaily-register.component.html new file mode 100644 index 000000000..40a18d212 --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/prepdaily-register/prepdaily-register.component.html @@ -0,0 +1,54 @@ +

+ {{ reportName }} +

+ +
+ Loading... +
+ + +
+ + + + +
+
+ +
+ × +

+ An + error occurred while trying to load the report. Please try again. +

+

+ {{ errorMessage }} +

+
+
+ Viewing a Draft Version of the Report for the chosen month. + This report is likely to change without warning. +
+
+ + + + + +
diff --git a/src/app/data-analytics-dashboard/hiv/registers/prepdaily-register/prepdaily-register.component.spec.ts b/src/app/data-analytics-dashboard/hiv/registers/prepdaily-register/prepdaily-register.component.spec.ts new file mode 100644 index 000000000..b44182395 --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/prepdaily-register/prepdaily-register.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PrepdailyRegisterComponent } from './prepdaily-register.component'; + +describe('PrepdailyRegisterComponent', () => { + let component: PrepdailyRegisterComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [PrepdailyRegisterComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(PrepdailyRegisterComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/data-analytics-dashboard/hiv/registers/prepdaily-register/prepdaily-register.component.ts b/src/app/data-analytics-dashboard/hiv/registers/prepdaily-register/prepdaily-register.component.ts new file mode 100644 index 000000000..c982e94bd --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/prepdaily-register/prepdaily-register.component.ts @@ -0,0 +1,161 @@ +import { Component, OnInit, Output } from '@angular/core'; +import { Router, ActivatedRoute } from '@angular/router'; +import * as _ from 'lodash'; +import * as Moment from 'moment'; +@Component({ + selector: 'app-prepdaily-register', + templateUrl: './prepdaily-register.component.html', + styleUrls: ['./prepdaily-register.component.css'] +}) +export class PrepdailyRegisterComponent implements OnInit { + @Output() + public params: any; + public indicators: string; + public selectedIndicators = []; + public txnewReportSummaryData: any = []; + public columnDefs: any = []; + public reportName = 'PrEP Daily Activity Register'; + public currentView = 'monthly'; + public currentViewBelow = 'pdf'; + public month: string; + public year: number; + public quarter: string; + public eDate: string; + public sDate: string; + + public statusError = false; + public errorMessage = ''; + public showInfoMessage = false; + public isLoading = false; + public reportHead: any; + public enabledControls = 'locationControl,monthControl'; + public pinnedBottomRowData: any = []; + public _month: string; + public isReleased = true; + + public _locationUuids: any = []; + public get locationUuids(): Array { + return this._locationUuids; + } + + public set locationUuids(v: Array) { + const locationUuids = []; + _.each(v, (location: any) => { + if (location.value) { + locationUuids.push(location); + } + }); + this._locationUuids = locationUuids; + } + + constructor(public router: Router, public route: ActivatedRoute) { + this.route.queryParams.subscribe((data) => { + data.month === undefined + ? (this._month = Moment() + .subtract(1, 'M') + .endOf('month') + .format('YYYY-MM-DD')) + : (this._month = data.month); + + this.showDraftReportAlert(this._month); + }); + } + + ngOnInit() {} + + public onMonthChange(value): any { + this._month = Moment(value).endOf('month').format('YYYY-MM-DD'); + } + + public generateReport(): any { + this.route.parent.parent.params.subscribe((params: any) => { + this.storeParamsInUrl(params.location_uuid); + }); + this.txnewReportSummaryData = []; + // this.getTxNewReport(this.params); + } + + public storeParamsInUrl(param) { + this.params = { + locationUuids: param, + _month: Moment(this._month).endOf('month').format('YYYY-MM-DD'), + month: Moment(this._month).endOf('month').format('YYYY-MM-DD'), + reportName: this.reportName, + _date: Moment(this._month).format('DD-MM-YYYY') + }; + this.router.navigate([], { + relativeTo: this.route, + queryParams: this.params + }); + } + + // public getTxNewReport(params: any) { + // this.isLoading = true; + // this.txnewReport.getTxNewReport(params).subscribe((data) => { + // if (data.error) { + // this.showInfoMessage = true; + // this.errorMessage = `There has been an error while loading the report, please retry again`; + // this.isLoading = false; + // } else { + // this.showInfoMessage = false; + // this.columnDefs = data.sectionDefinitions; + // this.txnewReportSummaryData = data.result; + // this.calculateTotalSummary(); + // this.isLoading = false; + // this.showDraftReportAlert(this._month); + // } + // }); + // } + + public calculateTotalSummary() { + const totalsRow = []; + if (this.txnewReportSummaryData.length > 0) { + const totalObj = { + location: 'Totals' + }; + _.each(this.txnewReportSummaryData, (row) => { + Object.keys(row).map((key) => { + if (Number.isInteger(row[key]) === true) { + if (totalObj[key]) { + totalObj[key] = row[key] + totalObj[key]; + } else { + totalObj[key] = row[key]; + } + } else { + if (Number.isNaN(totalObj[key])) { + totalObj[key] = 0; + } + if (totalObj[key] === null) { + totalObj[key] = 0; + } + totalObj[key] = 0 + totalObj[key]; + } + }); + }); + totalObj.location = 'Totals'; + totalsRow.push(totalObj); + this.pinnedBottomRowData = totalsRow; + } + } + public onIndicatorSelected(value) { + this.router.navigate(['patient-list'], { + relativeTo: this.route, + queryParams: { + indicators: value.field, + indicatorHeader: value.headerName, + indicatorGender: value.gender, + month: this._month, + locationUuids: value.location, + currentView: this.currentView + } + }); + } + + public showDraftReportAlert(date) { + if (date != null && date >= Moment().endOf('month').format('YYYY-MM-DD')) { + this.isReleased = false; + } else { + this.isReleased = true; + } + } +} diff --git a/src/app/data-analytics-dashboard/hiv/registers/registers.component.css b/src/app/data-analytics-dashboard/hiv/registers/registers.component.css new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/data-analytics-dashboard/hiv/registers/registers.component.html b/src/app/data-analytics-dashboard/hiv/registers/registers.component.html new file mode 100644 index 000000000..c40ea7725 --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/registers.component.html @@ -0,0 +1,27 @@ + +

Loading available dashboards ...

+
+ {{ errorMessage }} +
+ \ No newline at end of file diff --git a/src/app/data-analytics-dashboard/hiv/registers/registers.component.spec.ts b/src/app/data-analytics-dashboard/hiv/registers/registers.component.spec.ts new file mode 100644 index 000000000..769a029a0 --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/registers.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { RegistersComponent } from './registers.component'; + +describe('RegistersComponent', () => { + let component: RegistersComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [RegistersComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(RegistersComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/data-analytics-dashboard/hiv/registers/registers.component.ts b/src/app/data-analytics-dashboard/hiv/registers/registers.component.ts new file mode 100644 index 000000000..92750254f --- /dev/null +++ b/src/app/data-analytics-dashboard/hiv/registers/registers.component.ts @@ -0,0 +1,79 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; + +@Component({ + selector: 'app-registers', + templateUrl: './registers.component.html', + styleUrls: ['./registers.component.css'] +}) +export class RegistersComponent implements OnInit { + public isBusy = false; + public errorMessage = ''; + + public dashboards: Array = []; + constructor(public router: Router, public route: ActivatedRoute) {} + + ngOnInit() { + this.dashboards = [ + { + title: 'MOH-408: HEI Register', + description: '', + url: 'hei-register', + icon: 'fa' + }, + { + title: 'MOH-405: ANC Register', + description: '', + url: 'anc-register', + icon: 'fa' + }, + { + title: 'MOH-407: Nutrition Service Register', + description: '', + url: 'nutrition-register', + icon: 'fa' + }, + { + title: 'MOH-333: Martenity Register', + description: '', + url: 'maternity-register', + icon: 'fa' + }, + { + title: 'MOH-362: HTS Lab Refferal & Linkage Register', + description: '', + url: 'htsrefferallinkage-register', + icon: 'fa' + }, + { + title: 'MOH-406: PNC Register', + description: '', + url: 'pnc-register', + icon: 'fa' + }, + { + title: 'Defaulter Tracing Register', + description: '', + url: 'defaultertracing-register', + icon: 'fa' + }, + { + title: 'MOH-267: PrEP Daily Activity Register', + description: '', + url: 'prepdaily-register', + icon: 'fa' + }, + { + title: 'MOH-366: Care and Treatment Daily Activity', + description: '', + url: 'cntdaily-register', + icon: 'fa' + } + ]; + } + public viewDashboard(dashboard: any) { + this.router.navigate([dashboard.url], { + relativeTo: this.route + }); + } +} diff --git a/src/app/shared/dynamic-route/schema/analytics.dashboard.conf.json b/src/app/shared/dynamic-route/schema/analytics.dashboard.conf.json index 0cc6d3a9c..ebd82770a 100644 --- a/src/app/shared/dynamic-route/schema/analytics.dashboard.conf.json +++ b/src/app/shared/dynamic-route/schema/analytics.dashboard.conf.json @@ -114,6 +114,12 @@ "icon": "fa fa-file", "isSideBarOpen": false }, + { + "url": "registers", + "label": "Registers", + "icon": "fa fa-list-alt", + "isSideBarOpen": false + }, { "url": "select-department", "label": "Change Department", From 624b758c6da367a1997fbadbbefbfed65202fdbf Mon Sep 17 00:00:00 2001 From: Alfred-Mutai Date: Thu, 23 May 2024 10:22:12 +0300 Subject: [PATCH 2/4] POC-737: Development of MOH Registers --- .../hiv/registers/registers.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/data-analytics-dashboard/hiv/registers/registers.component.html b/src/app/data-analytics-dashboard/hiv/registers/registers.component.html index c40ea7725..e040fcba0 100644 --- a/src/app/data-analytics-dashboard/hiv/registers/registers.component.html +++ b/src/app/data-analytics-dashboard/hiv/registers/registers.component.html @@ -24,4 +24,4 @@
{{ dashboard.description }}
- \ No newline at end of file + From 7a9a298ea0937c899a34867da52a6a7afada5849 Mon Sep 17 00:00:00 2001 From: Alfred-Mutai Date: Thu, 23 May 2024 15:27:01 +0300 Subject: [PATCH 3/4] POC-739: MOH 408 HIV Exposed Infant Registers --- .../hei-register/hei-register.component.css | 8 + .../hei-register/hei-register.component.html | 336 +++++++++++++++++- 2 files changed, 328 insertions(+), 16 deletions(-) diff --git a/src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.css b/src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.css index e69de29bb..a6a8ced85 100644 --- a/src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.css +++ b/src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.css @@ -0,0 +1,8 @@ +tr, +.table-bordered th, +.table-bordered td { + border: 2px solid #000; /* Darker border color */ +} +tbody tr { + height: 20px; /* Adjust the height as per your design */ +} diff --git a/src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.html b/src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.html index 40a18d212..abed1fc6c 100644 --- a/src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.html +++ b/src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.html @@ -35,20 +35,324 @@

Viewing a Draft Version of the Report for the chosen month. This report is likely to change without warning. -
- - - - - +
+
+
+
+ Ministry Of Health +
+
+ HIV EXPOSED INFANT REGISTER MOH 408 +
+
+ Ver. July 2023 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Cohort: Month/Year + (MMM-YYYY).........................../.............................................. +
Infant and Mother/Guardian Information + First HIV DNA PCR Test at Birth, 6 weeks or First Contact + Second HIV DNA PCR TesThird HIV DNA PCR TestHEI Outcomes at 12 monthsConfirmatory PCRAntibody test (18 to 24 months)HEI Outcomes at 24 monthsComments
Registration InformationInfant's informationParent's information
Serial No. + Date of Collected enrollment (DD/MM/YYYY) + HEI ID (MFL-YYYY-NNNN)Infant's NameDOB (DD/MM/YYYY)HeaderSex + Infant Prophylaxis 1=NVP, 2=AZT, 3=NVP &AZT, 4=None, + Father's/Mother's/Guardian's NameAge at Test (in wks) + Type of Test 1=At Birth 2=at 6 weeks 3=at First Contact + Date Sample CollectedAge at Test (in months)Date Sample CollectedAge at Test (in months)Date Sample CollectedInfant Feeding + 1=Infected 2= Uninfected 3=Lost to Follow 4=Transfer Out 5=Dead + Age at Test (in months)Date Sample CollectedAge at Test (in months)Date Sample CollectedInfant Feeding + 1=Infected 2= Uninfected 3=Lost to Follow 4=Transfer Out 5=Dead +
Client Unique Number (NUPI)(M/F)(M/F)Telephone numberTest result (P,N)Test result (P,N)Test result (P,N)BF=Breastfeeding NBF=Not BreastfeedingTest result (P,N)Test result (P,N)BF=Breastfeeding NBF=Not Breastfeeding
(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)(m)(n)(o)(p)(q)(r)(s)(t)(u)(v)(w)(x)(y)
+
From e7fe89b6e001b6308733fae6888f8854052aaa11 Mon Sep 17 00:00:00 2001 From: Faith Kamau <121166087+hiqedme@users.noreply.github.com> Date: Wed, 5 Jun 2024 15:38:52 +0300 Subject: [PATCH 4/4] POC-739 added data for HEI --- .../hei-register/hei-register.component.html | 260 ++++-------------- .../hei-register/hei-register.component.ts | 52 ++-- .../etl-api/hei-register-resource.service.ts | 58 ++++ 3 files changed, 141 insertions(+), 229 deletions(-) create mode 100644 src/app/etl-api/hei-register-resource.service.ts diff --git a/src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.html b/src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.html index abed1fc6c..fedc228d4 100644 --- a/src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.html +++ b/src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.html @@ -35,7 +35,7 @@

Viewing a Draft Version of the Report for the chosen month. This report is likely to change without warning.

-
+
@@ -61,7 +61,7 @@

First HIV DNA PCR Test at Birth, 6 weeks or First Contact - Second HIV DNA PCR Tes + Second HIV DNA PCR Test Third HIV DNA PCR Test HEI Outcomes at 12 months Confirmatory PCR @@ -79,10 +79,10 @@

Date of Collected enrollment (DD/MM/YYYY) - HEI ID (MFL-YYYY-NNNN) - Infant's Name - DOB (DD/MM/YYYY) - Header + Birth Certificate Number + HEI ID (MFL-YYYY-NNNN) + Infant's Name + DOB (DD/MM/YYYY) Sex Infant Prophylaxis 1=NVP, 2=AZT, 3=NVP &AZT, 4=None, @@ -152,206 +152,54 @@

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + {{a+1}} + {{data.date_enrolled}} + {{data.Birth_Certificate_number}} + {{data.HEI_ID}} + {{data.Infant_name}} + {{data.birth_date}} + Sex + {{null}} + {{data.parent_name}} + {{data.age_in_weeks_on_first_pcr}} + {{date_enrolled}} + {{data.first_pcr_date}} + {{data.age_in_months_on_second_pcr}} + {{data.second_pcr_date}} + {{data.age_in_months_on_third_pcr}} + {{data.third_pcr_date}} + Infant Feeding + {{data.hei_outcome}} + {{data.age_in_months_on_confirm_pcr}} + {{data.confirm_pcr_date}} + {{data.age_in_months_on_first_antibody}} + {{data.first_antibody_date}} + {{null}} + {{null}} + {{null}} + + + {{data.NUPI}} + {{data.gender}} + {{data.Phone_Number}} + {{data.results_pcr_first_pcr}} + {{data.results_pcr_second_pcr}} + {{data.results_pcr_third_pcr}} + {{data.infant_feeding}} + {{data.results_confirm_pcr}} + {{data.results_first_antibody}} + {{null}} + {{null}} + + + + + +

diff --git a/src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.ts b/src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.ts index 2a9de1b47..5721caff6 100644 --- a/src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.ts +++ b/src/app/data-analytics-dashboard/hiv/registers/hei-register/hei-register.component.ts @@ -2,6 +2,7 @@ import { Component, OnInit, Output } from '@angular/core'; import { Router, ActivatedRoute } from '@angular/router'; import * as _ from 'lodash'; import * as Moment from 'moment'; +import { HeiRegisterResourceService } from 'src/app/etl-api/hei-register-resource.service'; @Component({ selector: 'app-hei-register', templateUrl: './hei-register.component.html', @@ -12,7 +13,7 @@ export class HeiRegisterComponent implements OnInit { public params: any; public indicators: string; public selectedIndicators = []; - public txnewReportSummaryData: any = []; + public heiRegisterData: any = []; public columnDefs: any = []; public reportName = 'HEI Register'; public currentView = 'monthly'; @@ -48,7 +49,11 @@ export class HeiRegisterComponent implements OnInit { this._locationUuids = locationUuids; } - constructor(public router: Router, public route: ActivatedRoute) { + constructor( + public router: Router, + public route: ActivatedRoute, + public heiRegisterService: HeiRegisterResourceService + ) { this.route.queryParams.subscribe((data) => { data.month === undefined ? (this._month = Moment() @@ -71,8 +76,8 @@ export class HeiRegisterComponent implements OnInit { this.route.parent.parent.params.subscribe((params: any) => { this.storeParamsInUrl(params.location_uuid); }); - this.txnewReportSummaryData = []; - // this.getTxNewReport(this.params); + this.heiRegisterData = []; + this.getHeiRegisterData(this.params); } public storeParamsInUrl(param) { @@ -89,31 +94,32 @@ export class HeiRegisterComponent implements OnInit { }); } - // public getTxNewReport(params: any) { - // this.isLoading = true; - // this.txnewReport.getTxNewReport(params).subscribe((data) => { - // if (data.error) { - // this.showInfoMessage = true; - // this.errorMessage = `There has been an error while loading the report, please retry again`; - // this.isLoading = false; - // } else { - // this.showInfoMessage = false; - // this.columnDefs = data.sectionDefinitions; - // this.txnewReportSummaryData = data.result; - // this.calculateTotalSummary(); - // this.isLoading = false; - // this.showDraftReportAlert(this._month); - // } - // }); - // } + public getHeiRegisterData(params: any) { + this.isLoading = true; + this.heiRegisterService.getHeiRegister(params).subscribe((data) => { + if (data.error) { + this.showInfoMessage = true; + this.errorMessage = `There has been an error while loading the report, please retry again`; + this.isLoading = false; + } else { + console.log('HeiDataSummary: ', data); + this.showInfoMessage = false; + this.columnDefs = data.sectionDefinitions; + this.heiRegisterData = data; + // this.calculateTotalSummary(); + this.isLoading = false; + this.showDraftReportAlert(this._month); + } + }); + } public calculateTotalSummary() { const totalsRow = []; - if (this.txnewReportSummaryData.length > 0) { + if (this.heiRegisterData.length > 0) { const totalObj = { location: 'Totals' }; - _.each(this.txnewReportSummaryData, (row) => { + _.each(this.heiRegisterData, (row) => { Object.keys(row).map((key) => { if (Number.isInteger(row[key]) === true) { if (totalObj[key]) { diff --git a/src/app/etl-api/hei-register-resource.service.ts b/src/app/etl-api/hei-register-resource.service.ts new file mode 100644 index 000000000..9fe930f89 --- /dev/null +++ b/src/app/etl-api/hei-register-resource.service.ts @@ -0,0 +1,58 @@ +import { Injectable } from '@angular/core'; +import { AppSettingsService } from '../app-settings/app-settings.service'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import * as Moment from 'moment'; +import { catchError, map } from 'rxjs/operators'; +@Injectable({ + providedIn: 'root' +}) +export class HeiRegisterResourceService { + public get url(): string { + return this.appSettingsService.getEtlRestbaseurl().trim(); + } + constructor( + public http: HttpClient, + public appSettingsService: AppSettingsService + ) {} + public getHeiRegister(params: any): Observable { + // tslint:disable-next-line: max-line-length + return this.http + .get( + `${this.url}hei-register?endDate=${params.month}&locationUuids=${params.locationUuids}` + ) + .pipe( + catchError((err: any) => { + const error: any = err; + const errorObj = { + error: error.status, + message: error.statusText + }; + return Observable.of(errorObj); + }), + map((response: Response) => { + return response; + }) + ); + } + public getTxNewPatientList(params: any): Observable { + // tslint:disable-next-line: max-line-length + return this.http + .get( + `${this.url}txnew-summary-patient-list?endDate=${params.month}&locationUuids=${params.locationUuids}&indicators=${params.indicators}` + ) + .pipe( + catchError((err: any) => { + const error: any = err; + const errorObj = { + error: error.status, + message: error.statusText + }; + return Observable.of(errorObj); + }), + map((response: Response) => { + return response; + }) + ); + } +}