Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added bed occupancy column to oxygen dashboard #99

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/components/DistrictDashboard/OxygenMonitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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]),
Expand Down
13 changes: 13 additions & 0 deletions src/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ export const AVAILABILITY_TYPES_ORDERED = [
40,
];

export const AVAILABILITY_TYPES_OXYGEN = [
10,
20,
50,
60,
70,
100,
110,
120,
150,
];
Comment on lines +33 to +43
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 what are these constants?


export const AVAILABILITY_TYPES = {
20: "Ventilator",
10: "ICU",
Expand Down Expand Up @@ -120,6 +132,7 @@ export const FACILITY_TYPES = [
];

export const OXYGEN_TYPES = [
"Bed Occupancy",
"Tank Capacity",
"Oxygen Tank",
"Cylinder D",
Expand Down