From 1dea88a54f4ed0a8b8f79114491f9ad833630dfe Mon Sep 17 00:00:00 2001 From: sainingo Date: Tue, 16 Jan 2024 14:18:24 +0300 Subject: [PATCH 1/8] Register dashboard --- .../hiv/hiv-program.routes.ts | 50 +++ src/app/etl-api/etl-api.module.ts | 4 +- .../etl-api/otz-register-resource.service.ts | 65 ++++ src/app/hiv-care-lib/hiv-care-lib.module.ts | 21 +- .../otz-register-filter.component.css | 11 + .../otz-register-filter.component.html | 16 + .../otz-register-filter.component.ts | 289 ++++++++++++++++++ .../otz-register-patient-list.component.css | 0 .../otz-register-patient-list.component.html | 54 ++++ .../otz-register-patient-list.component.ts | 183 +++++++++++ .../otz-register-tabular.component.css | 0 .../otz-register-tabular.component.html | 26 ++ .../otz-register-tabular.component.ts | 142 +++++++++ .../otz-registers/otz-register.component.css | 51 ++++ .../otz-registers/otz-register.component.html | 181 +++++++++++ .../otz-registers/otz-register.component.ts | 13 + .../registers-dashboard.component.html | 27 ++ .../registers-dashboard.component.ts | 43 +++ .../schema/clinic.dashboard.conf.json | 6 + 19 files changed, 1179 insertions(+), 3 deletions(-) create mode 100644 src/app/etl-api/otz-register-resource.service.ts create mode 100644 src/app/hiv-care-lib/registers/otz/otz-register-filters/otz-register-filter.component.css create mode 100644 src/app/hiv-care-lib/registers/otz/otz-register-filters/otz-register-filter.component.html create mode 100644 src/app/hiv-care-lib/registers/otz/otz-register-filters/otz-register-filter.component.ts create mode 100644 src/app/hiv-care-lib/registers/otz/otz-register-patient-list/otz-register-patient-list.component.css create mode 100644 src/app/hiv-care-lib/registers/otz/otz-register-patient-list/otz-register-patient-list.component.html create mode 100644 src/app/hiv-care-lib/registers/otz/otz-register-patient-list/otz-register-patient-list.component.ts create mode 100644 src/app/hiv-care-lib/registers/otz/otz-register-table/otz-register-tabular.component.css create mode 100644 src/app/hiv-care-lib/registers/otz/otz-register-table/otz-register-tabular.component.html create mode 100644 src/app/hiv-care-lib/registers/otz/otz-register-table/otz-register-tabular.component.ts create mode 100644 src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.css create mode 100644 src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.html create mode 100644 src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.ts create mode 100644 src/app/hiv-care-lib/registers/registers-dashboard.component.html create mode 100644 src/app/hiv-care-lib/registers/registers-dashboard.component.ts diff --git a/src/app/clinic-dashboard/hiv/hiv-program.routes.ts b/src/app/clinic-dashboard/hiv/hiv-program.routes.ts index 0d8ccb538..1df50dfb9 100644 --- a/src/app/clinic-dashboard/hiv/hiv-program.routes.ts +++ b/src/app/clinic-dashboard/hiv/hiv-program.routes.ts @@ -68,6 +68,8 @@ import { Covid19ReportPatientListComponent } from './../../hiv-care-lib/covid-19 import { PreAppointmentOutreachComponent } from '../general/pre-appointment-outreach/pre-appointment-outreach.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 { RegistersDashboardComponent } from 'src/app/hiv-care-lib/registers/registers-dashboard.component'; +import { OtzRegisterComponent } from 'src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component'; const routes: Routes = [ { @@ -293,6 +295,41 @@ const routes: Routes = [ } ] }, + { + path: 'registers', + children: [ + { + path: '', + component: MonthlyReportComponent + }, + { + path: 'prep-report', + children: [ + { + path: '', + component: PrepReportComponent + }, + { + path: 'patient-list', + component: PrepReportPatientListComponent + } + ] + }, + { + path: 'patient-gains-and-loses', + children: [ + { + path: '', + component: ClinicDashboardGainsAndLossesComponent + }, + { + path: 'patient-list', + component: PatientGainsAndLosesPatientListComponent + } + ] + } + ] + }, { path: 'hei-report', children: [ @@ -505,6 +542,19 @@ const routes: Routes = [ } ] }, + { + path: 'registers', + children: [ + { + path: '', + component: RegistersDashboardComponent + }, + { + path: 'otz-register', + component: OtzRegisterComponent + } + ] + }, { path: 'hei-report', children: [ diff --git a/src/app/etl-api/etl-api.module.ts b/src/app/etl-api/etl-api.module.ts index 66ca15eab..e0634dd52 100644 --- a/src/app/etl-api/etl-api.module.ts +++ b/src/app/etl-api/etl-api.module.ts @@ -44,6 +44,7 @@ import { MOH412ResourceService } from './moh-412-resource.service'; import { ClinicFlowResourceService } from './clinic-flow-resource.service'; import { Covid19ResourceService } from './covid-19-resource-service'; import { LocationUnitsService } from './location-units.service'; +import { OTZRegisterResourceService } from './otz-register-resource.service'; @NgModule({ imports: [CommonModule, AppSettingsModule], @@ -93,7 +94,8 @@ import { LocationUnitsService } from './location-units.service'; MOH412ResourceService, ClinicFlowResourceService, Covid19ResourceService, - LocationUnitsService + LocationUnitsService, + OTZRegisterResourceService ], exports: [] }) diff --git a/src/app/etl-api/otz-register-resource.service.ts b/src/app/etl-api/otz-register-resource.service.ts new file mode 100644 index 000000000..4383d3e53 --- /dev/null +++ b/src/app/etl-api/otz-register-resource.service.ts @@ -0,0 +1,65 @@ +import { Injectable } from '@angular/core'; +import { HttpClient, HttpParams } from '@angular/common/http'; + +import { Observable, of } from 'rxjs'; +import * as _ from 'lodash'; + +import { AppSettingsService } from '../app-settings/app-settings.service'; +import { DataCacheService } from '../shared/services/data-cache.service'; + +@Injectable() +export class OTZRegisterResourceService { + constructor( + protected http: HttpClient, + protected appSettingsService: AppSettingsService, + private cacheService: DataCacheService + ) {} + + public getBaseUrl(): string { + return this.appSettingsService.getEtlRestbaseurl().trim(); + } + public getPatientListUrl(): string { + return ( + this.appSettingsService.getEtlRestbaseurl().trim() + + 'moh-412-report/patient-list' + ); + } + + public getOTZMonthlyRegister(payload: any): Observable { + if (!payload) { + return null; + } + let urlParams: HttpParams = new HttpParams() + .set('endDate', payload.endDate) + .set('startDate', payload.startDate) + .set('locationType', payload.locationType); + if (payload.locationUuids) { + if (payload.locationUuids.length > 0) { + urlParams = urlParams.set('locationUuids', payload.locationUuids); + } + } + const url = this.getBaseUrl() + 'otz-register'; + const request = this.http.get(url, { + params: urlParams + }); + return this.cacheService.cacheRequest(url, urlParams, request); + } + + public getMoh412MonthlyReportPatientList(params: any) { + if (!params) { + return null; + } + const urlParams: HttpParams = new HttpParams() + .set('startDate', params.startDate) + .set('endDate', params.endDate) + .set('locationUuids', params.locationUuids) + .set('indicators', params.indicators) + .set('locationType', params.locationType); + + const url = this.getPatientListUrl(); + const request = this.http.get(url, { + params: urlParams + }); + return this.cacheService.cacheRequest(url, urlParams, request); + } +} diff --git a/src/app/hiv-care-lib/hiv-care-lib.module.ts b/src/app/hiv-care-lib/hiv-care-lib.module.ts index a8c45d4f9..507517e48 100644 --- a/src/app/hiv-care-lib/hiv-care-lib.module.ts +++ b/src/app/hiv-care-lib/hiv-care-lib.module.ts @@ -148,6 +148,12 @@ import { AhdMonthlyReportPatientlistComponent } from './ahd-monthly-report/ahd-m import { PlhivNcdV2ReportBaseComponent } from './plhiv-ncd-v2-report/plhiv-ncd-v2-report-base/plhiv-ncd-v2-report-base.component'; import { PlhivNcdV2ReportPatientListComponent } from './plhiv-ncd-v2-report/plhiv-ncd-v2-report-patient-list/plhiv-ncd-v2-report-patient-list.component'; import { PlhivNcdV2ReportViewComponent } from './plhiv-ncd-v2-report/plhiv-ncd-v2-report-view/plhiv-ncd-v2-report-view.component'; +import { RegistersDashboardComponent } from './registers/registers-dashboard.component'; +import { OtzRegisterComponent } from './registers/otz/otz-registers/otz-register.component'; +import { OTZRegisterFilterComponent } from './registers/otz/otz-register-filters/otz-register-filter.component'; +import { OTZRegisterPatientListComponent } from './registers/otz/otz-register-patient-list/otz-register-patient-list.component'; +import { OTZRegisterReportViewComponent } from './registers/otz/otz-register-report-view/otz-register-report-view.component'; +import { OTZRegisterTabularComponent } from './registers/otz/otz-register-table/otz-register-tabular.component'; @NgModule({ imports: [ @@ -251,7 +257,12 @@ import { PlhivNcdV2ReportViewComponent } from './plhiv-ncd-v2-report/plhiv-ncd-v PrepMonthlyReportViewComponent, TxMlReportViewComponent, AhdReportViewComponent, - PlhivNcdV2ReportViewComponent + PlhivNcdV2ReportViewComponent, + RegistersDashboardComponent, + OTZRegisterFilterComponent, + OTZRegisterPatientListComponent, + OTZRegisterReportViewComponent, + OTZRegisterTabularComponent ], declarations: [ Moh731TabularComponent, @@ -348,7 +359,13 @@ import { PlhivNcdV2ReportViewComponent } from './plhiv-ncd-v2-report/plhiv-ncd-v AhdMonthlyReportPatientlistComponent, PlhivNcdV2ReportBaseComponent, PlhivNcdV2ReportPatientListComponent, - PlhivNcdV2ReportViewComponent + PlhivNcdV2ReportViewComponent, + RegistersDashboardComponent, + OtzRegisterComponent, + OTZRegisterFilterComponent, + OTZRegisterPatientListComponent, + OTZRegisterReportViewComponent, + OTZRegisterTabularComponent ], providers: [ MOHReportService, diff --git a/src/app/hiv-care-lib/registers/otz/otz-register-filters/otz-register-filter.component.css b/src/app/hiv-care-lib/registers/otz/otz-register-filters/otz-register-filter.component.css new file mode 100644 index 000000000..c2c152386 --- /dev/null +++ b/src/app/hiv-care-lib/registers/otz/otz-register-filters/otz-register-filter.component.css @@ -0,0 +1,11 @@ +#moh-412-filter { + border-style: solid; + border: 1px double lightgray; + padding-top: 10px; + padding-bottom: 10px; + padding-left: 15px; + padding-right: 15px; + margin-left: 5px; + margin-right: 5px; + margin-bottom: 10px; +} diff --git a/src/app/hiv-care-lib/registers/otz/otz-register-filters/otz-register-filter.component.html b/src/app/hiv-care-lib/registers/otz/otz-register-filters/otz-register-filter.component.html new file mode 100644 index 000000000..e66de2cb8 --- /dev/null +++ b/src/app/hiv-care-lib/registers/otz/otz-register-filters/otz-register-filter.component.html @@ -0,0 +1,16 @@ +
+
+
+ + +
+
+
diff --git a/src/app/hiv-care-lib/registers/otz/otz-register-filters/otz-register-filter.component.ts b/src/app/hiv-care-lib/registers/otz/otz-register-filters/otz-register-filter.component.ts new file mode 100644 index 000000000..2da384112 --- /dev/null +++ b/src/app/hiv-care-lib/registers/otz/otz-register-filters/otz-register-filter.component.ts @@ -0,0 +1,289 @@ +import { + Component, + OnInit, + Input, + OnChanges, + SimpleChanges +} from '@angular/core'; +import { Router, ActivatedRoute } from '@angular/router'; + +import * as _ from 'lodash'; +import * as Moment from 'moment'; +import { DataAnalyticsDashboardService } from 'src/app/data-analytics-dashboard/services/data-analytics-dashboard.services'; +import { AppFeatureAnalytics } from 'src/app/shared/app-analytics/app-feature-analytics.service'; + +// import { AppFeatureAnalytics } from './../../../shared/app-analytics/app-feature-analytics.service'; +// import { DataAnalyticsDashboardService } from './../../../data-analytics-dashboard/services/data-analytics-dashboard.services'; + +@Component({ + selector: 'app-otz-register-filter', + templateUrl: './otz-register-filter.component.html', + styleUrls: ['./otz-register-filter.component.css'] +}) +export class OTZRegisterFilterComponent implements OnInit, OnChanges { + @Input() public startDate = Moment().startOf('month').format('YYYY-MM-DD'); + @Input() public endDate = Moment().endOf('month').format('YYYY-MM-DD'); + @Input() public reportType = ''; + @Input() public indicators = ''; + @Input() public ageRangeStart: number; + @Input() public ageRangeEnd: number; + @Input() public reportIndex: number; + @Input() public reportUuid: number; + @Input() public period = ''; + @Input() public gender: any = []; + @Input() public dashboardType = ''; + @Input() public dashboardLocation = []; + @Input() public currentView = 'pdf'; + public title = 'Filters'; + public data = []; + public sectionsDef = []; + public isAggregated: boolean; + public selectedIndicators = []; + public enabledControls = 'monthControl,locationControl,locationTypeControl'; + public isLoadingReport = false; + public encounteredError = false; + public errorMessage = ''; + public reportName = 'otz-monthly-register-report'; + public dates: any; + public age: any; + public selectedGender: any = []; + public selectedLocationType = ''; + public locationUuids: Array; + public monthlySummary: any = []; + public errorObj = { + message: '', + isError: false + }; + + constructor( + protected appFeatureAnalytics: AppFeatureAnalytics, + public dataAnalyticsDashboardService: DataAnalyticsDashboardService, + private router: Router, + private route: ActivatedRoute + ) {} + + public ngOnInit() {} + + public ngOnChanges(changes: SimpleChanges) { + this.processFilterData(changes); + } + + public getLocationsSelected() { + this.dataAnalyticsDashboardService + .getSelectedLocations() + .subscribe((data) => { + if (data) { + this.locationUuids = data.locations; + } + }); + } + + public processFilterData(filterChanges: any) { + if (filterChanges.gender !== undefined) { + if (filterChanges.gender.currentValue !== undefined) { + this.formatGenderFilter(filterChanges.gender.currentValue); + } + } + if (filterChanges.dashboardType !== undefined) { + if (filterChanges.dashboardType.currentValue !== undefined) { + this.toggleFilterControls(filterChanges.dashboardType.currentValue); + } + } + if (filterChanges.dashboardLocation !== undefined) { + if ( + filterChanges.dashboardLocation.currentValue !== undefined && + filterChanges.dashboardLocation.previousValue !== undefined + ) { + this.generateReport(); + } + } + if (filterChanges.currentView !== undefined) { + if ( + filterChanges.currentView.currentValue !== undefined && + filterChanges.currentView.previousValue !== undefined + ) { + this.generateReport(); + } + } + } + + public formatGenderFilter(genderArray) { + const selectedGender = []; + _.each(genderArray, (gender) => { + selectedGender.push({ + label: gender, + value: gender + }); + }); + this.selectedGender = selectedGender; + } + + public selectedPeriodChange($event) { + this.period = $event; + } + + public generateReport() { + this.isLoadingReport = true; + this.getLocationsSelected(); + this.storeReportParamsInUrl(); + this.encounteredError = false; + this.errorMessage = ''; + this.isLoadingReport = false; + } + + public storeReportParamsInUrl() { + const urlParams = this.route.snapshot.queryParams; + const queryParams = { + endDate: Moment(this.endDate).format('YYYY-MM-DD'), + startDate: Moment(this.startDate).format('YYYY-MM-DD'), + locationType: this.selectedLocationType, + indicators: this.indicators, + gender: this.gender, + period: this.period, + startAge: this.ageRangeStart, + endAge: this.ageRangeEnd, + type: this.reportType, + report: urlParams.report, + currentView: this.currentView, + reportIndex: this.reportIndex, + reportUuid: this.reportUuid, + locationUuids: this.getDashboardOrAnnalyticsLocation(this.dashboardType) + }; + + this.router.navigate(['./'], { + queryParams: queryParams, + relativeTo: this.route + }); + } + + public getDashboardOrAnnalyticsLocation(dashboardType: string) { + let location: any; + switch (dashboardType) { + case 'clinic-dashboard': + location = this.dashboardLocation; + break; + case 'data-analytics': + location = this.getSelectedLocations(this.locationUuids); + break; + default: + location = this.getSelectedLocations(this.locationUuids); + } + + return location; + } + + public getSelectedLocations(locationUuids: Array): string { + if (!locationUuids || locationUuids.length === 0) { + return ''; + } + + let selectedLocations = ''; + + for (let i = 0; i < locationUuids.length; i++) { + if (i === 0) { + selectedLocations = selectedLocations + (locationUuids[0] as any).value; + } else { + selectedLocations = + selectedLocations + ',' + (locationUuids[i] as any).value; + } + } + return selectedLocations; + } + + public formatDateField(result) { + const dates = []; + for (const item of result) { + const data = item; + for (const r in data) { + if (data.hasOwnProperty(r)) { + const month = Moment(data.month).format('MMM, YYYY'); + data['reporting_month'] = month; + } + } + dates.push(data); + } + return dates; + } + public onAgeChangeFinished($event) { + this.ageRangeStart = $event.ageFrom; + this.ageRangeEnd = $event.ageTo; + } + + public getSelectedGender(selectedGender) { + const gender: any = []; + _.each(selectedGender, (specGender: any) => { + if (typeof specGender === 'string') { + gender.push(specGender); + } else { + gender.push(specGender.value); + } + }); + this.gender = gender; + } + + public getSelectedIndicators(selectedIndicator) {} + + public formatIndicatorsToSelectArray(indicatorParam: string) { + const arr = indicatorParam.split(','); + _.each(arr, (indicator) => { + const text = this.translateIndicator(indicator); + const id = indicator; + + const data = { + value: id, + label: text + }; + this.selectedIndicators.push(data.value); + }); + } + + public translateIndicator(indicator: string) { + return indicator + .toLowerCase() + .split('_') + .map((word) => { + return word.charAt(0) + word.slice(1); + }) + .join(' '); + } + + public formatGenderToSelectArray(genderParam: string) { + if (genderParam.length > 1) { + const arr = genderParam.split(','); + _.each(arr, (gender) => { + const id = gender; + const text = gender === 'M' ? 'Male' : 'Female'; + const data = { + id: id, + text: text + }; + this.selectedGender.push(data); + }); + } else { + const data = { + id: genderParam, + text: genderParam === 'M' ? 'Male' : 'Female' + }; + this.selectedGender.push(data); + } + } + + public getLocations($event) {} + public onMonthChange($event) { + this.startDate = Moment($event).startOf('month').format('YYYY-MM-DD'); + this.endDate = Moment($event).endOf('month').format('YYYY-MM-DD'); + } + public toggleFilterControls(dashboardType: string) { + if (dashboardType === 'data-analytics') { + this.enabledControls = 'monthControl,locationControl,locationTypeControl'; + } else if (dashboardType === 'clinic-dashboard') { + this.enabledControls = 'monthControl,locationTypeControl'; + } else { + // this.enabledControls = 'monthControl,locationControl,locationTypeControl'; + this.enabledControls = 'monthControl, locationControl'; + } + } + public locationTypeChange($event) { + this.selectedLocationType = $event; + } +} diff --git a/src/app/hiv-care-lib/registers/otz/otz-register-patient-list/otz-register-patient-list.component.css b/src/app/hiv-care-lib/registers/otz/otz-register-patient-list/otz-register-patient-list.component.css new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/hiv-care-lib/registers/otz/otz-register-patient-list/otz-register-patient-list.component.html b/src/app/hiv-care-lib/registers/otz/otz-register-patient-list/otz-register-patient-list.component.html new file mode 100644 index 000000000..61d55f212 --- /dev/null +++ b/src/app/hiv-care-lib/registers/otz/otz-register-patient-list/otz-register-patient-list.component.html @@ -0,0 +1,54 @@ +
+ +
+
+ Loading... +
+

+

+ {{ indicatorData.label }} Patient List + + for ({{ params.startDate | date: 'dd-MMMM-yyyy' }} to + {{ params.endDate | date: 'dd-MMMM-yyyy' }}) +

+ +
+ + + + +
+

+ + All records loaded {{ '[ ' + patientData?.length + ' ]' }} +

+ +

+
+ +
+

Error loading patient list.

+
diff --git a/src/app/hiv-care-lib/registers/otz/otz-register-patient-list/otz-register-patient-list.component.ts b/src/app/hiv-care-lib/registers/otz/otz-register-patient-list/otz-register-patient-list.component.ts new file mode 100644 index 000000000..ef85838b4 --- /dev/null +++ b/src/app/hiv-care-lib/registers/otz/otz-register-patient-list/otz-register-patient-list.component.ts @@ -0,0 +1,183 @@ +import { Component, OnInit } from '@angular/core'; +import { Router, ActivatedRoute } from '@angular/router'; +import { Location } from '@angular/common'; +import { GridOptions } from 'ag-grid'; +import { MOH412ResourceService } from 'src/app/etl-api/moh-412-resource.service'; + +@Component({ + selector: 'app-otz-register-patient-list', + templateUrl: './otz-register-patient-list.component.html', + styleUrls: ['./otz-register-patient-list.component.css'] +}) +export class OTZRegisterPatientListComponent implements OnInit { + public title = 'OTZ Monthly Register'; + public params: any; + public patientData: any; + public isLoadingReport = true; + public overrideColumns: Array = []; + public selectedIndicator: string; + public hasLoadedAll = false; + public hasError = false; + public indicatorHeader: any; + public patientListCols = []; + public patientListColdefs = []; + public normalColdefs = [ + { + headerName: 'No', + field: 'no', + width: 50, + pinned: true, + valueGetter: this.getRowNNumber + }, + { + headerName: 'CCC Number', + field: 'ccc_number', + width: 100, + pinned: true + }, + { + headerName: 'Name', + field: 'person_name', + width: 250, + pinned: true + }, + { + headerName: 'NUPI Identifier', + field: 'upi_number', + width: 100, + pinned: true + }, + { headerName: 'Gender', field: 'gender', width: 100 }, + { headerName: 'Age', field: 'age', width: 100 }, + { + headerName: 'Identifiers', + field: 'identifiers', + width: 250, + cellRenderer: (column: any) => { + return ( + '' + + column.value + + '' + ); + } + }, + { headerName: 'HIV Status', field: 'hiv_status', width: 200 }, + { headerName: 'Screening Date', field: 'screening_date', width: 200 }, + { + headerName: 'Primary Facility', + field: 'primary_care_facility', + width: 200 + }, + { + headerName: 'Screening Location', + field: 'location', + width: 200 + }, + { headerName: 'Screening Method', field: 'screening_method', width: 200 }, + { headerName: 'OVCID', field: 'ovcid_id', width: 100 }, + { + headerName: 'Visit Type', + field: 'screening_visit_type', + width: 200 + }, + { + headerName: 'VIA or VIA/VILI RESULT', + field: 'via_or_via_vili_test_result', + width: 100 + }, + { headerName: 'Treatment Method', field: 'treatment_method', width: 200 } + ]; + public gridOptions: GridOptions = { + enableColResize: true, + enableSorting: true, + enableFilter: true, + showToolPanel: false, + pagination: true, + paginationPageSize: 300, + rowSelection: 'multiple', + onGridSizeChanged: () => { + if (this.gridOptions.api) { + this.gridOptions.api.sizeColumnsToFit(); + } + } + }; + + public indicatorData = { + label: 'Patient List', + description: '', + indicator: '' + }; + + constructor( + private router: Router, + private route: ActivatedRoute, + private _location: Location, + private moh412Service: MOH412ResourceService + ) {} + + ngOnInit() { + this.route.queryParams.subscribe( + (params) => { + if (params && params.startDate) { + this.params = params; + this.indicatorHeader = params.indicators; + this.getPatientList(params); + } + }, + (error) => { + console.error('Error', error); + } + ); + } + public extraColumns() { + return this.patientListCols; + } + private getPatientList(params: any) { + this.moh412Service + .getMoh412MonthlyReportPatientList(params) + .subscribe((data: any) => { + if (data.result.length > 0) { + this.patientData = data.result; + this.generatePatientCols(); + } + if (data.indicatorData.length > 0) { + this.indicatorData = data.indicatorData[0]; + } + this.hasLoadedAll = true; + this.isLoadingReport = false; + }); + } + public goBack() { + this._location.back(); + } + public generatePatientCols() { + const patientCols = this.normalColdefs; + const additionalCols = this.patientListCols; + additionalCols.forEach((col: any) => { + patientCols.push(col); + }); + + this.patientListColdefs = patientCols; + } + public redirectTopatientInfo(patientUuid: string) { + if (patientUuid === undefined || patientUuid === null) { + return; + } + this.router.navigate([ + '/patient-dashboard/patient/' + + patientUuid + + '/general/general/landing-page' + ]); + } + + public onCellClick($event: any) { + const patientUuid = $event.data.patient_uuid; + this.redirectTopatientInfo(patientUuid); + } + public exportPatientListToCsv() { + this.gridOptions.api.exportDataAsCsv(); + } + public getRowNNumber(column: any): number { + return parseInt(column.node.rowIndex, 10) + 1; + } +} diff --git a/src/app/hiv-care-lib/registers/otz/otz-register-table/otz-register-tabular.component.css b/src/app/hiv-care-lib/registers/otz/otz-register-table/otz-register-tabular.component.css new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/hiv-care-lib/registers/otz/otz-register-table/otz-register-tabular.component.html b/src/app/hiv-care-lib/registers/otz/otz-register-table/otz-register-tabular.component.html new file mode 100644 index 000000000..14355395f --- /dev/null +++ b/src/app/hiv-care-lib/registers/otz/otz-register-table/otz-register-tabular.component.html @@ -0,0 +1,26 @@ +
+
+
+ + + +
+
+
diff --git a/src/app/hiv-care-lib/registers/otz/otz-register-table/otz-register-tabular.component.ts b/src/app/hiv-care-lib/registers/otz/otz-register-table/otz-register-tabular.component.ts new file mode 100644 index 000000000..d6e7e0073 --- /dev/null +++ b/src/app/hiv-care-lib/registers/otz/otz-register-table/otz-register-tabular.component.ts @@ -0,0 +1,142 @@ +import { + Component, + OnInit, + OnChanges, + Input, + SimpleChanges +} from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; + +@Component({ + selector: 'app-otz-register-tabular-table', + templateUrl: 'otz-register-tabular.component.html', + styleUrls: ['./otz-register-tabular.component.css'] +}) +export class OTZRegisterTabularComponent implements OnInit, OnChanges { + public startDate: any; + public endDate: any; + public locationUuids: any; + public indicator = ''; + @Input() public reportDef = []; + + public gridOptions: any = { + enableColResize: true, + enableSorting: true, + enableFilter: true, + showToolPanel: false, + onGridSizeChanged: () => {}, + onGridReady: () => {} + }; + + public moh412SummaryColdef = []; + public data = []; + @Input() public moh412Data: Array = []; + @Input() public totalsData: Array = []; + @Input() public params: any; + public pinnedBottomRowData = []; + + constructor(private router: Router, public route: ActivatedRoute) {} + + public ngOnInit() {} + public ngOnChanges(changes: SimpleChanges) { + if (changes.reportDef) { + if (changes.reportDef.currentValue.length > 0) { + this.generateColDefs(); + } + } + if (changes.moh412Data) { + if (changes.moh412Data.currentValue.length > 0) { + this.data = []; + this.data = changes.moh412Data.currentValue; + this.generateRowData(); + this.generatePinnedBottomRowDataRow(changes.totalsData.currentValue); + } + } + } + + public generateColDefs() { + const cols = []; + cols.push({ + headerName: + this.params.locationType === 'primary_care_facility' + ? 'PrimaryCare Facility' + : 'Serial Counter', + width: 100, + field: 'location', + pinned: true + }); + this.reportDef.forEach((col: any) => { + const page = col.page; + const pageBody = col.pageBody; + cols.push({ + headerName: page, + width: 140, + field: 'screening_method', + children: pageBody.map((b: any) => { + return { + headerName: b.sectionTitle, + field: b.sectionTitle, + width: 100, + children: b.sections.map((s: any) => { + return { + headerName: s.name, + field: s.name, + width: 100, + children: s.body.map((body: any) => { + return { + headerName: body.title, + field: body.title, + width: 100, + children: body.indicators.map((i: any) => { + return { + headerName: i.label, + field: i.indicator, + width: 100, + cellRenderer: (column: any) => { + if (typeof column.value === 'undefined') { + return 0; + } else { + return `${column.value}`; + } + } + }; + }) + }; + }) + }; + }) + }; + }) + }); + }); + this.moh412SummaryColdef = cols; + } + + public generateRowData() {} + public onCellClick($event: any) { + const indicator = $event.colDef.field; + this.locationUuids = $event.data.location_uuid; + this.indicator = indicator; + const params = this.generateUrlParams(); + this.navigateToPatientList(params); + } + public generateUrlParams() { + return { + startDate: this.params.startDate, + endDate: this.params.endDate, + locationUuids: this.locationUuids, + locationType: this.params.locationType, + indicators: this.indicator + }; + } + + public navigateToPatientList(params: any) { + this.router.navigate(['patient-list'], { + relativeTo: this.route, + queryParams: params + }); + } + public generatePinnedBottomRowDataRow(totalsData: Array) { + this.pinnedBottomRowData = totalsData; + } +} diff --git a/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.css b/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.css new file mode 100644 index 000000000..0d25bd3d2 --- /dev/null +++ b/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.css @@ -0,0 +1,51 @@ +.collapsible-list { + list-style: none; + padding: 0; +} +.item-header { + cursor: pointer; + display: flex; + justify-content: space-between; + align-items: center; + padding: 8px; + background-color: #d9edf7; + border: 1px solid #00acd6; +} +.collapse-icon { + font-weight: bold; +} +.item-details { + padding: 8px; + background-color: #fff; + border: 1px solid #ccc; +} +.setfont { + font-size: 12px !important; +} +.header { + text-align: center; + margin-bottom: 20px; +} +.patient-info { + margin-bottom: 20px; +} +.medication-list { + border-collapse: collapse; + width: 100%; +} +.medication-list th, +.medication-list td { + border: 1px solid #000000; + padding: 4px; + text-align: left; +} +.footer { + text-align: center; + margin-top: 20px; +} +.setfont { + font-size: 14px !important; +} +.ppadding { + padding-right: 15px; +} diff --git a/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.html b/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.html new file mode 100644 index 000000000..f765c5f1a --- /dev/null +++ b/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.html @@ -0,0 +1,181 @@ +
+ OTZ Register +
+
    +
  • + +
    + +
    +
    +
    +
    +
    +

    D Month

    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Serial Counter + + Registration Details + + Status at Enrollment into OTZ + + ART Regimen Switch Post Enrollemnt into OTZ + + Viral Load Post Enrollment into OTZ +
    + Date of enrollment to OTZ + + Date of Birth +
    + Age at enrollment +
    + Unique Patient Number (CCC Number) + + ART Start Date + + Patient's Name +
    + First Name, Middle Name +
    + Last (Surname) +
    + Sex (M/F) + + Most Current Viral load +
    + VL Results (copies/ml) +
    + Date Done +
    + VL Done within 6 months (Yes/No) + + Most Current ART Regimen +
    + ART Regimen +
    + Date Started on Current Regimen +
    + Current Regimen Line (1st/2nd/3rd) + + 1st Regimen Switch + + Date + + Reasons + + 3rd Regimen Switch + + Date + + Reasons + + Viral load Results (copies/ml) + + Viral load Results (copies/ml) + + Viral load Results (copies/ml) + + Viral load Results (copies/ml) + + Viral load Results (copies/ml) + + Viral load Results (copies/ml) + + Viral load Results (copies/ml) + + Viral load Results (copies/ml) + + Viral load Results (copies/ml) + + Viral load Results (copies/ml) + + Viral load Results (copies/ml) + + Viral load Results (copies/ml) + + Viral load Results (copies/ml) + + Viral load Results (copies/ml) + + Viral load Results (copies/ml) + + Viral load Results (copies/ml) + + Viral load Results (copies/ml) + + Viral load Results (copies/ml) +
    +
    +
    +
    +
    +
  • +
+
diff --git a/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.ts b/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.ts new file mode 100644 index 000000000..fba7367bc --- /dev/null +++ b/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.ts @@ -0,0 +1,13 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; + +@Component({ + selector: 'app-otz-register', + templateUrl: './otz-register.component.html', + styleUrls: ['./otz-register.component.css'] +}) +export class OtzRegisterComponent implements OnInit { + constructor(public router: Router, public route: ActivatedRoute) {} + + public ngOnInit() {} +} diff --git a/src/app/hiv-care-lib/registers/registers-dashboard.component.html b/src/app/hiv-care-lib/registers/registers-dashboard.component.html new file mode 100644 index 000000000..9088dce3c --- /dev/null +++ b/src/app/hiv-care-lib/registers/registers-dashboard.component.html @@ -0,0 +1,27 @@ + +

Loading available dashboards ...

+
+ {{ errorMessage }} +
+ diff --git a/src/app/hiv-care-lib/registers/registers-dashboard.component.ts b/src/app/hiv-care-lib/registers/registers-dashboard.component.ts new file mode 100644 index 000000000..157b04d1f --- /dev/null +++ b/src/app/hiv-care-lib/registers/registers-dashboard.component.ts @@ -0,0 +1,43 @@ +import { Component, OnInit } from '@angular/core'; +import { Router, ActivatedRoute } from '@angular/router'; + +@Component({ + selector: 'app-registers-dashboard', + templateUrl: './registers-dashboard.component.html' +}) +export class RegistersDashboardComponent implements OnInit { + public isBusy = false; + public errorMessage = ''; + + public dashboards: Array = []; + constructor(public router: Router, public route: ActivatedRoute) {} + + ngOnInit() { + this.dashboards = [ + { + title: 'OTZ Register', + description: '', + url: 'otz-register', + icon: 'fa' + }, + { + title: 'Jua Mtoto Wako Register', + description: '', + url: 'jua-mtoto-wako-register', + icon: 'fa' + }, + { + title: 'Defaulter Tracing Register', + description: '', + url: 'defaulter-tracing-register', + icon: 'fa' + } + ]; + } + + public viewDashboard(dashboard: any) { + this.router.navigate([dashboard.url], { + relativeTo: this.route + }); + } +} diff --git a/src/app/shared/dynamic-route/schema/clinic.dashboard.conf.json b/src/app/shared/dynamic-route/schema/clinic.dashboard.conf.json index 1757d4686..cb0375415 100644 --- a/src/app/shared/dynamic-route/schema/clinic.dashboard.conf.json +++ b/src/app/shared/dynamic-route/schema/clinic.dashboard.conf.json @@ -176,6 +176,12 @@ "icon": "fa fa-table", "isSideBarOpen": false }, + { + "url": "registers", + "label": "Registers", + "icon": "fa fa-table", + "isSideBarOpen": false + }, { "url": "hei-report", "label": "HEI Report", From 95933b7ba75413bd2b311fdd8734c734e211f2bc Mon Sep 17 00:00:00 2001 From: sainingo Date: Tue, 16 Jan 2024 15:16:54 +0300 Subject: [PATCH 2/8] Remove otz report --- src/app/hiv-care-lib/hiv-care-lib.module.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/app/hiv-care-lib/hiv-care-lib.module.ts b/src/app/hiv-care-lib/hiv-care-lib.module.ts index 507517e48..acfcb07eb 100644 --- a/src/app/hiv-care-lib/hiv-care-lib.module.ts +++ b/src/app/hiv-care-lib/hiv-care-lib.module.ts @@ -152,7 +152,6 @@ import { RegistersDashboardComponent } from './registers/registers-dashboard.com import { OtzRegisterComponent } from './registers/otz/otz-registers/otz-register.component'; import { OTZRegisterFilterComponent } from './registers/otz/otz-register-filters/otz-register-filter.component'; import { OTZRegisterPatientListComponent } from './registers/otz/otz-register-patient-list/otz-register-patient-list.component'; -import { OTZRegisterReportViewComponent } from './registers/otz/otz-register-report-view/otz-register-report-view.component'; import { OTZRegisterTabularComponent } from './registers/otz/otz-register-table/otz-register-tabular.component'; @NgModule({ @@ -261,7 +260,6 @@ import { OTZRegisterTabularComponent } from './registers/otz/otz-register-table/ RegistersDashboardComponent, OTZRegisterFilterComponent, OTZRegisterPatientListComponent, - OTZRegisterReportViewComponent, OTZRegisterTabularComponent ], declarations: [ @@ -364,7 +362,6 @@ import { OTZRegisterTabularComponent } from './registers/otz/otz-register-table/ OtzRegisterComponent, OTZRegisterFilterComponent, OTZRegisterPatientListComponent, - OTZRegisterReportViewComponent, OTZRegisterTabularComponent ], providers: [ From c42f9c124dfb61aca57a40ce848f4e0c381bd86c Mon Sep 17 00:00:00 2001 From: sainingo Date: Wed, 17 Jan 2024 17:12:31 +0300 Subject: [PATCH 3/8] Work on OTZ Register UI --- src/app/hiv-care-lib/hiv-care-lib.module.ts | 14 +- .../otz-register-filter.component.css | 11 - .../otz-register-filter.component.html | 16 - .../otz-register-filter.component.ts | 289 ------------- .../otz-register-patient-list.component.css | 0 .../otz-register-patient-list.component.html | 54 --- .../otz-register-patient-list.component.ts | 183 --------- .../otz-register-tabular.component.css | 0 .../otz-register-tabular.component.html | 26 -- .../otz-register-tabular.component.ts | 142 ------- .../otz-registers/otz-register.component.css | 26 +- .../otz-registers/otz-register.component.html | 387 +++++++++++------- .../otz-registers/otz-register.component.ts | 25 +- 13 files changed, 282 insertions(+), 891 deletions(-) delete mode 100644 src/app/hiv-care-lib/registers/otz/otz-register-filters/otz-register-filter.component.css delete mode 100644 src/app/hiv-care-lib/registers/otz/otz-register-filters/otz-register-filter.component.html delete mode 100644 src/app/hiv-care-lib/registers/otz/otz-register-filters/otz-register-filter.component.ts delete mode 100644 src/app/hiv-care-lib/registers/otz/otz-register-patient-list/otz-register-patient-list.component.css delete mode 100644 src/app/hiv-care-lib/registers/otz/otz-register-patient-list/otz-register-patient-list.component.html delete mode 100644 src/app/hiv-care-lib/registers/otz/otz-register-patient-list/otz-register-patient-list.component.ts delete mode 100644 src/app/hiv-care-lib/registers/otz/otz-register-table/otz-register-tabular.component.css delete mode 100644 src/app/hiv-care-lib/registers/otz/otz-register-table/otz-register-tabular.component.html delete mode 100644 src/app/hiv-care-lib/registers/otz/otz-register-table/otz-register-tabular.component.ts diff --git a/src/app/hiv-care-lib/hiv-care-lib.module.ts b/src/app/hiv-care-lib/hiv-care-lib.module.ts index acfcb07eb..43cf0723a 100644 --- a/src/app/hiv-care-lib/hiv-care-lib.module.ts +++ b/src/app/hiv-care-lib/hiv-care-lib.module.ts @@ -150,9 +150,6 @@ import { PlhivNcdV2ReportPatientListComponent } from './plhiv-ncd-v2-report/plhi import { PlhivNcdV2ReportViewComponent } from './plhiv-ncd-v2-report/plhiv-ncd-v2-report-view/plhiv-ncd-v2-report-view.component'; import { RegistersDashboardComponent } from './registers/registers-dashboard.component'; import { OtzRegisterComponent } from './registers/otz/otz-registers/otz-register.component'; -import { OTZRegisterFilterComponent } from './registers/otz/otz-register-filters/otz-register-filter.component'; -import { OTZRegisterPatientListComponent } from './registers/otz/otz-register-patient-list/otz-register-patient-list.component'; -import { OTZRegisterTabularComponent } from './registers/otz/otz-register-table/otz-register-tabular.component'; @NgModule({ imports: [ @@ -255,12 +252,8 @@ import { OTZRegisterTabularComponent } from './registers/otz/otz-register-table/ Covid19TabularViewComponent, PrepMonthlyReportViewComponent, TxMlReportViewComponent, - AhdReportViewComponent, - PlhivNcdV2ReportViewComponent, RegistersDashboardComponent, - OTZRegisterFilterComponent, - OTZRegisterPatientListComponent, - OTZRegisterTabularComponent + OtzRegisterComponent ], declarations: [ Moh731TabularComponent, @@ -359,10 +352,7 @@ import { OTZRegisterTabularComponent } from './registers/otz/otz-register-table/ PlhivNcdV2ReportPatientListComponent, PlhivNcdV2ReportViewComponent, RegistersDashboardComponent, - OtzRegisterComponent, - OTZRegisterFilterComponent, - OTZRegisterPatientListComponent, - OTZRegisterTabularComponent + OtzRegisterComponent ], providers: [ MOHReportService, diff --git a/src/app/hiv-care-lib/registers/otz/otz-register-filters/otz-register-filter.component.css b/src/app/hiv-care-lib/registers/otz/otz-register-filters/otz-register-filter.component.css deleted file mode 100644 index c2c152386..000000000 --- a/src/app/hiv-care-lib/registers/otz/otz-register-filters/otz-register-filter.component.css +++ /dev/null @@ -1,11 +0,0 @@ -#moh-412-filter { - border-style: solid; - border: 1px double lightgray; - padding-top: 10px; - padding-bottom: 10px; - padding-left: 15px; - padding-right: 15px; - margin-left: 5px; - margin-right: 5px; - margin-bottom: 10px; -} diff --git a/src/app/hiv-care-lib/registers/otz/otz-register-filters/otz-register-filter.component.html b/src/app/hiv-care-lib/registers/otz/otz-register-filters/otz-register-filter.component.html deleted file mode 100644 index e66de2cb8..000000000 --- a/src/app/hiv-care-lib/registers/otz/otz-register-filters/otz-register-filter.component.html +++ /dev/null @@ -1,16 +0,0 @@ -
-
-
- - -
-
-
diff --git a/src/app/hiv-care-lib/registers/otz/otz-register-filters/otz-register-filter.component.ts b/src/app/hiv-care-lib/registers/otz/otz-register-filters/otz-register-filter.component.ts deleted file mode 100644 index 2da384112..000000000 --- a/src/app/hiv-care-lib/registers/otz/otz-register-filters/otz-register-filter.component.ts +++ /dev/null @@ -1,289 +0,0 @@ -import { - Component, - OnInit, - Input, - OnChanges, - SimpleChanges -} from '@angular/core'; -import { Router, ActivatedRoute } from '@angular/router'; - -import * as _ from 'lodash'; -import * as Moment from 'moment'; -import { DataAnalyticsDashboardService } from 'src/app/data-analytics-dashboard/services/data-analytics-dashboard.services'; -import { AppFeatureAnalytics } from 'src/app/shared/app-analytics/app-feature-analytics.service'; - -// import { AppFeatureAnalytics } from './../../../shared/app-analytics/app-feature-analytics.service'; -// import { DataAnalyticsDashboardService } from './../../../data-analytics-dashboard/services/data-analytics-dashboard.services'; - -@Component({ - selector: 'app-otz-register-filter', - templateUrl: './otz-register-filter.component.html', - styleUrls: ['./otz-register-filter.component.css'] -}) -export class OTZRegisterFilterComponent implements OnInit, OnChanges { - @Input() public startDate = Moment().startOf('month').format('YYYY-MM-DD'); - @Input() public endDate = Moment().endOf('month').format('YYYY-MM-DD'); - @Input() public reportType = ''; - @Input() public indicators = ''; - @Input() public ageRangeStart: number; - @Input() public ageRangeEnd: number; - @Input() public reportIndex: number; - @Input() public reportUuid: number; - @Input() public period = ''; - @Input() public gender: any = []; - @Input() public dashboardType = ''; - @Input() public dashboardLocation = []; - @Input() public currentView = 'pdf'; - public title = 'Filters'; - public data = []; - public sectionsDef = []; - public isAggregated: boolean; - public selectedIndicators = []; - public enabledControls = 'monthControl,locationControl,locationTypeControl'; - public isLoadingReport = false; - public encounteredError = false; - public errorMessage = ''; - public reportName = 'otz-monthly-register-report'; - public dates: any; - public age: any; - public selectedGender: any = []; - public selectedLocationType = ''; - public locationUuids: Array; - public monthlySummary: any = []; - public errorObj = { - message: '', - isError: false - }; - - constructor( - protected appFeatureAnalytics: AppFeatureAnalytics, - public dataAnalyticsDashboardService: DataAnalyticsDashboardService, - private router: Router, - private route: ActivatedRoute - ) {} - - public ngOnInit() {} - - public ngOnChanges(changes: SimpleChanges) { - this.processFilterData(changes); - } - - public getLocationsSelected() { - this.dataAnalyticsDashboardService - .getSelectedLocations() - .subscribe((data) => { - if (data) { - this.locationUuids = data.locations; - } - }); - } - - public processFilterData(filterChanges: any) { - if (filterChanges.gender !== undefined) { - if (filterChanges.gender.currentValue !== undefined) { - this.formatGenderFilter(filterChanges.gender.currentValue); - } - } - if (filterChanges.dashboardType !== undefined) { - if (filterChanges.dashboardType.currentValue !== undefined) { - this.toggleFilterControls(filterChanges.dashboardType.currentValue); - } - } - if (filterChanges.dashboardLocation !== undefined) { - if ( - filterChanges.dashboardLocation.currentValue !== undefined && - filterChanges.dashboardLocation.previousValue !== undefined - ) { - this.generateReport(); - } - } - if (filterChanges.currentView !== undefined) { - if ( - filterChanges.currentView.currentValue !== undefined && - filterChanges.currentView.previousValue !== undefined - ) { - this.generateReport(); - } - } - } - - public formatGenderFilter(genderArray) { - const selectedGender = []; - _.each(genderArray, (gender) => { - selectedGender.push({ - label: gender, - value: gender - }); - }); - this.selectedGender = selectedGender; - } - - public selectedPeriodChange($event) { - this.period = $event; - } - - public generateReport() { - this.isLoadingReport = true; - this.getLocationsSelected(); - this.storeReportParamsInUrl(); - this.encounteredError = false; - this.errorMessage = ''; - this.isLoadingReport = false; - } - - public storeReportParamsInUrl() { - const urlParams = this.route.snapshot.queryParams; - const queryParams = { - endDate: Moment(this.endDate).format('YYYY-MM-DD'), - startDate: Moment(this.startDate).format('YYYY-MM-DD'), - locationType: this.selectedLocationType, - indicators: this.indicators, - gender: this.gender, - period: this.period, - startAge: this.ageRangeStart, - endAge: this.ageRangeEnd, - type: this.reportType, - report: urlParams.report, - currentView: this.currentView, - reportIndex: this.reportIndex, - reportUuid: this.reportUuid, - locationUuids: this.getDashboardOrAnnalyticsLocation(this.dashboardType) - }; - - this.router.navigate(['./'], { - queryParams: queryParams, - relativeTo: this.route - }); - } - - public getDashboardOrAnnalyticsLocation(dashboardType: string) { - let location: any; - switch (dashboardType) { - case 'clinic-dashboard': - location = this.dashboardLocation; - break; - case 'data-analytics': - location = this.getSelectedLocations(this.locationUuids); - break; - default: - location = this.getSelectedLocations(this.locationUuids); - } - - return location; - } - - public getSelectedLocations(locationUuids: Array): string { - if (!locationUuids || locationUuids.length === 0) { - return ''; - } - - let selectedLocations = ''; - - for (let i = 0; i < locationUuids.length; i++) { - if (i === 0) { - selectedLocations = selectedLocations + (locationUuids[0] as any).value; - } else { - selectedLocations = - selectedLocations + ',' + (locationUuids[i] as any).value; - } - } - return selectedLocations; - } - - public formatDateField(result) { - const dates = []; - for (const item of result) { - const data = item; - for (const r in data) { - if (data.hasOwnProperty(r)) { - const month = Moment(data.month).format('MMM, YYYY'); - data['reporting_month'] = month; - } - } - dates.push(data); - } - return dates; - } - public onAgeChangeFinished($event) { - this.ageRangeStart = $event.ageFrom; - this.ageRangeEnd = $event.ageTo; - } - - public getSelectedGender(selectedGender) { - const gender: any = []; - _.each(selectedGender, (specGender: any) => { - if (typeof specGender === 'string') { - gender.push(specGender); - } else { - gender.push(specGender.value); - } - }); - this.gender = gender; - } - - public getSelectedIndicators(selectedIndicator) {} - - public formatIndicatorsToSelectArray(indicatorParam: string) { - const arr = indicatorParam.split(','); - _.each(arr, (indicator) => { - const text = this.translateIndicator(indicator); - const id = indicator; - - const data = { - value: id, - label: text - }; - this.selectedIndicators.push(data.value); - }); - } - - public translateIndicator(indicator: string) { - return indicator - .toLowerCase() - .split('_') - .map((word) => { - return word.charAt(0) + word.slice(1); - }) - .join(' '); - } - - public formatGenderToSelectArray(genderParam: string) { - if (genderParam.length > 1) { - const arr = genderParam.split(','); - _.each(arr, (gender) => { - const id = gender; - const text = gender === 'M' ? 'Male' : 'Female'; - const data = { - id: id, - text: text - }; - this.selectedGender.push(data); - }); - } else { - const data = { - id: genderParam, - text: genderParam === 'M' ? 'Male' : 'Female' - }; - this.selectedGender.push(data); - } - } - - public getLocations($event) {} - public onMonthChange($event) { - this.startDate = Moment($event).startOf('month').format('YYYY-MM-DD'); - this.endDate = Moment($event).endOf('month').format('YYYY-MM-DD'); - } - public toggleFilterControls(dashboardType: string) { - if (dashboardType === 'data-analytics') { - this.enabledControls = 'monthControl,locationControl,locationTypeControl'; - } else if (dashboardType === 'clinic-dashboard') { - this.enabledControls = 'monthControl,locationTypeControl'; - } else { - // this.enabledControls = 'monthControl,locationControl,locationTypeControl'; - this.enabledControls = 'monthControl, locationControl'; - } - } - public locationTypeChange($event) { - this.selectedLocationType = $event; - } -} diff --git a/src/app/hiv-care-lib/registers/otz/otz-register-patient-list/otz-register-patient-list.component.css b/src/app/hiv-care-lib/registers/otz/otz-register-patient-list/otz-register-patient-list.component.css deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/app/hiv-care-lib/registers/otz/otz-register-patient-list/otz-register-patient-list.component.html b/src/app/hiv-care-lib/registers/otz/otz-register-patient-list/otz-register-patient-list.component.html deleted file mode 100644 index 61d55f212..000000000 --- a/src/app/hiv-care-lib/registers/otz/otz-register-patient-list/otz-register-patient-list.component.html +++ /dev/null @@ -1,54 +0,0 @@ -
- -
-
- Loading... -
-

-

- {{ indicatorData.label }} Patient List - - for ({{ params.startDate | date: 'dd-MMMM-yyyy' }} to - {{ params.endDate | date: 'dd-MMMM-yyyy' }}) -

- -
- - - - -
-

- - All records loaded {{ '[ ' + patientData?.length + ' ]' }} -

- -

-
- -
-

Error loading patient list.

-
diff --git a/src/app/hiv-care-lib/registers/otz/otz-register-patient-list/otz-register-patient-list.component.ts b/src/app/hiv-care-lib/registers/otz/otz-register-patient-list/otz-register-patient-list.component.ts deleted file mode 100644 index ef85838b4..000000000 --- a/src/app/hiv-care-lib/registers/otz/otz-register-patient-list/otz-register-patient-list.component.ts +++ /dev/null @@ -1,183 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { Router, ActivatedRoute } from '@angular/router'; -import { Location } from '@angular/common'; -import { GridOptions } from 'ag-grid'; -import { MOH412ResourceService } from 'src/app/etl-api/moh-412-resource.service'; - -@Component({ - selector: 'app-otz-register-patient-list', - templateUrl: './otz-register-patient-list.component.html', - styleUrls: ['./otz-register-patient-list.component.css'] -}) -export class OTZRegisterPatientListComponent implements OnInit { - public title = 'OTZ Monthly Register'; - public params: any; - public patientData: any; - public isLoadingReport = true; - public overrideColumns: Array = []; - public selectedIndicator: string; - public hasLoadedAll = false; - public hasError = false; - public indicatorHeader: any; - public patientListCols = []; - public patientListColdefs = []; - public normalColdefs = [ - { - headerName: 'No', - field: 'no', - width: 50, - pinned: true, - valueGetter: this.getRowNNumber - }, - { - headerName: 'CCC Number', - field: 'ccc_number', - width: 100, - pinned: true - }, - { - headerName: 'Name', - field: 'person_name', - width: 250, - pinned: true - }, - { - headerName: 'NUPI Identifier', - field: 'upi_number', - width: 100, - pinned: true - }, - { headerName: 'Gender', field: 'gender', width: 100 }, - { headerName: 'Age', field: 'age', width: 100 }, - { - headerName: 'Identifiers', - field: 'identifiers', - width: 250, - cellRenderer: (column: any) => { - return ( - '' + - column.value + - '' - ); - } - }, - { headerName: 'HIV Status', field: 'hiv_status', width: 200 }, - { headerName: 'Screening Date', field: 'screening_date', width: 200 }, - { - headerName: 'Primary Facility', - field: 'primary_care_facility', - width: 200 - }, - { - headerName: 'Screening Location', - field: 'location', - width: 200 - }, - { headerName: 'Screening Method', field: 'screening_method', width: 200 }, - { headerName: 'OVCID', field: 'ovcid_id', width: 100 }, - { - headerName: 'Visit Type', - field: 'screening_visit_type', - width: 200 - }, - { - headerName: 'VIA or VIA/VILI RESULT', - field: 'via_or_via_vili_test_result', - width: 100 - }, - { headerName: 'Treatment Method', field: 'treatment_method', width: 200 } - ]; - public gridOptions: GridOptions = { - enableColResize: true, - enableSorting: true, - enableFilter: true, - showToolPanel: false, - pagination: true, - paginationPageSize: 300, - rowSelection: 'multiple', - onGridSizeChanged: () => { - if (this.gridOptions.api) { - this.gridOptions.api.sizeColumnsToFit(); - } - } - }; - - public indicatorData = { - label: 'Patient List', - description: '', - indicator: '' - }; - - constructor( - private router: Router, - private route: ActivatedRoute, - private _location: Location, - private moh412Service: MOH412ResourceService - ) {} - - ngOnInit() { - this.route.queryParams.subscribe( - (params) => { - if (params && params.startDate) { - this.params = params; - this.indicatorHeader = params.indicators; - this.getPatientList(params); - } - }, - (error) => { - console.error('Error', error); - } - ); - } - public extraColumns() { - return this.patientListCols; - } - private getPatientList(params: any) { - this.moh412Service - .getMoh412MonthlyReportPatientList(params) - .subscribe((data: any) => { - if (data.result.length > 0) { - this.patientData = data.result; - this.generatePatientCols(); - } - if (data.indicatorData.length > 0) { - this.indicatorData = data.indicatorData[0]; - } - this.hasLoadedAll = true; - this.isLoadingReport = false; - }); - } - public goBack() { - this._location.back(); - } - public generatePatientCols() { - const patientCols = this.normalColdefs; - const additionalCols = this.patientListCols; - additionalCols.forEach((col: any) => { - patientCols.push(col); - }); - - this.patientListColdefs = patientCols; - } - public redirectTopatientInfo(patientUuid: string) { - if (patientUuid === undefined || patientUuid === null) { - return; - } - this.router.navigate([ - '/patient-dashboard/patient/' + - patientUuid + - '/general/general/landing-page' - ]); - } - - public onCellClick($event: any) { - const patientUuid = $event.data.patient_uuid; - this.redirectTopatientInfo(patientUuid); - } - public exportPatientListToCsv() { - this.gridOptions.api.exportDataAsCsv(); - } - public getRowNNumber(column: any): number { - return parseInt(column.node.rowIndex, 10) + 1; - } -} diff --git a/src/app/hiv-care-lib/registers/otz/otz-register-table/otz-register-tabular.component.css b/src/app/hiv-care-lib/registers/otz/otz-register-table/otz-register-tabular.component.css deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/app/hiv-care-lib/registers/otz/otz-register-table/otz-register-tabular.component.html b/src/app/hiv-care-lib/registers/otz/otz-register-table/otz-register-tabular.component.html deleted file mode 100644 index 14355395f..000000000 --- a/src/app/hiv-care-lib/registers/otz/otz-register-table/otz-register-tabular.component.html +++ /dev/null @@ -1,26 +0,0 @@ -
-
-
- - - -
-
-
diff --git a/src/app/hiv-care-lib/registers/otz/otz-register-table/otz-register-tabular.component.ts b/src/app/hiv-care-lib/registers/otz/otz-register-table/otz-register-tabular.component.ts deleted file mode 100644 index d6e7e0073..000000000 --- a/src/app/hiv-care-lib/registers/otz/otz-register-table/otz-register-tabular.component.ts +++ /dev/null @@ -1,142 +0,0 @@ -import { - Component, - OnInit, - OnChanges, - Input, - SimpleChanges -} from '@angular/core'; -import { ActivatedRoute, Router } from '@angular/router'; - -@Component({ - selector: 'app-otz-register-tabular-table', - templateUrl: 'otz-register-tabular.component.html', - styleUrls: ['./otz-register-tabular.component.css'] -}) -export class OTZRegisterTabularComponent implements OnInit, OnChanges { - public startDate: any; - public endDate: any; - public locationUuids: any; - public indicator = ''; - @Input() public reportDef = []; - - public gridOptions: any = { - enableColResize: true, - enableSorting: true, - enableFilter: true, - showToolPanel: false, - onGridSizeChanged: () => {}, - onGridReady: () => {} - }; - - public moh412SummaryColdef = []; - public data = []; - @Input() public moh412Data: Array = []; - @Input() public totalsData: Array = []; - @Input() public params: any; - public pinnedBottomRowData = []; - - constructor(private router: Router, public route: ActivatedRoute) {} - - public ngOnInit() {} - public ngOnChanges(changes: SimpleChanges) { - if (changes.reportDef) { - if (changes.reportDef.currentValue.length > 0) { - this.generateColDefs(); - } - } - if (changes.moh412Data) { - if (changes.moh412Data.currentValue.length > 0) { - this.data = []; - this.data = changes.moh412Data.currentValue; - this.generateRowData(); - this.generatePinnedBottomRowDataRow(changes.totalsData.currentValue); - } - } - } - - public generateColDefs() { - const cols = []; - cols.push({ - headerName: - this.params.locationType === 'primary_care_facility' - ? 'PrimaryCare Facility' - : 'Serial Counter', - width: 100, - field: 'location', - pinned: true - }); - this.reportDef.forEach((col: any) => { - const page = col.page; - const pageBody = col.pageBody; - cols.push({ - headerName: page, - width: 140, - field: 'screening_method', - children: pageBody.map((b: any) => { - return { - headerName: b.sectionTitle, - field: b.sectionTitle, - width: 100, - children: b.sections.map((s: any) => { - return { - headerName: s.name, - field: s.name, - width: 100, - children: s.body.map((body: any) => { - return { - headerName: body.title, - field: body.title, - width: 100, - children: body.indicators.map((i: any) => { - return { - headerName: i.label, - field: i.indicator, - width: 100, - cellRenderer: (column: any) => { - if (typeof column.value === 'undefined') { - return 0; - } else { - return `${column.value}`; - } - } - }; - }) - }; - }) - }; - }) - }; - }) - }); - }); - this.moh412SummaryColdef = cols; - } - - public generateRowData() {} - public onCellClick($event: any) { - const indicator = $event.colDef.field; - this.locationUuids = $event.data.location_uuid; - this.indicator = indicator; - const params = this.generateUrlParams(); - this.navigateToPatientList(params); - } - public generateUrlParams() { - return { - startDate: this.params.startDate, - endDate: this.params.endDate, - locationUuids: this.locationUuids, - locationType: this.params.locationType, - indicators: this.indicator - }; - } - - public navigateToPatientList(params: any) { - this.router.navigate(['patient-list'], { - relativeTo: this.route, - queryParams: params - }); - } - public generatePinnedBottomRowDataRow(totalsData: Array) { - this.pinnedBottomRowData = totalsData; - } -} diff --git a/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.css b/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.css index 0d25bd3d2..593cd2d8c 100644 --- a/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.css +++ b/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.css @@ -31,12 +31,12 @@ } .medication-list { border-collapse: collapse; - width: 100%; + margin: 8px; } .medication-list th, .medication-list td { border: 1px solid #000000; - padding: 4px; + padding: 0px; text-align: left; } .footer { @@ -49,3 +49,25 @@ .ppadding { padding-right: 15px; } + +tbody tr { + height: 10px !important; + font-size: 12px !important; +} + +tbody tr td { + min-width: 100px; + text-align: center; +} + +.alphabets > td { + text-align: center; +} +.alphabets { + background-color: #d9edf7; +} + +.exportToExcelBtn { + margin-top: 10px; + padding-bottom: 12px; +} diff --git a/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.html b/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.html index f765c5f1a..3cf2273ac 100644 --- a/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.html +++ b/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.html @@ -1,178 +1,257 @@
- OTZ Register -
+

OTZ Register

  • - -
    - -
    -
    -
    -
    -
    -

    D Month

    +
    +
    + +
    + + + +
    -
    -
    + +
    - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Serial Counter - Registration Details + +

    Registration Details

    + Status at Enrollment into OTZ - ART Regimen Switch Post Enrollemnt into OTZ - - Viral Load Post Enrollment into OTZ + + ART Regimen Switch Post Enrolment into OTZ + + Viral Load Post Enrolment into OTZ + + Transition/Attrition + + OTZ Modules Completion Tracker + + Remarks
    - Date of enrollment to OTZ - - Date of Birth -
    - Age at enrollment -
    - Unique Patient Number (CCC Number) - - ART Start Date - - Patient's Name -
    - First Name, Middle Name -
    - Last (Surname) -
    - Sex (M/F) - - Most Current Viral load -
    - VL Results (copies/ml) -
    - Date Done -
    - VL Done within 6 months (Yes/No) - - Most Current ART Regimen -
    - ART Regimen -
    - Date Started on Current Regimen -
    - Current Regimen Line (1st/2nd/3rd) - - 1st Regimen Switch - - Date - - Reasons - - 3rd Regimen Switch - - Date - - Reasons - - Viral load Results (copies/ml) - - Viral load Results (copies/ml) - - Viral load Results (copies/ml) - - Viral load Results (copies/ml) - - Viral load Results (copies/ml) - - Viral load Results (copies/ml) - - Viral load Results (copies/ml) - - Viral load Results (copies/ml) - - Viral load Results (copies/ml) - - Viral load Results (copies/ml) - - Viral load Results (copies/ml) - - Viral load Results (copies/ml) - - Viral load Results (copies/ml) - - Viral load Results (copies/ml) - - Viral load Results (copies/ml) - - Viral load Results (copies/ml) - - Viral load Results (copies/ml) - - Viral load Results (copies/ml) - + Date of enrollment to OTZ (dd/mm/yyyy) + + Date of Birth (dd/mm/yyyy) + + Unique Patient Number (CCC Number) + ART Start DatePatient's Name + Sex (M/F) + Most Current Viral loadMost Current ART Regimen + Current Regimen Line(1st/2nd/3rd) +
    First Name, Middle NameVL Results (copies/ml) + VL Done Within 6 months (Yes/No) + ART Regimen1st Regimen SwitchDateReasons3rd Regimen SwitchDateReasonsViral load Results (copies/ml) + Outcomes (Transfer Out, LTFU, Dead,Opt Out,Transition to + Adult Care) +
    Age at enrolment (in completed years)Original ART RegimenLast (Surname)Date DoneDate Started on Current Regimen2nd Regimen SwitchDateReasons4th Regimen SwitchDateReasonsDate of VLDateTick for each session completed
    (a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)(m)(n)(o)
    1 + 2024-01-17 + + 1990-05-15 + + CCC123456 + + 2022-01-01 + + John, Doe + + M + 2023-01-23 + 1990-05-15 + + CCC123456 + + 2022-01-01 +
    34Yearsdoe34Yearsdoe
    +
    + +

    diff --git a/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.ts b/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.ts index fba7367bc..a6fe143f3 100644 --- a/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.ts +++ b/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.ts @@ -1,5 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; +import * as Moment from 'moment'; @Component({ selector: 'app-otz-register', @@ -7,7 +8,27 @@ import { ActivatedRoute, Router } from '@angular/router'; styleUrls: ['./otz-register.component.css'] }) export class OtzRegisterComponent implements OnInit { - constructor(public router: Router, public route: ActivatedRoute) {} - + public enabledControls = 'monthControl'; + public _month: string; + counterArray = Array(18) + .fill(0) + .map((_, index) => index + 1); + counter = Array(8) + .fill(0) + .map((_, index) => index + 1); + 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); + }); + } public ngOnInit() {} + + public onMonthChange(value): any { + this._month = Moment(value).endOf('month').format('YYYY-MM-DD'); + } } From 7218f1502af7fe8f26428e4e2c0e46a7f2c51fcb Mon Sep 17 00:00:00 2001 From: Angie-540 Date: Sun, 24 Mar 2024 18:55:14 +0300 Subject: [PATCH 4/8] POC-698: Added otzRegister service --- package.json | 13 ++------- src/app/etl-api/otz-register.service.ts | 38 +++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 11 deletions(-) create mode 100644 src/app/etl-api/otz-register.service.ts diff --git a/package.json b/package.json index 60afe4bd2..a61604dd8 100644 --- a/package.json +++ b/package.json @@ -22,17 +22,8 @@ "prestart": "node version.js", "prettier:check": "prettier --check src/app" }, - "husky": { - "hooks": { - "pre-commit": "lint-staged" - } - }, - "lint-staged": { - "*.{js,json,css,md,ts}": [ - "prettier --write", - "ng lint ngx-amrs" - ] - }, + + "private": true, "dependencies": { "@ampath-kenya/ngx-openmrs-formentry": "2.12.23", diff --git a/src/app/etl-api/otz-register.service.ts b/src/app/etl-api/otz-register.service.ts new file mode 100644 index 000000000..b16cd4b19 --- /dev/null +++ b/src/app/etl-api/otz-register.service.ts @@ -0,0 +1,38 @@ +import { Injectable } from '@angular/core'; +import { HttpClient, HttpParams } from '@angular/common/http'; + +import { Observable, of } from 'rxjs'; +import * as _ from 'lodash'; + +import { AppSettingsService } from '../app-settings/app-settings.service'; +import { DataCacheService } from '../shared/services/data-cache.service'; + +@Injectable() +export class OtzRegisterService { + constructor( + protected http: HttpClient, + protected appSettingsService: AppSettingsService, + private cacheService: DataCacheService + ) {} + + public getBaseUrl(): string { + return this.appSettingsService.getEtlRestbaseurl().trim() + 'otz-register'; + } + + public getOtzRegister(payload: { + endDate: string; + locationUuid: string; + }): Observable { + const url = this.getBaseUrl(); + let urlParams: HttpParams = new HttpParams().set( + 'endDate', + payload.endDate + ); + // .set('locationUuid', payload.locationUuid); + // const request = this.http.get(url); + + return this.http.get(url, { params: urlParams }); + + // return this.cacheService.cacheRequest(url, '', request); + } +} From 3564f996d1f39d09cb4340741be91363a4b669d6 Mon Sep 17 00:00:00 2001 From: Angie-540 Date: Wed, 3 Apr 2024 15:53:11 +0300 Subject: [PATCH 5/8] POC-698b:Added otz monthly register api endpoint --- src/app/etl-api/etl-api.module.ts | 4 +- src/app/etl-api/otz-register.service.ts | 2 +- .../otz-registers/otz-register.component.html | 66 ++++++++++--------- .../otz-registers/otz-register.component.ts | 21 +++++- 4 files changed, 58 insertions(+), 35 deletions(-) diff --git a/src/app/etl-api/etl-api.module.ts b/src/app/etl-api/etl-api.module.ts index e0634dd52..a43f348dc 100644 --- a/src/app/etl-api/etl-api.module.ts +++ b/src/app/etl-api/etl-api.module.ts @@ -44,7 +44,7 @@ import { MOH412ResourceService } from './moh-412-resource.service'; import { ClinicFlowResourceService } from './clinic-flow-resource.service'; import { Covid19ResourceService } from './covid-19-resource-service'; import { LocationUnitsService } from './location-units.service'; -import { OTZRegisterResourceService } from './otz-register-resource.service'; +import { OtzRegisterService } from './otz-register.service'; @NgModule({ imports: [CommonModule, AppSettingsModule], @@ -95,7 +95,7 @@ import { OTZRegisterResourceService } from './otz-register-resource.service'; ClinicFlowResourceService, Covid19ResourceService, LocationUnitsService, - OTZRegisterResourceService + OtzRegisterService ], exports: [] }) diff --git a/src/app/etl-api/otz-register.service.ts b/src/app/etl-api/otz-register.service.ts index b16cd4b19..a40c458fe 100644 --- a/src/app/etl-api/otz-register.service.ts +++ b/src/app/etl-api/otz-register.service.ts @@ -16,7 +16,7 @@ export class OtzRegisterService { ) {} public getBaseUrl(): string { - return this.appSettingsService.getEtlRestbaseurl().trim() + 'otz-register'; + return this.appSettingsService.getEtlRestbaseurl().trim() + 'otz-monthly-register/patient-list'; } public getOtzRegister(payload: { diff --git a/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.html b/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.html index 3cf2273ac..3edc720ed 100644 --- a/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.html +++ b/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.html @@ -158,14 +158,16 @@

    Registration Details

    - + - 1 + + {{ i + 1 }} + - 2024-01-17 + {{ data.date_enrolled_to_otz }} - 1990-05-15 + {{ data.birth_date }} Registration Details rowspan="2" style="width: 20%; text-align: center" > - CCC123456 + {{ data.identifiers }} Registration Details 2022-01-01 - John, Doe + {{ data.firstname_middlename }} - M + {{ data.gender }} + + + {{ data.vl_result_at_otz_enrollment }} - 2023-01-23 Registration Details - CCC123456 + {{ data.art_regimen_at_otz_enrollment }} - 2022-01-01 + {{ data.art_regimen_line_at_otz_enrollment }} - - - - - - + {{ data.first_regimen_switch }} + {{ data.first_regimen_switch_date }} + gm + {{ data.third_regimen_switch }} + {{ data.third_regimen_switch_date }} + pppprrr - + rrrr - - + gx + gy - 34Years - doe - 34Years - doe - - - - - - + {{ data.age_at_enrollment }} years + {{ data.last_name }} + {{ data.vl_result_date_at_otz_enrollment }} + {{ data.art_regimen_start_date_at_otz_enrollment }} + {{ data.second_regimen_switch }} + {{ data.second_regimen_switch_date }} + xxx + {{ data.fourth_regimen_switch }} + {{ data.fourth_regimen_switch_date }} + yyy - + gg - + gggg diff --git a/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.ts b/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.ts index a6fe143f3..c5b4adcd5 100644 --- a/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.ts +++ b/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.ts @@ -1,6 +1,9 @@ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import * as Moment from 'moment'; +import { take } from 'rxjs/operators'; +import { OtzRegisterService } from 'src/app/etl-api/otz-register.service'; + @Component({ selector: 'app-otz-register', @@ -8,15 +11,19 @@ import * as Moment from 'moment'; styleUrls: ['./otz-register.component.css'] }) export class OtzRegisterComponent implements OnInit { + public otzData = []; public enabledControls = 'monthControl'; public _month: string; + counterArray = Array(18) .fill(0) .map((_, index) => index + 1); + counter = Array(8) .fill(0) .map((_, index) => index + 1); - constructor(public router: Router, public route: ActivatedRoute) { + + constructor(public router: Router, public route: ActivatedRoute, private otzRegisterService: OtzRegisterService) { this.route.queryParams.subscribe((data) => { data.month === undefined ? (this._month = Moment() @@ -30,5 +37,17 @@ export class OtzRegisterComponent implements OnInit { public onMonthChange(value): any { this._month = Moment(value).endOf('month').format('YYYY-MM-DD'); + this.getOtzRegister(); + } + + public getOtzRegister() { + this.otzRegisterService.getOtzRegister({endDate: this._month, locationUuid: ''}) + // .pipe(take(1)) + .subscribe((result) => { + this.otzData = result.results.results; + console.log("otzdata", this.otzData); + console.log('age2', this.otzData[1].age_at_enrollment); + }) + } } From 7ea244aa4e18c1c7f342ca1794aedeff041dd4e3 Mon Sep 17 00:00:00 2001 From: Angie-540 Date: Thu, 11 Apr 2024 12:41:18 +0300 Subject: [PATCH 6/8] POC-698b: Added otz register endpoint --- .../otz-registers/otz-register.component.html | 23 ++++++++-------- .../otz-registers/otz-register.component.ts | 26 ++++++++++++++++++- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.html b/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.html index 3edc720ed..7aa57c2cb 100644 --- a/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.html +++ b/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.html @@ -182,7 +182,7 @@

    Registration Details

    rowspan="2" style="width: 20%; text-align: center" > - 2022-01-01 + {{data.original_art_regimen}} {{ data.firstname_middlename }} @@ -217,32 +217,33 @@

    Registration Details

    {{ data.first_regimen_switch }} {{ data.first_regimen_switch_date }} - gm + {{ data.first_regimen_switch_reason }} {{ data.third_regimen_switch }} {{ data.third_regimen_switch_date }} - pppprrr + {{ data.third_regimen_switch_reason }} - rrrr + {{ vlResult }} - - gx - gy + {{ data.discontinue_otz_reason }} + + {{ data.clinical_remarks }} {{ data.age_at_enrollment }} years + {{ data.last_name }} {{ data.vl_result_date_at_otz_enrollment }} {{ data.art_regimen_start_date_at_otz_enrollment }} {{ data.second_regimen_switch }} {{ data.second_regimen_switch_date }} - xxx + {{ data.second_regimen_switch_reason }} {{ data.fourth_regimen_switch }} {{ data.fourth_regimen_switch_date }} - yyy + {{ data.fourth_regimen_switch_reason }} - gg + {{ vlDate }} - gggg + {{ data.discontinue_otz_date }}
    diff --git a/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.ts b/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.ts index c5b4adcd5..e90c5ad8e 100644 --- a/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.ts +++ b/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.ts @@ -14,7 +14,9 @@ export class OtzRegisterComponent implements OnInit { public otzData = []; public enabledControls = 'monthControl'; public _month: string; - + public vlDate = []; + public vlResult = [] ; + counterArray = Array(18) .fill(0) .map((_, index) => index + 1); @@ -47,7 +49,29 @@ export class OtzRegisterComponent implements OnInit { this.otzData = result.results.results; console.log("otzdata", this.otzData); console.log('age2', this.otzData[1].age_at_enrollment); + + for (let data of this.otzData) { + const viral_load = data.vl_result_post_otz_enrollment; + const vl_array = viral_load.split(','); + console.log(vl_array); + const mapped_vls = vl_array.map((v) => { + const vl_dates = v.split('='); + this.vlDate = vl_dates[0]; + this.vlResult = vl_dates[1]; + console.log('Date:', this.vlDate, 'Result:', this.vlResult); + return { + vlDate: vl_dates[0], + vlResult: vl_dates[1] + + }; + }); + console.log('mapped_vls',mapped_vls); + + + } + }) + } } From 134cbce1daf447c5113e9a94fd72df9169df201f Mon Sep 17 00:00:00 2001 From: Alfred-Mutai Date: Wed, 8 May 2024 19:54:28 +0300 Subject: [PATCH 7/8] Cleaned lint errors --- src/app/etl-api/etl-api.module.ts | 5 +- src/app/etl-api/otz-register.service.ts | 7 +- .../otz-registers/otz-register.component.ts | 66 +++++++++---------- 3 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/app/etl-api/etl-api.module.ts b/src/app/etl-api/etl-api.module.ts index a43f348dc..02a24cb72 100644 --- a/src/app/etl-api/etl-api.module.ts +++ b/src/app/etl-api/etl-api.module.ts @@ -44,8 +44,7 @@ import { MOH412ResourceService } from './moh-412-resource.service'; import { ClinicFlowResourceService } from './clinic-flow-resource.service'; import { Covid19ResourceService } from './covid-19-resource-service'; import { LocationUnitsService } from './location-units.service'; -import { OtzRegisterService } from './otz-register.service'; - +import { OtzRegisterService } from './otz-register.service'; @NgModule({ imports: [CommonModule, AppSettingsModule], declarations: [], @@ -95,7 +94,7 @@ import { OtzRegisterService } from './otz-register.service'; ClinicFlowResourceService, Covid19ResourceService, LocationUnitsService, - OtzRegisterService + OtzRegisterService ], exports: [] }) diff --git a/src/app/etl-api/otz-register.service.ts b/src/app/etl-api/otz-register.service.ts index a40c458fe..44f138b34 100644 --- a/src/app/etl-api/otz-register.service.ts +++ b/src/app/etl-api/otz-register.service.ts @@ -16,7 +16,10 @@ export class OtzRegisterService { ) {} public getBaseUrl(): string { - return this.appSettingsService.getEtlRestbaseurl().trim() + 'otz-monthly-register/patient-list'; + return ( + this.appSettingsService.getEtlRestbaseurl().trim() + + 'otz-monthly-register/patient-list' + ); } public getOtzRegister(payload: { @@ -24,7 +27,7 @@ export class OtzRegisterService { locationUuid: string; }): Observable { const url = this.getBaseUrl(); - let urlParams: HttpParams = new HttpParams().set( + const urlParams: HttpParams = new HttpParams().set( 'endDate', payload.endDate ); diff --git a/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.ts b/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.ts index e90c5ad8e..1ec18c1d8 100644 --- a/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.ts +++ b/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.ts @@ -2,8 +2,7 @@ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import * as Moment from 'moment'; import { take } from 'rxjs/operators'; -import { OtzRegisterService } from 'src/app/etl-api/otz-register.service'; - +import { OtzRegisterService } from 'src/app/etl-api/otz-register.service'; @Component({ selector: 'app-otz-register', @@ -15,17 +14,21 @@ export class OtzRegisterComponent implements OnInit { public enabledControls = 'monthControl'; public _month: string; public vlDate = []; - public vlResult = [] ; - + public vlResult = []; + counterArray = Array(18) .fill(0) .map((_, index) => index + 1); - + counter = Array(8) .fill(0) .map((_, index) => index + 1); - constructor(public router: Router, public route: ActivatedRoute, private otzRegisterService: OtzRegisterService) { + constructor( + public router: Router, + public route: ActivatedRoute, + private otzRegisterService: OtzRegisterService + ) { this.route.queryParams.subscribe((data) => { data.month === undefined ? (this._month = Moment() @@ -43,35 +46,30 @@ export class OtzRegisterComponent implements OnInit { } public getOtzRegister() { - this.otzRegisterService.getOtzRegister({endDate: this._month, locationUuid: ''}) - // .pipe(take(1)) - .subscribe((result) => { - this.otzData = result.results.results; - console.log("otzdata", this.otzData); - console.log('age2', this.otzData[1].age_at_enrollment); + this.otzRegisterService + .getOtzRegister({ endDate: this._month, locationUuid: '' }) + // .pipe(take(1)) + .subscribe((result) => { + this.otzData = result.results.results; + console.log('otzdata', this.otzData); + console.log('age2', this.otzData[1].age_at_enrollment); - for (let data of this.otzData) { - const viral_load = data.vl_result_post_otz_enrollment; - const vl_array = viral_load.split(','); - console.log(vl_array); + for (const data of this.otzData) { + const viral_load = data.vl_result_post_otz_enrollment; + const vl_array = viral_load.split(','); + console.log(vl_array); const mapped_vls = vl_array.map((v) => { - const vl_dates = v.split('='); - this.vlDate = vl_dates[0]; - this.vlResult = vl_dates[1]; - console.log('Date:', this.vlDate, 'Result:', this.vlResult); - return { - vlDate: vl_dates[0], - vlResult: vl_dates[1] - - }; - }); - console.log('mapped_vls',mapped_vls); - - - } - - }) - - + const vl_dates = v.split('='); + this.vlDate = vl_dates[0]; + this.vlResult = vl_dates[1]; + console.log('Date:', this.vlDate, 'Result:', this.vlResult); + return { + vlDate: vl_dates[0], + vlResult: vl_dates[1] + }; + }); + console.log('mapped_vls', mapped_vls); + } + }); } } From 6e7fad62dd153afc556f3e7bb79cb4256dadde61 Mon Sep 17 00:00:00 2001 From: Alfred-Mutai Date: Wed, 8 May 2024 20:09:01 +0300 Subject: [PATCH 8/8] Cleaned lint errors --- .../otz/otz-registers/otz-register.component.html | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.html b/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.html index 7aa57c2cb..d6681643d 100644 --- a/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.html +++ b/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.html @@ -182,7 +182,7 @@

    Registration Details

    rowspan="2" style="width: 20%; text-align: center" > - {{data.original_art_regimen}} + {{ data.original_art_regimen }} {{ data.firstname_middlename }} @@ -213,7 +213,7 @@

    Registration Details

    rowspan="2" style="width: 20%; text-align: center" > - {{ data.art_regimen_line_at_otz_enrollment }} + {{ data.art_regimen_line_at_otz_enrollment }} {{ data.first_regimen_switch }} {{ data.first_regimen_switch_date }} @@ -230,10 +230,14 @@

    Registration Details

    {{ data.age_at_enrollment }} years - + {{ data.last_name }} - {{ data.vl_result_date_at_otz_enrollment }} - {{ data.art_regimen_start_date_at_otz_enrollment }} + + {{ data.vl_result_date_at_otz_enrollment }} + + + {{ data.art_regimen_start_date_at_otz_enrollment }} + {{ data.second_regimen_switch }} {{ data.second_regimen_switch_date }} {{ data.second_regimen_switch_reason }}