Skip to main content

Clinical values

Every clinical number in CareOS goes through one shared formatter, fmt, exported from health-components together with the range registry and the range context. The rules below are normative; the components in Clinical values (ClinicalValue, AbnormalFlag, ReferenceRangeBar, UnitToggle, DoseDisplay, DateTimeClinical, IdentifierDisplay, CodeDisplay, MoneyDisplay) and every complex component that shows a clinical value apply them by calling fmt.

Sample ranges

Every range in the registry is a sample value, not clinical guidance. Pass the performing lab's range on each result.

Clinical value rules​

Every clinical number in CareOS goes through CareOS.fmt. Components never call toFixed or build a unit string themselves. This is what makes a potassium of 5.4 look the same in the banner, the flowsheet, the result inbox and the mobile app.

  1. Tabular figures. Numbers use font-variant-numeric: tabular-nums so columns line up.
  2. Unit always shown. Data keeps the UCUM code (mm[Hg], Cel, 10*3/uL); the screen shows the readable label (mmHg, °C, K/µL). A value with no unit is a bug.
  3. Precision belongs to the measure. Each measure has one number of decimals, applied by rounding half away from zero. Lab and vital values keep trailing zeros at that precision (temperature 37.0 °C) because the precision itself carries meaning.
  4. Doses follow ISMP. Doses are the exception to rule 3: never a trailing zero (5 mg, not 5.0 mg), always a leading zero (0.5 mg, not .5 mg), "units" never "U" or "IU", "mcg" never "µg", "mL" never "cc", commas from 1,000. Look-alike drug names use tall-man lettering (hydrOXYzine, hydrALAZINE).
  5. Flags are never colour alone. Every flag shows a letter (N, L, H, LL, HH, A), an icon and a screen-reader word. Critical flags also show the word on screen.
  6. Critical thresholds use strict comparison. A value flags LL only when it is below critLow and HH only when it is above critHigh. A lab that defines critical as "at or below" must send its own flag.
  7. The range travels with the value. Hover or focus shows the reference range, LOINC code, time and source. When a value is converted to another unit, the range converts with it.
  8. Entered in error stays visible. The number is struck through, greyed, never flagged and labelled "Entered in error". It is never silently removed.
  9. Negative money uses parentheses: ($45.00). Dates are MM/DD/YYYY; times are 12-hour by default with a 24-hour option, and show the zone when one is passed.

Precision per measure​

Decimals and display unit per measure. Ranges are not in this table: every set reads them from one registry, described below.

MeasureLOINCUnit shownDecimalsPaediatric note
Systolic BP8480-6mmHg0Age and height percentiles under 13 y
Diastolic BP8462-4mmHg0
Heart rate8867-4bpm0Newborn 100-160
Respiratory rate9279-1breaths/min0Newborn 30-60
Temperature8310-5°C (°F)1
SpO259408-5%0COPD targets set per patient
Weight29463-7kg (lb)1Infants under 10 kg: 2 decimals
Height8302-2cm (in)1
BMI39156-5kg/m²1Under 20 y: BMI-for-age percentile
Pain score72514-3/100FLACC or Wong-Baker in young children
Glucose2345-7mg/dL (mmol/L, 1 dp)0
Potassium2823-3mmol/L1Newborn upper limit about 6.0
Sodium2951-2mmol/L0
Creatinine2160-0mg/dL (µmol/L, 0 dp)2Much lower in children
eGFR98979-8mL/min/1.73m²0Not reported under 18 y by most labs
Hemoglobin A1c4548-4% (mmol/mol, 0 dp)1
INR6301-6INR1On warfarin the target replaces the range
Hemoglobin718-7g/dL1Adult female 11.6-15.0
WBC6690-2K/µL1
Platelets777-3K/µL0
LDL cholesterol13457-7mg/dL0
TSH3016-3mIU/L2
Troponin I, high sensitivity89579-7ng/L0Cut-off is assay specific

The reference ranges for these measures are in the next section, Reference ranges and flags.

Conversion factors​

