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

Fixes unknown option for heartbeat rhythm; adds i18n to vitals section #8411

Merged
merged 3 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 8 additions & 2 deletions src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,12 @@ export const RESOURCE_FILTER_ORDER: Array<OptionsType> = [
{ id: 4, text: "-modified_date", desc: "DESC Modified Date" },
];

export const HEARTBEAT_RHYTHM_CHOICES = [
"REGULAR",
"IRREGULAR",
"UNKNOWN",
] as const;

export const NURSING_CARE_PROCEDURES = [
"personal_hygiene",
"positioning",
Expand Down Expand Up @@ -760,12 +766,12 @@ export const RHYTHM_CHOICES = [
{ id: 10, text: "IRREGULAR", desc: "Irregular" },
] as const;

export const LOCATION_BED_TYPES: Array<any> = [
export const LOCATION_BED_TYPES = [
{ id: "ISOLATION", name: "Isolation" },
{ id: "ICU", name: "ICU" },
{ id: "BED_WITH_OXYGEN_SUPPORT", name: "Bed with oxygen support" },
{ id: "REGULAR", name: "Regular" },
];
] as const;

export const ASSET_META_TYPE = [
{ id: "CAMERA", text: "Camera(ONVIF)" },
Expand Down
8 changes: 8 additions & 0 deletions src/Components/LogUpdate/CriticalCarePreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,14 @@ export default function CriticalCarePreview(props: Props) {
},
]}
/>
<Detail
label={t("heartbeat_rhythm")}
value={data.rhythm && t(`HEARTBEAT_RHYTHM__${data.rhythm}`)}
/>
<Detail
label={t("heartbeat_description")}
value={data.rhythm_detail}
/>
<h4 className="py-4">Pain Scale</h4>
<PainChart pain={data.pain_scale_enhanced ?? []} />
</Section>
Expand Down
55 changes: 25 additions & 30 deletions src/Components/LogUpdate/Sections/Vitals.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useTranslation } from "react-i18next";
import {
celsiusToFahrenheit,
fahrenheitToCelsius,
Expand All @@ -10,11 +11,12 @@ import RadioFormField from "../../Form/FormFields/RadioFormField";
import RangeFormField from "../../Form/FormFields/RangeFormField";
import TextAreaFormField from "../../Form/FormFields/TextAreaFormField";
import { FieldChangeEvent } from "../../Form/FormFields/Utils";
import { DailyRoundsModel } from "../../Patient/models";
import PainChart from "../components/PainChart";
import { LogUpdateSectionMeta, LogUpdateSectionProps } from "../utils";
import { HEARTBEAT_RHYTHM_CHOICES } from "../../../Common/constants";

const Vitals = ({ log, onChange }: LogUpdateSectionProps) => {
const { t } = useTranslation();
const handleBloodPressureChange = (event: FieldChangeEvent<number>) => {
const bp = {
...(log.bp ?? {}),
Expand All @@ -27,11 +29,14 @@ const Vitals = ({ log, onChange }: LogUpdateSectionProps) => {
return (
<div className="space-y-8">
<div className="flex items-end justify-between">
<h2 className="text-lg">Blood Pressure</h2>
<span>MAP: {(log.bp?.mean && properRoundOf(log.bp.mean)) || "--"}</span>
<h2 className="text-lg">{t("blood_pressure")}</h2>
<span>
{t("map_acronym")}:{" "}
{(log.bp?.mean && properRoundOf(log.bp.mean)) || "--"}
</span>
</div>
<RangeFormField
label="Systolic"
label={t("systolic")}
name="systolic"
onChange={handleBloodPressureChange}
value={log.bp?.systolic}
Expand All @@ -42,7 +47,7 @@ const Vitals = ({ log, onChange }: LogUpdateSectionProps) => {
valueDescriptions={rangeValueDescription({ low: 99, high: 139 })}
/>
<RangeFormField
label="Diastolic"
label={t("diastolic")}
name="diastolic"
onChange={handleBloodPressureChange}
value={log.bp?.diastolic}
Expand All @@ -54,11 +59,7 @@ const Vitals = ({ log, onChange }: LogUpdateSectionProps) => {
/>
<hr />
<RangeFormField
label={
<span>
SpO<sub>2</sub>
</span>
}
label={t("spo2")}
name="ventilator_spo2" //TODO: ensure whether this should be ventilator_spo2 itself or spo2
onChange={(c) => onChange({ ventilator_spo2: c.value })}
value={log.ventilator_spo2}
Expand All @@ -69,7 +70,7 @@ const Vitals = ({ log, onChange }: LogUpdateSectionProps) => {
valueDescriptions={rangeValueDescription({ low: 89 })}
/>
<RangeFormField
label="Temperature"
label={t("temperature")}
name="temperature"
onChange={(c) => onChange({ temperature: c.value })}
value={log.temperature}
Expand All @@ -87,7 +88,7 @@ const Vitals = ({ log, onChange }: LogUpdateSectionProps) => {
]}
/>
<RangeFormField
label="Respiratory Rate"
label={t("resipiratory_rate")}
name="resp"
onChange={(c) => onChange({ resp: c.value })}
value={log.resp}
Expand All @@ -99,9 +100,9 @@ const Vitals = ({ log, onChange }: LogUpdateSectionProps) => {
/>
<hr />
<div>
<h2 className="text-lg">Pain</h2>
<h2 className="text-lg">{t("pain")}</h2>
<span className="text-secondary-800">
Mark region and intensity of pain
{t("pain_chart_description")}
</span>
</div>
<PainChart
Expand All @@ -110,7 +111,7 @@ const Vitals = ({ log, onChange }: LogUpdateSectionProps) => {
/>
<hr />
<RangeFormField
label="Pulse"
label={t("pulse")}
name="pulse"
onChange={(c) => onChange({ pulse: c.value })}
value={log.pulse}
Expand All @@ -122,36 +123,30 @@ const Vitals = ({ log, onChange }: LogUpdateSectionProps) => {
{
till: 40,
className: "text-red-500",
text: "Bradycardia",
text: t("bradycardia"),
},
{
till: 100,
className: "text-green-500",
text: "Normal",
text: t("normal"),
},
{
className: "text-red-500",
text: "Tachycardia",
text: t("tachycardia"),
},
]}
/>
<RadioFormField
label="Heartbeat Rhythm"
label={t("heartbeat_rhythm")}
name="heartbeat-rythm"
options={[
{ label: "Regular", value: "REGULAR" },
{ label: "Irregular", value: "IRREGULAR" },
{ label: "Unknown", value: null },
]}
optionDisplay={(c) => c.label}
optionValue={(c) => c.value || ""}
options={HEARTBEAT_RHYTHM_CHOICES}
optionDisplay={(c) => t(`HEARTBEAT_RHYTHM__${c}`)}
optionValue={(c) => c}
value={log.rhythm}
onChange={(c) =>
onChange({ rhythm: c.value as DailyRoundsModel["rhythm"] })
}
onChange={(c) => onChange({ rhythm: c.value ?? undefined })}
/>
<TextAreaFormField
label="Heartbeat Description"
label={t("heartbeat_description")}
name="rhythm_detail"
value={log.rhythm_detail}
onChange={(c) => onChange({ rhythm_detail: c.value })}
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Patient/models.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ConsultationModel, PatientCategory } from "../Facility/models";
import { PerformedByModel } from "../HCX/misc";
import {
CONSCIOUSNESS_LEVEL,
HEARTBEAT_RHYTHM_CHOICES,
HumanBodyRegion,
INSULIN_INTAKE_FREQUENCY_OPTIONS,
LIMB_RESPONSE_OPTIONS,
Expand All @@ -12,7 +13,6 @@ import {
PressureSoreTissueTypeOptions,
RATION_CARD_CATEGORY,
RESPIRATORY_SUPPORT,
RHYTHM_CHOICES,
VENTILATOR_MODE_OPTIONS,
} from "../../Common/constants";

Expand Down Expand Up @@ -311,7 +311,7 @@ export type IPressureSore = {
};
export interface DailyRoundsModel {
spo2?: number;
rhythm?: (typeof RHYTHM_CHOICES)[number]["text"];
rhythm?: (typeof HEARTBEAT_RHYTHM_CHOICES)[number];
rhythm_detail?: string;
bp?: BloodPressure;
pulse?: number;
Expand Down
1 change: 1 addition & 0 deletions src/Locale/en/Common.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@
"GENDER__1": "Male",
"GENDER__2": "Female",
"GENDER__3": "Non-binary",
"normal": "Normal",
"done": "Done",
"view": "View",
"rename": "Rename",
Expand Down
19 changes: 18 additions & 1 deletion src/Locale/en/LogUpdate.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,22 @@
"NURSING_CARE_PROCEDURE__chest_tube_care": "Chest Tube Care",
"NURSING_CARE_PROCEDURE__tracheostomy_care": "Tracheostomy Care",
"NURSING_CARE_PROCEDURE__stoma_care": "Stoma Care",
"NURSING_CARE_PROCEDURE__catheter_care": "Catheter Care"
"NURSING_CARE_PROCEDURE__catheter_care": "Catheter Care",
"HEARTBEAT_RHYTHM__REGULAR": "Regular",
"HEARTBEAT_RHYTHM__IRREGULAR": "Irregular",
"HEARTBEAT_RHYTHM__UNKNOWN": "Unknown",
"heartbeat_rhythm": "Heartbeat Rhythm",
"heartbeat_description": "Heartbeat Description",
"blood_pressure": "Blood Pressure",
"map_acronym": "M.A.P.",
"systolic": "Systolic",
"diastolic": "Diastolic",
"temperature": "Temperature",
"resipiratory_rate": "Respiratory Rate",
"pain": "Pain",
"pain_chart_description": "Mark region and intensity of pain",
"pulse": "Pulse",
"bradycardia": "Bradycardia",
"tachycardia": "Tachycardia",
"spo2": "SpO₂"
}
Loading