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 397 fixes #1664

Merged
merged 8 commits into from
Sep 12, 2023
Merged
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
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
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