From 6dd2a9320b7c1b80795d8d96e0888c6e1496955a Mon Sep 17 00:00:00 2001 From: Henry Korir <5462699+henrykorir@users.noreply.github.com> Date: Fri, 29 Sep 2023 09:53:49 +0300 Subject: [PATCH] POC-536: Display all the available PCR results on the HEI summary (#1668) * POC-536: Display all the available PCR results on the HEI summary * POC-536: Display all the available PCR results on the HEI summary * Update hiv-summary-latest.component.ts --------- Co-authored-by: Drizzentic --- .../hiv-summary-latest.component.html | 38 +++++++++++-- .../hiv-summary-latest.component.ts | 55 +++++++++++++++++++ 2 files changed, 89 insertions(+), 4 deletions(-) diff --git a/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary-latest.component.html b/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary-latest.component.html index 213903d83..9bb83dba8 100644 --- a/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary-latest.component.html +++ b/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary-latest.component.html @@ -278,11 +278,41 @@ Current weight (kg): {{ hivSummary?.weight !== null ? hivSummary?.weight : 'NONE' }} -
  • - Last PCR status: {{ lastPCRStatus }} +
  • + PCR 1 +
    Age PCR Done: {{ pcrSnapShop?.hiv_dna_pcr_1_at }}M
    +
    PCR Results: {{ pcrSnapShop?.hiv_dna_pcr_1 }}
    +
    + Date Done: {{ hivSummary?.hiv_dna_pcr_1_date | date: 'dd-MM-yyyy' }} +
  • -
  • - Last PCR Date: {{ lastPCRDate | date: 'dd-MM-yyyy' }} +
  • + PCR 2 +
    Age PCR Done: {{ pcrSnapShop?.hiv_dna_pcr_2_at }}M
    +
    PCR Results: {{ pcrSnapShop?.hiv_dna_pcr_2 }}
    +
    + Date Done: {{ hivSummary?.hiv_dna_pcr_2_date | date: 'dd-MM-yyyy' }} +
    +
  • +
  • + PCR 3 +
    Age PCR Done: {{ pcrSnapShop?.hiv_dna_pcr_3_at }}M
    +
    PCR Results: {{ pcrSnapShop?.hiv_dna_pcr_3 }}
    +
    + Date Done: {{ hivSummary?.hiv_dna_pcr_3_date | date: 'dd-MM-yyyy' }} +
  • Current ART Prophylaxis: {{ hivSummary?.cur_arv_meds }} diff --git a/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary-latest.component.ts b/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary-latest.component.ts index 0c1b3edbf..5f717a050 100644 --- a/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary-latest.component.ts +++ b/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary-latest.component.ts @@ -58,6 +58,14 @@ export class HivSummaryLatestComponent implements OnInit, OnDestroy { public infantFeedingMethod: string; public heiOutCome: string; public pcpProphylaxis: string; + public pcrSnapShop = { + hiv_dna_pcr_1: null, + hiv_dna_pcr_1_at: null, + hiv_dna_pcr_2: null, + hiv_dna_pcr_2_at: null, + hiv_dna_pcr_3: null, + hiv_dna_pcr_3_at: null + }; constructor( private hivSummaryService: HivSummaryService, @@ -243,6 +251,7 @@ export class HivSummaryLatestComponent implements OnInit, OnDestroy { this.infantFeedingMethod = this.getInfantFeedingMethod(); this.heiOutCome = this.getHEIOutcome(); this.pcpProphylaxis = this.getPCPprophylaxis(); + this.getHEIPCRSnapshot(); } } this.getPatientEligibility(this.hivSummary); @@ -469,4 +478,50 @@ export class HivSummaryLatestComponent implements OnInit, OnDestroy { } return 'NONE'; } + + private pcr_status_helper(pcr_status: number): string { + if (pcr_status === 664) { + return 'NEGATIVE'; + } else if (pcr_status === 703) { + return 'POSITIVE'; + } else if (pcr_status === 1118) { + return 'NOT DONE'; + } else if (pcr_status === 1138) { + return 'INDETERMINATE'; + } else if (pcr_status === 1304) { + return 'POOR SAMPLE QUALITY'; + } else { + return 'NONE'; + } + } + + private calculate_age_by_pcr_date(pcr_date: string): number { + const age = Moment(pcr_date).diff( + Moment(this.hivSummary.birth_date), + 'months' + ); + return age; + } + + public getHEIPCRSnapshot(): void { + this.pcrSnapShop.hiv_dna_pcr_1 = this.pcr_status_helper( + this.hivSummary.hiv_dna_pcr_1 + ); + this.pcrSnapShop.hiv_dna_pcr_2 = this.pcr_status_helper( + this.hivSummary.hiv_dna_pcr_2 + ); + this.pcrSnapShop.hiv_dna_pcr_3 = this.pcr_status_helper( + this.hivSummary.hiv_dna_pcr_3 + ); + + this.pcrSnapShop.hiv_dna_pcr_1_at = this.calculate_age_by_pcr_date( + this.hivSummary.hiv_dna_pcr_1_date + ); + this.pcrSnapShop.hiv_dna_pcr_2_at = this.calculate_age_by_pcr_date( + this.hivSummary.hiv_dna_pcr_2_date + ); + this.pcrSnapShop.hiv_dna_pcr_3_at = this.calculate_age_by_pcr_date( + this.hivSummary.hiv_dna_pcr_3_date + ); + } }