Skip to content

@kaiord/core


@kaiord/core / resolveAffineUnit

Function: resolveAffineUnit()

resolveAffineUnit(param, unitRaw): AffineUnit | null

Defined in: packages/core/src/domain/lab/unit-conversion.ts:28

Resolve the affine transform for unitRaw on a parameter. The canonical unit maps to identity (factor 1). A free parameter (param undefined) or an unrecognized unit returns null, signalling passthrough (no conversion).

Parameters

param

{ canonicalRefHigh?: number; canonicalRefLow?: number; canonicalUnit: string; key: string; knownUnits?: object[]; loinc?: string; panel: "hemogram" | "biochemistry" | "lipids" | "hepatic" | "ions" | "iron" | "thyroid" | "vitamins" | "hormones" | "sports"; refBySex?: { female: { high?: number; low?: number; }; male: { high?: number; low?: number; }; }; } | undefined

unitRaw

string

Returns

AffineUnit | null