From 284610010cd68c42cc1cd00d0612ab3e07e5f6ce Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Mon, 6 May 2024 20:54:46 +0530 Subject: [PATCH 01/14] MEWS Score (#7761) --- .../e2e/patient_spec/patient_logupdate.cy.ts | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/cypress/e2e/patient_spec/patient_logupdate.cy.ts b/cypress/e2e/patient_spec/patient_logupdate.cy.ts index 859cf623f30..470d8d8fab3 100644 --- a/cypress/e2e/patient_spec/patient_logupdate.cy.ts +++ b/cypress/e2e/patient_spec/patient_logupdate.cy.ts @@ -154,6 +154,38 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { cy.verifyContentPresence("#basic-information", [additionalSymptoms]); }); + it("Create a normal log update to verify MEWS Score Functionality", () => { + patientPage.visitPatient(domicilaryPatient); + patientConsultationPage.clickEditConsultationButton(); + patientConsultationPage.selectPatientSuggestion("Domiciliary Care"); + cy.submitButton("Update Consultation"); + cy.verifyNotification("Consultation updated successfully"); + cy.closeNotification(); + patientLogupdate.clickLogupdate(); + // Verify the MEWS Score reflection + patientLogupdate.selectPatientCategory(patientCategory); + patientLogupdate.typeSystolic(patientSystolic); + patientLogupdate.typeDiastolic(patientDiastolic); + patientLogupdate.typePulse(patientPulse); + patientLogupdate.typeTemperature(patientTemperature); + patientLogupdate.typeRespiratory(patientRespiratory); + cy.get("#consciousness_level-2").click(); + cy.submitButton("Save"); + cy.verifyNotification("Consultation Updates details created successfully"); + cy.closeNotification(); + cy.verifyContentPresence("#consultation-buttons", ["9"]); + // Verify the Incomplete data will give blank info + patientLogupdate.clickLogupdate(); + patientLogupdate.selectPatientCategory(patientCategory); + patientLogupdate.typeSystolic(patientSystolic); + patientLogupdate.typeDiastolic(patientDiastolic); + patientLogupdate.typePulse(patientPulse); + cy.submitButton("Save"); + cy.verifyNotification("Consultation Updates details created successfully"); + cy.closeNotification(); + cy.verifyContentPresence("#consultation-buttons", ["-"]); + }); + afterEach(() => { cy.saveLocalStorage(); }); From ca4040e499d3ff12b34f32afc59af2ea06f0b12d Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Mon, 6 May 2024 20:54:56 +0530 Subject: [PATCH 02/14] Duplicate medicine (#7764) --- cypress/e2e/patient_spec/patient_manage.cy.ts | 15 ------ .../patient_spec/patient_prescription.cy.ts | 49 +++++++++++++++++++ .../pageobject/Patient/PatientPrescription.ts | 10 ++-- 3 files changed, 54 insertions(+), 20 deletions(-) create mode 100644 cypress/e2e/patient_spec/patient_prescription.cy.ts diff --git a/cypress/e2e/patient_spec/patient_manage.cy.ts b/cypress/e2e/patient_spec/patient_manage.cy.ts index c25677d9e8b..00756f832f6 100644 --- a/cypress/e2e/patient_spec/patient_manage.cy.ts +++ b/cypress/e2e/patient_spec/patient_manage.cy.ts @@ -2,13 +2,11 @@ import { afterEach, before, beforeEach, cy, describe, it } from "local-cypress"; import LoginPage from "../../pageobject/Login/LoginPage"; import { PatientConsultationPage } from "../../pageobject/Patient/PatientConsultation"; import { PatientPage } from "../../pageobject/Patient/PatientCreation"; -import PatientPrescription from "../../pageobject/Patient/PatientPrescription"; describe("Patient", () => { const loginPage = new LoginPage(); const patientPage = new PatientPage(); const patientConsultationPage = new PatientConsultationPage(); - const patientPrescription = new PatientPrescription(); before(() => { loginPage.loginAsDisctrictAdmin(); @@ -45,19 +43,6 @@ describe("Patient", () => { cy.verifyNotification("Note added successfully"); }); - it("Edit prescription for an already created patient", () => { - patientPage.visitPatient("Dummy Patient 4"); - patientPrescription.visitEditPrescriptionPage(); - patientPrescription.clickAddPrescription(); - patientPrescription.interceptMedibase(); - patientPrescription.selectMedicinebox(); - patientPrescription.selectMedicine("DOLO"); - patientPrescription.enterDosage("4"); - patientPrescription.selectDosageFrequency("Twice daily"); - cy.submitButton("Submit"); - cy.verifyNotification("Medicine prescribed"); - }); - afterEach(() => { cy.saveLocalStorage(); }); diff --git a/cypress/e2e/patient_spec/patient_prescription.cy.ts b/cypress/e2e/patient_spec/patient_prescription.cy.ts new file mode 100644 index 00000000000..3cf5a1ba5aa --- /dev/null +++ b/cypress/e2e/patient_spec/patient_prescription.cy.ts @@ -0,0 +1,49 @@ +import PatientPrescription from "../../pageobject/Patient/PatientPrescription"; +import LoginPage from "../../pageobject/Login/LoginPage"; +import { PatientPage } from "../../pageobject/Patient/PatientCreation"; + +const patientPrescription = new PatientPrescription(); +const loginPage = new LoginPage(); +const patientPage = new PatientPage(); + +describe("Patient Medicine Administration", () => { + before(() => { + loginPage.loginAsDisctrictAdmin(); + cy.saveLocalStorage(); + }); + + beforeEach(() => { + cy.restoreLocalStorage(); + cy.clearLocalStorage(/filters--.+/); + cy.awaitUrl("/patients"); + }); + + it("Add a new medicine for a patient and verify the duplicate medicine validation", () => { + patientPage.visitPatient("Dummy Patient 4"); + patientPrescription.visitMedicineTab(); + patientPrescription.clickAddPrescription(); + patientPrescription.interceptMedibase(); + patientPrescription.selectMedicinebox(); + patientPrescription.selectMedicine("DOLO"); + patientPrescription.enterDosage("4"); + patientPrescription.selectDosageFrequency("Twice daily"); + cy.submitButton("Submit"); + cy.verifyNotification("Medicine prescribed"); + cy.closeNotification(); + // verify the duplicate medicine error message + patientPrescription.clickAddPrescription(); + patientPrescription.interceptMedibase(); + patientPrescription.selectMedicinebox(); + patientPrescription.selectMedicine("DOLO"); + patientPrescription.enterDosage("4"); + patientPrescription.selectDosageFrequency("Twice daily"); + cy.submitButton("Submit"); + cy.verifyNotification( + "Medicine - This medicine is already prescribed to this patient. Please discontinue the existing prescription to prescribe again.", + ); + }); + + afterEach(() => { + cy.saveLocalStorage(); + }); +}); diff --git a/cypress/pageobject/Patient/PatientPrescription.ts b/cypress/pageobject/Patient/PatientPrescription.ts index 5c5c64483e4..dc4163e4823 100644 --- a/cypress/pageobject/Patient/PatientPrescription.ts +++ b/cypress/pageobject/Patient/PatientPrescription.ts @@ -12,13 +12,13 @@ export class PatientPrescription { selectMedicine(medicine: string) { cy.searchAndSelectOption( "div#medicine_object input[placeholder='Select'][role='combobox']", - medicine + medicine, ); } selectMedicinebox() { cy.get( - "div#medicine_object input[placeholder='Select'][role='combobox']" + "div#medicine_object input[placeholder='Select'][role='combobox']", ).click(); } @@ -37,21 +37,21 @@ export class PatientPrescription { clickReturnToDashboard() { cy.verifyAndClickElement( "[data-testid='return-to-patient-dashboard']", - "Return to Patient Dashboard" + "Return to Patient Dashboard", ); } discontinuePreviousPrescription() { cy.intercept( "POST", - "**/api/v1/consultation/*/prescriptions/*/discontinue/" + "**/api/v1/consultation/*/prescriptions/*/discontinue/", ).as("deletePrescription"); cy.get("button").contains("Discontinue").click(); cy.get("#submit").contains("Discontinue").click(); cy.wait("@deletePrescription").its("response.statusCode").should("eq", 200); } - visitEditPrescriptionPage() { + visitMedicineTab() { cy.get("#consultation_tab_nav").scrollIntoView(); cy.get("#consultation_tab_nav").contains("Medicines").click(); cy.get("a[href='prescriptions']").first().click(); From 9a1c3372f7c3a3154cafc96186788c01c6152e3e Mon Sep 17 00:00:00 2001 From: Keshav Malik <91189139+Keshav-0907@users.noreply.github.com> Date: Tue, 7 May 2024 14:30:50 +0530 Subject: [PATCH 03/14] Fix : Minimum value in forms should be greater than 0 (#7273) * Triage Form Fix * Added Validation for Negative Values in forms * Update src/Components/Facility/ConsultationForm.tsx Co-authored-by: Khavin Shankar * fix lint --------- Co-authored-by: Ashesh <3626859+Ashesh3@users.noreply.github.com> Co-authored-by: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Co-authored-by: Rithvik Nishad Co-authored-by: Khavin Shankar Co-authored-by: Rithvik Nishad --- src/Components/Facility/ConsultationForm.tsx | 12 +++++++ src/Components/Facility/TriageForm.tsx | 36 ++++++++++++++++++++ src/Components/Patient/PatientRegister.tsx | 10 ++++++ 3 files changed, 58 insertions(+) diff --git a/src/Components/Facility/ConsultationForm.tsx b/src/Components/Facility/ConsultationForm.tsx index e0c79823434..e4b3f4a195f 100644 --- a/src/Components/Facility/ConsultationForm.tsx +++ b/src/Components/Facility/ConsultationForm.tsx @@ -642,6 +642,18 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => { } return; } + case "weight": + case "height": { + if (state.form.suggestion !== "DD") { + const value = state.form[field]; + if (!value || parseFloat(value) <= 0) { + errors[field] = `Please enter a valid ${field}`; + invalidForm = true; + break; + } + } + return; + } default: return; diff --git a/src/Components/Facility/TriageForm.tsx b/src/Components/Facility/TriageForm.tsx index 5cf76fbda49..1efe22e66a4 100644 --- a/src/Components/Facility/TriageForm.tsx +++ b/src/Components/Facility/TriageForm.tsx @@ -102,6 +102,42 @@ export const TriageForm = ({ facilityId, id }: Props) => { invalidForm = true; } return; + case "num_patients_visited": + if (state.form[field] < 0) { + errors[field] = + "Number of patients visited must be greater than or equal to 0"; + invalidForm = true; + } + return; + case "num_patients_home_quarantine": + if (state.form[field] < 0) { + errors[field] = + "Number of patients in Home Qurantine must be greater than or equal to 0"; + invalidForm = true; + } + return; + case "num_patients_isolation": + if (state.form[field] < 0) { + errors[field] = + "Number of patients in Isolation must be greater than or equal to 0"; + invalidForm = true; + } + return; + case "num_patient_referred": + if (state.form[field] < 0) { + errors[field] = + "Number of patients referred must be greater than or equal to 0"; + invalidForm = true; + } + return; + case "num_patient_confirmed_positive": + if (state.form[field] < 0) { + errors[field] = + "Number of patients confirmed positive must be greater than or equal to 0"; + invalidForm = true; + } + return; + default: return; } diff --git a/src/Components/Patient/PatientRegister.tsx b/src/Components/Patient/PatientRegister.tsx index dea0484a67c..67032abede8 100644 --- a/src/Components/Patient/PatientRegister.tsx +++ b/src/Components/Patient/PatientRegister.tsx @@ -649,6 +649,16 @@ export const PatientRegister = (props: PatientRegisterProps) => { errors[field] = "Please select a blood group"; } return; + case "number_of_primary_contacts": + if (form[field] < 0) { + errors[field] = "Number of primary contacts cannot be negative"; + } + return; + case "number_of_secondary_contacts": + if (form[field] < 0) { + errors[field] = "Number of secondary contacts cannot be negative"; + } + return; case "is_vaccinated": if (form.is_vaccinated === "true") { From 02d9b90a59d08774f65db2843229326bb145d28b Mon Sep 17 00:00:00 2001 From: Vibhu Chandransh Bhanot <66901877+Vibhu1710@users.noreply.github.com> Date: Tue, 7 May 2024 14:31:25 +0530 Subject: [PATCH 04/14] #7308 fix : use "hidden" css property to toggle b/w Login & Forgot Password (#7323) * fix : use "hidden" css property to toggle b/w Login & Forgot Password page * suggestions from code review --------- Co-authored-by: Vibhu1710 Co-authored-by: rithviknishad --- src/Components/Auth/Login.tsx | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/Components/Auth/Login.tsx b/src/Components/Auth/Login.tsx index b3d2fef8d31..a74969fbfa4 100644 --- a/src/Components/Auth/Login.tsx +++ b/src/Components/Auth/Login.tsx @@ -13,6 +13,7 @@ import ReactMarkdown from "react-markdown"; import rehypeRaw from "rehype-raw"; import { useAuthContext } from "../../Common/hooks/useAuthUser"; import FiltersCache from "../../Utils/FiltersCache"; +import { classNames } from "../../Utils/utils"; export const Login = (props: { forgot?: boolean }) => { const { signIn } = useAuthContext(); @@ -276,12 +277,10 @@ export const Login = (props: { forgot?: boolean }) => {
{t("auth_login_title")} @@ -353,12 +352,10 @@ export const Login = (props: { forgot?: boolean }) => {