Skip to content

Commit

Permalink
POC-539: Display latest PCR and Infant feeding method under HEI Snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
henrykorir committed Sep 21, 2023
1 parent ae733c4 commit 6630ed0
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,24 +93,12 @@ <h4 class="component-title">Last Encounter</h4>
</div>
<div class="snapshot-body">
<div class="col-md-12">
<div
[ngClass]="
isHEIActive === true
? 'col-md-12 col-xs-12'
: 'col-md-6 col-xs-12'
"
>
<div class="col-md-6 col-xs-12">
<p>
Date: {{ patientData?.encounter_datetime | date: 'dd-MM-yyyy' }}
</p>
</div>
<div
[ngClass]="
isHEIActive === true
? 'col-md-12 col-xs-12'
: 'col-md-6 col-xs-12'
"
>
<div class="col-md-6 col-xs-12">
<p>
Type:
{{
Expand All @@ -125,8 +113,11 @@ <h4 class="component-title">Last Encounter</h4>
<div class="col-md-6 col-xs-12">
<p>ARV Regimen: {{ patientData?.cur_arv_meds }}</p>
</div>
<div class="col-md-6 col-xs-12" *ngIf="!isHEIActive">
<p [ngClass]="{ 'text-bold red': isVirallyUnsuppressed }">
<div class="col-md-6 col-xs-12">
<p
*ngIf="!isHEIActive"
[ngClass]="{ 'text-bold red': isVirallyUnsuppressed }"
>
Last Viral Load: {{ patientData?.latest_vl | zeroVl }}
<ng-container *ngIf="patientData.latest_vl !== undefined">
(<span>{{
Expand All @@ -135,6 +126,12 @@ <h4 class="component-title">Last Encounter</h4>
>)
</ng-container>
</p>
<p
*ngIf="isHEIActive"
[ngClass]="{ 'text-bold red': isVirallyUnsuppressed }"
>
Age PCR Done: {{ age_of_ped_on_last_pcr }}M
</p>
<p>
<i
style="font-size: smaller"
Expand All @@ -158,7 +155,12 @@ <h4 class="component-title">Last Encounter</h4>
</div>
<div class="col-md-12">
<div class="col-md-6 col-xs-12">
<p>RTC Date: {{ patientData?.rtc_date | date: 'dd-MM-yyyy' }}</p>
<p *ngIf="!isHEIActive">
RTC Date: {{ patientData?.rtc_date | date: 'dd-MM-yyyy' }}
</p>
<p *ngIf="isHEIActive">
Infant Feeding Method: {{ infant_feeding_method }}
</p>

<p *ngIf="!isHEIActive">
Disclosure Status:
Expand Down Expand Up @@ -211,6 +213,14 @@ <h4 class="component-title">Last Encounter</h4>
</p>
</div>
</div>
<div *ngIf="isHEIActive" class="col-md-6 col-xs-12">
<p>
PCR Results:
<span style="text-transform: capitalize">
{{ 'NEGATIVE' }}
</span>
</p>
</div>
<div
class="col-md-6 col-xs-12"
*ngIf="showCareStatus && !isHEIActive"
Expand Down Expand Up @@ -303,6 +313,14 @@ <h4 class="component-title">Last Encounter</h4>
</div>
</div>
</div>
<div *ngIf="isHEIActive" class="col-md-12">
<div class="col-md-6 col-xs-12">
<p>RTC Date: {{ patientData?.rtc_date | date: 'dd-MM-yyyy' }}</p>
</div>
<div class="col-md-6 col-xs-12">
<p>Date of PCR: {{ last_pcr_date | date: 'dd-MM-yyyy' }}</p>
</div>
</div>
<div class="clear"></div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ export class HivProgramSnapshotComponent implements OnInit {
public prediction: any;

public isHEIActive = false;
public age_of_ped_on_last_pcr: number;
public last_pcr_status: string;
public last_pcr_date: string;
public infant_feeding_method: string;

constructor(
private hivSummaryResourceService: HivSummaryResourceService,
Expand Down Expand Up @@ -251,6 +255,15 @@ export class HivProgramSnapshotComponent implements OnInit {
this.resolveLastEncounterLocation(this.patientData.location_uuid);
}
}
if (this.isHEIActive) {
this.last_pcr_date = this.getLastPCRDate();
this.last_pcr_status = this.getLastPCRStatus();
this.infant_feeding_method = this.getInfantFeedingMethod();
this.age_of_ped_on_last_pcr = moment(this.last_pcr_date).diff(
moment(this.patientData.birth_date),
'months'
);
}
});
}

Expand Down Expand Up @@ -725,4 +738,79 @@ export class HivProgramSnapshotComponent implements OnInit {

return latestStatus[0];
}

public getLastPCRDate(): string {
let last_pcr_date = '';

if (this.patientData.hiv_dna_pcr_4_date !== null) {
last_pcr_date = this.patientData.hiv_dna_pcr_4_date;
} else if (this.patientData.hiv_dna_pcr_3_date !== null) {
last_pcr_date = this.patientData.hiv_dna_pcr_3_date;
} else if (this.patientData.hiv_dna_pcr_2_date !== null) {
last_pcr_date = this.patientData.hiv_dna_pcr_2_date;
} else if (this.patientData.hiv_dna_pcr_1_date !== null) {
last_pcr_date = this.patientData.hiv_dna_pcr_1_date;
} else {
return '';
}

return last_pcr_date;
}

public getLastPCRStatus(): string {
let last_pcr_status: number;

if (this.patientData.hiv_dna_pcr_resulted !== null) {
last_pcr_status = this.patientData.hiv_dna_pcr_resulted;
} else if (this.patientData.hiv_dna_pcr_4 !== null) {
last_pcr_status = this.patientData.hiv_dna_pcr_4;
} else if (this.patientData.hiv_dna_pcr_3 !== null) {
last_pcr_status = this.patientData.hiv_dna_pcr_3;
} else if (this.patientData.hiv_dna_pcr_2 !== null) {
last_pcr_status = this.patientData.hiv_dna_pcr_2;
} else if (this.patientData.hiv_dna_pcr_1 !== null) {
last_pcr_status = this.patientData.hiv_dna_pcr_1;
} else {
last_pcr_status = null;
}
if (last_pcr_status === 664) {
return 'NEGATIVE';
} else if (last_pcr_status === 703) {
return 'POSITIVE';
} else if (last_pcr_status === 1118) {
return 'NOT DONE';
} else if (last_pcr_status === 1138) {
return 'INDETERMINATE';
} else if (last_pcr_status === 1304) {
return 'POOR SAMPLE QUALITY';
} else {
return 'NONE';
}
}

public getInfantFeedingMethod(): string {
const INFANT_FEEDING_METHODS = [
'NONE',
'EXPRESSED BREASTMILK',
'WEANED',
'INFANT FORMULA',
'BREASTFEEDING PREDOMINATELY',
'MIXED FEEDING',
'BREASTFEEDING EXCLUSIVELY',
'COW MILK',
'REGULAR FOOD',
'BREASTFEEDING',
'LIQUID FOODS OTHER THAN BREAST MILK',
'WATER',
'SOLID FOOD',
'UJI',
'OTHER NON-CODED',
'COMPLEMENTARY FEEDING',
'PLUMPY NUT',
'NEVER BREASTFED',
'CHILD ON REPLACEMENT FEEDING'
];

return INFANT_FEEDING_METHODS[this.patientData.infant_feeding_method];
}
}

0 comments on commit 6630ed0

Please sign in to comment.