ConversionFormulaBasis
lb to kg× 0.45359237Exact by definition
in to cm× 2.54Exact by definition
°F to °C(F − 32) × 5/9Exact
Glucose mg/dL to mmol/L÷ 18.016From molar mass 180.16 g/mol
Creatinine mg/dL to µmol/L× 88.42From molar mass 113.12 g/mol
A1c % to mmol/mol(% − 2.15) × 10.929IFCC master equation

Conversion happens on the stored number, never on the rounded display. Converting 154.3 lb back and forth never drifts.

Age display​

Under 14 days in days (8 d), under 8 weeks in weeks (6 wk), under 24 months in months (9 mo), then years (47 y). Gestational age shows as 38w 4d, from weeks and days or from the EDD.

Reference ranges and flags​

Every CareOS set reads reference ranges from one registry, CareOS.fmt.RANGES, and flags through one function, CareOS.fmt.flag(value, measure, {context, refLow, refHigh}). The same value in the same context gets the same flag on the ED board, the inpatient census, the nursing flowsheet, the chart panels, the specialty screens and ClinicalValue. build/probe_values.js checks this on every build.

Every range in the registry is a sample value, not clinical guidance. Each entry carries source: 'sample value, not clinical guidance'. A deployment replaces the registry with its own reviewed ranges or, better, passes the performing lab's range on each result.

Which range wins​

  1. The lab range on the result. refLow / refHigh passed with the value (FHIR Observation.referenceRange) replace the registry's reference edges in every context. Lab critLow / critHigh replace the registry's critical edges when passed; otherwise the context's critical edges still apply.
  2. The component's rangeContext prop. Every complex component in the inpatient, ED, specialty and chart panel sets, and ClinicalValue, ReferenceRangeBar and UnitToggle, take rangeContext. It reaches every value inside the component. CareOS.RangeContext.Provider does the same for a whole subtree.
  3. The global setting. CareOS.setRangeContext('outpatient' | 'inpatient' | 'ed' | 'pediatric' | 'pregnancy') sets the context for the whole app and re-renders every value. CareOS.setRangeContext(null) clears it.
  4. The set's default. ED and perioperative parts default to ed; inpatient flow and inpatient nursing parts default to inpatient; PrenatalFlowsheet defaults to pregnancy. The others have no default.
  5. Outpatient adult, when nothing above applies.

A context a measure does not define falls back to outpatient. The ed context therefore equals outpatient adult for every measure except temperature, where it uses the fever cut-off of 38.0 °C. The pediatric context picks the band by ageYears; with no age it uses the oldest band, so a missing age never applies an infant's range to a teenager. No set passes an age today, so pediatric bands only apply where a caller passes ageYears to CareOS.fmt.flag or ClinicalValue.

The precedence of the set default under the global setting is a design choice: an app that calls setRangeContext controls every screen, and a screen that needs a different context says so with the prop.

Sample ranges​

Reference edges, with critical edges in parentheses. A value flags L or H when it is strictly outside the reference edges and LL or HH when it is strictly outside the critical edges. Units are the measure's display unit.

