fix(labs): name calcifediol as the source of the vitamin D factor

The note said the factor was taken from cholecalciferol (C27H44O2). Vitamin
D3 is C27H44O; C27H44O2 is 25-hydroxyvitamin D3 (calcifediol), the form the
assay reports and the one whose molar mass gives 1 ng/mL = 2.496 nmol/L. The
factor was right; the note now says what it rests on.
This commit is contained in:
Marc-André Bombeck committed 2026-10-14 19:19:15 +02:00
1 parent 07f09e1b61
commit 350fd1b767
2 files changed
+24 -2

No files matched your search

@@ -28,7 +28,7 @@ const MOLAR_MASS: Record<string, number> = {
"uric-acid": 168.112, // C5H4N4O3
"calcium-total": 40.078, // Ca
"bilirubin-total": 584.673, // C33H36N4O6
"vitamin-d": 400.647, // C27H44O2
"vitamin-d": 400.647, // C27H44O2, 25-hydroxyvitamin D3 (calcifediol)
};
/** Of the entry's amount unit: how many of its mass unit one of it is, per g/mol. */
@@ -44,6 +44,23 @@ const POWER_OF_TEN: Record<string, number> = {
"vitamin-d": 1 / 1_000, // nmol/L -> ng/mL
};
describe("the vitamin D entry", () => {
const entry = analyteConversionFor("vitamin-d")!;
it("names the molecule its factor comes from: calcifediol, not vitamin D3", () => {
// Cholecalciferol is C27H44O; the factor uses C27H44O2, which is the
// 25-hydroxy form a lab reports. The note must say which one it is.
expect(entry.source).toContain("calcifediol");
expect(entry.source).toContain("C27H44O2");
expect(entry.source).not.toMatch(/cholecalciferol \(C27H44O2\)/);
});
it("converts 1 ng/mL to 2.496 nmol/L", () => {
// ng/mL is the hub; nmol/L maps to it by 400.647 / 1000.
expect(1 / entry.units["nmol/L"].a).toBeCloseTo(2.496, 3);
});
});
describe("the registry's entries", () => {
const entries = allAnalyteConversions();
+6 -1
View File
@@ -187,7 +187,12 @@ const ENTRIES: readonly AnalyteConversion[] = [
formula: { C: 27, H: 44, O: 2 },
mass: "ng/mL",
amount: "nmol/L",
note: "25-hydroxyvitamin D, taken as cholecalciferol (C27H44O2).",
// What a lab measures and reports is 25-hydroxyvitamin D (calcifediol),
// so its molar mass sets the factor: 1 ng/mL is 2.496 nmol/L. Vitamin D3
// itself (cholecalciferol, C27H44O) is lighter by the one oxygen atom.
note:
"25-hydroxyvitamin D3 (calcifediol, C27H44O2), the form the assay reports; " +
"1 ng/mL = 2.496 nmol/L.",
}),
defineAnalyteConversion({
key: "hba1c",