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-571 #1686

Merged
merged 21 commits into from
Dec 14, 2023
Merged

POC-571 #1686

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
61 changes: 61 additions & 0 deletions src/app/etl-api/cohort-otz-module-resource.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { Injectable } from '@angular/core';
import { AppSettingsService } from '../app-settings/app-settings.service';
import { Observable } from 'rxjs';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';

@Injectable()
export class CohortOtzModuleResourceService {
constructor(
private http: HttpClient,
private appSettingsService: AppSettingsService
) {}
public getUrl(): string {
return (
this.appSettingsService.getEtlRestbaseurl().trim() + 'cohort-modules'
);
}

public getSummaryUrl(): string {
return (
this.appSettingsService.getEtlRestbaseurl().trim() +
'hiv-latest-summaries'
);
}

public getCohortSuppressionsUrl(): string {
return (
this.appSettingsService.getEtlRestbaseurl().trim() +
'viral-load-suppression-rate'
);
}

public getCohortOtzModule(cohortUuid: string): Observable<any> {
return this.http.get(this.getUrl() + '/' + cohortUuid);
}
public getUrlRequestParams(patientUuids: string[]): HttpParams {
let urlParams: HttpParams = new HttpParams();

if (patientUuids && patientUuids.length > 0) {
urlParams = urlParams.set('uuid', patientUuids.join(','));
}
return urlParams;
}

public getPatientsLatestHivSummaries(payload: string[]) {
if (!payload || payload.length === 0) {
return null;
}
return this.http.get(this.getSummaryUrl(), {
params: this.getUrlRequestParams(payload)
});
}

public getCohortSuppressionStatus(payload: string[]) {
if (!payload || payload.length === 0) {
return null;
}
return this.http.get(this.getCohortSuppressionsUrl(), {
params: this.getUrlRequestParams(payload)
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ <h4 class="text">Group Summary</h4>
<strong>Leader: </strong>
<ng-container *ngIf="currentLeader">
<span *ngIf="currentLeader.person">
{{ currentLeader.person.display }} ({{ leadershipType }}),
{{ currentLeader.person.display }},
</span>
<span>since {{ currentLeader.startDate | date: 'medium' }}</span>
</ng-container>
Expand Down Expand Up @@ -108,6 +108,12 @@ <h4 class="text">Group Summary</h4>
</ng-container>
</td>
</tr>
<tr>
<td>
<strong>Group Activity: </strong>
<span *ngIf="landmark">{{ groupActivity?.value }}</span>
</td>
</tr>
</tbody>
</table>
</div>
Expand Down Expand Up @@ -195,10 +201,23 @@ <h4 class="modal-title pull-left">Edit Leadership</h4>
>
<div class="col-xs-10">
<mat-radio-group formControlName="leadershipType">
<mat-radio-button value="peer" color="primary"
<mat-radio-button
*ngIf="validOTZProgram"
value="peer"
[checked]="defaultLeadershipType == 'peer'"
color="primary"
>OTZ Champion</mat-radio-button
>
<mat-radio-button
*ngIf="!validOTZProgram"
value="peer"
color="primary"
>Peer Leadership</mat-radio-button
>
<mat-radio-button value="staff" color="primary"
<mat-radio-button
*ngIf="!validOTZProgram"
value="staff"
color="primary"
>Community Staff Leadership</mat-radio-button
>
</mat-radio-group>
Expand Down Expand Up @@ -349,12 +368,21 @@ <h4 class="modal-title pull-left">Add Leader</h4>
<div class="col-xs-10">
<mat-radio-group (change)="onDefaultLeadershipTypeChanged($event)">
<mat-radio-button
*ngIf="validOTZProgram"
value="peer"
[checked]="defaultLeadershipType == 'peer'"
color="primary"
>OTZ Champion</mat-radio-button
>
<mat-radio-button
*ngIf="!validOTZProgram"
value="peer"
[checked]="defaultLeadershipType == 'peer'"
color="primary"
>Peer Leadership</mat-radio-button
>
<mat-radio-button
*ngIf="!validOTZProgram"
value="staff"
[checked]="defaultLeadershipType !== 'peer'"
color="primary"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export class GroupDetailSummaryComponent implements OnInit, OnDestroy {
public group: Group;
public groupNumber: any;
public landmark: any;
public groupActivity: any;
public provider: any;
public program: any;
public currentLeader: any;
Expand All @@ -76,6 +77,7 @@ export class GroupDetailSummaryComponent implements OnInit, OnDestroy {
public currentMonth = Moment().month() + 1;
public providerSuggest: Subject<any> = new Subject();
public editLeaderForm: FormGroup;
public validOTZProgram = false;
public endDate = {
date: {
month: this.currentMonth,
Expand Down Expand Up @@ -104,6 +106,10 @@ export class GroupDetailSummaryComponent implements OnInit, OnDestroy {
'landmark',
this.group.attributes
);
this.groupActivity = this.communityGroupService.getGroupAttribute(
'groupActivity',
this.group.attributes
);
this.currentLeader = this.getCurrentLeader(
group.cohortLeaders,
group.cohortMembers
Expand Down Expand Up @@ -347,6 +353,10 @@ export class GroupDetailSummaryComponent implements OnInit, OnDestroy {
'landmark',
this.group.attributes
);
this.groupActivity = this.communityGroupService.getGroupAttribute(
'groupActivity',
this.group.attributes
);
this.currentLeader = this.getCurrentLeader(
group.cohortLeaders,
group.cohortMembers
Expand Down Expand Up @@ -561,6 +571,7 @@ export class GroupDetailSummaryComponent implements OnInit, OnDestroy {
groupProgram: { label: program['name'], value: program['uuid'] },
provider: { label: provider.person.display, value: provider.person.uuid },
address: this.landmark.value,
groupActivity: this.groupActivity.value,
groupUuid: this.group.uuid,
actionButtonText: 'Save Changes'
};
Expand Down Expand Up @@ -716,6 +727,9 @@ export class GroupDetailSummaryComponent implements OnInit, OnDestroy {
const sub = this.programService.getProgramByUuid(program.value).subscribe(
(prog) => {
this.program = prog;
if (this.program.name === 'OTZ PROGRAM') {
this.validOTZProgram = true;
}
},
(error) => {
console.log(error);
Expand Down
18 changes: 16 additions & 2 deletions src/app/group-manager/group-detail/group-detail.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,10 @@ <h4 class="modal-title pull-left">Add Membership</h4>
<div class="alert alert-danger" *ngIf="enrollmentErrorMessage">
{{ enrollmentErrorMessage }}
</div>
<div class="alert alert-info" *ngIf="showEnrollmentButton">
<div
class="alert alert-info"
*ngIf="showEnrollmentButton && showOTZEnrollmentMsg"
>
<button
class="btn btn-xs btn-primary pull-right"
(click)="enrollPatienttoProgram()"
Expand All @@ -249,6 +252,13 @@ <h4 class="modal-title pull-left">Add Membership</h4>
</button>
The patient is not enrolled in this program.
</div>
<div
class="alert alert-info"
*ngIf="showEnrollmentButton && !showOTZEnrollmentMsg"
>
Patient is not eligible for OTZ enrollment
</div>

<busy
*ngIf="validatingEnrollment"
[message]="'Validating Enrollment...'"
Expand Down Expand Up @@ -366,7 +376,11 @@ <h4 class="modal-title pull-left">Start Group Meeting</h4>
>
<ng-container *ngFor="let item of visitTypes">
<option
*ngIf="item.display.toLowerCase().includes('community')"
*ngIf="
isOtzProgram
? item.display.toLowerCase().includes('otz')
: item.display.toLowerCase().includes('community')
"
[value]="item.uuid"
>
{{ item.display }}
Expand Down
Loading
Loading