Skip to content

Commit

Permalink
Adds support for specifying onset and cure date in Encounter Symptoms (
Browse files Browse the repository at this point in the history
…#7874)

* update types and required utilities

* Implements necessary reusable components for composing the Symptoms Builder

* Migrate in Consultation Form

* Migrate in daily rounds form

* improve reusability

* patch types, remove unused references, switch to new choices

* rename consultation symptom to encounter symptom

* Show symptoms in consultation dashboard

* add loading state

* update sorting

* add loading state

* fixes during QA

* fix responsiveness of symptoms card

* update button design

* Make symptoms builder entries responsive

* make add symptom block responsive

* correct separator for for last element

* remove unused imports
  • Loading branch information
rithviknishad authored May 28, 2024
1 parent f238475 commit 54a3244
Show file tree
Hide file tree
Showing 19 changed files with 746 additions and 363 deletions.
36 changes: 0 additions & 36 deletions src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -318,42 +318,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
85 changes: 0 additions & 85 deletions src/Components/Common/SymptomsSelect.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions src/Components/Diagnosis/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import routes from "../../Redux/api";
import request from "../../Utils/request/request";
import { ICD11DiagnosisModel } from "./types";

// TODO: cache ICD11 responses and hit the cache if present instead of making an API call.

export const getDiagnosisById = async (id: ICD11DiagnosisModel["id"]) => {
return (await request(routes.getICD11Diagnosis, { pathParams: { id } })).data;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { BedModel } from "../models";
import HL7PatientVitalsMonitor from "../../VitalsMonitor/HL7PatientVitalsMonitor";
import VentilatorPatientVitalsMonitor from "../../VitalsMonitor/VentilatorPatientVitalsMonitor";
import useVitalsAspectRatioConfig from "../../VitalsMonitor/useVitalsAspectRatioConfig";
import { DISCHARGE_REASONS, SYMPTOM_CHOICES } from "../../../Common/constants";
import { DISCHARGE_REASONS } from "../../../Common/constants";
import PrescriptionsTable from "../../Medicine/PrescriptionsTable";
import Chip from "../../../CAREUI/display/Chip";
import {
Expand All @@ -23,6 +23,7 @@ import { getVitalsMonitorSocketUrl } from "../../VitalsMonitor/utils";
import useQuery from "../../../Utils/request/useQuery";
import routes from "../../../Redux/api";
import CareIcon from "../../../CAREUI/icons/CareIcon";
import EncounterSymptomsCard from "../../Symptoms/SymptomsCard";

const PageTitle = lazy(() => import("../../Common/PageTitle"));

Expand Down Expand Up @@ -363,91 +364,10 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
)}
</div>
)}
{props.consultationData.symptoms_text && (
<div className="overflow-hidden rounded-lg bg-white shadow">
<div className="px-4 py-5 sm:p-6">
<h3 className="mb-4 text-lg font-semibold leading-relaxed text-gray-900">
Symptoms
</h3>
<div className="">
<div className="text-sm font-semibold uppercase">
Last Daily Update
</div>
{props.consultationData.last_daily_round
?.additional_symptoms && (
<>
<div className="my-4 flex flex-wrap items-center gap-2">
{props.consultationData.last_daily_round?.additional_symptoms.map(
(symptom: any, index: number) => (
<Chip
key={index}
text={
SYMPTOM_CHOICES.find(
(choice) => choice.id === symptom,
)?.text ?? "Err. Unknown"
}
size="small"
/>
),
)}
</div>
{props.consultationData.last_daily_round
?.other_symptoms && (
<div className="capitalize">
<div className="text-xs font-semibold">
Other Symptoms:
</div>
{
props.consultationData.last_daily_round
?.other_symptoms
}
</div>
)}
<span className="text-xs font-semibold leading-relaxed text-gray-800">
from{" "}
{formatDate(
props.consultationData.last_daily_round.taken_at,
)}
</span>
</>
)}
<hr className="my-4 border border-gray-300" />
<div className="text-sm font-semibold uppercase">
Consultation Update
</div>
<div className="my-4 flex flex-wrap items-center gap-2">
{props.consultationData.symptoms?.map(
(symptom, index) => (
<Chip
key={index}
text={
SYMPTOM_CHOICES.find(
(choice) => choice.id === symptom,
)?.text ?? "Err. Unknown"
}
size="small"
/>
),
)}
</div>
{props.consultationData.other_symptoms && (
<div className="capitalize">
<div className="text-xs font-semibold">
Other Symptoms:
</div>
{props.consultationData.other_symptoms}
</div>
)}
<span className="text-xs font-semibold leading-relaxed text-gray-800">
from{" "}
{props.consultationData.symptoms_onset_date
? formatDate(props.consultationData.symptoms_onset_date)
: "--/--/----"}
</span>
</div>
</div>
</div>
)}

<div className="rounded-lg bg-white px-4 py-5 shadow sm:p-6 md:col-span-2">
<EncounterSymptomsCard />
</div>

{props.consultationData.history_of_present_illness && (
<div className="overflow-hidden rounded-lg bg-white shadow">
Expand Down
25 changes: 10 additions & 15 deletions src/Components/Facility/ConsultationDetails/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import {
CONSULTATION_TABS,
GENDER_TYPES,
SYMPTOM_CHOICES,
} from "../../../Common/constants";
import { CONSULTATION_TABS, GENDER_TYPES } from "../../../Common/constants";
import { ConsultationModel } from "../models";
import {
getConsultation,
Expand Down Expand Up @@ -44,7 +40,6 @@ import { CameraFeedPermittedUserTypes } from "../../../Utils/permissions";

const Loading = lazy(() => import("../../Common/Loading"));
const PageTitle = lazy(() => import("../../Common/PageTitle"));
const symptomChoices = [...SYMPTOM_CHOICES];

export interface ConsultationTabProps {
consultationId: string;
Expand Down Expand Up @@ -114,15 +109,15 @@ export const ConsultationDetails = (props: any) => {
...res.data,
symptoms_text: "",
};
if (res.data.symptoms?.length) {
const symptoms = res.data.symptoms
.filter((symptom: number) => symptom !== 9)
.map((symptom: number) => {
const option = symptomChoices.find((i) => i.id === symptom);
return option ? option.text.toLowerCase() : symptom;
});
data.symptoms_text = symptoms.join(", ");
}
// if (res.data.symptoms?.length) {
// const symptoms = res.data.symptoms
// .filter((symptom: number) => symptom !== 9)
// .map((symptom: number) => {
// const option = symptomChoices.find((i) => i.id === symptom);
// return option ? option.text.toLowerCase() : symptom;
// });
// data.symptoms_text = symptoms.join(", ");
// }
if (facilityId != data.facility || patientId != data.patient) {
navigate(
`/facility/${data.facility}/patient/${data.patient}/consultation/${data?.id}`,
Expand Down
Loading

0 comments on commit 54a3244

Please sign in to comment.