From fb0608e8a79820b503bd2749d2ed548ecc015a8f Mon Sep 17 00:00:00 2001 From: Devansh Kaushik Date: Wed, 12 May 2021 02:29:27 +0530 Subject: [PATCH] Added bed occupancy column to oxygen dashboard --- src/components/DistrictDashboard/OxygenMonitor.js | 7 ++++++- src/utils/constants.js | 13 +++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/components/DistrictDashboard/OxygenMonitor.js b/src/components/DistrictDashboard/OxygenMonitor.js index 9626d57..26b774a 100644 --- a/src/components/DistrictDashboard/OxygenMonitor.js +++ b/src/components/DistrictDashboard/OxygenMonitor.js @@ -5,7 +5,7 @@ import React, { lazy, Suspense, useMemo } from "react"; import useSWR from "swr"; import { careSummary } from "../../utils/api"; -import { OXYGEN_TYPES } from "../../utils/constants"; +import { OXYGEN_TYPES, AVAILABILITY_TYPES_OXYGEN } from "../../utils/constants"; import { dateString, getNDateAfter, @@ -178,9 +178,14 @@ function OxygenMonitor({ filterDistrict, filterFacilityTypes, date }) { Object.keys(c.inventory).length !== 0 && (c.inventory[2] || c.inventory[4] || c.inventory[5] || c.inventory[6]) ) { + const bedOccupency = AVAILABILITY_TYPES_OXYGEN.map( + (k) => c.capacity[k]?.current_capacity || 0 + ).reduce((a, b) => a + b, 0); + const arr = [ [ [c.name, c.facilityType, c.phoneNumber], + [bedOccupency], [c.oxygenCapacity], showStockWithBurnRate(c.inventory[2]), showStockWithBurnRate(c.inventory[4]), diff --git a/src/utils/constants.js b/src/utils/constants.js index e95596f..3715a79 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.js @@ -30,6 +30,18 @@ export const AVAILABILITY_TYPES_ORDERED = [ 40, ]; +export const AVAILABILITY_TYPES_OXYGEN = [ + 10, + 20, + 50, + 60, + 70, + 100, + 110, + 120, + 150, +]; + export const AVAILABILITY_TYPES = { 20: "Ventilator", 10: "ICU", @@ -120,6 +132,7 @@ export const FACILITY_TYPES = [ ]; export const OXYGEN_TYPES = [ + "Bed Occupancy", "Tank Capacity", "Oxygen Tank", "Cylinder D",