Measure keyOutpatient (default adult)InpatientEDPediatric (age bands)Pregnancy
bpSys90-129 (crit <70, >180)90-139 (crit <70, >180)as outpatient1-12 y: 85-115 (crit <60, >140); 13-17 y: 90-129 (crit <70, >160)90-139 (crit <70, >159)
bpDia60-79 (crit <40, >120)60-89 (crit <40, >120)as outpatient1-12 y: 50-75 (crit <35, >100); 13-17 y: 60-79 (crit <40, >110)60-89 (crit <40, >109)
map65-110 (crit <55, >130)as outpatientas outpatientas outpatientas outpatient
hr60-100 (crit <40, >150)as outpatientas outpatientunder 1 y: 100-160 (crit <80, >200); 1-5 y: 80-140 (crit <60, >180); 6-12 y: 70-120 (crit <50, >160); 13-17 y: 60-100 (crit <40, >150)60-110 (crit <40, >150)
rr12-20 (crit <8, >30)as outpatientas outpatientunder 1 y: 30-60 (crit <20, >70); 1-5 y: 24-40 (crit <16, >50); 6-12 y: 18-30 (crit <12, >40); 13-17 y: 12-20 (crit <8, >30)as outpatient
temp36.1-37.2 (crit <35, >40)36.1-37.9 (crit <35, >40)36.1-37.9 (crit <35, >40)as outpatientas outpatient
spo295-100 (crit <88)92-100 (crit <88)as outpatientas outpatientas outpatient
etco235-45 (crit <25, >60)as outpatientas outpatientas outpatientas outpatient
gcs15-15 (crit <9)as outpatientas outpatientas outpatientas outpatient
bmi18.5-24.9as outpatientas outpatientas outpatientas outpatient
pain0-3as outpatientas outpatientas outpatientas outpatient
glucose70-99 (crit <54, >400)70-180 (crit <54, >400)as outpatientunder 1 month: 50-99 (crit <40, >300); 1 month-17 y: 70-99 (crit <54, >400)70-94 (crit <54, >400)
potassium3.5-5.1 (crit <2.8, >6.2)as outpatientas outpatientunder 1 month: 3.7-5.9 (crit <2.8, >7); 1 month-17 y: 3.4-4.7 (crit <2.8, >6)as outpatient
sodium136-145 (crit <120, >160)as outpatientas outpatientas outpatientas outpatient
chloride98-107as outpatientas outpatientas outpatientas outpatient
bicarbonate22-29 (crit <10, >40)as outpatientas outpatientas outpatientas outpatient
bun7-20as outpatientas outpatientas outpatientas outpatient
creatinine0.74-1.35as outpatientas outpatient1-5 y: 0.2-0.5; 6-12 y: 0.3-0.7; 13-17 y: 0.5-10.4-0.8
egfr≥60as outpatientas outpatientas outpatientas outpatient
calcium8.6-10.3 (crit <6, >13)as outpatientas outpatientas outpatientas outpatient
magnesium1.7-2.2 (crit <1, >4.9)as outpatientas outpatientas outpatientas outpatient
a1c4-5.6as outpatientas outpatientas outpatientas outpatient
ldl≤99as outpatientas outpatientas outpatientas outpatient
tsh0.4-4.5as outpatientas outpatientas outpatient0.1-2.5
alt7-56as outpatientas outpatientas outpatientas outpatient
inr0.8-1.1 (crit >5)as outpatientas outpatientas outpatientas outpatient
hgb13.2-16.6 (crit <7, >20)as outpatientas outpatient6 months-5 y: 11-14 (crit <7, >20); 6-12 y: 11.5-15.5 (crit <7, >20); 13-17 y: 12-16 (crit <7, >20)11-15 (crit <7, >20)
wbc3.4-9.6 (crit <1, >30)as outpatientas outpatient1-5 y: 5.5-15.5 (crit <1, >30); 6-17 y: 4.5-13.5 (crit <1, >30)as outpatient
anc≥1.5 (crit <0.5)as outpatientas outpatientas outpatientas outpatient
plt135-317 (crit <20, >1000)as outpatientas outpatientas outpatientas outpatient
bnp≤125as outpatientas outpatientas outpatientas outpatient
trop≤34as outpatientas outpatientas outpatientas outpatient
lactate0.5-2.2 (crit >4)as outpatientas outpatientas outpatientas outpatient
vanc10-20 (crit >25)as outpatientas outpatientas outpatientas outpatient
crcl≥60 (crit <15)as outpatientas outpatientas outpatientas outpatient
phq9≤9 (crit >19)as outpatientas outpatientas outpatientas outpatient
iop10-21 (crit >29)as outpatientas outpatientas outpatientas outpatient
dbhl≤25 (crit >90)as outpatientas outpatientas outpatientas outpatient
uoRate≥0.5as outpatientas outpatientas outpatientas outpatient
fhr110-160 (crit <100, >180)as outpatientas outpatientas outpatientas outpatient
contractions0-5 (crit >6)as outpatientas outpatientas outpatientas outpatient
oxytocin≤20 (crit >30)as outpatientas outpatientas outpatientas outpatient
rom≤18 (crit >24)as outpatientas outpatientas outpatientas outpatient
ebl≤500 (crit >1000)as outpatientas outpatientas outpatientas outpatient

