@precisa-saude/fhir-calculators 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,560 @@
1
+ /**
2
+ * PhenoAge Calculator Types
3
+ *
4
+ * Based on Levine et al. (2018) - "An epigenetic biomarker of aging for lifespan and healthspan"
5
+ */
6
+ /**
7
+ * The 9 biomarkers required for PhenoAge calculation (in SI units)
8
+ */
9
+ interface PhenoAgeBiomarkers {
10
+ albumin: number;
11
+ alkalinePhosphatase: number;
12
+ creatinine: number;
13
+ crp: number;
14
+ glucose: number;
15
+ lymphocytePercent: number;
16
+ mcv: number;
17
+ rdw: number;
18
+ wbc: number;
19
+ }
20
+ /**
21
+ * Full input for PhenoAge calculation
22
+ */
23
+ interface PhenoAgeInput extends PhenoAgeBiomarkers {
24
+ chronologicalAge: number;
25
+ }
26
+ /**
27
+ * Individual component contribution to the linear predictor
28
+ */
29
+ interface ComponentBreakdown$1 {
30
+ coefficient: number;
31
+ contribution: number;
32
+ key?: string;
33
+ name: string;
34
+ valueWithUnit: string;
35
+ }
36
+ /**
37
+ * Complete PhenoAge calculation result
38
+ */
39
+ interface PhenoAgeResult {
40
+ ageDifference: number;
41
+ breakdown: ComponentBreakdown$1[];
42
+ calculatedAt: string;
43
+ chronologicalAge: number;
44
+ labResultDate?: string;
45
+ linearPredictor: number;
46
+ mortalityScore: number;
47
+ phenoAge: number;
48
+ }
49
+ /**
50
+ * Biomarker availability check result
51
+ */
52
+ interface BiomarkerAvailability$1 {
53
+ available: string[];
54
+ isComplete: boolean;
55
+ missing: string[];
56
+ values?: PhenoAgeBiomarkers;
57
+ }
58
+
59
+ /**
60
+ * PhenoAge Calculator
61
+ *
62
+ * Implements the Levine PhenoAge algorithm from:
63
+ * "An epigenetic biomarker of aging for lifespan and healthspan" (Aging, 2018)
64
+ */
65
+
66
+ /**
67
+ * Main PhenoAge calculation function
68
+ *
69
+ * @param input - Biomarker values in SI units plus chronological age
70
+ * @returns Complete PhenoAge result with breakdown
71
+ */
72
+ declare const calculatePhenoAge: (input: PhenoAgeInput) => PhenoAgeResult;
73
+ /**
74
+ * Validates biomarker values are within acceptable ranges
75
+ */
76
+ declare const validateBiomarkers$1: (input: PhenoAgeInput) => {
77
+ isValid: boolean;
78
+ errors: string[];
79
+ };
80
+
81
+ /**
82
+ * PhenoAge Calculator Constants
83
+ *
84
+ * Coefficients from Levine et al. (2018) Table 1
85
+ * Units: albumin (g/L), creatinine (μmol/L), glucose (mmol/L),
86
+ * CRP (ln of mg/L), lymphocyte (%), MCV (fL), RDW (%),
87
+ * ALP (U/L), WBC (10^9/L), age (years)
88
+ */
89
+ /**
90
+ * Regression coefficients from the Cox proportional hazards model
91
+ */
92
+ declare const PHENOAGE_COEFFICIENTS: {
93
+ readonly age: 0.0804;
94
+ readonly albumin: -0.0336;
95
+ readonly alkalinePhosphatase: 0.0019;
96
+ readonly creatinine: 0.0095;
97
+ readonly glucose: 0.1953;
98
+ readonly intercept: -19.9067;
99
+ readonly logCrp: 0.0954;
100
+ readonly lymphocytePercent: -0.012;
101
+ readonly mcv: 0.0268;
102
+ readonly rdw: 0.3306;
103
+ readonly wbc: 0.0554;
104
+ };
105
+ /**
106
+ * Gompertz mortality model parameters
107
+ */
108
+ declare const GOMPERTZ_PARAMS: {
109
+ readonly ageCoefficient: 0.090165;
110
+ readonly baseAge: 141.50225;
111
+ readonly gamma: 0.0076927;
112
+ readonly mortalityConstant: 0.00553;
113
+ };
114
+ /**
115
+ * Biomarker reference ranges for validation
116
+ */
117
+ declare const BIOMARKER_RANGES$1: {
118
+ readonly albumin: {
119
+ readonly max: 60;
120
+ readonly min: 10;
121
+ readonly typical: {
122
+ readonly max: 50;
123
+ readonly min: 35;
124
+ };
125
+ readonly unit: "g/L";
126
+ };
127
+ readonly alkalinePhosphatase: {
128
+ readonly max: 500;
129
+ readonly min: 10;
130
+ readonly typical: {
131
+ readonly max: 130;
132
+ readonly min: 40;
133
+ };
134
+ readonly unit: "U/L";
135
+ };
136
+ readonly chronologicalAge: {
137
+ readonly max: 120;
138
+ readonly min: 18;
139
+ readonly typical: {
140
+ readonly max: 100;
141
+ readonly min: 18;
142
+ };
143
+ readonly unit: "anos";
144
+ };
145
+ readonly creatinine: {
146
+ readonly max: 500;
147
+ readonly min: 20;
148
+ readonly typical: {
149
+ readonly max: 110;
150
+ readonly min: 60;
151
+ };
152
+ readonly unit: "μmol/L";
153
+ };
154
+ readonly crp: {
155
+ readonly max: 200;
156
+ readonly min: 0.01;
157
+ readonly typical: {
158
+ readonly max: 3;
159
+ readonly min: 0;
160
+ };
161
+ readonly unit: "mg/L";
162
+ };
163
+ readonly glucose: {
164
+ readonly max: 30;
165
+ readonly min: 2;
166
+ readonly typical: {
167
+ readonly max: 6;
168
+ readonly min: 4;
169
+ };
170
+ readonly unit: "mmol/L";
171
+ };
172
+ readonly lymphocytePercent: {
173
+ readonly max: 80;
174
+ readonly min: 1;
175
+ readonly typical: {
176
+ readonly max: 40;
177
+ readonly min: 20;
178
+ };
179
+ readonly unit: "%";
180
+ };
181
+ readonly mcv: {
182
+ readonly max: 150;
183
+ readonly min: 50;
184
+ readonly typical: {
185
+ readonly max: 100;
186
+ readonly min: 80;
187
+ };
188
+ readonly unit: "fL";
189
+ };
190
+ readonly rdw: {
191
+ readonly max: 25;
192
+ readonly min: 8;
193
+ readonly typical: {
194
+ readonly max: 15;
195
+ readonly min: 11;
196
+ };
197
+ readonly unit: "%";
198
+ };
199
+ readonly wbc: {
200
+ readonly max: 30;
201
+ readonly min: 1;
202
+ readonly typical: {
203
+ readonly max: 11;
204
+ readonly min: 4;
205
+ };
206
+ readonly unit: "10^9/L";
207
+ };
208
+ };
209
+ /**
210
+ * Mapping from FHIR biomarker codes to PhenoAge input fields
211
+ */
212
+ declare const FHIR_CODE_TO_PHENOAGE: Record<string, keyof typeof BIOMARKER_RANGES$1>;
213
+ /**
214
+ * Required biomarker codes for PhenoAge calculation
215
+ */
216
+ declare const REQUIRED_BIOMARKERS: readonly ["Albumin", "Creatinine", "Glucose", "CRP", "Lymphocytes", "MCV", "RDW", "AlkalinePhosphatase", "WBC"];
217
+ /**
218
+ * Portuguese names for biomarkers (for display)
219
+ */
220
+ declare const BIOMARKER_NAMES_PT$1: Record<string, string>;
221
+ /**
222
+ * Short descriptions for biomarkers (for tooltips)
223
+ * Explains what each biomarker indicates in the context of aging
224
+ */
225
+ declare const BIOMARKER_DESCRIPTIONS_PT: Record<string, string>;
226
+ /**
227
+ * Biomarker information for lab order requests
228
+ * Includes LOINC codes and English names for lab requisitions
229
+ */
230
+ interface BiomarkerLabInfo {
231
+ loincCode: string;
232
+ nameEn: string;
233
+ namePt: string;
234
+ }
235
+ /**
236
+ * Lab order information for PhenoAge biomarkers
237
+ * Mapped by FHIR code
238
+ */
239
+ declare const BIOMARKER_LAB_INFO: Record<string, BiomarkerLabInfo>;
240
+
241
+ /**
242
+ * Unit Converters for PhenoAge Calculator
243
+ *
244
+ * Brazilian labs (Weinmann, Fleury, etc.) often report in different units
245
+ * than the SI units required by the PhenoAge algorithm.
246
+ */
247
+ /**
248
+ * Conversion factors for each biomarker
249
+ * Key: source unit, Value: multiplier to get SI unit
250
+ */
251
+ declare const CONVERSION_FACTORS$1: Record<string, Record<string, number>>;
252
+ /**
253
+ * Target units for PhenoAge calculation (SI units)
254
+ */
255
+ declare const TARGET_UNITS$1: Record<string, string>;
256
+ /**
257
+ * Convert a biomarker value from source unit to SI unit
258
+ *
259
+ * @param biomarker - The biomarker key (e.g., 'albumin', 'glucose')
260
+ * @param value - The numeric value
261
+ * @param sourceUnit - The unit of the input value
262
+ * @returns Converted value in SI units
263
+ * @throws Error if the unit is not recognized
264
+ */
265
+ declare const convertToSI: (biomarker: string, value: number, sourceUnit: string) => number;
266
+ /**
267
+ * Check if a value needs conversion
268
+ *
269
+ * @param biomarker - The biomarker key
270
+ * @param sourceUnit - The current unit
271
+ * @returns true if conversion is needed
272
+ */
273
+ declare const needsConversion: (biomarker: string, sourceUnit: string) => boolean;
274
+ /**
275
+ * Auto-detect unit and convert to SI if needed
276
+ * Uses heuristics based on typical value ranges
277
+ *
278
+ * @param biomarker - The biomarker key
279
+ * @param value - The numeric value
280
+ * @param unit - Optional unit hint
281
+ * @returns Object with converted value and detected unit
282
+ */
283
+ declare const autoConvertToSI: (biomarker: string, value: number, unit?: string) => {
284
+ value: number;
285
+ unit: string;
286
+ wasConverted: boolean;
287
+ };
288
+
289
+ declare const index$1_BIOMARKER_DESCRIPTIONS_PT: typeof BIOMARKER_DESCRIPTIONS_PT;
290
+ declare const index$1_BIOMARKER_LAB_INFO: typeof BIOMARKER_LAB_INFO;
291
+ type index$1_BiomarkerLabInfo = BiomarkerLabInfo;
292
+ declare const index$1_FHIR_CODE_TO_PHENOAGE: typeof FHIR_CODE_TO_PHENOAGE;
293
+ declare const index$1_GOMPERTZ_PARAMS: typeof GOMPERTZ_PARAMS;
294
+ declare const index$1_PHENOAGE_COEFFICIENTS: typeof PHENOAGE_COEFFICIENTS;
295
+ type index$1_PhenoAgeBiomarkers = PhenoAgeBiomarkers;
296
+ type index$1_PhenoAgeInput = PhenoAgeInput;
297
+ type index$1_PhenoAgeResult = PhenoAgeResult;
298
+ declare const index$1_REQUIRED_BIOMARKERS: typeof REQUIRED_BIOMARKERS;
299
+ declare const index$1_autoConvertToSI: typeof autoConvertToSI;
300
+ declare const index$1_calculatePhenoAge: typeof calculatePhenoAge;
301
+ declare const index$1_convertToSI: typeof convertToSI;
302
+ declare const index$1_needsConversion: typeof needsConversion;
303
+ declare namespace index$1 {
304
+ export { index$1_BIOMARKER_DESCRIPTIONS_PT as BIOMARKER_DESCRIPTIONS_PT, index$1_BIOMARKER_LAB_INFO as BIOMARKER_LAB_INFO, BIOMARKER_NAMES_PT$1 as BIOMARKER_NAMES_PT, BIOMARKER_RANGES$1 as BIOMARKER_RANGES, type BiomarkerAvailability$1 as BiomarkerAvailability, type index$1_BiomarkerLabInfo as BiomarkerLabInfo, CONVERSION_FACTORS$1 as CONVERSION_FACTORS, type ComponentBreakdown$1 as ComponentBreakdown, index$1_FHIR_CODE_TO_PHENOAGE as FHIR_CODE_TO_PHENOAGE, index$1_GOMPERTZ_PARAMS as GOMPERTZ_PARAMS, index$1_PHENOAGE_COEFFICIENTS as PHENOAGE_COEFFICIENTS, type index$1_PhenoAgeBiomarkers as PhenoAgeBiomarkers, type index$1_PhenoAgeInput as PhenoAgeInput, type index$1_PhenoAgeResult as PhenoAgeResult, index$1_REQUIRED_BIOMARKERS as REQUIRED_BIOMARKERS, TARGET_UNITS$1 as TARGET_UNITS, index$1_autoConvertToSI as autoConvertToSI, index$1_calculatePhenoAge as calculatePhenoAge, index$1_convertToSI as convertToSI, index$1_needsConversion as needsConversion, validateBiomarkers$1 as validateBiomarkers };
305
+ }
306
+
307
+ /**
308
+ * BrDMrisc Calculator Types
309
+ *
310
+ * Based on Bracco et al. (2023) - "BrDMrisc: a Brazilian diabetes risk score
311
+ * for screening of type 2 diabetes mellitus"
312
+ * DOI: 10.3389/fendo.2023.1166147
313
+ */
314
+ type RiskCategory = 'low' | 'moderate' | 'high' | 'very-high';
315
+ interface BrDMriscModelDefinition {
316
+ auc: number;
317
+ coefficients: Record<string, number>;
318
+ id: number;
319
+ intercept: number;
320
+ isLabOnly: boolean;
321
+ name: string;
322
+ namePt: string;
323
+ requiredBiomarkers: string[];
324
+ }
325
+ interface BrDMriscInput {
326
+ fpg?: number;
327
+ hba1c?: number;
328
+ hdlc?: number;
329
+ triglycerides?: number;
330
+ }
331
+ interface BrDMriscResult {
332
+ breakdown: ComponentBreakdown[];
333
+ calculatedAt: string;
334
+ labResultDate?: string;
335
+ modelUsed: BrDMriscModelDefinition;
336
+ risk10y: number;
337
+ riskCategory: RiskCategory;
338
+ riskPercent: number;
339
+ }
340
+ interface ComponentBreakdown {
341
+ coefficient: number;
342
+ contribution: number;
343
+ key: string;
344
+ name: string;
345
+ value: number;
346
+ valueWithUnit: string;
347
+ }
348
+ interface BiomarkerAvailability {
349
+ available: string[];
350
+ bestModelId: number | null;
351
+ hasFpg: boolean;
352
+ hasHba1c: boolean;
353
+ hasHdlc: boolean;
354
+ hasTriglycerides: boolean;
355
+ missing: string[];
356
+ }
357
+
358
+ /**
359
+ * BrDMrisc Calculator
360
+ *
361
+ * Implements the BrDMrisc algorithm from:
362
+ * Bracco et al. (2023) - "BrDMrisc: a Brazilian diabetes risk score
363
+ * for screening of type 2 diabetes mellitus"
364
+ * Frontiers in Endocrinology, DOI: 10.3389/fendo.2023.1166147
365
+ *
366
+ * Formula:
367
+ * x = intercept + Σ(coeff_i × value_i)
368
+ * p = 1 / (1 + exp(-x)) — logistic regression probability (~7.4 years)
369
+ * risk10y = 1 - (1 - p)^(10/7.4) — extrapolated to 10-year risk
370
+ */
371
+
372
+ /**
373
+ * Select the best available model based on which biomarkers are present.
374
+ * Iterates through models in priority order (highest AUC first) and
375
+ * returns the first one whose requirements are fully met.
376
+ */
377
+ declare const selectModel: (input: BrDMriscInput, labOnly?: boolean) => BrDMriscModelDefinition | null;
378
+ /**
379
+ * Classify risk percentage into a category
380
+ */
381
+ declare const classifyRisk: (riskPercent: number) => RiskCategory;
382
+ /**
383
+ * Calculate BrDMrisc 10-year diabetes risk
384
+ */
385
+ declare const calculateBrDMrisc: (input: BrDMriscInput, model?: BrDMriscModelDefinition) => BrDMriscResult;
386
+ /**
387
+ * Validate biomarker values are within plausible ranges
388
+ */
389
+ declare const validateBiomarkers: (input: BrDMriscInput) => {
390
+ isValid: boolean;
391
+ errors: string[];
392
+ };
393
+
394
+ /**
395
+ * BrDMrisc Calculator Constants
396
+ *
397
+ * All 14 model definitions with coefficients extracted from:
398
+ * Bracco et al. (2023) Table 2 & Supplementary Material
399
+ * DOI: 10.3389/fendo.2023.1166147
400
+ *
401
+ * Models 1-6 are lab-only (MVP scope).
402
+ * Models 7-14 include clinical variables (Phase 2).
403
+ *
404
+ * Follow-up period: 7.4 years (ELSA-Brasil median)
405
+ * Units expected: FPG (mg/dL), HbA1c (%), triglycerides (mg/dL), HDL-c (mg/dL)
406
+ */
407
+
408
+ /**
409
+ * ELSA-Brasil median follow-up in years.
410
+ * Used to extrapolate the logistic regression probability to 10-year risk.
411
+ */
412
+ declare const FOLLOW_UP_YEARS = 7.4;
413
+ /**
414
+ * All 14 BrDMrisc models.
415
+ * Models ordered by ID. Lab-only models (1-6) are the MVP.
416
+ *
417
+ * Coefficients from Supplementary Table S2 of the paper,
418
+ * verified against the Shiny app demo at:
419
+ * https://paulabracco.shinyapps.io/BrDMrisc_pt/
420
+ */
421
+ declare const BRDMRISC_MODELS: BrDMriscModelDefinition[];
422
+ /**
423
+ * Lab-only models for MVP, ordered by priority (highest AUC first)
424
+ */
425
+ declare const LAB_ONLY_MODELS: BrDMriscModelDefinition[];
426
+ /**
427
+ * Model selection priority for lab-only models (highest AUC first)
428
+ */
429
+ declare const LAB_MODEL_PRIORITY: readonly [6, 5, 3, 4, 1, 2];
430
+ /**
431
+ * FHIR biomarker code → BrDMrisc input field mapping
432
+ */
433
+ declare const FHIR_CODE_TO_BRDMRISC: Record<string, keyof BrDMriscInput>;
434
+ /**
435
+ * Required FHIR biomarker codes (all 4 lab biomarkers)
436
+ */
437
+ declare const BRDMRISC_BIOMARKER_CODES: readonly ["Glucose", "HbA1c", "Triglycerides", "HDL"];
438
+ /**
439
+ * Portuguese names for biomarkers
440
+ */
441
+ declare const BIOMARKER_NAMES_PT: Record<string, string>;
442
+ /**
443
+ * Biomarker units used by the model
444
+ */
445
+ declare const BIOMARKER_UNITS: Record<string, string>;
446
+ /**
447
+ * Biomarker validation ranges (plausible values)
448
+ */
449
+ declare const BIOMARKER_RANGES: Record<string, {
450
+ min: number;
451
+ max: number;
452
+ unit: string;
453
+ }>;
454
+ /**
455
+ * Risk category thresholds based on clinical recommendations
456
+ * from Bracco et al. (2023). The paper notes that 20% triggers
457
+ * intensive prevention.
458
+ */
459
+ declare const RISK_THRESHOLDS: {
460
+ readonly high: 0.2;
461
+ readonly moderate: 0.1;
462
+ readonly veryHigh: 0.35;
463
+ };
464
+
465
+ /**
466
+ * Unit Converters for BrDMrisc Calculator
467
+ *
468
+ * BrDMrisc expects: FPG (mg/dL), HbA1c (%), triglycerides (mg/dL), HDL-c (mg/dL)
469
+ * Brazilian labs typically report in these units already, but some may
470
+ * use mmol/L for glucose or mmol/mol for HbA1c (IFCC standard).
471
+ */
472
+ /**
473
+ * Conversion factors for each biomarker
474
+ * Key: source unit, Value: multiplier to get target unit
475
+ */
476
+ declare const CONVERSION_FACTORS: Record<string, Record<string, number>>;
477
+ /**
478
+ * Target units for BrDMrisc calculation
479
+ */
480
+ declare const TARGET_UNITS: Record<string, string>;
481
+ /**
482
+ * Convert a biomarker value to the target unit expected by BrDMrisc
483
+ */
484
+ declare const convertToTargetUnit: (biomarker: string, value: number, sourceUnit: string) => number;
485
+ /**
486
+ * Auto-detect unit and convert to target if needed.
487
+ * Uses heuristics based on typical value ranges.
488
+ */
489
+ declare const autoConvertToTarget: (biomarker: string, value: number, unit?: string) => {
490
+ value: number;
491
+ unit: string;
492
+ wasConverted: boolean;
493
+ };
494
+
495
+ declare const index_BIOMARKER_NAMES_PT: typeof BIOMARKER_NAMES_PT;
496
+ declare const index_BIOMARKER_RANGES: typeof BIOMARKER_RANGES;
497
+ declare const index_BIOMARKER_UNITS: typeof BIOMARKER_UNITS;
498
+ declare const index_BRDMRISC_BIOMARKER_CODES: typeof BRDMRISC_BIOMARKER_CODES;
499
+ declare const index_BRDMRISC_MODELS: typeof BRDMRISC_MODELS;
500
+ type index_BiomarkerAvailability = BiomarkerAvailability;
501
+ type index_BrDMriscInput = BrDMriscInput;
502
+ type index_BrDMriscModelDefinition = BrDMriscModelDefinition;
503
+ type index_BrDMriscResult = BrDMriscResult;
504
+ declare const index_CONVERSION_FACTORS: typeof CONVERSION_FACTORS;
505
+ type index_ComponentBreakdown = ComponentBreakdown;
506
+ declare const index_FHIR_CODE_TO_BRDMRISC: typeof FHIR_CODE_TO_BRDMRISC;
507
+ declare const index_FOLLOW_UP_YEARS: typeof FOLLOW_UP_YEARS;
508
+ declare const index_LAB_MODEL_PRIORITY: typeof LAB_MODEL_PRIORITY;
509
+ declare const index_LAB_ONLY_MODELS: typeof LAB_ONLY_MODELS;
510
+ declare const index_RISK_THRESHOLDS: typeof RISK_THRESHOLDS;
511
+ type index_RiskCategory = RiskCategory;
512
+ declare const index_TARGET_UNITS: typeof TARGET_UNITS;
513
+ declare const index_autoConvertToTarget: typeof autoConvertToTarget;
514
+ declare const index_calculateBrDMrisc: typeof calculateBrDMrisc;
515
+ declare const index_classifyRisk: typeof classifyRisk;
516
+ declare const index_convertToTargetUnit: typeof convertToTargetUnit;
517
+ declare const index_selectModel: typeof selectModel;
518
+ declare const index_validateBiomarkers: typeof validateBiomarkers;
519
+ declare namespace index {
520
+ export { index_BIOMARKER_NAMES_PT as BIOMARKER_NAMES_PT, index_BIOMARKER_RANGES as BIOMARKER_RANGES, index_BIOMARKER_UNITS as BIOMARKER_UNITS, index_BRDMRISC_BIOMARKER_CODES as BRDMRISC_BIOMARKER_CODES, index_BRDMRISC_MODELS as BRDMRISC_MODELS, type index_BiomarkerAvailability as BiomarkerAvailability, type index_BrDMriscInput as BrDMriscInput, type index_BrDMriscModelDefinition as BrDMriscModelDefinition, type index_BrDMriscResult as BrDMriscResult, index_CONVERSION_FACTORS as CONVERSION_FACTORS, type index_ComponentBreakdown as ComponentBreakdown, index_FHIR_CODE_TO_BRDMRISC as FHIR_CODE_TO_BRDMRISC, index_FOLLOW_UP_YEARS as FOLLOW_UP_YEARS, index_LAB_MODEL_PRIORITY as LAB_MODEL_PRIORITY, index_LAB_ONLY_MODELS as LAB_ONLY_MODELS, index_RISK_THRESHOLDS as RISK_THRESHOLDS, type index_RiskCategory as RiskCategory, index_TARGET_UNITS as TARGET_UNITS, index_autoConvertToTarget as autoConvertToTarget, index_calculateBrDMrisc as calculateBrDMrisc, index_classifyRisk as classifyRisk, index_convertToTargetUnit as convertToTargetUnit, index_selectModel as selectModel, index_validateBiomarkers as validateBiomarkers };
521
+ }
522
+
523
+ /**
524
+ * Derived Biomarker Calculator
525
+ *
526
+ * Derives biomarkers from existing extracted values when the lab report
527
+ * doesn't include them directly.
528
+ *
529
+ * Currently supports:
530
+ * - HOMA-IR = (Fasting Glucose × Fasting Insulin) / 405
531
+ * - VLDL = Triglycerides / 5
532
+ * - BMI = weight_kg / (height_m)² (requires UserContext with height)
533
+ */
534
+ interface BiomarkerInput {
535
+ code: string;
536
+ value: number | string;
537
+ unit?: string;
538
+ }
539
+ interface DerivedBiomarker {
540
+ code: string;
541
+ loincCode?: string;
542
+ name: string;
543
+ unit: string;
544
+ value: number;
545
+ }
546
+ interface DerivedOptions {
547
+ codeToLoinc?: (code: string) => string | undefined;
548
+ userContext?: {
549
+ heightCm?: number;
550
+ };
551
+ }
552
+ /**
553
+ * Compute derived biomarkers from existing extracted values.
554
+ * Only adds a calculated biomarker if:
555
+ * - All required inputs are present with numeric values
556
+ * - The biomarker isn't already present in the results
557
+ */
558
+ declare function computeDerivedBiomarkers(biomarkers: BiomarkerInput[], options?: DerivedOptions): DerivedBiomarker[];
559
+
560
+ export { type BiomarkerInput, type DerivedBiomarker, type DerivedOptions, index as brdmrisc, computeDerivedBiomarkers, index$1 as phenoage };