From ae4de5f5b419c9203e1973bfa21f93650f3cb8bc Mon Sep 17 00:00:00 2001 From: Vineet Sharma Date: Wed, 17 Apr 2024 20:44:18 +0530 Subject: [PATCH] (fix) O3-3046: Updated the interpretation keys for vital signs matching table headers (#1791) --- __mocks__/vitals-and-biometrics.mock.ts | 8 ++++---- .../src/common/data.resource.ts | 11 ++++++++--- packages/esm-patient-vitals-app/src/common/types.ts | 2 +- .../vitals-header.test.tsx | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/__mocks__/vitals-and-biometrics.mock.ts b/__mocks__/vitals-and-biometrics.mock.ts index afdc06e17e..9383ee5415 100644 --- a/__mocks__/vitals-and-biometrics.mock.ts +++ b/__mocks__/vitals-and-biometrics.mock.ts @@ -6020,7 +6020,7 @@ export const formattedVitals = [ diastolic: 89, systolic: 121, bmi: null, - bloodPressureInterpretation: 'normal', + bloodPressureRenderInterpretation: 'normal', }, { id: '1', @@ -6034,7 +6034,7 @@ export const formattedVitals = [ temperature: 37, spo2: 90, bmi: 23, - bloodPressureInterpretation: 'normal', + bloodPressureRenderInterpretation: 'normal', }, { id: '2', @@ -6042,7 +6042,7 @@ export const formattedVitals = [ diastolic: 80, systolic: 120, bmi: null, - bloodPressureInterpretation: 'normal', + bloodPressureRenderInterpretation: 'normal', }, { id: '3', @@ -6053,7 +6053,7 @@ export const formattedVitals = [ pulse: 78, respiratoryRate: 65, bmi: 22.6, - bloodPressureInterpretation: 'normal', + bloodPressureRenderInterpretation: 'normal', }, ]; diff --git a/packages/esm-patient-vitals-app/src/common/data.resource.ts b/packages/esm-patient-vitals-app/src/common/data.resource.ts index 4166fe792a..6c4db2645a 100644 --- a/packages/esm-patient-vitals-app/src/common/data.resource.ts +++ b/packages/esm-patient-vitals-app/src/common/data.resource.ts @@ -52,6 +52,11 @@ interface VitalsConceptMetadataResponse { }>; } +function getInterpretationKey(header: string) { + // Reason for `Render` string is to match the column header in the table + return `${header}RenderInterpretation`; +} + export function useVitalsConceptMetadata() { const customRepresentation = 'custom:(setMembers:(uuid,display,hiNormal,hiAbsolute,hiCritical,lowNormal,lowAbsolute,lowCritical,units))'; @@ -205,13 +210,13 @@ export function useVitalsAndBiometrics(patientUuid: string, mode: VitalsAndBiome vitalsHashTable.set(recordedDate, { ...vitalsHashTable.get(recordedDate), [getVitalsMapKey(vitalSign.code)]: vitalSign.value, - [getVitalsMapKey(vitalSign.code) + 'Interpretation']: vitalSign.interpretation, + [getInterpretationKey(getVitalsMapKey(vitalSign.code))]: vitalSign.interpretation, }); } else { vitalSign.value && vitalsHashTable.set(recordedDate, { [getVitalsMapKey(vitalSign.code)]: vitalSign.value, - [getVitalsMapKey(vitalSign.code) + 'Interpretation']: vitalSign.interpretation, + [getInterpretationKey(getVitalsMapKey(vitalSign.code))]: vitalSign.interpretation, }); } @@ -230,7 +235,7 @@ export function useVitalsAndBiometrics(patientUuid: string, mode: VitalsAndBiome } if (mode === 'both' || mode === 'vitals') { - result.bloodPressureInterpretation = interpretBloodPressure( + result.bloodPressureRenderInterpretation = interpretBloodPressure( vitalSigns.systolic, vitalSigns.diastolic, concepts, diff --git a/packages/esm-patient-vitals-app/src/common/types.ts b/packages/esm-patient-vitals-app/src/common/types.ts index d12a8ab83d..d576ab7e1b 100644 --- a/packages/esm-patient-vitals-app/src/common/types.ts +++ b/packages/esm-patient-vitals-app/src/common/types.ts @@ -30,7 +30,7 @@ export interface PatientVitalsAndBiometrics { date: string; systolic?: number; diastolic?: number; - bloodPressureInterpretation?: ObservationInterpretation; + bloodPressureRenderInterpretation?: ObservationInterpretation; pulse?: number; temperature?: number; spo2?: number; diff --git a/packages/esm-patient-vitals-app/src/vitals-and-biometrics-header/vitals-header.test.tsx b/packages/esm-patient-vitals-app/src/vitals-and-biometrics-header/vitals-header.test.tsx index cceace1f9a..80f1cfac26 100644 --- a/packages/esm-patient-vitals-app/src/vitals-and-biometrics-header/vitals-header.test.tsx +++ b/packages/esm-patient-vitals-app/src/vitals-and-biometrics-header/vitals-header.test.tsx @@ -121,7 +121,7 @@ describe('VitalsHeader: ', () => { date: '2022-05-19T00:00:00.000Z', systolic: 165, diastolic: 150, - bloodPressureInterpretation: 'critically_high', + bloodPressureRenderInterpretation: 'critically_high', pulse: 76, spo2: undefined, temperature: 37,