Measures for labor and delivery (fhr, contractions, oxytocin, rom, ebl) and some unit protocols (uoRate) are protocol thresholds rather than lab reference ranges. They sit in the registry so every screen flags them the same way. Some screens also apply their own protocol rules that are not reference ranges: the ESI danger-zone vitals in TriageForm (HR above 100, RR above 20, SpO2 below 92%), the regimen hold limits in OncologyRegimen, and the severe-range blood pressure alert text in PrenatalFlowsheet. Those are not changed by the range context.

How far the sets share these rules today​

Measured on 10/09/2026 by feeding the same values through each set's formatter and rendered value (build/probe_values.js). Digits, decimals and units match across all sets: 1234.5 bpm shows as 1,235 bpm and 70.25 kg as 70.3 kg everywhere. Flags now come from one registry (see Reference ranges and flags): 235 of 235 value and context combinations gave the same flag in every set that has the measure, the context switches matched the registry in every set, and a lab range overrode the registry in every set and context. Before this change the emergency, perioperative and inpatient flow parts kept their own sample ranges, so a temperature of 37.5 °C showed normal on the ED board and H in ClinicalValue. Flags on a screen can still differ from another screen when the two screens run in different contexts, which is intended: glucose 150 mg/dL is H in outpatient and ED and normal against the inpatient 70 to 180 target. The registry values are samples chosen for the design system. They need review by a clinical owner before any product uses them, and a live system passes the lab's range on each result, which overrides them all.

In code​

The brand book refers to CareOS.fmt, CareOS.RangeContext.Provider and CareOS.setRangeContext. In the React package they are named exports:

import {
fmt,
ClinicalValue,
RangeContextProvider,
setRangeContext,
useRangeContext,
} from 'health-components';

// Pure formatting: the same answer everywhere.
fmt.number(37, 1); // '37.0'
fmt.unitLabel('mm[Hg]'); // 'mmHg'
fmt.dose('.5', 'mg'); // '0.5 mg'
fmt.money(-45); // '($45.00)'
fmt.code('icd10', 'E119'); // 'E11.9'
fmt.identifier('ssn', '123456789', true); // '•••-••-6789'
fmt.convert(212, 'mg/dL', 'mmol/L', 'glucose'); // 11.767...

// Ranges and flags from the shared registry.
fmt.flag(150, 'glucose', { context: 'outpatient' }); // 'H'
fmt.flag(150, 'glucose', { context: 'inpatient' }); // 'N'
fmt.flag(150, 'glucose', { refLow: 70, refHigh: 140, context: 'inpatient' }); // 'H': the lab range wins
fmt.rangeFor('hr', { context: 'pediatric', ageYears: 8 }); // { refLow: 70, refHigh: 120, critLow: 50, critHigh: 160, band: '6-12 y', ... }

// 3. The global setting for the whole app (null clears it). Call it once at start-up on the client.
setRangeContext('inpatient');

function Ward() {
return (
// 2. A subtree: every value inside uses the ED ranges.
<RangeContextProvider value="ed">
<ClinicalValue measure="temp" value={37.5} />
{/* 2. A component prop wins over the provider; 1. the lab range wins over everything. */}
<ClinicalValue measure="glucose" value={150} rangeContext="outpatient" refLow={70} refHigh={200} />
</RangeContextProvider>
);
}

// In your own component: prop > provider > global > your set's default > 'outpatient'.
function GlucoseCell({ value, rangeContext }: { value: number; rangeContext?: 'outpatient' | 'inpatient' | 'ed' | 'pediatric' | 'pregnancy' }) {
const ctx = useRangeContext('inpatient', rangeContext);
return <span>{fmt.number(value, 0)} {fmt.flag(value, 'glucose', { context: ctx })}</span>;
}

Components never call toFixed, never build a unit string and never keep their own range table: they call fmt. setRangeContext is module state shared by the whole JavaScript process, so on a server pass the context with RangeContextProvider or the rangeContext prop instead.