Skip to content

Commit

Permalink
Fix linting errors and add ventilator icon
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashesh3 committed Jun 23, 2023
1 parent 4570aba commit 31ed9ae
Show file tree
Hide file tree
Showing 25 changed files with 167 additions and 180 deletions.
4 changes: 4 additions & 0 deletions src/CAREUI/icons/UniconPaths.json
Original file line number Diff line number Diff line change
Expand Up @@ -4826,5 +4826,9 @@
"M 240.597 461.473 C 220.81 461.029 192.233 463.058 178.057 454.48 C 164.694 445.827 162.683 425.894 165.82 412.187 C 168.959 398.48 177.502 388.694 196.136 384.235 C 214.77 379.777 243.494 380.758 257.859 381.084 L 277.091 381.519 M 232 461.492 L 421.232 460.324 M 329.715 263.31 L 245.019 461.334 M 75.568 466.762 L 75.605 428.08 C 75.643 393.838 75.716 325.356 103.858 291.044 C 131.997 256.732 188.204 256.591 244.837 256.666 C 301.471 256.739 358.534 257.029 386.994 291.326 C 415.453 325.624 415.309 393.93 415.237 428.084 L 415 466.397 M 316.704 107.273 C 316.704 146.649 284.782 178.571 245.405 178.571 C 206.03 178.571 174.109 146.649 174.109 107.273 C 174.109 67.897 206.03 35.976 245.405 35.976 C 284.782 35.976 316.704 67.897 316.704 107.273 Z",
false,
40
],
"l-lungs" :[
640,
"M636.11 390.15C614.44 308.85 580.07 231 534.1 159.13 511.98 124.56 498.03 96 454.05 96 415.36 96 384 125.42 384 161.71v60.11l-32.88-21.92a15.996 15.996 0 0 1-7.12-13.31V16c0-8.84-7.16-16-16-16h-16c-8.84 0-16 7.16-16 16v170.59c0 5.35-2.67 10.34-7.12 13.31L256 221.82v-60.11C256 125.42 224.64 96 185.95 96c-43.98 0-57.93 28.56-80.05 63.13C59.93 231 25.56 308.85 3.89 390.15 1.3 399.84 0 409.79 0 419.78 0 472.11 45.63 512 98.07 512c18.09 0 24.45-2.87 86.68-19.55 42.18-11.3 71.26-47.47 71.26-88.62v-87.49l-48 32v55.49c0 19.25-14.67 36.62-35.68 42.25C107.71 463.4 107.88 464 98.07 464c-30.31 0-57.91-23.57-47.79-61.49C70.68 325.93 103 252.74 146.33 185c23.04-36.41 25.34-41 39.62-41 11.95 0 22.05 8.11 22.05 17.71v92.11l-80 53.33c-7.35 4.9-9.34 14.83-4.44 22.19l8.88 13.31c4.9 7.35 14.84 9.34 22.19 4.44L320 236.84l165.38 110.25c7.35 4.9 17.29 2.91 22.19-4.44l8.88-13.31c4.9-7.35 2.91-17.29-4.44-22.19l-80-53.33v-92.11c0-9.6 10.1-17.71 22.05-17.71 14.28 0 16.57 4.59 39.62 41 43.33 67.74 75.65 140.93 96.06 217.51 10.12 37.92-17.48 61.49-47.79 61.49-9.81 0-9.64-.6-74.25-17.91-21.01-5.63-35.68-23.01-35.68-42.25v-55.49l-48-32v87.49c0 41.15 29.08 77.31 71.26 88.62 62.22 16.68 68.59 19.55 86.68 19.55 52.44 0 98.07-39.89 98.07-92.22-.03-10-1.33-19.95-3.92-29.64z"
]
}
6 changes: 3 additions & 3 deletions src/Components/Assets/AssetManage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const AssetManage = (props: AssetManageProps) => {
const assetData = await dispatch(getAsset(assetId));
if (!status.aborted) {
setIsLoading(false);
if (assetData && assetData.data) {
if (assetData?.data) {
setAsset(assetData.data);

const transactionFilter = assetData.qr_code_id
Expand All @@ -77,7 +77,7 @@ const AssetManage = (props: AssetManageProps) => {
offset,
})
);
if (transactionsData && transactionsData.data) {
if (transactionsData?.data) {
setTransactions(transactionsData.data.results);
setTotalCount(transactionsData.data.count);
} else {
Expand Down Expand Up @@ -124,7 +124,7 @@ const AssetManage = (props: AssetManageProps) => {
</div>
<h2 className="text-center">Print Preview</h2>
<div id="section-to-print" className="print flex justify-center">
<QRCode size={200} value={asset?.id || ""} />
<QRCode size={200} value={asset?.id ?? ""} />
</div>
</div>
);
Expand Down
5 changes: 5 additions & 0 deletions src/Components/Assets/AssetTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ export const assetClassProps = {
description: "",
icon: "monitor-heart-rate",
},
VENTILATOR: {
name: "Ventilator",
description: "",
icon: "lungs",
},
NONE: {
name: "N/A",
icon: "box",
Expand Down
13 changes: 7 additions & 6 deletions src/Components/Assets/AssetsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
getAnyFacility,
listAssets,
getFacilityAssetLocation,
getAsset,
} from "../../Redux/actions";
import { assetClassProps, AssetData } from "./AssetTypes";
import { getAsset } from "../../Redux/actions";
import { useState, useCallback, useEffect } from "react";
import { Link, navigate } from "raviger";
import loadable from "@loadable/component";
Expand Down Expand Up @@ -241,6 +241,7 @@ const AssetsList = () => {
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 md:-mx-8 gap-2">
{assets.map((asset: AssetData) => (
<Link
key={asset.id}
href={`/facility/${asset?.location_object.facility.id}/assets/${asset.id}`}
className="text-inherit"
>
Expand Down Expand Up @@ -394,12 +395,12 @@ const AssetsList = () => {
<>
<FilterBadges
badges={({ badge, value }) => [
value("Facility", "facility", facilityName || ""),
value("Facility", "facility", facilityName ?? ""),
badge("Name/Serial No./QR ID", "search"),
value("Asset Type", "asset_type", asset_type || ""),
value("Asset Class", "asset_class", asset_class || ""),
value("Status", "status", status?.replace(/_/g, " ") || ""),
value("Location", "location", locationName || ""),
value("Asset Type", "asset_type", asset_type ?? ""),
value("Asset Class", "asset_class", asset_class ?? ""),
value("Status", "status", status?.replace(/_/g, " ") ?? ""),
value("Location", "location", locationName ?? ""),
]}
/>
<div className="grow">
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Common/AddCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface AddCardProps {
onClick: any;
}

const useStyles = makeStyles((theme) => ({
const useStyles = makeStyles((_theme) => ({
card: {
background: "#ffffff",
border: "dashed 1px #333",
Expand Down
8 changes: 4 additions & 4 deletions src/Components/CriticalCareRecording/CriticalCare__API.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { fireRequestV2 } from "../../Redux/fireRequest";
export const loadDailyRound = (
consultationId: string,
id: string,
successCB: any = () => {},
errorCB: any = () => {}
successCB: any = () => null,
errorCB: any = () => null
) => {
fireRequestV2("getDailyReport", [], {}, successCB, errorCB, {
consultationId,
Expand All @@ -16,8 +16,8 @@ export const updateDailyRound = (
consultationId: string,
id: string,
params: object,
successCB: any = () => {},
errorCB: any = () => {}
successCB: any = () => null,
errorCB: any = () => null
) => {
fireRequestV2("updateDailyRound", [], params, successCB, errorCB, {
consultationId,
Expand Down
54 changes: 25 additions & 29 deletions src/Components/Facility/ConsultationDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,7 @@ export const ConsultationDetails = (props: any) => {
`${patientData.address},\n${patientData.ward_object?.name},\n${patientData.local_body_object?.name},\n${patientData.district_object?.name},\n${patientData.state_object?.name}`;

const getPatientComorbidities = (patientData: any) => {
if (
patientData &&
patientData.medical_history &&
patientData.medical_history.length
) {
if (patientData?.medical_history?.length) {
const medHis = patientData.medical_history;
return medHis.map((item: any) => item.disease).join(", ");
} else {
Expand All @@ -100,12 +96,12 @@ export const ConsultationDetails = (props: any) => {
setIsLoading(true);
const res = await dispatch(getConsultation(consultationId));
if (!status.aborted) {
if (res && res.data) {
if (res?.data) {
const data: ConsultationModel = {
...res.data,
symptoms_text: "",
};
if (res.data.symptoms && res.data.symptoms.length) {
if (res.data.symptoms?.length) {
const symptoms = res.data.symptoms
.filter((symptom: number) => symptom !== 9)
.map((symptom: number) => {
Expand All @@ -117,7 +113,7 @@ export const ConsultationDetails = (props: any) => {
setConsultationData(data);
const id = res.data.patient;
const patientRes = await dispatch(getPatient({ id }));
if (patientRes && patientRes.data) {
if (patientRes?.data) {
const patientGender = getPatientGender(patientRes.data);
const patientAddress = getPatientAddress(patientRes.data);
const patientComorbidities = getPatientComorbidities(
Expand Down Expand Up @@ -297,7 +293,7 @@ export const ConsultationDetails = (props: any) => {
{consultationData.admitted_to}
</span>
</div>
{(consultationData.admission_date ||
{(consultationData.admission_date ??
consultationData.discharge_date) && (
<div className="text-3xl font-bold">
{moment(
Expand Down Expand Up @@ -346,7 +342,7 @@ export const ConsultationDetails = (props: any) => {
},
]
: []),
...(consultationData?.icd11_diagnoses_object || []),
...(consultationData?.icd11_diagnoses_object ?? []),
]}
label="Diagnosis (as per ICD-11 recommended by WHO)"
/>
Expand Down Expand Up @@ -422,7 +418,7 @@ export const ConsultationDetails = (props: any) => {
{CONSULTATION_TABS.map((p: OptionsType) => {
if (p.text === "FEED") {
if (
!consultationData?.current_bed?.bed_object?.id ||
!consultationData?.current_bed?.bed_object?.id ??
consultationData?.discharge_date !== null
)
return null;
Expand Down Expand Up @@ -470,7 +466,7 @@ export const ConsultationDetails = (props: any) => {
{DISCHARGE_REASONS.find(
(d) =>
d.id === consultationData.discharge_reason
)?.text || "--"}
)?.text ?? "--"}
</span>
</div>
{consultationData.discharge_reason === "REC" && (
Expand All @@ -489,12 +485,12 @@ export const ConsultationDetails = (props: any) => {
<div>
Advice {" - "}
<span className="font-semibold">
{consultationData.discharge_notes || "--"}
{consultationData.discharge_notes ?? "--"}
</span>
</div>
<div className="overflow-x-auto overflow-y-hidden">
<PrescriptionsTable
consultation_id={consultationData.id}
consultation_id={consultationData.id ?? ""}
is_prn={false}
readonly
prescription_type="DISCHARGE"
Expand All @@ -503,7 +499,7 @@ export const ConsultationDetails = (props: any) => {
<hr className="border border-gray-300 my-2"></hr>
<div className="overflow-x-auto overflow-y-hidden">
<PrescriptionsTable
consultation_id={consultationData.id}
consultation_id={consultationData.id ?? ""}
is_prn
readonly
prescription_type="DISCHARGE"
Expand All @@ -526,20 +522,20 @@ export const ConsultationDetails = (props: any) => {
<div>
Cause of death {" - "}
<span className="font-semibold">
{consultationData.discharge_notes || "--"}
{consultationData.discharge_notes ?? "--"}
</span>
</div>
<div>
Confirmed By {" - "}
<span className="font-semibold">
{consultationData.death_confirmed_doctor ||
{consultationData.death_confirmed_doctor ??
"--"}
</span>
</div>
</div>
)}
{["REF", "LAMA"].includes(
consultationData.discharge_reason || ""
consultationData.discharge_reason ?? ""
) && (
<div className="grid gap-4">
<div>
Expand All @@ -556,7 +552,7 @@ export const ConsultationDetails = (props: any) => {
<div>
Notes {" - "}
<span className="font-semibold">
{consultationData.discharge_notes || "--"}
{consultationData.discharge_notes ?? "--"}
</span>
</div>
</div>
Expand Down Expand Up @@ -586,7 +582,7 @@ export const ConsultationDetails = (props: any) => {
text={
SYMPTOM_CHOICES.find(
(choice) => choice.id === symptom
)?.text || "Err. Unknown"
)?.text ?? "Err. Unknown"
}
color={"primary"}
size={"small"}
Expand Down Expand Up @@ -626,7 +622,7 @@ export const ConsultationDetails = (props: any) => {
text={
SYMPTOM_CHOICES.find(
(choice) => choice.id === symptom
)?.text || "Err. Unknown"
)?.text ?? "Err. Unknown"
}
color={"primary"}
size={"small"}
Expand Down Expand Up @@ -717,7 +713,7 @@ export const ConsultationDetails = (props: any) => {
</div>
)}

{(consultationData.operation ||
{(consultationData.operation ??
consultationData.special_instruction) && (
<div className="bg-white overflow-hidden shadow rounded-lg">
<div className="px-4 py-5 sm:p-6">
Expand Down Expand Up @@ -878,25 +874,25 @@ export const ConsultationDetails = (props: any) => {
<div>
Gender {" - "}
<span className="font-semibold">
{patientData.gender || "-"}
{patientData.gender ?? "-"}
</span>
</div>
<div>
Age {" - "}
<span className="font-semibold">
{patientData.age || "-"}
{patientData.age ?? "-"}
</span>
</div>
<div>
Weight {" - "}
<span className="font-semibold">
{consultationData.weight || "-"} Kg
{consultationData.weight ?? "-"} Kg
</span>
</div>
<div>
Height {" - "}
<span className="font-semibold">
{consultationData.height || "-"} cm
{consultationData.height ?? "-"} cm
</span>
</div>
<div>
Expand All @@ -913,7 +909,7 @@ export const ConsultationDetails = (props: any) => {
<div>
Blood Group {" - "}
<span className="font-semibold">
{patientData.blood_group || "-"}
{patientData.blood_group ?? "-"}
</span>
</div>
</div>
Expand Down Expand Up @@ -1176,7 +1172,7 @@ const VitalsCard = ({ consultation }: { consultation: ConsultationModel }) => {
const hl7Meta = assetBeds.find(
(i) => i.asset_object.asset_class === AssetClass.HL7MONITOR
)?.asset_object?.meta;
const hl7Middleware = hl7Meta?.middleware_hostname || middleware_address;
const hl7Middleware = hl7Meta?.middleware_hostname ?? middleware_address;
if (hl7Middleware && hl7Meta?.local_ip_address) {
setHL7SocketUrl(
`wss://${hl7Middleware}/observations/${hl7Meta.local_ip_address}`
Expand All @@ -1187,7 +1183,7 @@ const VitalsCard = ({ consultation }: { consultation: ConsultationModel }) => {
(i) => i.asset_object.asset_class === AssetClass.VENTILATOR
)?.asset_object?.meta;
const ventilatorMiddleware =
ventilatorMeta?.middleware_hostname || middleware_address;
ventilatorMeta?.middleware_hostname ?? middleware_address;
if (ventilatorMiddleware && ventilatorMeta?.local_ip_address) {
setVentilatorSocketUrl(
`wss://${ventilatorMiddleware}/observations/${ventilatorMeta?.local_ip_address}`
Expand Down
Loading

0 comments on commit 31ed9ae

Please sign in to comment.