Skip to content

Commit 1bdb3b2

Browse files
authored
HIV Viral Load Date should fall back to the encounter date if not present
1 parent a3aee46 commit 1bdb3b2

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

packages/esm-care-panel-app/src/vl-history/vl-history.resource.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,28 @@ export function usePatientObservations(patientUuid, conceptUuids) {
3030
const coding = observation?.code?.coding[0];
3131
if (coding?.code === `${configSchema.hivViralLoadUuid._default}` && observation?.valueQuantity) {
3232
acc[effectiveDateTime].valuesArray.push(observation.valueQuantity.value);
33-
} else if (coding?.code === `${configSchema.hivViralLoadDateUuid._default}` && observation?.effectiveDateTime) {
33+
}
34+
35+
if (coding?.code === `${configSchema.hivViralLoadDateUuid._default}`) {
3436
acc[effectiveDateTime].dateArray.push(observation.effectiveDateTime);
35-
} else if (
37+
}
38+
39+
if (
3640
coding?.code === `${configSchema.hivViralLoadQualitativeUuid._default}` &&
3741
observation?.valueCodeableConcept
3842
) {
3943
acc[effectiveDateTime].displayArray.push(observation.valueCodeableConcept?.coding[0]?.display);
4044
}
4145

46+
if (acc[effectiveDateTime].dateArray.length === 0) {
47+
acc[effectiveDateTime].dateArray.push(observation.effectiveDateTime);
48+
}
49+
4250
return acc;
4351
}, {});
4452

4553
return groupedObservations;
4654
}, [data]);
47-
4855
return {
4956
observations: observationsByDate,
5057
isLoading: isValidating,

0 commit comments

Comments
 (0)