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

Ventilator mode/oxygen modality data on consultation page #8781

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
172e891
Ventilator Data
Jacobjeevan Oct 9, 2024
87ef849
MarkerLine and MarkerArea
Jacobjeevan Oct 10, 2024
2da3738
MarkLine, rm MarkArea code
Jacobjeevan Oct 14, 2024
21ef525
Merge branch 'develop' into issues/8264-VentilatorData-ConsultationPage
Jacobjeevan Oct 14, 2024
3ecf02c
Rm markArea import
Jacobjeevan Oct 14, 2024
e0c0c73
added overflow to table/mobile view
Jacobjeevan Oct 15, 2024
b21a3ed
Merge branch 'develop' into issues/8264-VentilatorData-ConsultationPage
Jacobjeevan Oct 16, 2024
292cbd2
render most recent mode/modality on graph
Jacobjeevan Oct 18, 2024
6020479
Merge branch 'develop' into issues/8264-VentilatorData-ConsultationPage
Jacobjeevan Oct 18, 2024
43d0b6a
log fixes
Jacobjeevan Oct 21, 2024
5703f3f
Merge branch 'develop' into issues/8264-VentilatorData-ConsultationPage
Jacobjeevan Oct 21, 2024
d36c1c4
IV/NIV log text modification
Jacobjeevan Oct 22, 2024
2f73b9d
Fixes and cleanup
Jacobjeevan Oct 24, 2024
c816a13
Merge branch 'develop' into issues/8264-VentilatorData-ConsultationPage
Jacobjeevan Oct 24, 2024
e63d220
Cleanup
Jacobjeevan Oct 28, 2024
c5021d6
Merge branch 'develop' into issues/8264-VentilatorData-ConsultationPage
Jacobjeevan Oct 28, 2024
d39fd1e
Pagination Limit
Jacobjeevan Oct 28, 2024
c4faca1
using date utils
Jacobjeevan Nov 4, 2024
fd6b6aa
Merge branch 'develop' into issues/8264-VentilatorData-ConsultationPage
Jacobjeevan Nov 4, 2024
9abc403
improvement suggestions
Jacobjeevan Nov 6, 2024
dd4abbb
Nitpick fixes
Jacobjeevan Nov 6, 2024
98055fb
type fix
Jacobjeevan Nov 6, 2024
b900412
Merge branch 'develop' into issues/8264-VentilatorData-ConsultationPage
Jacobjeevan Nov 8, 2024
c5c354d
lint fix
Jacobjeevan Nov 8, 2024
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
11 changes: 6 additions & 5 deletions cypress/e2e/assets_spec/AssetHomepage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { AssetSearchPage } from "../../pageobject/Asset/AssetSearch";
import { AssetQRScanPage } from "../../pageobject/Asset/AssetQRScan";
import { AssetPagination } from "../../pageobject/Asset/AssetPagination";
import { AssetFilters } from "../../pageobject/Asset/AssetFilters";
import { v4 as uuidv4 } from "uuid";

import { AssetPage } from "../../pageobject/Asset/AssetCreation";
import { AssetFilters } from "../../pageobject/Asset/AssetFilters";
import { AssetPagination } from "../../pageobject/Asset/AssetPagination";
import { AssetQRScanPage } from "../../pageobject/Asset/AssetQRScan";
import { AssetSearchPage } from "../../pageobject/Asset/AssetSearch";
import LoginPage from "../../pageobject/Login/LoginPage";
import { v4 as uuidv4 } from "uuid";

