Skip to content

Commit

Permalink
Merge branch 'coronasafe:develop' into Fix-ohcnetwork#6944
Browse files Browse the repository at this point in the history
  • Loading branch information
AshrafMd-1 authored May 29, 2024
2 parents a0608e1 + 8ae85d6 commit e7297f1
Show file tree
Hide file tree
Showing 59 changed files with 3,172 additions and 889 deletions.
30 changes: 12 additions & 18 deletions cypress/e2e/patient_spec/patient_consultation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe("Patient Consultation in multiple combination", () => {
patientConsultationPage.selectConsultationStatus(
"Outpatient/Emergency Room",
);
cy.searchAndSelectOption("#symptoms", "ASYMPTOMATIC");
cy.get("#is_asymptomatic").click();
patientConsultationPage.typePatientIllnessHistory(patientIllnessHistory);
patientConsultationPage.typePatientExaminationHistory(
patientExaminationHistory,
Expand Down Expand Up @@ -175,7 +175,7 @@ describe("Patient Consultation in multiple combination", () => {
"Outpatient/Emergency Room",
);
// Asymptomatic
cy.searchAndSelectOption("#symptoms", "ASYMPTOMATIC");
cy.get("#is_asymptomatic").click();
// CRITICAL category
patientConsultationPage.selectPatientCategory("Critical");
patientConsultationPage.selectPatientSuggestion("Declare Death");
Expand Down Expand Up @@ -234,7 +234,7 @@ describe("Patient Consultation in multiple combination", () => {
);
patientConsultationPage.selectPatientWard("Dummy Location 1");
// Asymptomatic
cy.searchAndSelectOption("#symptoms", "ASYMPTOMATIC");
cy.get("#is_asymptomatic").click();
// Abnormal category
patientConsultationPage.selectPatientCategory("Moderate");
patientConsultationPage.selectPatientSuggestion("Domiciliary Care");
Expand Down Expand Up @@ -293,18 +293,14 @@ describe("Patient Consultation in multiple combination", () => {
);
// verify the free text in referring facility name
patientConsultationPage.typeReferringFacility("Life Care Hospital");
// Vomiting and Nausea symptoms
patientConsultationPage.selectSymptomsDate("01012024");
patientConsultationPage.typeAndMultiSelectSymptoms("s", [
"SPUTUM",
"SORE THROAT",
"Sore throat",
"Sputum",
]);
patientConsultationPage.clickAddSymptom();
// Stable category
patientConsultationPage.selectPatientCategory("Mild");
// Date of symptoms
patientConsultationPage.selectSymptomsDate(
"#symptoms_onset_date",
"01012024",
);
// OP Consultation
patientConsultationPage.selectPatientSuggestion("OP Consultation");
// one ICD-11 and no principal
Expand Down Expand Up @@ -341,18 +337,16 @@ describe("Patient Consultation in multiple combination", () => {
patientConsultationPage.selectConsultationStatus(
"Outpatient/Emergency Room",
);
// Select the Symptoms - Sore throat and fever symptoms
// Select the Symptoms - Breathlessness and Bleeding symptoms
patientConsultationPage.selectSymptomsDate("01012024");
patientConsultationPage.typeAndMultiSelectSymptoms("b", [
"BREATHLESSNESS",
"BLEEDING",
"Breathlessness",
"Bleeding",
]);
patientConsultationPage.clickAddSymptom();
// Comfort Care category
patientConsultationPage.selectPatientCategory("Comfort Care");
// Date of symptoms
patientConsultationPage.selectSymptomsDate(
"#symptoms_onset_date",
"01012024",
);
// Decision after consultation - Referred to Facility
patientConsultationPage.selectPatientSuggestion(
"Refer to another Hospital",
Expand Down
22 changes: 11 additions & 11 deletions cypress/e2e/patient_spec/patient_logupdate.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
const patientLogupdate = new PatientLogupdate();
const domicilaryPatient = "Dummy Patient 11";
const patientCategory = "Moderate";
const additionalSymptoms = "ASYMPTOMATIC";
const additionalSymptoms = "Fever";
const physicalExamination = "physical examination details";
const otherExamination = "Other";
const patientSystolic = "119";
Expand Down Expand Up @@ -59,9 +59,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientLogupdate.typeRhythm(patientRhythm);
cy.get("#consciousness_level-2").click();
cy.submitButton("Save");
cy.verifyNotification(
"Telemedicine Log Updates details created successfully",
);
cy.verifyNotification("Tele-medicine log update created successfully");
});

it("Create a new log normal update for a domicilary care patient and edit it", () => {
Expand All @@ -86,7 +84,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientLogupdate.typeRhythm(patientRhythm);
cy.get("#consciousness_level-2").click();
cy.submitButton("Save");
cy.verifyNotification("Normal Log Updates details created successfully");
cy.verifyNotification("Normal log update created successfully");
cy.closeNotification();
// edit the card and verify the data.
cy.contains("Daily Rounds").click();
Expand All @@ -109,7 +107,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientLogupdate.clickClearButtonInElement("#diastolic");
patientLogupdate.typeDiastolic(patientModifiedDiastolic);
cy.submitButton("Continue");
cy.verifyNotification("Normal Log Updates details updated successfully");
cy.verifyNotification("Normal log update details updated successfully");
cy.contains("Daily Rounds").click();
patientLogupdate.clickLogupdateCard("#dailyround-entry", patientCategory);
cy.verifyContentPresence("#consultation-preview", [
Expand All @@ -127,7 +125,9 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientLogupdate.clickLogupdate();
patientLogupdate.typePhysicalExamination(physicalExamination);
patientLogupdate.typeOtherDetails(otherExamination);
patientLogupdate.typeAdditionalSymptoms(additionalSymptoms);
patientLogupdate.selectSymptomsDate("01012024");
patientLogupdate.typeAndMultiSelectSymptoms("fe", ["Fever"]);
patientLogupdate.clickAddSymptom();
patientLogupdate.selectPatientCategory(patientCategory);
patientLogupdate.typeSystolic(patientSystolic);
patientLogupdate.typeDiastolic(patientDiastolic);
Expand All @@ -140,10 +140,10 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
cy.get("#consciousness_level-2").click();
cy.submitButton("Save");
cy.wait(2000);
cy.verifyNotification("Normal Log Updates details created successfully");
cy.verifyNotification("Normal log update created successfully");
// Verify the card content
cy.get("#basic-information").scrollIntoView();
cy.verifyContentPresence("#basic-information", [additionalSymptoms]);
cy.verifyContentPresence("#encounter-symptoms", [additionalSymptoms]);
});

it("Create a normal log update to verify MEWS Score Functionality", () => {
Expand All @@ -163,7 +163,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientLogupdate.typeRespiratory(patientRespiratory);
cy.get("#consciousness_level-2").click();
cy.submitButton("Save");
cy.verifyNotification("Normal Log Updates details created successfully");
cy.verifyNotification("Normal log update created successfully");
cy.closeNotification();
cy.verifyContentPresence("#consultation-buttons", ["9"]);
// Verify the Incomplete data will give blank info
Expand All @@ -173,7 +173,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientLogupdate.typeDiastolic(patientDiastolic);
patientLogupdate.typePulse(patientPulse);
cy.submitButton("Save");
cy.verifyNotification("Normal Log Updates details created successfully");
cy.verifyNotification("Normal log update created successfully");
cy.closeNotification();
cy.verifyContentPresence("#consultation-buttons", ["-"]);
});
Expand Down
6 changes: 6 additions & 0 deletions cypress/e2e/users_spec/user_homepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe("User Homepage", () => {
userPage.selectDistrict("Ernakulam");
userPage.typeInPhoneNumber(phone_number);
userPage.typeInAltPhoneNumber(alt_phone_number);
userPage.selectHomeFacility("Dummy Facility 40");
userPage.applyFilter();
userPage.verifyUrlafteradvancefilter();
userPage.checkUsernameText(usernameToTest);
Expand All @@ -46,13 +47,18 @@ describe("User Homepage", () => {
"WhatsApp no.: +919876543219",
);
userPage.verifyDataTestIdText("Role", "Role: Doctor");
userPage.verifyDataTestIdText(
"Home Facility",
"Home Facility: Dummy Facility 40",
);
userPage.verifyDataTestIdText("District", "District: Ernakulam");
userPage.clearFilters();
userPage.verifyDataTestIdNotVisible("First Name");
userPage.verifyDataTestIdNotVisible("Last Name");
userPage.verifyDataTestIdNotVisible("Phone Number");
userPage.verifyDataTestIdNotVisible("WhatsApp no.");
userPage.verifyDataTestIdNotVisible("Role");
userPage.verifyDataTestIdNotVisible("Home Facility");
userPage.verifyDataTestIdNotVisible("District");
});

Expand Down
12 changes: 6 additions & 6 deletions cypress/pageobject/Patient/PatientConsultation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ export class PatientConsultationPage {
cy.clickAndSelectOption("#route_to_facility", status);
}

selectSymptoms(symptoms) {
cy.clickAndMultiSelectOption("#symptoms", symptoms);
}
typeAndMultiSelectSymptoms(input, symptoms) {
cy.typeAndMultiSelectOption("#symptoms", input, symptoms);
cy.typeAndMultiSelectOption("#additional_symptoms", input, symptoms);
}
selectSymptomsDate(date: string) {
cy.clickAndTypeDate("#symptoms_onset_date", date);
}
selectSymptomsDate(selector: string, date: string) {
cy.clickAndTypeDate(selector, date);
clickAddSymptom() {
cy.get("#add-symptom").click();
}

verifyConsultationPatientName(patientName: string) {
Expand Down
10 changes: 10 additions & 0 deletions cypress/pageobject/Patient/PatientLogupdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ class PatientLogupdate {
cy.searchAndSelectOption("#additional_symptoms", symptoms);
}

typeAndMultiSelectSymptoms(input, symptoms) {
cy.typeAndMultiSelectOption("#additional_symptoms", input, symptoms);
}
selectSymptomsDate(date: string) {
cy.clickAndTypeDate("#symptoms_onset_date", date);
}
clickAddSymptom() {
cy.get("#add-symptom").click();
}

typeSystolic(systolic: string) {
cy.searchAndSelectOption("#systolic", systolic);
}
Expand Down
4 changes: 4 additions & 0 deletions cypress/pageobject/Users/UserSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ export class UserPage {
cy.get("#alt_phone_number").click().type(altPhone);
}

selectHomeFacility(facility: string) {
cy.searchAndSelectOption("input[name='home_facility']", facility);
}

applyFilter() {
cy.get("#apply-filter").click();
}
Expand Down
40 changes: 3 additions & 37 deletions src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -343,42 +343,6 @@ export const REVIEW_AT_CHOICES: Array<OptionsType> = [
{ id: 30 * 24 * 60, text: "1 month" },
];

export const SYMPTOM_CHOICES = [
{ id: 1, text: "ASYMPTOMATIC", isSingleSelect: true },
{ id: 2, text: "FEVER" },
{ id: 3, text: "SORE THROAT" },
{ id: 4, text: "COUGH" },
{ id: 5, text: "BREATHLESSNESS" },
{ id: 6, text: "MYALGIA" },
{ id: 7, text: "ABDOMINAL DISCOMFORT" },
{ id: 8, text: "VOMITING" },
{ id: 11, text: "SPUTUM" },
{ id: 12, text: "NAUSEA" },
{ id: 13, text: "CHEST PAIN" },
{ id: 14, text: "HEMOPTYSIS" },
{ id: 15, text: "NASAL DISCHARGE" },
{ id: 16, text: "BODY ACHE" },
{ id: 17, text: "DIARRHOEA" },
{ id: 18, text: "PAIN" },
{ id: 19, text: "PEDAL EDEMA" },
{ id: 20, text: "WOUND" },
{ id: 21, text: "CONSTIPATION" },
{ id: 22, text: "HEAD ACHE" },
{ id: 23, text: "BLEEDING" },
{ id: 24, text: "DIZZINESS" },
{ id: 25, text: "CHILLS" },
{ id: 26, text: "GENERAL WEAKNESS" },
{ id: 27, text: "IRRITABILITY" },
{ id: 28, text: "CONFUSION" },
{ id: 29, text: "ABDOMINAL PAIN" },
{ id: 30, text: "JOINT PAIN" },
{ id: 31, text: "REDNESS OF EYES" },
{ id: 32, text: "ANOREXIA" },
{ id: 33, text: "NEW LOSS OF TASTE" },
{ id: 34, text: "NEW LOSS OF SMELL" },
{ id: 9, text: "OTHERS" },
];

export const DISCHARGE_REASONS = [
{ id: 1, text: "Recovered" },
{ id: 2, text: "Referred" },
Expand Down Expand Up @@ -1333,7 +1297,7 @@ export const CONSENT_PATIENT_CODE_STATUS_CHOICES = [
{ id: 1, text: "Do Not Hospitalise (DNH)" },
{ id: 2, text: "Do Not Resuscitate (DNR)" },
{ id: 3, text: "Comfort Care Only" },
{ id: 4, text: "Active treatment (Default)" },
{ id: 4, text: "Active treatment" },
];
export const OCCUPATION_TYPES = [
{
Expand Down Expand Up @@ -1429,3 +1393,5 @@ export const PATIENT_NOTES_THREADS = {
Doctors: 10,
Nurses: 20,
} as const;

export const RATION_CARD_CATEGORY = ["BPL", "APL", "NO_CARD"] as const;
49 changes: 44 additions & 5 deletions src/Components/CameraFeed/AssetBedSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Fragment } from "react";
import { AssetBedModel } from "../Assets/AssetTypes";
import { Listbox, Transition } from "@headlessui/react";
import CareIcon from "../../CAREUI/icons/CareIcon";
import { classNames } from "../../Utils/utils";

interface Props {
options: AssetBedModel[];
Expand All @@ -10,7 +11,40 @@ interface Props {
onChange?: (value: AssetBedModel) => void;
}

export default function AssetBedSelect(props: Props) {
export default function CameraPresetSelect(props: Props) {
const label = props.label ?? defaultLabel;
return (
<>
<div className="hidden gap-2 whitespace-nowrap pr-2 md:flex">
{/* Desktop View */}
{props.options
.slice(0, props.options.length > 5 ? 4 : 5)
.map((option) => (
<button
className={classNames(
"rounded-xl border px-2 py-0.5 text-xs transition-all duration-200 ease-in-out hover:bg-zinc-600",
props.value?.id === option.id
? "border-white bg-zinc-100 font-bold text-black"
: "border-white/50 text-zinc-100",
)}
onClick={() => props.onChange?.(option)}
>
{label(option)}
</button>
))}
{props.options.length > 5 && (
<CameraPresetDropdown {...props} options={props.options.slice(4)} />
)}
</div>
<div className="md:hidden">
{/* Mobile View */}
<CameraPresetDropdown {...props} />
</div>
</>
);
}

export const CameraPresetDropdown = (props: Props) => {
const selected = props.value;

const options = props.options.filter(({ meta }) => meta.type !== "boundary");
Expand All @@ -20,9 +54,14 @@ export default function AssetBedSelect(props: Props) {
return (
<Listbox value={selected} onChange={props.onChange}>
<div className="relative flex-1">
<Listbox.Button className="relative w-full cursor-default pr-6 text-right text-xs text-zinc-400 focus:outline-none disabled:cursor-not-allowed disabled:bg-transparent disabled:text-zinc-700 sm:text-sm">
<span className="block truncate">
{selected ? label(selected) : "No Preset"}
<Listbox.Button className="relative w-full cursor-default pr-6 text-left text-xs text-white focus:outline-none disabled:cursor-not-allowed disabled:bg-transparent disabled:text-zinc-700 sm:text-sm md:pl-2">
<span
className={classNames(
"block truncate",
!selected && "text-gray-500",
)}
>
{selected ? label(selected) : "Select preset"}
</span>
<span className="pointer-events-none absolute inset-y-0 right-0 mt-1 flex items-center">
<CareIcon icon="l-angle-down" className="text-lg text-zinc-500" />
Expand Down Expand Up @@ -63,7 +102,7 @@ export default function AssetBedSelect(props: Props) {
</div>
</Listbox>
);
}
};

const defaultLabel = ({ bed_object, meta }: AssetBedModel) => {
return `${bed_object.name}: ${meta.preset_name}`;
Expand Down
Loading

0 comments on commit e7297f1

Please sign in to comment.