Skip to content

Commit

Permalink
Merge branch 'develop' into mar-binning
Browse files Browse the repository at this point in the history
  • Loading branch information
rithviknishad committed Oct 9, 2023
2 parents 1ce94cd + 83597f1 commit 1c2944c
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 22 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
2 changes: 1 addition & 1 deletion src/Components/Auth/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export const Login = (props: { forgot?: boolean }) => {
body: { ...valid },
});
setLoading(false);
if (res && res.statusText === "OK") {
if (res?.ok) {
Notification.Success({
msg: t("password_sent"),
});
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Auth/ResetPassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const ResetPassword = (props: any) => {
const { res, error } = await request(routes.resetPassword, {
body: { ...valid },
});
if (res && res.statusText === "OK") {
if (res?.ok) {
localStorage.removeItem(LocalStorageKeys.accessToken);
Notification.Success({
msg: t("password_reset_success"),
Expand All @@ -89,7 +89,7 @@ export const ResetPassword = (props: any) => {
const { res } = await request(routes.checkResetToken, {
body: { token: props.token },
});
if (!res || res.statusText !== "OK") {
if (!res || !res.ok) {
navigate("/invalid-reset");
}
};
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
3 changes: 3 additions & 0 deletions src/Redux/api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,23 @@ const routes = {
checkResetToken: {
path: "/api/v1/password_reset/check/",
method: "POST",
noAuth: true,
TRes: Type<Record<string, never>>(),
TBody: Type<{ token: string }>(),
},

resetPassword: {
path: "/api/v1/password_reset/confirm/",
method: "POST",
noAuth: true,
TRes: Type<Record<string, never>>(),
TBody: Type<{ password: string; confirm: string }>(),
},

forgotPassword: {
path: "/api/v1/password_reset/",
method: "POST",
noAuth: true,
TRes: Type<Record<string, never>>(),
TBody: Type<{ username: string }>(),
},
Expand Down

0 comments on commit 1c2944c

Please sign in to comment.