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/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..02a24cb72 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 { OtzRegisterService } from './otz-register.service'; @NgModule({ imports: [CommonModule, AppSettingsModule], declarations: [], @@ -93,7 +93,8 @@ import { LocationUnitsService } from './location-units.service'; MOH412ResourceService, ClinicFlowResourceService, Covid19ResourceService, - LocationUnitsService + LocationUnitsService, + OtzRegisterService ], 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/etl-api/otz-register.service.ts b/src/app/etl-api/otz-register.service.ts new file mode 100644 index 000000000..44f138b34 --- /dev/null +++ b/src/app/etl-api/otz-register.service.ts @@ -0,0 +1,41 @@ +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-monthly-register/patient-list' + ); + } + + public getOtzRegister(payload: { + endDate: string; + locationUuid: string; + }): Observable { + const url = this.getBaseUrl(); + const 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); + } +} 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..43cf0723a 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,8 @@ 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'; @NgModule({ imports: [ @@ -250,8 +252,8 @@ import { PlhivNcdV2ReportViewComponent } from './plhiv-ncd-v2-report/plhiv-ncd-v Covid19TabularViewComponent, PrepMonthlyReportViewComponent, TxMlReportViewComponent, - AhdReportViewComponent, - PlhivNcdV2ReportViewComponent + RegistersDashboardComponent, + OtzRegisterComponent ], declarations: [ Moh731TabularComponent, @@ -348,7 +350,9 @@ import { PlhivNcdV2ReportViewComponent } from './plhiv-ncd-v2-report/plhiv-ncd-v AhdMonthlyReportPatientlistComponent, PlhivNcdV2ReportBaseComponent, PlhivNcdV2ReportPatientListComponent, - PlhivNcdV2ReportViewComponent + PlhivNcdV2ReportViewComponent, + RegistersDashboardComponent, + OtzRegisterComponent ], providers: [ MOHReportService, 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..593cd2d8c --- /dev/null +++ b/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.css @@ -0,0 +1,73 @@ +.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; + margin: 8px; +} +.medication-list th, +.medication-list td { + border: 1px solid #000000; + padding: 0px; + text-align: left; +} +.footer { + text-align: center; + margin-top: 20px; +} +.setfont { + font-size: 14px !important; +} +.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 new file mode 100644 index 000000000..d6681643d --- /dev/null +++ b/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.html @@ -0,0 +1,269 @@ +
+

OTZ Register

+
    +
  • +
    +
    + +
    + + + + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Serial Counter + +

    Registration Details

    +
    + Status at 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 (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)
    + {{ i + 1 }} + + {{ data.date_enrolled_to_otz }} + + {{ data.birth_date }} + + {{ data.identifiers }} + + {{ data.original_art_regimen }} + + {{ data.firstname_middlename }} + + {{ data.gender }} + + {{ data.vl_result_at_otz_enrollment }} + + 1990-05-15 + + {{ data.art_regimen_at_otz_enrollment }} + + {{ data.art_regimen_line_at_otz_enrollment }} + {{ data.first_regimen_switch }}{{ data.first_regimen_switch_date }}{{ data.first_regimen_switch_reason }}{{ data.third_regimen_switch }}{{ data.third_regimen_switch_date }}{{ data.third_regimen_switch_reason }}{{ vlResult }}{{ 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 }}{{ data.second_regimen_switch_reason }}{{ data.fourth_regimen_switch }}{{ data.fourth_regimen_switch_date }}{{ data.fourth_regimen_switch_reason }}{{ vlDate }}{{ 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 new file mode 100644 index 000000000..1ec18c1d8 --- /dev/null +++ b/src/app/hiv-care-lib/registers/otz/otz-registers/otz-register.component.ts @@ -0,0 +1,75 @@ +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', + templateUrl: './otz-register.component.html', + styleUrls: ['./otz-register.component.css'] +}) +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); + + counter = Array(8) + .fill(0) + .map((_, index) => index + 1); + + constructor( + public router: Router, + public route: ActivatedRoute, + private otzRegisterService: OtzRegisterService + ) { + 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'); + 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); + + 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); + } + }); + } +} 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",