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

Log Update: Rounding off the PCO2 values to nearest integer #8776

Merged
6 changes: 5 additions & 1 deletion src/Components/Form/FormFields/RangeFormField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type BaseProps = FormFieldBaseProps<number> & {
valueDescriptions?: ValueDescription[];
hideInput?: boolean;
hideUnitInLabel?: boolean;
allowIntegersOnly?: boolean;
Jacobjeevan marked this conversation as resolved.
Show resolved Hide resolved
};

type PropsWithUnit = BaseProps & {
Expand Down Expand Up @@ -93,7 +94,10 @@ export default function RangeFormField(props: Props) {
sliderDelta) *
100;

const handleChange = (v: number) => field.handleChange(unit.inversionFn(v));
const handleChange = (v: number) =>
field.handleChange(
unit.inversionFn(props.allowIntegersOnly ? Math.round(v) : v),
);

const displayValue = value != null ? properRoundOf(value) : "";

Expand Down
5 changes: 5 additions & 0 deletions src/Components/LogUpdate/Sections/ABGAnalysis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const ABGAnalysisFields = [
min: 10,
max: 400,
valueDescription: rangeValueDescription({ low: 49, high: 200 }),
allowIntegersOnly: true,
},
{
key: "pco2",
Expand All @@ -28,6 +29,7 @@ export const ABGAnalysisFields = [
min: 10,
max: 200,
valueDescription: rangeValueDescription({ low: 34, high: 45 }),
allowIntegersOnly: true,
},
{
key: "ph",
Expand Down Expand Up @@ -58,6 +60,7 @@ export const ABGAnalysisFields = [
min: -20,
max: 20,
valueDescription: rangeValueDescription({ low: -3, high: 2 }),
allowIntegersOnly: true,
},
{
key: "lactate",
Expand Down Expand Up @@ -94,6 +97,7 @@ export const ABGAnalysisFields = [
max: number;
step?: number;
valueDescription: ValueDescription[];
allowIntegersOnly?: boolean;
}[];

const ABGAnalysis = ({ log, onChange }: LogUpdateSectionProps) => {
Expand All @@ -111,6 +115,7 @@ const ABGAnalysis = ({ log, onChange }: LogUpdateSectionProps) => {
max={field.max}
step={field.step || 1}
valueDescriptions={field.valueDescription}
allowIntegersOnly={field.allowIntegersOnly ?? false}
/>
))}
</div>
Expand Down
1 change: 1 addition & 0 deletions src/Components/LogUpdate/Sections/BloodSugar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const BloodSugar = ({ log, onChange }: LogUpdateSectionProps) => {
min={0}
max={700}
valueDescriptions={rangeValueDescription({ low: 69, high: 110 })}
allowIntegersOnly
/>
<br />
<hr />
Expand Down
2 changes: 2 additions & 0 deletions src/Components/LogUpdate/Sections/Dialysis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const Dialysis = ({ log, onChange }: LogUpdateSectionProps) => {
value={log.dialysis_fluid_balance}
min={0}
max={5000}
allowIntegersOnly
/>
<br />
<RangeFormField
Expand All @@ -22,6 +23,7 @@ const Dialysis = ({ log, onChange }: LogUpdateSectionProps) => {
value={log.dialysis_net_balance}
min={0}
max={5000}
allowIntegersOnly
/>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const OxygenRespiratorySupport = ({ log, onChange }: LogUpdateSectionProps) => {
min={0}
max={70}
valueDescriptions={rangeValueDescription({ low: 34, high: 60 })}
allowIntegersOnly
/>
<br />
<RangeFormField
Expand All @@ -56,6 +57,7 @@ const OxygenRespiratorySupport = ({ log, onChange }: LogUpdateSectionProps) => {
min={21}
max={100}
valueDescriptions={rangeValueDescription({ high: 60 })}
allowIntegersOnly
/>
</>
) : (
Expand All @@ -72,6 +74,7 @@ const OxygenRespiratorySupport = ({ log, onChange }: LogUpdateSectionProps) => {
min={0}
max={50}
valueDescriptions={rangeValueDescription({ low: 4, high: 10 })}
allowIntegersOnly
/>
)}
<br />
Expand All @@ -88,6 +91,7 @@ const OxygenRespiratorySupport = ({ log, onChange }: LogUpdateSectionProps) => {
min={0}
max={100}
valueDescriptions={rangeValueDescription({ low: 89 })}
allowIntegersOnly
/>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const VentilatorFields = [
min: 0,
max: 100,
valueDescription: rangeValueDescription({ low: 11, high: 30 }),
allowIntegersOnly: true,
},
{
key: "ventilator_mean_airway_pressure",
Expand All @@ -32,6 +33,7 @@ export const VentilatorFields = [
min: 0,
max: 40,
valueDescription: rangeValueDescription({ low: 11, high: 25 }),
allowIntegersOnly: true,
},
{
key: "ventilator_resp_rate",
Expand All @@ -40,6 +42,7 @@ export const VentilatorFields = [
min: 0,
max: 100,
valueDescription: rangeValueDescription({ low: 39, high: 60 }),
allowIntegersOnly: true,
},
{
key: "ventilator_pressure_support",
Expand All @@ -48,6 +51,7 @@ export const VentilatorFields = [
min: 0,
max: 40,
valueDescription: rangeValueDescription({ low: 6, high: 15 }),
allowIntegersOnly: true,
},
{
key: "ventilator_tidal_volume",
Expand All @@ -56,6 +60,7 @@ export const VentilatorFields = [
min: 0,
max: 1000,
valueDescription: rangeValueDescription({}),
allowIntegersOnly: true,
},
{
key: "ventilator_fio2",
Expand All @@ -68,6 +73,7 @@ export const VentilatorFields = [
min: 21,
max: 100,
valueDescription: rangeValueDescription({ high: 60 }),
allowIntegersOnly: true,
},
{
key: "ventilator_spo2",
Expand All @@ -80,6 +86,7 @@ export const VentilatorFields = [
min: 0,
max: 100,
valueDescription: rangeValueDescription({ low: 89 }),
allowIntegersOnly: true,
},
] satisfies {
key: keyof DailyRoundsModel;
Expand All @@ -89,6 +96,7 @@ export const VentilatorFields = [
max: number;
step?: number;
valueDescription: ValueDescription[];
allowIntegersOnly?: boolean;
}[];

const VentilatorRespiratorySupport = ({
Expand Down Expand Up @@ -116,6 +124,7 @@ const VentilatorRespiratorySupport = ({
max={field.max}
step={field.step || 1}
valueDescriptions={field.valueDescription}
allowIntegersOnly={field.allowIntegersOnly}
/>
))}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const RespiratorySupport = ({ log, onChange }: LogUpdateSectionProps) => {
max={200}
step={1}
valueDescriptions={rangeValueDescription({ low: 34, high: 45 })}
allowIntegersOnly
/>
<hr />
<RadioFormField
Expand Down
3 changes: 3 additions & 0 deletions src/Components/LogUpdate/Sections/Vitals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const Vitals = ({ log, onChange }: LogUpdateSectionProps) => {
step={1}
unit="%"
valueDescriptions={rangeValueDescription({ low: 89 })}
allowIntegersOnly
/>
<RangeFormField
label={t("LOG_UPDATE_FIELD_LABEL__temperature")}
Expand Down Expand Up @@ -67,6 +68,7 @@ const Vitals = ({ log, onChange }: LogUpdateSectionProps) => {
step={1}
unit="bpm"
valueDescriptions={rangeValueDescription({ low: 11, high: 16 })}
allowIntegersOnly
/>
<hr />
<div>
Expand Down Expand Up @@ -105,6 +107,7 @@ const Vitals = ({ log, onChange }: LogUpdateSectionProps) => {
text: t("tachycardia"),
},
]}
allowIntegersOnly
/>
<RadioFormField
label={t("LOG_UPDATE_FIELD_LABEL__rhythm")}
Expand Down
Loading