Skip to main content

PediatricDosingCalculator

ComplexSpecialty<co-pediatric-dosing-calculator>

PediatricDosingCalculator works out a weight-based dose in mg/kg, caps it at the maximum single and daily dose, converts it to mL, and shows the working so a second person can check it.

import { PediatricDosingCalculator } from 'health-components';

Examples​

Capped Single Dose​

Storybook

Stale Weight​

Storybook

No Weight Read Only​

Storybook

Usage​

<PediatricDosingCalculator defaultWeight={18.4} drugs={[{ name: "Ibuprofen", form: "100 mg/5 mL suspension", mgkg: 10, perDay: 4, freq: "every 6 hours as needed", maxDose: 400, maxDaily: 1600, conc: 20 }]} />

When to use​

  • Pediatric prescribing, ED and urgent care, inpatient pediatric orders.

When not to use​

  • Infusions in mcg/kg/min: a drip calculator.
  • Chemotherapy by body surface area: OncologyRegimen.

Variants and states​

VariantWhat it is
normalWeight times mg/kg equals the dose, then volume at the concentration.
capped singleThe weight-based dose is above the maximum single dose: warning Alert, maximum used.
capped dailyDoses per day would pass the daily maximum: each dose reduced.
invalid weightEmpty, zero or above 150 kg: field error and no result.
stale weightWarning to weigh again.
readOnlyHides Use in Order.

Clinical values​

Every number goes through the shared clinical value rules (CareOS.fmt and ClinicalValue from the clinical-values card): tabular digits, the unit always shown, a fixed precision per measure, the reference range in the tooltip, and H, L or critical flags. Medication amounts follow the ISMP dose style through fmt.doseNumber: rounded to the stated precision, then shown with no trailing zero (5 mg, never 5.0 mg) and a leading zero (0.5 mL). The specialty measures this card adds sit in CareOS.specialty.MEAS with their precision: weight 1 decimal kg; mg/kg, dose, volume and concentration rounded to 0.1 then shown without trailing zeros. Ranges in the previews are sample values for the design system, not clinical guidance; a real deployment passes its own.

Accessibility​

  • The result is a live region so changes to weight are announced.
  • Caps are explained in words, not just a colour.
  • Weight has a unit suffix and an error message tied to the field.

Do and don't​

  • Do: Show the working: weight, mg/kg and the raw dose.
  • Do: Ask for a second check on high-alert drugs.
  • Don't: Hide that a dose was capped.
  • Don't: Accept a weight without a date.

Props​

PropTypeDefaultDescription
drugs *ReadonlyArray<PediatricDrug>—Medications to choose from; required
weightstringuncontrolledWeight in kg typed in the field (controlled, text)
defaultWeightnumbernoneFirst weight in kg (uncontrolled)
onWeightChange(weight: string) => voidnoneCalled with the weight text as typed
drugnumberuncontrolledSelected medication index (controlled)
defaultDrugnumber0First medication index (uncontrolled)
onDrugChange(index: number) => voidnoneCalled with the medication index
weightDatestringnone (helper asks for today's weight)When the weight was taken
weightStalestringnoneHow old the weight is ("45 days"): shows a warning
titlestring'Pediatric dose calculator'Card title
subtitlestringnoneLine under the title
readOnlybooleanfalseHides Use in Order and Request Double Check
onUseInOrder(result: Exclude<PedsDoseResult, { error: string }>, drug: PediatricDrug) => voidnoneUse in Order action, with the result and the medication
onRequestDoubleCheck() => voidnoneRequest Double Check action
rangeContextRangeContextIdthe global context, else 'outpatient'Which shared reference range flags use; the lab range on a result still wins

Also accepts native attributes, including defaultChecked, defaultValue, autoFocus, plus className and event handlers on the root element.

Angular, Vue and HTML​

Register the elements once (Angular guide), then use <co-pediatric-dosing-calculator>. Attributes take strings; arrays and objects are set as properties (Angular [prop], Vue :prop) or as JSON attributes. Callbacks are DOM events with the value in event.detail.

Angular template
<co-pediatric-dosing-calculator weight="…" default-weight="…" [drugs]="drugs" (co-weight-change)="onWeightChange($event.detail)"></co-pediatric-dosing-calculator>
KindNameDescription
property / JSON attributedrugsMedications to choose from; required
attributeweightWeight in kg typed in the field (controlled, text); default uncontrolled
attributedefault-weight / defaultWeightFirst weight in kg (uncontrolled); default none
attributedrugSelected medication index (controlled); default uncontrolled
attributedefault-drug / defaultDrugFirst medication index (uncontrolled); default 0
attributeweight-date / weightDateWhen the weight was taken; default none (helper asks for today's weight)
attributeweight-stale / weightStaleHow old the weight is ("45 days"): shows a warning; default none
attributetitleCard title; default 'Pediatric dose calculator'
attributesubtitleLine under the title; default none
attributeread-only / readOnlyHides Use in Order and Request Double Check; default false
attributerange-context / rangeContextWhich shared reference range flags use; the lab range on a result still wins; default the global context, else 'outpatient'
attributedefault-checked / defaultChecked
property / JSON attributedefault-value / defaultValue
attributeauto-focus / autoFocus
eventco-weight-changeCalled with the weight text as typed; default none (React: onWeightChange)
eventco-drug-changeCalled with the medication index; default none (React: onDrugChange)
eventco-use-in-orderUse in Order action, with the result and the medication; default none (React: onUseInOrder)
eventco-request-double-checkRequest Double Check action; default none (React: onRequestDoubleCheck)