describe("Asset Tab", () => {
const assetSearchPage = new AssetSearchPage();
Expand Down
5 changes: 3 additions & 2 deletions cypress/e2e/assets_spec/AssetsCreation.cy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { AssetPage } from "../../pageobject/Asset/AssetCreation";
import { v4 as uuidv4 } from "uuid";
import LoginPage from "../../pageobject/Login/LoginPage";

import { AssetPage } from "../../pageobject/Asset/AssetCreation";
import { AssetSearchPage } from "../../pageobject/Asset/AssetSearch";
import LoginPage from "../../pageobject/Login/LoginPage";

describe("Asset", () => {
const assetPage = new AssetPage();
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/assets_spec/AssetsManage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { AssetPage } from "../../pageobject/Asset/AssetCreation";
import LoginPage from "../../pageobject/Login/LoginPage";
import { AssetFilters } from "../../pageobject/Asset/AssetFilters";
import { AssetSearchPage } from "../../pageobject/Asset/AssetSearch";
import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import { AssetFilters } from "../../pageobject/Asset/AssetFilters";
import LoginPage from "../../pageobject/Login/LoginPage";

function addDaysToDate(numberOfDays: number) {
const inputDate = new Date();
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/facility_spec/FacilityCreation.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import LoginPage from "../../pageobject/Login/LoginPage";
import FacilityHome from "../../pageobject/Facility/FacilityHome";
import LoginPage from "../../pageobject/Login/LoginPage";
import ManageUserPage from "../../pageobject/Users/ManageUserPage";
import { UserCreationPage } from "../../pageobject/Users/UserCreation";

Expand Down
7 changes: 3 additions & 4 deletions cypress/e2e/facility_spec/FacilityHomepage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// FacilityCreation

import LoginPage from "../../pageobject/Login/LoginPage";
import { AssetPagination } from "../../pageobject/Asset/AssetPagination";
import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import FacilityHome from "../../pageobject/Facility/FacilityHome";
import LoginPage from "../../pageobject/Login/LoginPage";
import ManageUserPage from "../../pageobject/Users/ManageUserPage";
import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import { UserPage } from "../../pageobject/Users/UserSearch";
import { AssetPagination } from "../../pageobject/Asset/AssetPagination";

describe("Facility Homepage Function", () => {
const loginPage = new LoginPage();
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/facility_spec/FacilityInventory.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import LoginPage from "../../pageobject/Login/LoginPage";
import FacilityHome from "../../pageobject/Facility/FacilityHome";
import LoginPage from "../../pageobject/Login/LoginPage";

describe("Inventory Management Section", () => {
const facilityPage = new FacilityPage();
Expand Down
7 changes: 4 additions & 3 deletions cypress/e2e/facility_spec/FacilityManage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import LoginPage from "../../pageobject/Login/LoginPage";
import FacilityManage from "../../pageobject/Facility/FacilityManage";
import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import { v4 as uuidv4 } from "uuid";

import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import FacilityManage from "../../pageobject/Facility/FacilityManage";
import LoginPage from "../../pageobject/Login/LoginPage";

describe("Facility Manage Functions", () => {
const loginPage = new LoginPage();
const facilityManage = new FacilityManage();
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/patient_spec/PatientBedManagement.cy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import LoginPage from "../../pageobject/Login/LoginPage";
import { PatientConsultationPage } from "../../pageobject/Patient/PatientConsultation";
import { PatientPage } from "../../pageobject/Patient/PatientCreation";
import PatientLogupdate from "../../pageobject/Patient/PatientLogupdate";
import { PatientConsultationPage } from "../../pageobject/Patient/PatientConsultation";

describe("Patient swtich bed functionality", () => {
const loginPage = new LoginPage();
Expand Down
10 changes: 5 additions & 5 deletions cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import LoginPage from "../../pageobject/Login/LoginPage";
import { PatientPage } from "../../pageobject/Patient/PatientCreation";
import { PatientConsultationPage } from "../../pageobject/Patient/PatientConsultation";
import PatientPredefined from "../../pageobject/Patient/PatientPredefined";
import ShiftCreation from "../../pageobject/Shift/ShiftCreation";
import PatientInvestigation from "../../pageobject/Patient/PatientInvestigation";
import PatientTreatmentPlan from "../../pageobject/Patient/PatientTreatmentPlan";
import { PatientPage } from "../../pageobject/Patient/PatientCreation";
import PatientDeathReport from "../../pageobject/Patient/PatientDeathReport";
import PatientInvestigation from "../../pageobject/Patient/PatientInvestigation";
import PatientPredefined from "../../pageobject/Patient/PatientPredefined";
import PatientPrescription from "../../pageobject/Patient/PatientPrescription";
import PatientTreatmentPlan from "../../pageobject/Patient/PatientTreatmentPlan";
import ShiftCreation from "../../pageobject/Shift/ShiftCreation";

describe("Patient Consultation in multiple combination", () => {
const patientConsultationPage = new PatientConsultationPage();
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/patient_spec/PatientDoctorConnect.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DoctorConnect } from "pageobject/Patient/PatientDoctorConnect";

import LoginPage from "../../pageobject/Login/LoginPage";
import { PatientPage } from "../../pageobject/Patient/PatientCreation";

Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/patient_spec/PatientFileUpload.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import LoginPage from "../../pageobject/Login/LoginPage";
import { PatientPage } from "../../pageobject/Patient/PatientCreation";
import { PatientFileUpload } from "../../pageobject/Patient/PatientFileupload";

const loginPage = new LoginPage();
const patientPage = new PatientPage();
const patientFileUpload = new PatientFileUpload();
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/patient_spec/PatientLogUpdate.cy.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import LoginPage from "../../pageobject/Login/LoginPage";
import { PatientConsultationPage } from "../../pageobject/Patient/PatientConsultation";
import { PatientPage } from "../../pageobject/Patient/PatientCreation";
import PatientLogupdate from "../../pageobject/Patient/PatientLogupdate";
import PatientInvestigation from "../../pageobject/Patient/PatientInvestigation";
import PatientLogupdate from "../../pageobject/Patient/PatientLogupdate";
import PatientPrescription from "../../pageobject/Patient/PatientPrescription";

describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/patient_spec/PatientPrescription.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PatientPrescription from "../../pageobject/Patient/PatientPrescription";
import LoginPage from "../../pageobject/Login/LoginPage";
import { PatientPage } from "../../pageobject/Patient/PatientCreation";
import PatientPrescription from "../../pageobject/Patient/PatientPrescription";

const patientPrescription = new PatientPrescription();
const loginPage = new LoginPage();
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/patient_spec/PatientRegistration.cy.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import LoginPage from "../../pageobject/Login/LoginPage";
import { PatientPage } from "../../pageobject/Patient/PatientCreation";
import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import { generatePhoneNumber } from "../../pageobject/utils/constants";
import PatientTransfer from "../../pageobject/Patient/PatientTransfer";
import PatientInsurance from "../../pageobject/Patient/PatientInsurance";
import PatientMedicalHistory from "../../pageobject/Patient/PatientMedicalHistory";
import PatientTransfer from "../../pageobject/Patient/PatientTransfer";
import { generatePhoneNumber } from "../../pageobject/utils/constants";

const yearOfBirth = "2001";
const isHCXEnabled = Cypress.env("ENABLE_HCX");
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/resource_spec/ResourcesHomepage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import LoginPage from "../../pageobject/Login/LoginPage";
import ResourcePage from "../../pageobject/Resource/ResourcePage";
import FacilityPage from "../../pageobject/Facility/FacilityCreation";

describe("Resource Page", () => {
let createdResource: string;
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/users_spec/UsersCreation.cy.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import LoginPage from "../../pageobject/Login/LoginPage";
import { AssetSearchPage } from "../../pageobject/Asset/AssetSearch";
import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import { UserPage } from "../../pageobject/Users/UserSearch";
import LoginPage from "../../pageobject/Login/LoginPage";
import { UserCreationPage } from "../../pageobject/Users/UserCreation";
import { UserPage } from "../../pageobject/Users/UserSearch";
import {
generatePhoneNumber,
generateEmergencyPhoneNumber,
generatePhoneNumber,
} from "../../pageobject/utils/constants";

describe("User Creation", () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/users_spec/UsersManage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import LoginPage from "../../pageobject/Login/LoginPage";
import { UserPage } from "../../pageobject/Users/UserSearch";
import ManageUserPage from "../../pageobject/Users/ManageUserPage";
import { UserCreationPage } from "../../pageobject/Users/UserCreation";
import { UserPage } from "../../pageobject/Users/UserSearch";

describe("Manage User", () => {
const loginPage = new LoginPage();
Expand Down
20 changes: 20 additions & 0 deletions public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,13 @@
"ORAL_ISSUE__NO_ISSUE": "No issues",
"ORAL_ISSUE__ODYNOPHAGIA": "Odynophagia",
"OXYGEN_MODALITY__HIGH_FLOW_NASAL_CANNULA": "High Flow Nasal Cannula",
"OXYGEN_MODALITY__HIGH_FLOW_NASAL_CANNULA_short": "HFNC",
"OXYGEN_MODALITY__NASAL_PRONGS": "Nasal Prongs",
"OXYGEN_MODALITY__NASAL_PRONGS_short": "NP",
"OXYGEN_MODALITY__NON_REBREATHING_MASK": "Non Rebreathing Mask",
"OXYGEN_MODALITY__NON_REBREATHING_MASK_short": "NRM",
"OXYGEN_MODALITY__SIMPLE_FACE_MASK": "Simple Face Mask",
"OXYGEN_MODALITY__SIMPLE_FACE_MASK_short": "SFM",
"PRESCRIPTION_FREQUENCY_BD": "Twice daily",
"PRESCRIPTION_FREQUENCY_HS": "Night only",
"PRESCRIPTION_FREQUENCY_OD": "Once daily",
Expand Down Expand Up @@ -206,12 +210,19 @@
"URINATION_FREQUENCY__NORMAL": "Normal",
"VENTILATOR": "Detailed Update",
"VENTILATOR_MODE__CMV": "Control Mechanical Ventilation (CMV)",
"VENTILATOR_MODE__CMV_short": "CMV",
"VENTILATOR_MODE__PCV": "Pressure Control Ventilation (PCV)",
"VENTILATOR_MODE__PCV_short": "PCV",
"VENTILATOR_MODE__PC_SIMV": "Pressure Controlled SIMV (PC-SIMV)",
"VENTILATOR_MODE__PC_SIMV_short": "PC-SIMV",
"VENTILATOR_MODE__PSV": "C-PAP / Pressure Support Ventilation (PSV)",
"VENTILATOR_MODE__PSV_short": "C-PAP/PSV",
"VENTILATOR_MODE__SIMV": "Synchronised Intermittent Mandatory Ventilation (SIMV)",
"VENTILATOR_MODE__SIMV_short": "SIMV",
"VENTILATOR_MODE__VCV": "Volume Control Ventilation (VCV)",
"VENTILATOR_MODE__VCV_short": "VCV",
"VENTILATOR_MODE__VC_SIMV": "Volume Controlled SIMV (VC-SIMV)",
"VENTILATOR_MODE__VC_SIMV_short": "VC-SIMV",
"View Facility": "View Facility",
"aadhaar_number": "Aadhaar Number",
"aadhaar_number_will_not_be_stored": "Aadhaar number will not be stored by CARE",
Expand Down Expand Up @@ -611,6 +622,7 @@
"encounter_suggestion__OP": "Out-patient visit",
"encounter_suggestion__R": "Consultation",
"encounter_suggestion_edit_disallowed": "Not allowed to switch to this option in edit consultation",
"end_datetime": "End Date/Time",
"enter_aadhaar_number": "Enter a 12-digit Aadhaar ID",
"enter_aadhaar_otp": "Enter OTP sent to the registered mobile with Aadhaar",
"enter_abha_address": "Enter ABHA Address",
Expand Down Expand Up @@ -1145,6 +1157,7 @@
"spokes": "Spoke Facilities",
"srf_id": "SRF ID",
"staff_list": "Staff List",
"start_datetime": "Start Date/Time",
"start_dosage": "Start Dosage",
"state": "State",
"status": "Status",
Expand Down Expand Up @@ -1236,6 +1249,13 @@
"vacant": "Vacant",
"vehicle_preference": "Vehicle preference",
"vendor_name": "Vendor Name",
"ventilator_interface": "Respiratory Support Type",
"ventilator_log": "Ventilator Log",
"ventilator_modality": "Modality",
"ventilator_mode": "Ventilator Mode",
"ventilator_oxygen_modality": "Oxygen Modality",
"ventilator_oxygen_modality_oxygen_rate": "Oxygen Flow Rate",
"ventilator_spo2": "SpO₂",
"verify_and_link": "Verify and Link",
"verify_otp": "Verify OTP",
"verify_otp_error": "Failed to verify OTP. Please try again later.",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,44 @@
import Loading from "@/components/Common/Loading";
import PageTitle from "@/components/Common/PageTitle";
import { ConsultationTabProps } from "@/components/Facility/ConsultationDetails/index";
import { VentilatorPlot } from "@/components/Facility/Consultations/VentilatorPlot";
import VentilatorTable from "@/components/Facility/Consultations/VentilatorTable";

import useFilters from "@/hooks/useFilters";

import routes from "@/Utils/request/api";
import useQuery from "@/Utils/request/useQuery";

export const ConsultationVentilatorTab = (props: ConsultationTabProps) => {
const { consultationId } = props;
const { qParams, Pagination, resultsPerPage } = useFilters({ limit: 36 });
Copy link
Contributor

@coderabbitai coderabbitai bot Nov 8, 2024

Choose a reason for hiding this comment

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

💡 Codebase verification

Consider standardizing the pagination limit

The codebase shows inconsistent pagination limits across different components:

  • 36 items in ConsultationVentilatorTab
  • 16 items in another component
  • 15 items in another component
  • 12 items in two other components

This inconsistency suggests there's no standardized pagination limit across the application. The current implementation with 36 items significantly deviates from other components that use smaller limits (12-16 items), which could impact performance and user experience.

🔗 Analysis chain

Verify the pagination limit of 36 items.

The limit of 36 items per page seems arbitrary. Please confirm if this number was chosen based on specific requirements or if it should align with other pagination implementations in the application.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other pagination limit implementations
rg -g '*.{ts,tsx}' 'useFilters.*limit:' --no-filename | sort | uniq

Length of output: 415

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's 36 daily log events and not every event would have a corresponding ventilator table entry.

Copy link
Contributor

Choose a reason for hiding this comment

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

@Jacobjeevan, understood. Thank you for the clarification. I've noted this for future reviews.

(_/)
(•_•)
/ ?


✏️ Learnings added
Learnt from: Jacobjeevan
PR: ohcnetwork/care_fe#8781
File: src/components/Facility/ConsultationDetails/ConsultationVentilatorTab.tsx:14-14
Timestamp: 2024-11-08T09:25:33.310Z
Learning: In the `ConsultationVentilatorTab`, the pagination limit is set to 36 because not every event corresponds to a ventilator table entry.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


const { loading: isLoading, data } = useQuery(routes.getDailyReports, {
pathParams: { consultationId },
query: {
limit: resultsPerPage,
offset: (qParams.page ? qParams.page - 1 : 0) * resultsPerPage,
},
});
Jacobjeevan marked this conversation as resolved.
Show resolved Hide resolved

if (isLoading) {
return <Loading />;
}

return (
<div>
<PageTitle
title="Respiratory Support"
hideBack={true}
breadcrumbs={false}
/>
<VentilatorPlot
facilityId={props.facilityId}
patientId={props.patientId}
consultationId={props.consultationId}
/>
<VentilatorTable dailyRoundsList={data?.results} />
<VentilatorPlot dailyRoundsList={data?.results} />
{Boolean(data?.count && data.count > 0) && (
<div className="mt-4 flex w-full justify-center">
<Pagination totalCount={data?.count ?? 0} />
</div>
)}
</div>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ export default function EventsList({ query }: { query: QueryParams }) {
}

const values = Object.fromEntries(entries);
if (
values.ventilator_interface === "INVASIVE" ||
values.ventilator_interface === "NON_INVASIVE"
) {
values.ventilator_interface += " VENTILATOR";
}
Jacobjeevan marked this conversation as resolved.
Show resolved Hide resolved

switch (item.event_type.name) {
case "INTERNAL_TRANSFER":
Expand Down
Loading
Loading