-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
1,968 additions
and
264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
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 getUrlRequestParamsByLocationUuid(locationUuid: string): HttpParams { | ||
let urlParams: HttpParams = new HttpParams(); | ||
|
||
if (locationUuid) { | ||
urlParams = urlParams.set('uuid', locationUuid); | ||
} | ||
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(locationUuid: string) { | ||
return this.http.get(this.getCohortSuppressionsUrl(), { | ||
params: this.getUrlRequestParamsByLocationUuid(locationUuid) | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.