Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POC-873: HTS Module Workflows #1774

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Build prod
run: npm run build-prod
- name: Upload build files to artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: build-files
path: dist
Expand Down
5 changes: 5 additions & 0 deletions src/app/clinic-dashboard/clinic-dashboard-routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ const clinicDashboardRoutes: Routes = [
(mod) => mod.MNCHModule
)
},
{
path: 'hts',
loadChildren: () =>
System.import('./hts/hts-program.module').then((mod) => mod.HTSModule)
},
{
path: '',
redirectTo: 'general',
Expand Down
4 changes: 3 additions & 1 deletion src/app/clinic-dashboard/clinic-dashboard.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import { PatientProgramEnrollmentModule } from './../patients-program-enrollment
import { PatientReferralProgramModule } from './referral/patient-referral-program.module';
import { ClinicRoutesFactory } from '../navigation/side-navigation/clinic-side-nav/clinic-side-nav-routes.factory';
import { MNCHModule } from './mnch/mnch-program.module';
import { HTSModule } from './hts/hts-program.module';

@NgModule({
declarations: [
Expand Down Expand Up @@ -102,7 +103,8 @@ import { MNCHModule } from './mnch/mnch-program.module';
NgxPaginationModule,
PatientReferralProgramModule,
OncologyProgramModule,
MNCHModule
MNCHModule,
HTSModule
],
providers: [
ClinicDashboardCacheService,
Expand Down
4 changes: 4 additions & 0 deletions src/app/clinic-dashboard/clinic-dashboard.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ export const routes = [
path: 'mnch',
loadChildren: './mnch/mnch-program.module#MNCHModule'
},
{
path: 'hts',
loadChildren: './hts/hts-program.module#HTSModule'
},
{ path: '', redirectTo: 'general', pathMatch: 'prefix' }
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<clinic-flow [date]="selectedDate"></clinic-flow>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { ComponentFixture, async, TestBed } from '@angular/core/testing';

import { DateTimePickerModule } from '@ampath-kenya/ngx-openmrs-formentry';
import { CalendarModule } from 'angular-calendar';
import { NgxMyDatePickerModule } from 'ngx-mydatepicker';

import { DailyScheduleClinicFlowComponent } from './daily-schedule-clinic-flow.component';
import { ClinicFlowCacheService } from '../../../hiv-care-lib/clinic-flow/clinic-flow-cache.service';
import { ClinicDashboardCacheService } from '../../services/clinic-dashboard-cache.service';

describe('Daily-schedule-clinic-flow Tests', () => {
let comp: DailyScheduleClinicFlowComponent;
let fixture: ComponentFixture<DailyScheduleClinicFlowComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
DateTimePickerModule,
NgxMyDatePickerModule.forRoot(),
CalendarModule.forRoot()
],
declarations: [DailyScheduleClinicFlowComponent],
providers: [ClinicFlowCacheService, ClinicDashboardCacheService]
})
.compileComponents()
.then(() => {
fixture = TestBed.createComponent(DailyScheduleClinicFlowComponent);
comp = fixture.componentInstance;
});
}));

/*it('should be defined', () => {
expect(comp).toBeDefined();
});*/
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { DatePipe } from '@angular/common';

import { ClinicFlowCacheService } from '../../../hiv-care-lib/clinic-flow/clinic-flow-cache.service';
import { ClinicDashboardCacheService } from '../../services/clinic-dashboard-cache.service';
import { Subscription } from 'rxjs';

