/** * UCUM Validator * -------------- * * Thin wrapper around `@lhncbc/ucum-lhc` to validate Unified Code for * Units of Measure (UCUM) expressions that appear in FHIR `Quantity` * (and its specialisations: `SimpleQuantity`, `Age`, `Duration`, * `Distance`, `Count`, `Money`, …) `code` fields when the `system` * is `http://unitsofmeasure.org`. * * The `ucum-lhc` package has to build its unit tables on first use * which is ~100-300 ms. We initialise the singleton lazily so the * validator startup is not penalised when no UCUM codes are present. * * This closes the Phase A corpus miss for * `observation-ucum-code-rewritten.json` — Records used to only * check CodeableConcept/Coding elements, which left * `Quantity.code` silently unvalidated. */ export declare const UCUM_SYSTEM_URL = "http://unitsofmeasure.org"; interface UcumValidationResult { valid: boolean; message?: string; /** * Correction suggested by ucum-lhc's own engine for an invalid code * (e.g. `mmHg` → `mm[Hg]`). Generalises beyond the curated static table. */ suggestion?: { code: string; display?: string; }; } /** * Validate a single UCUM expression. * * Returns `{ valid: true }` if the code parses as a valid UCUM * expression (including composed units like `mg/dL`, `10*3/uL`), or * `{ valid: false, message }` otherwise. * * Empty / falsy input is treated as valid — callers are expected to * pre-filter for presence because "no UCUM code" is a different bug * than "invalid UCUM code". */ export declare function validateUcumCode(code: string | undefined | null): UcumValidationResult; export declare function ucumCodeHasAnnotation(code: string | undefined | null): boolean; /** * Convenience: check whether a Quantity-shaped value carries a UCUM code * that the validator should evaluate. FHIR profiles can declare * `system` implicitly, but we deliberately require it to be present and * equal to the UCUM URL — a quantity without a system is a different * kind of problem (tracked by structural validation, not terminology). */ export declare function quantityUsesUcum(value: unknown): value is { system: string; code: string; }; export {}; //# sourceMappingURL=ucum-validator.d.ts.map