From 1554ef2fc6af55333199140659468e894b220dda Mon Sep 17 00:00:00 2001
From: Khavin Shankar <khavinshankar@gmail.com>
Date: Wed, 22 May 2024 14:02:17 +0530
Subject: [PATCH] Show standardized labels for patient categorization (#7875)

---
 cypress/e2e/patient_spec/patient_consultation.cy.ts | 6 +++---
 cypress/e2e/patient_spec/patient_logupdate.cy.ts    | 2 +-
 src/Common/constants.tsx                            | 4 ++--
 src/Components/Facility/models.tsx                  | 6 +-----
 src/Components/Patient/ManagePatients.tsx           | 9 +--------
 5 files changed, 8 insertions(+), 19 deletions(-)

diff --git a/cypress/e2e/patient_spec/patient_consultation.cy.ts b/cypress/e2e/patient_spec/patient_consultation.cy.ts
index 8caea111ca1..d5732a6619d 100644
--- a/cypress/e2e/patient_spec/patient_consultation.cy.ts
+++ b/cypress/e2e/patient_spec/patient_consultation.cy.ts
@@ -66,7 +66,7 @@ describe("Patient Consultation in multiple combination", () => {
     );
     patientConsultationPage.typePatientWeight(patientWeight);
     patientConsultationPage.typePatientHeight(patientHeight);
-    patientConsultationPage.selectPatientCategory("Stable");
+    patientConsultationPage.selectPatientCategory("Mild");
     // icd 11 - 4 diagnosis with one principal
     patientConsultationPage.selectPatientDiagnosis(
       diagnosis1,
@@ -236,7 +236,7 @@ describe("Patient Consultation in multiple combination", () => {
     // Asymptomatic
     cy.searchAndSelectOption("#symptoms", "ASYMPTOMATIC");
     // Abnormal category
-    patientConsultationPage.selectPatientCategory("Abnormal");
+    patientConsultationPage.selectPatientCategory("Moderate");
     patientConsultationPage.selectPatientSuggestion("Domiciliary Care");
     // one ICD-11 diagnosis
     patientConsultationPage.selectPatientDiagnosis(
@@ -299,7 +299,7 @@ describe("Patient Consultation in multiple combination", () => {
       "SORE THROAT",
     ]);
     // Stable category
-    patientConsultationPage.selectPatientCategory("Stable");
+    patientConsultationPage.selectPatientCategory("Mild");
     // Date of symptoms
     patientConsultationPage.selectSymptomsDate(
       "#symptoms_onset_date",
diff --git a/cypress/e2e/patient_spec/patient_logupdate.cy.ts b/cypress/e2e/patient_spec/patient_logupdate.cy.ts
index 8cf83b1c5a8..a55b86e464b 100644
--- a/cypress/e2e/patient_spec/patient_logupdate.cy.ts
+++ b/cypress/e2e/patient_spec/patient_logupdate.cy.ts
@@ -10,7 +10,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
   const patientPage = new PatientPage();
   const patientLogupdate = new PatientLogupdate();
   const domicilaryPatient = "Dummy Patient 11";
-  const patientCategory = "Abnormal";
+  const patientCategory = "Moderate";
   const additionalSymptoms = "ASYMPTOMATIC";
   const physicalExamination = "physical examination details";
   const otherExamination = "Other";
diff --git a/src/Common/constants.tsx b/src/Common/constants.tsx
index 10cdbdbcc7f..de0ab305f48 100644
--- a/src/Common/constants.tsx
+++ b/src/Common/constants.tsx
@@ -431,8 +431,8 @@ export const PATIENT_CATEGORIES: {
   twClass: string;
 }[] = [
   { id: "Comfort", text: "Comfort Care", twClass: "patient-comfort" },
-  { id: "Stable", text: "Stable", twClass: "patient-stable" },
-  { id: "Moderate", text: "Abnormal", twClass: "patient-abnormal" },
+  { id: "Stable", text: "Mild", twClass: "patient-stable" },
+  { id: "Moderate", text: "Moderate", twClass: "patient-abnormal" },
   { id: "Critical", text: "Critical", twClass: "patient-critical" },
 ];
 
diff --git a/src/Components/Facility/models.tsx b/src/Components/Facility/models.tsx
index d61d5a9f129..49a2f1346af 100644
--- a/src/Components/Facility/models.tsx
+++ b/src/Components/Facility/models.tsx
@@ -95,11 +95,7 @@ export interface OptionsType {
   disabled?: boolean;
 }
 
-export type PatientCategory =
-  | "Comfort Care"
-  | "Stable"
-  | "Abnormal"
-  | "Critical";
+export type PatientCategory = "Comfort Care" | "Mild" | "Moderate" | "Critical";
 
 export interface ConsultationModel {
   encounter_date: string;
diff --git a/src/Components/Patient/ManagePatients.tsx b/src/Components/Patient/ManagePatients.tsx
index e0a3b2d9ee5..ac716f7bf45 100644
--- a/src/Components/Patient/ManagePatients.tsx
+++ b/src/Components/Patient/ManagePatients.tsx
@@ -77,13 +77,6 @@ function TabPanel(props: TabPanelProps) {
   );
 }
 
-const PatientCategoryDisplayText: Record<PatientCategory, string> = {
-  "Comfort Care": "COMFORT CARE",
-  Stable: "STABLE",
-  Abnormal: "ABNORMAL",
-  Critical: "CRITICAL",
-};
-
 export const PatientManager = () => {
   const { t } = useTranslation();
   const {
@@ -473,7 +466,7 @@ export const PatientManager = () => {
             className={`absolute inset-y-0 left-0 flex h-full w-1 items-center rounded-l-lg transition-all duration-200 ease-in-out group-hover:w-5 ${categoryClass}`}
           >
             <span className="absolute -inset-x-32 inset-y-0 flex -rotate-90 items-center justify-center text-center text-xs font-bold uppercase tracking-widest opacity-0 transition-all duration-200 ease-in-out group-hover:opacity-100">
-              {category ? PatientCategoryDisplayText[category] : "UNKNOWN"}
+              {category || "UNKNOWN"}
             </span>
           </div>
           <div className="flex flex-col items-start gap-4 md:flex-row">