@Component({
selector: 'daily-schedule-clinic-flow-component',
templateUrl: './daily-schedule-clinic-flow.component.html'
})
export class DailyScheduleClinicFlowComponent implements OnInit, OnDestroy {
public selectedDate: any;
private _datePipe: DatePipe;
private subs: Subscription[] = [];
constructor(
private clinicFlowCache: ClinicFlowCacheService,
private clinicDashboardCacheService: ClinicDashboardCacheService
) {
this._datePipe = new DatePipe('en-US');
}

public ngOnInit() {
if (this.clinicFlowCache.lastClinicFlowSelectedDate) {
this.selectedDate = this.clinicFlowCache.lastClinicFlowSelectedDate;
} else {
this.selectedDate = this._datePipe.transform(new Date(), 'yyyy-MM-dd');
this.clinicFlowCache.setSelectedDate(this.selectedDate);
}
const routeSub = this.clinicDashboardCacheService
.getCurrentClinic()
.subscribe((clinic) => {
this.clinicFlowCache.setSelectedLocation(clinic);
});

this.subs.push(routeSub);
}

public ngOnDestroy() {
this.subs.forEach((sub) => {
sub.unsubscribe();
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { Subscription } from 'rxjs';
import { ClinicDashboardCacheService } from '../../services/clinic-dashboard-cache.service';
import { Router, ActivatedRoute } from '@angular/router';
import { DatePipe } from '@angular/common';
import { DailyScheduleBaseComponent } from '../../../clinic-schedule-lib/daily-schedule/daily-schedule.component';
import { ClinicFlowCacheService } from '../../../hiv-care-lib/clinic-flow/clinic-flow-cache.service';
import { SelectDepartmentService } from './../../../shared/services/select-department.service';
import * as Moment from 'moment';
@Component({
selector: 'hts-daily-schedule',
templateUrl:
'../../../clinic-schedule-lib/daily-schedule/daily-schedule.component.html'
})
export class HTSDailyScheduleComponent
extends DailyScheduleBaseComponent
implements OnInit, OnDestroy {
public routeSub: Subscription = new Subscription();
public myDepartment = 'HTS';
public _datePipe: DatePipe;
public selectedDate: any;
public paramsSub: Subscription;
public activeLinkIndex = 0;
public tabLinks = [
{ label: 'Appointments', link: 'daily-appointments' },
{ label: 'Visits', link: 'daily-visits' },
{ label: 'Clinic Flow', link: 'clinic-flow' },
{ label: 'Has not returned', link: 'daily-not-returned' }
];

constructor(
public clinicDashboardCacheService: ClinicDashboardCacheService,
public router: Router,
public route: ActivatedRoute,
public clinicFlowCache: ClinicFlowCacheService,
private selectDepartmentService: SelectDepartmentService
) {
super(clinicDashboardCacheService, router, route, clinicFlowCache);
this._datePipe = new DatePipe('en-US');
}

public ngOnInit() {
this.setActiveTab();
this.paramsSub = this.route.queryParams.subscribe((params) => {
if (params.startDate) {
this.selectedDate = Moment(params.startDate).format('MMM D , YYYY ');
this.clinicFlowCache.setSelectedDate(this.selectedDate);
}
});
this.selectDepartmentService.setDepartment(this.myDepartment);
this.routeSub = this.route.parent.parent.params.subscribe((params) => {
this.clinicDashboardCacheService.setCurrentClinic(
params['location_uuid']
);
});
if (this.clinicFlowCache.lastClinicFlowSelectedDate) {
this.selectedDate = this.clinicFlowCache.lastClinicFlowSelectedDate;
} else {
this.selectedDate = Moment().format('MMM D , YYYY ');
this.clinicFlowCache.setSelectedDate(this.selectedDate);
}
}

public ngOnDestroy() {
this.routeSub.unsubscribe();
this.paramsSub.unsubscribe();
}

public setActiveTab() {
if (this.router.url) {
let path = this.router.url;
const n = this.router.url.indexOf('?');
path = this.router.url.substring(0, n !== -1 ? n : path.length);
path = path.substr(this.router.url.lastIndexOf('/') + 1);
this.activeLinkIndex = this.tabLinks.findIndex((x) => x.link === path);
}
}
}
49 changes: 49 additions & 0 deletions src/app/clinic-dashboard/hts/hts-program.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import {
MatProgressSpinnerModule,
MatProgressBarModule,
MatTabsModule
} from '@angular/material';
import { ClinicScheduleLibModule } from '../../clinic-schedule-lib/clinic-schedule-lib.module';
import { CalendarModule } from 'angular-calendar';
import { htsProgramRouting } from './hts-program.routes';
import { DateTimePickerModule } from '@ampath-kenya/ngx-openmrs-formentry';
import { EtlApi } from '../../etl-api/etl-api.module';
import { HivCareLibModule } from '../../hiv-care-lib/hiv-care-lib.module';
import { DataListsModule } from '../../shared/data-lists/data-lists.module';
import { HTSDailyScheduleComponent } from './daily-schedule/daily-schedule.component';
import { DailyScheduleClinicFlowComponent } from './clinic-flow/daily-schedule-clinic-flow.component';
import { ProgramVisitEncounterSearchModule } from '../../program-visit-encounter-search/program-visit-encounter-search.module';
import { GeneralModule } from '../general/general.module';
import { ChangeDepartmentModule } from '../change-department/change-department.module';
import { HtsMonthlyScheduleComponent } from './monthly-schedule/monthly-schedule.component';

@NgModule({
imports: [
htsProgramRouting,
HivCareLibModule,
ClinicScheduleLibModule,
DateTimePickerModule,
CalendarModule,
EtlApi,
DataListsModule,
CommonModule,
FormsModule,
MatTabsModule,
MatProgressSpinnerModule,
MatProgressBarModule,
ProgramVisitEncounterSearchModule,
GeneralModule,
ChangeDepartmentModule
],
exports: [],
declarations: [
HTSDailyScheduleComponent,
HtsMonthlyScheduleComponent,
DailyScheduleClinicFlowComponent
],
providers: []
})
export class HTSModule {}
57 changes: 57 additions & 0 deletions src/app/clinic-dashboard/hts/hts-program.routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { ModuleWithProviders } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { HTSDailyScheduleComponent } from './daily-schedule/daily-schedule.component';
import { DailyScheduleVisitsComponent } from '../../clinic-schedule-lib/daily-schedule/daily-schedule-visits.component';
import { DailyScheduleAppointmentsComponent } from '../../clinic-schedule-lib/daily-schedule/daily-schedule-appointments.component';
import { DailyScheduleNotReturnedComponent } from '../../clinic-schedule-lib/daily-schedule/daily-schedule-not-returned.component';
import { DailyScheduleClinicFlowComponent } from './clinic-flow/daily-schedule-clinic-flow.component';
import { ClinicFlowVisitsComponent } from '../../hiv-care-lib/clinic-flow/clinic-flow-visits.component';
import { ClinicFlowLocationStatsComponent } from '../../hiv-care-lib/clinic-flow/clinic-flow-location-stats.component';
import { ClinicFlowProviderStatsComponent } from '../../hiv-care-lib/clinic-flow/clinic-flow-provider-stats.component';
import { ClinicFlowSummaryComponent } from '../../hiv-care-lib/clinic-flow/clinic-flow-summary.component';
import { ChangeDepartmentComponent } from '../change-department/change-department.component';
import { HtsMonthlyScheduleComponent } from './monthly-schedule/monthly-schedule.component';
const routes: Routes = [
{
path: 'daily-schedule',
component: HTSDailyScheduleComponent,
children: [
{ path: '', redirectTo: 'daily-appointments', pathMatch: 'prefix' },
{ path: 'daily-visits', component: DailyScheduleVisitsComponent },
{
path: 'daily-appointments',
component: DailyScheduleAppointmentsComponent
},
{
path: 'daily-not-returned',
component: DailyScheduleNotReturnedComponent
},
{
path: 'clinic-flow',
component: DailyScheduleClinicFlowComponent,
children: [
{ path: 'visits', component: ClinicFlowVisitsComponent },
{ path: 'summary', component: ClinicFlowSummaryComponent },
{
path: 'provider-stats',
component: ClinicFlowProviderStatsComponent
},
{ path: 'location', component: ClinicFlowLocationStatsComponent },
{ path: '', redirectTo: 'summary', pathMatch: 'prefix' }
]
}
]
},
{
path: 'monthly-schedule',
component: HtsMonthlyScheduleComponent
},
{
path: 'department-select',
component: ChangeDepartmentComponent
}
];

export const htsProgramRouting: ModuleWithProviders = RouterModule.forChild(
routes
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { Component, OnDestroy, OnInit, Input } from '@angular/core';
import { Subscription } from 'rxjs';
import { Router, ActivatedRoute, Params } from '@angular/router';
import {
CalendarEvent,
CalendarEventAction,
CalendarEventTimesChangedEvent,
CalendarMonthViewDay
} from 'angular-calendar';
import { MonthlyScheduleBaseComponent } from '../../../clinic-schedule-lib/monthly-schedule/monthly-schedule.component';
import { SelectDepartmentService } from './../../../shared/services/select-department.service';
import { ClinicDashboardCacheService } from '../../services/clinic-dashboard-cache.service';
import { AppFeatureAnalytics } from '../../../shared/app-analytics/app-feature-analytics.service';
import { PatientProgramResourceService } from '../../../etl-api/patient-program-resource.service';
import { LocalStorageService } from '../../../utils/local-storage.service';
import { MonthlyScheduleResourceService } from '../../../etl-api/monthly-scheduled-resource.service';
@Component({
selector: 'hts-monthly-schedule',
templateUrl:
'../../../clinic-schedule-lib/monthly-schedule/monthly-schedule.component.html'
})
export class HtsMonthlyScheduleComponent
extends MonthlyScheduleBaseComponent
implements OnInit, OnDestroy {
public routeSub: Subscription = new Subscription();
public myDepartment = 'HTS';

constructor(
public monthlyScheduleResourceService: MonthlyScheduleResourceService,
public clinicDashboardCacheService: ClinicDashboardCacheService,
public router: Router,
public route: ActivatedRoute,
public appFeatureAnalytics: AppFeatureAnalytics,
public localstorageService: LocalStorageService,
public patientProgramService: PatientProgramResourceService,
public selectDepartmentService: SelectDepartmentService
) {
super(
monthlyScheduleResourceService,
clinicDashboardCacheService,
router,
route,
appFeatureAnalytics,
localstorageService,
patientProgramService
);
}

public ngOnInit() {
this.selectDepartmentService.setDepartment(this.myDepartment);
this.route.parent.parent.params.subscribe((params) => {
this.clinicDashboardCacheService.setCurrentClinic(
params['location_uuid']
);
});
}

public ngOnDestroy() {
this.routeSub.unsubscribe();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export const routes: Routes = [
{
path: 'cdm',
loadChildren: './cdm/data-analytics-cdm.module#DataAnalyticsCdmModule'
},
{
path: 'hts',
loadChildren: './hts/data-analytics-hts.module#DataAnalyticsHtsModule'
}
]
}
Expand Down
Loading
Loading