PediatricDosingCalculator
<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
Stale Weight
No Weight Read Only
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
| Variant | What it is |
|---|---|
| normal | Weight times mg/kg equals the dose, then volume at the concentration. |
| capped single | The weight-based dose is above the maximum single dose: warning Alert, maximum used. |
| capped daily | Doses per day would pass the daily maximum: each dose reduced. |
| invalid weight | Empty, zero or above 150 kg: field error and no result. |
| stale weight | Warning to weigh again. |
| readOnly | Hides 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
| Prop | Type | Default | Description |
|---|---|---|---|
drugs * | ReadonlyArray<PediatricDrug> | — | Medications to choose from; required |
weight | string | uncontrolled | Weight in kg typed in the field (controlled, text) |
defaultWeight | number | none | First weight in kg (uncontrolled) |
onWeightChange | (weight: string) => void | none | Called with the weight text as typed |
drug | number | uncontrolled | Selected medication index (controlled) |
defaultDrug | number | 0 | First medication index (uncontrolled) |
onDrugChange | (index: number) => void | none | Called with the medication index |
weightDate | string | none (helper asks for today's weight) | When the weight was taken |
weightStale | string | none | How old the weight is ("45 days"): shows a warning |
title | string | 'Pediatric dose calculator' | Card title |
subtitle | string | none | Line under the title |
readOnly | boolean | false | Hides Use in Order and Request Double Check |
onUseInOrder | (result: Exclude<PedsDoseResult, { error: string }>, drug: PediatricDrug) => void | none | Use in Order action, with the result and the medication |
onRequestDoubleCheck | () => void | none | Request Double Check action |
rangeContext | RangeContextId | the 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.
<co-pediatric-dosing-calculator weight="…" default-weight="…" [drugs]="drugs" (co-weight-change)="onWeightChange($event.detail)"></co-pediatric-dosing-calculator>
| Kind | Name | Description |
|---|---|---|
| property / JSON attribute | drugs | Medications to choose from; required |
| attribute | weight | Weight in kg typed in the field (controlled, text); default uncontrolled |
| attribute | default-weight / defaultWeight | First weight in kg (uncontrolled); default none |
| attribute | drug | Selected medication index (controlled); default uncontrolled |
| attribute | default-drug / defaultDrug | First medication index (uncontrolled); default 0 |
| attribute | weight-date / weightDate | When the weight was taken; default none (helper asks for today's weight) |
| attribute | weight-stale / weightStale | How old the weight is ("45 days"): shows a warning; default none |
| attribute | title | Card title; default 'Pediatric dose calculator' |
| attribute | subtitle | Line under the title; default none |
| attribute | read-only / readOnly | Hides Use in Order and Request Double Check; default false |
| attribute | range-context / rangeContext | Which shared reference range flags use; the lab range on a result still wins; default the global context, else 'outpatient' |
| attribute | default-checked / defaultChecked | |
| property / JSON attribute | default-value / defaultValue | |
| attribute | auto-focus / autoFocus | |
| event | co-weight-change | Called with the weight text as typed; default none (React: onWeightChange) |
| event | co-drug-change | Called with the medication index; default none (React: onDrugChange) |
| event | co-use-in-order | Use in Order action, with the result and the medication; default none (React: onUseInOrder) |
| event | co-request-double-check | Request Double Check action; default none (React: onRequestDoubleCheck) |