Skip to content

Commit

Permalink
hacks/treat-negative-bp-as-undefined (#6987)
Browse files Browse the repository at this point in the history
  • Loading branch information
rithviknishad authored Jan 6, 2024
1 parent fedb2e2 commit 7f6cc0c
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/Components/Facility/Consultations/PrimaryParametersPlot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ interface PrimaryParametersPlotProps {
consultationId: string;
}

const sanitizeBPAttribute = (value: number | undefined) => {
// Temp. hack until the cleaning of daily rounds as a db migration is done.
// TODO: remove once migration is merged.

if (value == null || value < 0) {
return;
}

return value;
};

export const PrimaryParametersPlot = ({
consultationId,
}: PrimaryParametersPlotProps) => {
Expand Down Expand Up @@ -77,19 +88,19 @@ export const PrimaryParametersPlot = ({
{
name: "diastolic",
data: Object.values(results)
.map((p: any) => p.bp && p.bp.diastolic)
.map((p: any) => p.bp && sanitizeBPAttribute(p.bp.diastolic))
.reverse(),
},
{
name: "systolic",
data: Object.values(results)
.map((p: any) => p.bp && p.bp.systolic)
.map((p: any) => p.bp && sanitizeBPAttribute(p.bp.systolic))
.reverse(),
},
{
name: "mean",
data: Object.values(results)
.map((p: any) => p.bp && p.bp.mean)
.map((p: any) => p.bp && sanitizeBPAttribute(p.bp.mean))
.reverse(),
},
];
Expand Down

0 comments on commit 7f6cc0c

Please sign in to comment.