Skip to content

Commit

Permalink
Merge branch 'coronasafe:develop' into fix#6360
Browse files Browse the repository at this point in the history
  • Loading branch information
konavivekramakrishna authored Oct 8, 2023
2 parents d09cd54 + 83597f1 commit 435778f
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 19 deletions.
4 changes: 2 additions & 2 deletions cypress/pageobject/Patient/PatientConsultation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ export class PatientConsultationPage {
.click()
.type("1A");
cy.get("#icd11_diagnoses_object [role='option']")
.contains("1A03 Intestinal infections due to Escherichia coli")
.contains("1A00 Cholera")
.scrollIntoView()
.click();
cy.get("label[for='icd11_diagnoses_object']").click();
cy.wait("@getIcdResults").its("response.statusCode").should("eq", 200);

cy.get("#icd11_principal_diagnosis [role='combobox']").click().type("1A");
cy.get("#icd11_principal_diagnosis [role='option']")
.contains("1A03 Intestinal infections due to Escherichia coli")
.contains("1A00 Cholera")
.click();

cy.get("#consultation_notes").click().type(consulationNotes);
Expand Down
12 changes: 2 additions & 10 deletions src/Components/Common/DateInputV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ const DateInputV2: React.FC<Props> = ({
)
);
close();
setIsOpen?.(false);
};

const getDayCount = (date: Date) => {
Expand Down Expand Up @@ -212,13 +213,7 @@ const DateInputV2: React.FC<Props> = ({
<Popover className="relative">
{({ open, close }) => (
<div>
<Popover.Button
disabled={disabled}
className="w-full"
onClick={() => {
setIsOpen?.(!isOpen);
}}
>
<Popover.Button disabled={disabled} className="w-full">
<input type="hidden" name="date" />
<input
id={id}
Expand All @@ -237,9 +232,6 @@ const DateInputV2: React.FC<Props> = ({

{(open || isOpen) && (
<Popover.Panel
onBlur={() => {
setIsOpen?.(false);
}}
static
className={classNames(
"cui-dropdown-base absolute mt-0.5 w-72 divide-y-0 p-4",
Expand Down
36 changes: 31 additions & 5 deletions src/Components/VitalsMonitor/HL7PatientVitalsMonitor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ import { classNames } from "../../Utils/utils";
import { IVitalsComponentProps, VitalsValueBase } from "./types";
import { triggerGoal } from "../../Integrations/Plausible";
import useAuthUser from "../../Common/hooks/useAuthUser";
import dayjs from "dayjs";

const minutesAgo = (timestamp: string) => {
return `${dayjs().diff(dayjs(timestamp), "minute")}m ago`;
};

const isWithinMinutes = (timestamp: string, minutes: number) => {
return dayjs().diff(dayjs(timestamp), "minute") < minutes;
};

export default function HL7PatientVitalsMonitor(props: IVitalsComponentProps) {
const { connect, waveformCanvas, data, isOnline } = useHL7VitalsMonitor(
Expand All @@ -30,6 +39,10 @@ export default function HL7PatientVitalsMonitor(props: IVitalsComponentProps) {
connect(props.socketUrl);
}, [props.socketUrl]);

const bpWithinMaxPersistence = !!(
(data.bp?.["date-time"] && isWithinMinutes(data.bp?.["date-time"], 30)) // Max blood pressure persistence is 30 minutes
);

return (
<div className="flex flex-col gap-1 rounded bg-[#020617] p-2">
{props.patientAssetBed && (
Expand Down Expand Up @@ -97,24 +110,37 @@ export default function HL7PatientVitalsMonitor(props: IVitalsComponentProps) {

{/* Blood Pressure */}
<div className="flex flex-col p-1">
<div className="flex w-full gap-2 font-bold text-orange-500">
<div className="flex w-full justify-between gap-2 font-bold text-orange-500">
<span className="text-sm">NIBP</span>
<span className="text-xs">{data.bp?.systolic.unit ?? "--"}</span>
<span className="text-xs">
{bpWithinMaxPersistence ? data.bp?.systolic.unit ?? "--" : "--"}
</span>
<span className="text-xs">
{data.bp?.["date-time"] && minutesAgo(data.bp?.["date-time"])}
</span>
</div>
<div className="flex w-full justify-center text-sm font-medium text-orange-500">
Sys / Dia
</div>
<div className="flex w-full justify-center text-2xl font-black text-orange-300 md:text-4xl">
<span>{data.bp?.systolic.value ?? "--"}</span>
<span>
{bpWithinMaxPersistence
? data.bp?.systolic.value ?? "--"
: "--"}
</span>
<span>/</span>
<span>{data.bp?.diastolic.value ?? "--"}</span>
<span>
{bpWithinMaxPersistence
? data.bp?.diastolic.value ?? "--"
: "--"}
</span>
</div>
<div className="flex items-end">
<span className="flex-1 text-sm font-bold text-orange-500">
Mean
</span>
<span className="flex-1 text-xl font-bold text-gray-300">
{data.bp?.map.value ?? "--"}
{bpWithinMaxPersistence ? data.bp?.map.value ?? "--" : "--"}
</span>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/Components/VitalsMonitor/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface VitalsDataBase {
"patient-name": string;
}

export interface VitalsValueBase {
export interface VitalsValueBase extends VitalsDataBase {
value: number;
unit: string;
interpretation: string;
Expand Down
3 changes: 2 additions & 1 deletion src/Components/VitalsMonitor/useHL7VitalsMonitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import useCanvas from "../../Common/hooks/useCanvas";
import {
ChannelOptions,
IVitalsComponentProps,
VitalsDataBase,
VitalsValueBase as VitalsValue,
} from "./types";
import { getChannel, getVitalsCanvasSizeAndDuration } from "./utils";

interface VitalsBPValue {
interface VitalsBPValue extends VitalsDataBase {
systolic: VitalsValue;
diastolic: VitalsValue;
map: VitalsValue;
Expand Down

0 comments on commit 435778f

Please sign in to comment.