Skip to content

Commit

Permalink
Merge pull request #18 from sainingo/POC-145
Browse files Browse the repository at this point in the history
POC-145
  • Loading branch information
hiqedme authored Oct 2, 2023
2 parents e28ae3e + 7980df0 commit fc0881b
Show file tree
Hide file tree
Showing 42 changed files with 1,948 additions and 120 deletions.
70 changes: 34 additions & 36 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,36 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "attach",
"name": "Unit tests",
"address": "localhost",
"port": 9333,
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
},
{
"name": "ng serve",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000/#",
"webRoot": "${workspaceFolder}"
},
{
"name": "npm run test",
"type": "chrome",
"request": "launch",
"url": "http://localhost:9876/debug.html",
"webRoot": "${workspaceFolder}"
},
{
"name": "ng e2e",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/protractor/bin/protractor",
"protocol": "inspector",
"args": [
"${workspaceFolder}/e2e/protractor.conf.js"
]
}
]
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "attach",
"name": "Unit tests",
"address": "localhost",
"port": 9333,
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
},
{
"name": "ng serve",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000/#",
"webRoot": "${workspaceFolder}"
},
{
"name": "npm run test",
"type": "chrome",
"request": "launch",
"url": "http://localhost:9876/debug.html",
"webRoot": "${workspaceFolder}"
},
{
"name": "ng e2e",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/protractor/bin/protractor",
"protocol": "inspector",
"args": ["${workspaceFolder}/e2e/protractor.conf.js"]
}
]
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ export class PreAppointmentOutreachComponent implements OnInit {
private ALL = 'All';
private FOLLOW_UP_SUCCESSFUL = 'Follow-up Successful';
private FAILED_FOLLOW_UP_ATTEMPT = 'Failed Follow-up Attempt';
private NO_FOLLOW_UP_ATTEMPT = 'Follow-up Not Attempted';

public filterTypeOptions: any[] = [
this.ALL,
this.FOLLOW_UP_SUCCESSFUL,
this.FAILED_FOLLOW_UP_ATTEMPT
this.FAILED_FOLLOW_UP_ATTEMPT,
this.NO_FOLLOW_UP_ATTEMPT
];
public selectedFilterType = 'All'; // defaults to All
// TODO refactor this later
Expand Down Expand Up @@ -102,6 +104,11 @@ export class PreAppointmentOutreachComponent implements OnInit {
this.explainedFilterType =
'Patient for whom follow-up attempts have been unsuccessful.';
break;
case this.NO_FOLLOW_UP_ATTEMPT:
this.mappedSelectedFilterType = 2;
this.explainedFilterType =
'Patients for whom there has been no follow-up attempt.';
break;
default:
this.explainedFilterType = '';
}
Expand Down
7 changes: 5 additions & 2 deletions src/app/etl-api/clinical-notes-resource.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export class ClinicalNotesResourceService {
public getClinicalNotes(
patientUuid: string,
startIndex: number,
limit: number
limit: number,
isHEIActive: boolean
) {
const api =
this.appSettingsService.getEtlServer() +
Expand All @@ -32,7 +33,9 @@ export class ClinicalNotesResourceService {

const params: HttpParams = new HttpParams()
.set('startIndex', (startIndex as any) as string)
.set('limit', (limit as any) as string);
.set('limit', (limit as any) as string)
.set('includeNonClinicalEncounter', 'false')
.set('isHEIActive', (isHEIActive as any) as string);

return this.http.get(api, { params: params });
}
Expand Down
11 changes: 7 additions & 4 deletions src/app/etl-api/hiv-patient-clinical-summary-resource.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,27 @@ import { Injectable } from '@angular/core';
import { AppSettingsService } from '../app-settings/app-settings.service';
import { Observable } from 'rxjs';
import { HttpClient, HttpParams } from '@angular/common/http';

@Injectable()
export class HivPatientClinicalSummaryResourceService {
constructor(
protected http: HttpClient,
protected appSettingsService: AppSettingsService
) {}

public fetchPatientSummary(patientUuid: string): Observable<any> {
public fetchPatientSummary(
patientUuid: string,
isHEIActive?: any
): Observable<any> {
const api: string =
this.appSettingsService.getEtlServer() +
'/patient/' +
patientUuid +
'/hiv-patient-clinical-summary';

const params: HttpParams = new HttpParams()
.set('startIndex', (0 as any) as string)
.set('limit', (20 as any) as string);
.set('startIndex', '0')
.set('limit', '20')
.set('isHEIActive', (isHEIActive as any) as string);

return this.http.get(api, { params: params });
}
Expand Down
8 changes: 5 additions & 3 deletions src/app/etl-api/hiv-summary-resource.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { HttpClient, HttpParams } from '@angular/common/http';

@Injectable()
export class HivSummaryResourceService {
public months: string;
constructor(
protected http: HttpClient,
protected appSettingsService: AppSettingsService
Expand All @@ -19,7 +20,8 @@ export class HivSummaryResourceService {
patientUuid: string,
startIndex: number,
limit: number,
includeNonClinicalEncounter?: boolean
includeNonClinicalEncounter?: boolean,
isHEIActive?: any
): Observable<any> {
let url = this.getUrl();
url += '/' + patientUuid + '/hiv-summary';
Expand All @@ -40,8 +42,8 @@ export class HivSummaryResourceService {
.set(
'includeNonClinicalEncounter',
(includeNonClinicalEncounter as any) as string
);

)
.set('isHEIActive', (isHEIActive as any) as string);
return this.http
.get<any>(url, {
params: params
Expand Down
3 changes: 3 additions & 0 deletions src/app/etl-api/pre-appointment-outreach-resource.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export class PreAppointmentOutreachResourceService {
if (params.processOutcome === 0) {
urlParams = urlParams.set('failedOutcome', '1');
}
if (params.processOutcome === 2) {
urlParams = urlParams.set('unknownOutcome', '0');
}

const url = this.getUrl('ml-weekly-predictions');
const request = this.http
Expand Down
30 changes: 19 additions & 11 deletions src/app/lab-order-search/lab-order-search-post.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ interface Identifier {
})
export class LabOrderSearchPostComponent implements OnInit, OnChanges {
public _order: any = null;
isHEIActive: any;
@Input()
set order(order: any) {
this.selectedLabLocation = null;
Expand Down Expand Up @@ -129,6 +130,11 @@ export class LabOrderSearchPostComponent implements OnInit, OnChanges {
});
this.patient = this.order.patient;
this.person = new Person(this.order.patient.person);
if (Moment().diff(Moment(this.person.birthdate), 'months') <= 18) {
this.isHEIActive = true;
} else {
this.isHEIActive = false;
}
this.searchIdentifiers = this.labOrdersSearchHelperService.searchIdentifiers(
this.order.patient.identifiers
);
Expand Down Expand Up @@ -197,17 +203,19 @@ export class LabOrderSearchPostComponent implements OnInit, OnChanges {
}

public loadHivSummary(patientUuid) {
this.hivSummaryService.getHivSummary(patientUuid, 0, 1, false).subscribe(
(data) => {
this.hivSummary = data && data.length > 0 ? data[0] : null;
this.isBusy = false;
},
(err) => {
this.error =
'An error occured while loading Hiv Summary. Please try again.';
this.isBusy = false;
}
);
this.hivSummaryService
.getHivSummary(patientUuid, 0, 1, false, this.isHEIActive)
.subscribe(
(data) => {
this.hivSummary = data && data.length > 0 ? data[0] : null;
this.isBusy = false;
},
(err) => {
this.error =
'An error occured while loading Hiv Summary. Please try again.';
this.isBusy = false;
}
);
}

public displayDnaPcrInputs() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Injectable } from '@angular/core';
import { RoutesProviderService } from '../../../shared/dynamic-route/route-config-provider.service';
import { RouteModel } from '../../../shared/dynamic-route/route.model';
import { Patient } from '../../../models/patient.model';
import * as Moment from 'moment';
@Injectable()
export class PatientRoutesFactory {
constructor(public routesProvider: RoutesProviderService) {}
Expand All @@ -16,6 +17,19 @@ export class PatientRoutesFactory {
patientRoutesConfig = this.processSharedRoutes(patientRoutesConfig);

const routes: RouteModel[] = [];
if (Moment().diff(Moment(patient.person.birthdate), 'months') <= 18) {
patientRoutesConfig.sharedRoutes.hiv[3] = {
url: 'hiv-summary',
label: 'HEI Summary',
icon: 'fa fa-child'
};
} else {
patientRoutesConfig.sharedRoutes.hiv[3] = {
url: 'hiv-summary',
label: 'HIV Summary',
icon: 'fa fa-medkit'
};
}
if (Array.isArray(patientRoutesConfig['programs'])) {
for (const program of patientRoutesConfig.programs) {
if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { AppFeatureAnalytics } from '../../../shared/app-analytics/app-feature-a
import { ClinicalNotesResourceService } from '../../../etl-api/clinical-notes-resource.service';
import { ClinicalNotesHelperService } from './clinical-notes.helper';
import { Subscription } from 'rxjs';
import { PatientResourceService } from 'src/app/openmrs-api/patient-resource.service';
import * as Moment from 'moment';

@Component({
selector: 'app-clinical-notes',
Expand All @@ -25,6 +27,8 @@ export class ClinicalNotesComponent implements OnInit, OnDestroy {

public notes: Array<any> = [];

public isHEIActive = false;

private helper: ClinicalNotesHelperService;

private subscription: Subscription;
Expand All @@ -36,7 +40,8 @@ export class ClinicalNotesComponent implements OnInit, OnDestroy {
constructor(
private route: ActivatedRoute,
private notesResource: ClinicalNotesResourceService,
private appFeatureAnalytics: AppFeatureAnalytics
private appFeatureAnalytics: AppFeatureAnalytics,
private patientResourceService: PatientResourceService
) {
this.helper = new ClinicalNotesHelperService();
}
Expand All @@ -51,16 +56,24 @@ export class ClinicalNotesComponent implements OnInit, OnDestroy {
this.subscription = this.route.parent.params.subscribe((params: Params) => {
this.patientUuid = params['patient_uuid'];

this.getNotes(0, 10, (err, notes) => {
if (err) {
console.error(err);
return;
}

this.notes = notes;

this.fetching = false;
});
this.patientResourceService
.getPatientByUuid(this.patientUuid)
.subscribe((result) => {
this.isHEIActive =
Moment().diff(Moment(result.person.birthdate), 'months') <= 18
? true
: false;
this.getNotes(0, 10, this.isHEIActive, (err, notes) => {
if (err) {
console.error(err);
return;
}

this.notes = notes;

this.fetching = false;
});
});
});
}

Expand All @@ -76,7 +89,7 @@ export class ClinicalNotesComponent implements OnInit, OnDestroy {

this.fetching = false;

this.getNotes(this.nextStartIndex, 10, (err, notes) => {
this.getNotes(this.nextStartIndex, 10, this.isHEIActive, (err, notes) => {
if (err) {
console.error(err);
return;
Expand All @@ -92,9 +105,9 @@ export class ClinicalNotesComponent implements OnInit, OnDestroy {
});
}

public getNotes(startIndex: number, limit: number, cb) {
public getNotes(startIndex: number, limit: number, isHEIACTIVE: boolean, cb) {
this.isBusy = this.notesResource
.getClinicalNotes(this.patientUuid, startIndex, limit)
.getClinicalNotes(this.patientUuid, startIndex, limit, this.isHEIActive)
.pipe(take(1))
.subscribe(
(data: any) => {
Expand Down
Loading

0 comments on commit fc0881b

Please sign in to comment.