Skip to content

Commit

Permalink
change the NIBP display from last 30 mins to current bed assignment d…
Browse files Browse the repository at this point in the history
…ate (#6479)

* change the NIBP display from last 30 mins to currect bed assignment date

* change model name to PascalCase and used PaginatedResponse to wrap the model

* use onResponse for useQuery

* resolved merge conflict

* move bed assignment date fetch logic to parent component

* replaced console log with notification for error

* change logic by passing date to VitalsMonitor and change models

* remove unused models and useState variables

* update the CNS to pass the bedAssignmentStartDate prop to HL7PatientVitalsMonitor component

* Reverted last commit

* update the CNS to pass the correct bedAssignmentStartDate to the VitalsMonitor component

* remove usage of useQuery and replaced the prop with existing data

* fix NIBP visibility bug in Vitals Monitor

* delete unused function

---------

Co-authored-by: Mohammed Nihal <[email protected]>
  • Loading branch information
sriharsh05 and nihal467 authored Nov 7, 2023
1 parent 585cb5a commit e8091bf
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/Components/Facility/CentralNursingStation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ export default function CentralNursingStation({ facilityId }: Props) {
{data.map((props) => (
<div className="overflow-hidden text-clip">
<HL7PatientVitalsMonitor
patientCurrentBedAssignmentDate={
props.patientAssetBed?.patient?.last_consultation?.current_bed
?.start_date
}
key={`${props.patientAssetBed?.bed.id}-${hash}`}
{...props}
config={config}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
<div className="mx-auto flex w-full flex-col justify-between gap-1 rounded bg-[#020617] lg:w-auto lg:min-w-[1280px] lg:flex-row">
<div className="min-h-[400px] flex-1">
<HL7PatientVitalsMonitor
patientCurrentBedAssignmentDate={
props.patientData?.last_consultation?.current_bed
?.start_date
}
patientAssetBed={{
asset: monitorBedData?.asset_object as AssetData,
bed: monitorBedData?.bed_object as BedModel,
Expand Down Expand Up @@ -150,6 +154,10 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
<div className="min-h-[400px] flex-1">
<HL7PatientVitalsMonitor
key={`hl7-${hl7SocketUrl}-${vitals.hash}`}
patientCurrentBedAssignmentDate={
props.patientData?.last_consultation?.current_bed
?.start_date
}
patientAssetBed={{
asset: monitorBedData?.asset_object as AssetData,
bed: monitorBedData?.bed_object as BedModel,
Expand Down
8 changes: 2 additions & 6 deletions src/Components/VitalsMonitor/HL7PatientVitalsMonitor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ 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(
props.config
Expand All @@ -39,8 +35,8 @@ 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
const bpWithinMaxPersistence = dayjs(data.bp?.["date-time"]).isAfter(
props.patientCurrentBedAssignmentDate
);

return (
Expand Down
1 change: 1 addition & 0 deletions src/Components/VitalsMonitor/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export interface ChannelOptions {
}

export interface IVitalsComponentProps {
patientCurrentBedAssignmentDate?: string;
patientAssetBed?: PatientAssetBed;
socketUrl: string;
config?: ReturnType<typeof getVitalsCanvasSizeAndDuration>;
Expand Down
3 changes: 3 additions & 0 deletions src/Redux/api.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { IConfig } from "../Common/hooks/useConfig";

import {
IAadhaarOtp,
IAadhaarOtpTBody,
Expand Down Expand Up @@ -29,6 +30,7 @@ import {
} from "../Components/Assets/AssetTypes";
import {
ConsultationModel,
CurrentBed,
FacilityModel,
LocationModel,
WardModel,
Expand Down Expand Up @@ -355,6 +357,7 @@ const routes = {
listConsultationBeds: {
path: "/api/v1/consultationbed/",
method: "GET",
TRes: Type<PaginatedResponse<CurrentBed>>(),
},
createConsultationBed: {
path: "/api/v1/consultationbed/",
Expand Down

0 comments on commit e8091bf

Please sign in to comment.