@precisa-saude/fhir 0.10.0 → 0.11.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.
Files changed (38) hide show
  1. package/README.md +28 -10
  2. package/dist/biomarkers.cjs +2 -2
  3. package/dist/biomarkers.js +1 -1
  4. package/dist/{chunk-S6VJHXJF.js → chunk-4YQOKZX7.js} +2 -2
  5. package/dist/{chunk-2EVQ2ESB.cjs → chunk-EW5GLFSC.cjs} +205 -1
  6. package/dist/chunk-EW5GLFSC.cjs.map +1 -0
  7. package/dist/{chunk-I6H35QXI.js → chunk-ICSMWCVT.js} +205 -1
  8. package/dist/{chunk-I6H35QXI.js.map → chunk-ICSMWCVT.js.map} +1 -1
  9. package/dist/{chunk-O25F6G3K.cjs → chunk-NOJRDKFO.cjs} +4 -4
  10. package/dist/{chunk-O25F6G3K.cjs.map → chunk-NOJRDKFO.cjs.map} +1 -1
  11. package/dist/{chunk-N6J26FVW.js → chunk-NR4OTNC4.js} +2 -2
  12. package/dist/{chunk-PJJVDGX4.cjs → chunk-OPS7XHIL.cjs} +3 -3
  13. package/dist/{chunk-PJJVDGX4.cjs.map → chunk-OPS7XHIL.cjs.map} +1 -1
  14. package/dist/{chunk-D6XKCRS2.cjs → chunk-T22Q6ML7.cjs} +203 -82
  15. package/dist/chunk-T22Q6ML7.cjs.map +1 -0
  16. package/dist/{chunk-GTKRPCZB.js → chunk-WTAXN4BF.js} +203 -82
  17. package/dist/chunk-WTAXN4BF.js.map +1 -0
  18. package/dist/cli.js +407 -82
  19. package/dist/converter.cjs +3 -3
  20. package/dist/converter.js +2 -2
  21. package/dist/importer.cjs +3 -3
  22. package/dist/importer.js +2 -2
  23. package/dist/index.cjs +85 -6
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +34 -2
  26. package/dist/index.d.ts +34 -2
  27. package/dist/index.js +83 -4
  28. package/dist/index.js.map +1 -1
  29. package/dist/reference-ranges.cjs +2 -2
  30. package/dist/reference-ranges.d.cts +38 -3
  31. package/dist/reference-ranges.d.ts +38 -3
  32. package/dist/reference-ranges.js +1 -1
  33. package/package.json +1 -1
  34. package/dist/chunk-2EVQ2ESB.cjs.map +0 -1
  35. package/dist/chunk-D6XKCRS2.cjs.map +0 -1
  36. package/dist/chunk-GTKRPCZB.js.map +0 -1
  37. /package/dist/{chunk-S6VJHXJF.js.map → chunk-4YQOKZX7.js.map} +0 -0
  38. /package/dist/{chunk-N6J26FVW.js.map → chunk-NR4OTNC4.js.map} +0 -0
package/dist/cli.js CHANGED
@@ -2436,6 +2436,210 @@ var BIOMARKER_DEFINITIONS = [
2436
2436
  pt: ["Z-Score Corpo Total", "Z-Score", "Escore Z", "Z-Score DMO", "Z-Score Densidade \xD3ssea"]
2437
2437
  },
2438
2438
  unit: "score"
2439
+ },
2440
+ // ============================================================================
2441
+ // CARDIOVASCULAR MARKERS — Insuficiência cardíaca e dano miocárdico
2442
+ // ============================================================================
2443
+ {
2444
+ category: "coracao",
2445
+ code: "NTproBNP",
2446
+ loinc: "33762-6",
2447
+ names: {
2448
+ en: ["NT-proBNP", "N-Terminal pro B-Type Natriuretic Peptide", "NT-pro-BNP"],
2449
+ pt: ["NT-proBNP", "Pept\xEDdeo Natriur\xE9tico Tipo B N-Terminal", "Pr\xF3-BNP N-Terminal"]
2450
+ },
2451
+ unit: "pg/mL"
2452
+ },
2453
+ {
2454
+ category: "coracao",
2455
+ code: "BNP",
2456
+ loinc: "30934-4",
2457
+ names: {
2458
+ en: ["BNP", "B-Type Natriuretic Peptide", "Brain Natriuretic Peptide"],
2459
+ pt: ["BNP", "Pept\xEDdeo Natriur\xE9tico Tipo B", "Pept\xEDdeo Natriur\xE9tico Cerebral"]
2460
+ },
2461
+ unit: "pg/mL"
2462
+ },
2463
+ {
2464
+ category: "coracao",
2465
+ code: "TroponinI",
2466
+ loinc: "49563-0",
2467
+ names: {
2468
+ en: ["Troponin I", "cTnI", "Cardiac Troponin I", "hs-TnI", "High-Sensitivity Troponin I"],
2469
+ pt: ["Troponina I", "cTnI", "Troponina I Card\xEDaca", "Troponina I Ultrassens\xEDvel"]
2470
+ },
2471
+ unit: "ng/mL"
2472
+ },
2473
+ {
2474
+ category: "coracao",
2475
+ code: "TroponinT",
2476
+ loinc: "6598-7",
2477
+ names: {
2478
+ en: ["Troponin T", "cTnT", "Cardiac Troponin T", "hs-TnT", "High-Sensitivity Troponin T"],
2479
+ pt: ["Troponina T", "cTnT", "Troponina T Card\xEDaca", "Troponina T Ultrassens\xEDvel"]
2480
+ },
2481
+ unit: "ng/mL"
2482
+ },
2483
+ // ============================================================================
2484
+ // COAGULATION — Coagulação
2485
+ // ============================================================================
2486
+ {
2487
+ category: "sangue",
2488
+ code: "DDimer",
2489
+ loinc: "48066-5",
2490
+ names: {
2491
+ en: ["D-Dimer", "D Dimer", "Fibrin D-Dimer"],
2492
+ pt: ["D\xEDmero-D", "D\xEDmero D", "D-D\xEDmero"]
2493
+ },
2494
+ unit: "ng/mL"
2495
+ },
2496
+ {
2497
+ category: "sangue",
2498
+ code: "Fibrinogen",
2499
+ loinc: "3255-7",
2500
+ names: {
2501
+ en: ["Fibrinogen", "Fibrinogen Activity"],
2502
+ pt: ["Fibrinog\xEAnio", "Atividade do Fibrinog\xEAnio"]
2503
+ },
2504
+ unit: "mg/dL"
2505
+ },
2506
+ // ============================================================================
2507
+ // HEMATOLOGY — Hematologia adicional
2508
+ // ============================================================================
2509
+ {
2510
+ category: "figado",
2511
+ code: "LDH",
2512
+ loinc: "2532-0",
2513
+ names: {
2514
+ en: ["Lactate Dehydrogenase", "LDH", "LD"],
2515
+ pt: ["Desidrogenase L\xE1tica", "DHL", "LDH", "Lactato Desidrogenase"]
2516
+ },
2517
+ unit: "U/L"
2518
+ },
2519
+ // ============================================================================
2520
+ // ENDOCRINE — Eixo cálcio/fósforo
2521
+ // ============================================================================
2522
+ {
2523
+ category: "hormonios",
2524
+ code: "PTH",
2525
+ loinc: "2731-8",
2526
+ names: {
2527
+ en: ["Parathyroid Hormone", "PTH", "Intact PTH"],
2528
+ pt: ["Paratorm\xF4nio", "PTH", "Horm\xF4nio da Paratireoide", "PTH Intacto"]
2529
+ },
2530
+ unit: "pg/mL"
2531
+ },
2532
+ // ============================================================================
2533
+ // IMMUNOLOGY — Complemento e imunoglobulinas
2534
+ // ============================================================================
2535
+ {
2536
+ category: "autoimunidade",
2537
+ code: "IgM",
2538
+ loinc: "2472-9",
2539
+ names: {
2540
+ en: ["Immunoglobulin M", "IgM", "Total IgM"],
2541
+ pt: ["Imunoglobulina M", "IgM", "IgM Total"]
2542
+ },
2543
+ unit: "mg/dL"
2544
+ },
2545
+ {
2546
+ category: "autoimunidade",
2547
+ code: "C3",
2548
+ loinc: "4485-3",
2549
+ names: {
2550
+ en: ["Complement C3", "C3"],
2551
+ pt: ["Complemento C3", "C3", "Fra\xE7\xE3o C3 do Complemento"]
2552
+ },
2553
+ unit: "mg/dL"
2554
+ },
2555
+ {
2556
+ category: "autoimunidade",
2557
+ code: "C4",
2558
+ loinc: "4498-6",
2559
+ names: {
2560
+ en: ["Complement C4", "C4"],
2561
+ pt: ["Complemento C4", "C4", "Fra\xE7\xE3o C4 do Complemento"]
2562
+ },
2563
+ unit: "mg/dL"
2564
+ },
2565
+ // ============================================================================
2566
+ // TUMOR MARKERS — Marcadores tumorais adicionais
2567
+ // ============================================================================
2568
+ {
2569
+ category: "marcadores-tumorais",
2570
+ code: "CA199",
2571
+ loinc: "24108-3",
2572
+ names: {
2573
+ en: ["CA 19-9", "Carbohydrate Antigen 19-9", "CA19-9"],
2574
+ pt: ["CA 19-9", "Ant\xEDgeno Carboidrato 19-9", "CA19-9"]
2575
+ },
2576
+ unit: "U/mL"
2577
+ },
2578
+ {
2579
+ category: "marcadores-tumorais",
2580
+ code: "CA153",
2581
+ loinc: "6875-9",
2582
+ names: {
2583
+ en: ["CA 15-3", "Cancer Antigen 15-3", "CA15-3"],
2584
+ pt: ["CA 15-3", "Ant\xEDgeno C\xE2ncer 15-3", "CA15-3"]
2585
+ },
2586
+ sex: "female",
2587
+ unit: "U/mL"
2588
+ },
2589
+ {
2590
+ category: ["saude-feminina", "marcadores-tumorais"],
2591
+ code: "BetaHCG",
2592
+ loinc: "19080-1",
2593
+ names: {
2594
+ en: ["Beta-hCG", "Beta Human Chorionic Gonadotropin", "\u03B2-hCG Quantitative", "hCG"],
2595
+ pt: [
2596
+ "Beta-hCG",
2597
+ "Beta Gonadotrofina Cori\xF4nica Humana",
2598
+ "\u03B2-hCG Quantitativo",
2599
+ "hCG",
2600
+ "Gonadotrofina Cori\xF4nica"
2601
+ ]
2602
+ },
2603
+ unit: "mIU/mL"
2604
+ },
2605
+ // ============================================================================
2606
+ // RENAL — Filtração glomerular alternativa
2607
+ // ============================================================================
2608
+ {
2609
+ category: "rins",
2610
+ code: "CystatinC",
2611
+ loinc: "33863-2",
2612
+ names: {
2613
+ en: ["Cystatin C", "Cystatin-C"],
2614
+ pt: ["Cistatina C", "Cistatina-C"]
2615
+ },
2616
+ unit: "mg/L"
2617
+ },
2618
+ // ============================================================================
2619
+ // NUTRIENTS — Oligoelementos adicionais
2620
+ // ============================================================================
2621
+ {
2622
+ category: "nutrientes",
2623
+ code: "Selenium",
2624
+ loinc: "5697-7",
2625
+ names: {
2626
+ en: ["Selenium", "Se"],
2627
+ pt: ["Sel\xEAnio", "Se"]
2628
+ },
2629
+ unit: "\xB5g/L"
2630
+ },
2631
+ // ============================================================================
2632
+ // METABOLIC — Cetonas séricas
2633
+ // ============================================================================
2634
+ {
2635
+ category: "pancreas",
2636
+ code: "BetaHydroxybutyrate",
2637
+ loinc: "53060-0",
2638
+ names: {
2639
+ en: ["Beta-Hydroxybutyrate", "\u03B2-Hydroxybutyrate", "BHB", "Ketone Bodies"],
2640
+ pt: ["Beta-Hidroxibutirato", "\u03B2-Hidroxibutirato", "BHB", "Corpos Cet\xF4nicos"]
2641
+ },
2642
+ unit: "mmol/L"
2439
2643
  }
2440
2644
  ];
2441
2645
  var loincToCodeMap = /* @__PURE__ */ new Map();
@@ -3920,9 +4124,6 @@ import { parseArgs as parseArgs2 } from "util";
3920
4124
 
3921
4125
  // src/reference-ranges.ts
3922
4126
  var biomarkerRangeDefinitions = {
3923
- // =============================================================================
3924
- // LIPIDS
3925
- // =============================================================================
3926
4127
  Albumin_Creatinine_Ratio: {
3927
4128
  default: { max: 30, min: 0, optimalMax: 20, optimalMin: 0, unit: "mg/g" },
3928
4129
  source: "tietz-7ed-2015"
@@ -4051,9 +4252,6 @@ var biomarkerRangeDefinitions = {
4051
4252
  ApoCIII_ApoA1_Ratio: {
4052
4253
  default: { max: 0.15, min: 0, optimalMax: 0.1, optimalMin: 0, unit: "" }
4053
4254
  },
4054
- // =============================================================================
4055
- // THYROID
4056
- // =============================================================================
4057
4255
  Omega6_AA: {
4058
4256
  default: { max: 15, min: 5, optimalMax: 12, optimalMin: 7, unit: "%" },
4059
4257
  source: "simopoulos-omega-ratio-2002"
@@ -4091,9 +4289,6 @@ var biomarkerRangeDefinitions = {
4091
4289
  default: { max: 0.1, min: 0, optimalMax: 0.05, optimalMin: 0, unit: "K/uL" },
4092
4290
  source: "pns-hemograma-2019"
4093
4291
  },
4094
- // =============================================================================
4095
- // HEMATOLOGY - CBC
4096
- // =============================================================================
4097
4292
  Bicarbonate: {
4098
4293
  default: { max: 29, min: 23, optimalMax: 28, optimalMin: 24, unit: "mEq/L" },
4099
4294
  source: "tietz-7ed-2015"
@@ -4228,13 +4423,28 @@ var biomarkerRangeDefinitions = {
4228
4423
  source: "tietz-7ed-2015"
4229
4424
  },
4230
4425
  CPeptide: {
4231
- default: { max: 3.9, min: 0.8, optimalMax: 3, optimalMin: 1, unit: "ng/mL" },
4426
+ default: {
4427
+ fastingRequired: "strict",
4428
+ max: 3.9,
4429
+ min: 0.8,
4430
+ optimalMax: 3,
4431
+ optimalMin: 1,
4432
+ unit: "ng/mL"
4433
+ },
4232
4434
  source: "tietz-7ed-2015"
4233
4435
  },
4234
4436
  Creatinine: {
4235
4437
  default: { max: 1.2, min: 0.6, optimalMax: 1, optimalMin: 0.7, unit: "mg/dL" },
4236
4438
  source: "pns-bioquimica-2019",
4237
4439
  variants: [
4440
+ // Gestação: hiperfiltração glomerular (↑ 40–50% GFR) reduz a creatinina
4441
+ // sérica. Valores "normais" de não-gestante podem sinalizar disfunção
4442
+ // renal em gestante. Limites tipicamente citados: 0.4–0.8 mg/dL.
4443
+ {
4444
+ pregnant: true,
4445
+ range: { max: 0.8, min: 0.4, optimalMax: 0.7, optimalMin: 0.5, unit: "mg/dL" },
4446
+ sex: "F"
4447
+ },
4238
4448
  {
4239
4449
  ageMin: 18,
4240
4450
  range: { max: 1.3, min: 0.7, optimalMax: 1.1, optimalMin: 0.8, unit: "mg/dL" },
@@ -4261,9 +4471,6 @@ var biomarkerRangeDefinitions = {
4261
4471
  default: { max: 500, min: 0, optimalMax: 250, optimalMin: 0, unit: "ng/mL" },
4262
4472
  source: "wells-ddimer-2003"
4263
4473
  },
4264
- // =============================================================================
4265
- // METABOLIC PANEL
4266
- // =============================================================================
4267
4474
  Omega3_DHA: {
4268
4475
  default: { max: 8, min: 2, optimalMax: 6.5, optimalMin: 3.5, unit: "%" },
4269
4476
  source: "harris-omega3-2004"
@@ -4370,10 +4577,24 @@ var biomarkerRangeDefinitions = {
4370
4577
  default: { max: 86, min: 0, optimalMax: 60, optimalMin: 0, unit: "pg/mL" },
4371
4578
  source: "tietz-7ed-2015"
4372
4579
  },
4580
+ // Ferritina — WHO 2020 é o documento de referência específico para avaliação
4581
+ // do status de ferro via ferritina. Importante: inflamação aguda eleva
4582
+ // ferritina (proteína de fase aguda); WHO 2020 recomenda dosagem concomitante
4583
+ // de PCR para interpretação em contexto inflamatório (fora do escopo deste
4584
+ // tipo de faixa, mas documentado aqui para consumidores).
4373
4585
  Ferritin: {
4374
4586
  default: { max: 150, min: 12, optimalMax: 120, optimalMin: 30, unit: "ng/mL" },
4375
- source: "tietz-7ed-2015",
4587
+ source: "who-iron-2020",
4376
4588
  variants: [
4589
+ // Gestação: ferritina cai fisiologicamente no 2º/3º trimestre pela expansão
4590
+ // do volume plasmático e maior demanda fetal. WHO 2020: <15 ng/mL sugere
4591
+ // depleção; muitas diretrizes nacionais usam <30 como gatilho mais sensível
4592
+ // na gestação dada a alta prevalência de deficiência subclínica.
4593
+ {
4594
+ pregnant: true,
4595
+ range: { max: 120, min: 15, optimalMax: 80, optimalMin: 30, unit: "ng/mL" },
4596
+ sex: "F"
4597
+ },
4377
4598
  {
4378
4599
  ageMin: 18,
4379
4600
  range: { max: 250, min: 20, optimalMax: 200, optimalMin: 40, unit: "ng/mL" },
@@ -4401,9 +4622,6 @@ var biomarkerRangeDefinitions = {
4401
4622
  default: { max: 20, min: 3, optimalMax: 15, optimalMin: 5, unit: "ng/mL" },
4402
4623
  source: "tietz-7ed-2015"
4403
4624
  },
4404
- // =============================================================================
4405
- // LIVER FUNCTION
4406
- // =============================================================================
4407
4625
  FSH: {
4408
4626
  default: { max: 12.4, min: 1.5, optimalMax: 10, optimalMin: 3, unit: "mIU/mL" },
4409
4627
  source: "tietz-7ed-2015",
@@ -4451,9 +4669,38 @@ var biomarkerRangeDefinitions = {
4451
4669
  default: { max: 3.5, min: 2, optimalMax: 3.2, optimalMin: 2.3, unit: "g/dL" },
4452
4670
  source: "tietz-7ed-2015"
4453
4671
  },
4672
+ // Glicemia de jejum — 70–99 mg/dL é a faixa de normalidade (SBD 2024, ADA);
4673
+ // hipoglicemia clinicamente acionável em não-diabético é <54 mg/dL (Level 2
4674
+ // ADA/SBD), não 70. O corte 70 era Level 1 (alerta em diabético em tratamento)
4675
+ // e gerava falsos "abaixo do normal" em indivíduos saudáveis cuja glicemia
4676
+ // em jejum está fisiologicamente entre 54–70. optimalMin preserva o alvo.
4454
4677
  Glucose: {
4455
- default: { max: 100, min: 70, optimalMax: 90, optimalMin: 70, unit: "mg/dL" },
4456
- source: "sbd-diabetes-2024"
4678
+ default: {
4679
+ fastingRequired: "strict",
4680
+ max: 100,
4681
+ min: 54,
4682
+ optimalMax: 90,
4683
+ optimalMin: 70,
4684
+ unit: "mg/dL"
4685
+ },
4686
+ source: "sbd-diabetes-2024",
4687
+ variants: [
4688
+ // Gestação: DMG (IADPSG/SBD 2024) usa cortes mais restritivos na glicemia
4689
+ // de jejum — ≥92 mg/dL já indica diabetes mellitus gestacional. Portanto
4690
+ // a faixa "normal" em gestante vai até 91 mg/dL no jejum.
4691
+ {
4692
+ pregnant: true,
4693
+ range: {
4694
+ fastingRequired: "strict",
4695
+ max: 91,
4696
+ min: 54,
4697
+ optimalMax: 85,
4698
+ optimalMin: 70,
4699
+ unit: "mg/dL"
4700
+ },
4701
+ sex: "F"
4702
+ }
4703
+ ]
4457
4704
  },
4458
4705
  GlycoMark: {
4459
4706
  default: { max: 40, min: 10, optimalMax: 35, optimalMin: 15, unit: "mcg/mL" },
@@ -4463,8 +4710,14 @@ var biomarkerRangeDefinitions = {
4463
4710
  default: { max: 5, min: 0, optimalMax: 3, optimalMin: 0, unit: "ng/mL" },
4464
4711
  source: "tietz-7ed-2015"
4465
4712
  },
4713
+ // HbA1c — SBD 2024 não estabelece piso de referência clinicamente acionável.
4714
+ // Valores <4.0% podem refletir anemia hemolítica, perda sanguínea recente ou
4715
+ // hemoglobinopatia, não patologia do metabolismo glicêmico. Usamos min=2 como
4716
+ // piso de sanidade (HbA1c <2% é quase sempre erro instrumental/entrada) sem
4717
+ // criar flag clínico em valores fisiologicamente baixos. optimalMin preserva
4718
+ // o alvo fisiológico da fração glicada.
4466
4719
  HbA1c: {
4467
- default: { max: 5.7, min: 4, optimalMax: 5.3, optimalMin: 4.5, unit: "%" },
4720
+ default: { max: 5.7, min: 2, optimalMax: 5.3, optimalMin: 4.5, unit: "%" },
4468
4721
  source: "sbd-diabetes-2024"
4469
4722
  },
4470
4723
  Hct: {
@@ -4507,13 +4760,37 @@ var biomarkerRangeDefinitions = {
4507
4760
  direction: "higher-better",
4508
4761
  source: "caulfield-ionmobility-2008"
4509
4762
  },
4510
- // =============================================================================
4511
- // INFLAMMATION
4512
- // =============================================================================
4513
4763
  Hgb: {
4514
4764
  default: { max: 17.5, min: 12, optimalMax: 16, optimalMin: 13.5, unit: "g/dL" },
4515
4765
  source: "pns-hemograma-2019",
4516
4766
  variants: [
4767
+ // Gestação: hemodiluição fisiológica reduz o piso aceitável.
4768
+ // OMS e CDC: anemia gestacional quando Hgb <11 g/dL (1º e 3º tri) ou
4769
+ // <10.5 g/dL (2º tri, dilucional mais acentuada). Catch-all adota a
4770
+ // faixa mais conservadora (2º tri) quando trimestre é desconhecido.
4771
+ {
4772
+ pregnant: true,
4773
+ pregnancyTrimester: 1,
4774
+ range: { max: 14, min: 11, optimalMax: 13, optimalMin: 11.5, unit: "g/dL" },
4775
+ sex: "F"
4776
+ },
4777
+ {
4778
+ pregnant: true,
4779
+ pregnancyTrimester: 2,
4780
+ range: { max: 14, min: 10.5, optimalMax: 13, optimalMin: 11, unit: "g/dL" },
4781
+ sex: "F"
4782
+ },
4783
+ {
4784
+ pregnant: true,
4785
+ pregnancyTrimester: 3,
4786
+ range: { max: 14, min: 11, optimalMax: 13, optimalMin: 11.5, unit: "g/dL" },
4787
+ sex: "F"
4788
+ },
4789
+ {
4790
+ pregnant: true,
4791
+ range: { max: 14, min: 10.5, optimalMax: 13, optimalMin: 11, unit: "g/dL" },
4792
+ sex: "F"
4793
+ },
4517
4794
  {
4518
4795
  ageMin: 18,
4519
4796
  range: { max: 17.5, min: 13.5, optimalMax: 16.5, optimalMin: 14, unit: "g/dL" },
@@ -4526,10 +4803,20 @@ var biomarkerRangeDefinitions = {
4526
4803
  }
4527
4804
  ]
4528
4805
  },
4806
+ // HOMA-IR — corte 2.71 do estudo BRAMS (Geloneze et al., 2009) validado em
4807
+ // população urbana brasileira; Tietz 7ª ed. não publica corte próprio de
4808
+ // HOMA-IR, então a fonte anterior era citação inadequada.
4529
4809
  HOMA_IR: {
4530
- default: { max: 2.5, min: 0, optimalMax: 1.5, optimalMin: 0, unit: "" },
4810
+ default: {
4811
+ fastingRequired: "strict",
4812
+ max: 2.71,
4813
+ min: 0,
4814
+ optimalMax: 1.5,
4815
+ optimalMin: 0,
4816
+ unit: ""
4817
+ },
4531
4818
  direction: "lower-better",
4532
- source: "tietz-7ed-2015"
4819
+ source: "geloneze-brams-2009"
4533
4820
  },
4534
4821
  Homocysteine: {
4535
4822
  default: { max: 15, min: 4, optimalMax: 10, optimalMin: 5, unit: "umol/L" },
@@ -4540,15 +4827,19 @@ var biomarkerRangeDefinitions = {
4540
4827
  default: { max: 350, min: 100, optimalMax: 300, optimalMin: 150, unit: "ng/mL" },
4541
4828
  source: "tietz-7ed-2015"
4542
4829
  },
4543
- // =============================================================================
4544
- // METABOLIC
4545
- // =============================================================================
4546
4830
  ImmatureGranulocytes: {
4547
4831
  default: { max: 1, min: 0, optimalMax: 0.5, optimalMin: 0, unit: "%" },
4548
4832
  source: "tietz-7ed-2015"
4549
4833
  },
4550
4834
  Insulin: {
4551
- default: { max: 25, min: 2, optimalMax: 8, optimalMin: 3, unit: "\xB5IU/mL" },
4835
+ default: {
4836
+ fastingRequired: "strict",
4837
+ max: 25,
4838
+ min: 2,
4839
+ optimalMax: 8,
4840
+ optimalMin: 3,
4841
+ unit: "\xB5IU/mL"
4842
+ },
4552
4843
  source: "tietz-7ed-2015"
4553
4844
  },
4554
4845
  Iron: {
@@ -4597,9 +4888,6 @@ var biomarkerRangeDefinitions = {
4597
4888
  direction: "higher-better",
4598
4889
  source: "caulfield-ionmobility-2008"
4599
4890
  },
4600
- // =============================================================================
4601
- // IRON STUDIES
4602
- // =============================================================================
4603
4891
  LDL_Small: {
4604
4892
  // LDL Small (LDL Pequena): lower is better (small dense LDL is most atherogenic)
4605
4893
  // Quest Ion Mobility reference: Male 123-441, Female 126-382 nmol/L, optimal <142
@@ -4654,9 +4942,6 @@ var biomarkerRangeDefinitions = {
4654
4942
  default: { max: 35, min: 15, optimalMax: 28, optimalMin: 18, unit: "%" },
4655
4943
  source: "simopoulos-omega-ratio-2002"
4656
4944
  },
4657
- // =============================================================================
4658
- // VITAMINS
4659
- // =============================================================================
4660
4945
  Lipoprotein_a: {
4661
4946
  default: { max: 75, min: 0, optimalMax: 30, optimalMin: 0, unit: "nmol/L" },
4662
4947
  direction: "lower-better",
@@ -4698,9 +4983,6 @@ var biomarkerRangeDefinitions = {
4698
4983
  default: { max: 30, min: 0, optimalMax: 20, optimalMin: 0, unit: "mg/L" },
4699
4984
  source: "kdigo-ckd-2024"
4700
4985
  },
4701
- // =============================================================================
4702
- // HORMONES
4703
- // =============================================================================
4704
4986
  MMA: {
4705
4987
  default: { max: 378, min: 0, optimalMax: 270, optimalMin: 0, unit: "nmol/L" },
4706
4988
  source: "tietz-7ed-2015"
@@ -4766,9 +5048,6 @@ var biomarkerRangeDefinitions = {
4766
5048
  direction: "lower-better",
4767
5049
  source: "simopoulos-omega-ratio-2002"
4768
5050
  },
4769
- // =============================================================================
4770
- // TUMOR MARKERS
4771
- // =============================================================================
4772
5051
  OmegaCheck: {
4773
5052
  default: { max: 8, min: 4, optimalMax: 8, optimalMin: 5.5, unit: "%" },
4774
5053
  source: "harris-omega3-2004"
@@ -4789,9 +5068,6 @@ var biomarkerRangeDefinitions = {
4789
5068
  default: { max: 5, min: 3.5, optimalMax: 4.6, optimalMin: 3.8, unit: "mEq/L" },
4790
5069
  source: "tietz-7ed-2015"
4791
5070
  },
4792
- // =============================================================================
4793
- // CARDIAC MARKERS
4794
- // =============================================================================
4795
5071
  Prealbumin: {
4796
5072
  default: { max: 38, min: 18, optimalMax: 35, optimalMin: 20, unit: "mg/dL" },
4797
5073
  source: "tietz-7ed-2015"
@@ -4861,9 +5137,6 @@ var biomarkerRangeDefinitions = {
4861
5137
  }
4862
5138
  ]
4863
5139
  },
4864
- // =============================================================================
4865
- // URINALYSIS
4866
- // =============================================================================
4867
5140
  RDW: {
4868
5141
  default: { max: 14.5, min: 11.5, optimalMax: 14, optimalMin: 12, unit: "%" },
4869
5142
  source: "pns-hemograma-2019"
@@ -4900,9 +5173,6 @@ var biomarkerRangeDefinitions = {
4900
5173
  default: { max: 145, min: 136, optimalMax: 143, optimalMin: 138, unit: "mEq/L" },
4901
5174
  source: "tietz-7ed-2015"
4902
5175
  },
4903
- // =============================================================================
4904
- // KIDNEY FUNCTION
4905
- // =============================================================================
4906
5176
  SpecificGravity_Urine: {
4907
5177
  default: { max: 1.03, min: 1.005, optimalMax: 1.025, optimalMin: 1.01, unit: "SG" },
4908
5178
  source: "tietz-7ed-2015"
@@ -4915,9 +5185,6 @@ var biomarkerRangeDefinitions = {
4915
5185
  default: { max: 4.2, min: 2.3, optimalMax: 3.8, optimalMin: 2.8, unit: "pg/mL" },
4916
5186
  source: "tietz-7ed-2015"
4917
5187
  },
4918
- // =============================================================================
4919
- // OMEGA FATTY ACIDS
4920
- // =============================================================================
4921
5188
  T3Reverse: {
4922
5189
  default: { max: 24, min: 10, optimalMax: 20, optimalMin: 12, unit: "ng/dL" },
4923
5190
  source: "tietz-7ed-2015"
@@ -5012,8 +5279,18 @@ var biomarkerRangeDefinitions = {
5012
5279
  }
5013
5280
  ]
5014
5281
  },
5282
+ // Triglicérides — SBC 2017/2025 permite dosagem não-jejum com corte distinto
5283
+ // (<175 mg/dL pós-prandial). Marcamos `preferred` para indicar que a faixa
5284
+ // padrão é de jejum, mas não bloqueamos interpretação em não-jejum.
5015
5285
  Triglycerides: {
5016
- default: { max: 150, min: 0, optimalMax: 100, optimalMin: 0, unit: "mg/dL" },
5286
+ default: {
5287
+ fastingRequired: "preferred",
5288
+ max: 150,
5289
+ min: 0,
5290
+ optimalMax: 100,
5291
+ optimalMin: 0,
5292
+ unit: "mg/dL"
5293
+ },
5017
5294
  direction: "lower-better",
5018
5295
  source: "sbc-lipids-2025"
5019
5296
  },
@@ -5027,10 +5304,47 @@ var biomarkerRangeDefinitions = {
5027
5304
  default: { max: 14, min: 0, optimalMax: 10, optimalMin: 0, unit: "ng/L" },
5028
5305
  source: "giannitsis-hstnt-2010"
5029
5306
  },
5307
+ // TSH — 0.4–4.0 é a faixa de referência adulta geral. O alvo 2.5 µIU/mL é
5308
+ // específico do 1º trimestre gestacional (ATA 2017) e não se aplica a
5309
+ // não-gestantes; optimalMax=3.0 reflete o limite superior do tercil "ótimo"
5310
+ // sem invadir a faixa subclínica. Variante ageMin=65 mantém limite superior
5311
+ // expandido (tolerância fisiológica do eixo em idosos, SBEM 2013).
5030
5312
  TSH: {
5031
- default: { max: 4, min: 0.4, optimalMax: 2.5, optimalMin: 1, unit: "\xB5IU/mL" },
5313
+ default: { max: 4, min: 0.4, optimalMax: 3, optimalMin: 1, unit: "\xB5IU/mL" },
5032
5314
  source: "sbem-thyroid-2013",
5033
5315
  variants: [
5316
+ // Variantes gestacionais (ATA 2017 / SBEM): supressão fisiológica por hCG
5317
+ // no 1º trimestre, recuperação progressiva no 2º/3º. Trimestre-específicas
5318
+ // precedem a catch-all; catch-all cobre contexto gestante sem trimestre
5319
+ // conhecido.
5320
+ // optimalMin/optimalMax definem subfaixa "alvo" mais estreita que o
5321
+ // intervalo de referência — ex.: 1º tri aceita 0.1–2.5, mas o alvo
5322
+ // terapêutico é 0.5–2.5.
5323
+ {
5324
+ pregnant: true,
5325
+ pregnancyTrimester: 1,
5326
+ range: { max: 2.5, min: 0.1, optimalMax: 2, optimalMin: 0.5, unit: "\xB5IU/mL" },
5327
+ sex: "F"
5328
+ },
5329
+ {
5330
+ pregnant: true,
5331
+ pregnancyTrimester: 2,
5332
+ range: { max: 3, min: 0.2, optimalMax: 2.5, optimalMin: 0.5, unit: "\xB5IU/mL" },
5333
+ sex: "F"
5334
+ },
5335
+ {
5336
+ pregnant: true,
5337
+ pregnancyTrimester: 3,
5338
+ range: { max: 3, min: 0.3, optimalMax: 2.5, optimalMin: 0.5, unit: "\xB5IU/mL" },
5339
+ sex: "F"
5340
+ },
5341
+ // Catch-all gestacional — usada quando o trimestre não é informado.
5342
+ // Adota a faixa mais conservadora (2º/3º trimestre: 0.2–3.0).
5343
+ {
5344
+ pregnant: true,
5345
+ range: { max: 3, min: 0.2, optimalMax: 2.5, optimalMin: 0.5, unit: "\xB5IU/mL" },
5346
+ sex: "F"
5347
+ },
5034
5348
  {
5035
5349
  ageMin: 65,
5036
5350
  range: { max: 6, min: 0.4, optimalMax: 4, optimalMin: 1, unit: "\xB5IU/mL" },
@@ -5062,9 +5376,6 @@ var biomarkerRangeDefinitions = {
5062
5376
  default: { max: 1, min: 0.1, optimalMax: 1, optimalMin: 0.1, unit: "mg/dL" },
5063
5377
  source: "tietz-7ed-2015"
5064
5378
  },
5065
- // =============================================================================
5066
- // ADVANCED CARDIOVASCULAR
5067
- // =============================================================================
5068
5379
  pH_Urine: {
5069
5380
  default: { max: 8, min: 4.5, optimalMax: 7, optimalMin: 5.5, unit: "pH" },
5070
5381
  source: "tietz-7ed-2015"
@@ -5093,9 +5404,6 @@ var biomarkerRangeDefinitions = {
5093
5404
  default: { max: 100, min: 20, optimalMax: 80, optimalMin: 30, unit: "mcg/dL" },
5094
5405
  source: "tietz-7ed-2015"
5095
5406
  },
5096
- // =============================================================================
5097
- // MINERALS
5098
- // =============================================================================
5099
5407
  VitaminB1: {
5100
5408
  default: { max: 180, min: 70, optimalMax: 150, optimalMin: 80, unit: "nmol/L" },
5101
5409
  source: "tietz-7ed-2015"
@@ -5112,12 +5420,28 @@ var biomarkerRangeDefinitions = {
5112
5420
  default: { max: 2, min: 0.4, optimalMax: 1.5, optimalMin: 0.6, unit: "mg/dL" },
5113
5421
  source: "tietz-7ed-2015"
5114
5422
  },
5115
- // =============================================================================
5116
- // HEAVY METALS
5117
- // =============================================================================
5423
+ // Vitamina D — posicionamento conjunto SBEM/SBPC-ML 2017:
5424
+ // ≥20 ng/mL é desejável para população saudável <60 anos
5425
+ // ≥30 ng/mL é recomendado para grupos de risco (idosos, gestantes, DRC,
5426
+ // osteoporose, hiperparatireoidismo secundário).
5427
+ // A variante ageMin=60 cobre idosos. Gestação, doença renal crônica,
5428
+ // osteoporose e hiperparatireoidismo secundário também exigem min=30;
5429
+ // o tipo `BiomarkerReferenceRange` atual não expressa esses contextos
5430
+ // clínicos além de gestação e idade, portanto consumidores devem aplicar
5431
+ // o limiar ≥30 nessas populações quando souberem a comorbidade. Gestação
5432
+ // será modelada quando `pregnant: true` — aceita-se TODO até lá.
5433
+ // TODO(PR-vitd-pregnancy): adicionar variante `pregnant: true` com min=30
5434
+ // quando a modelagem de comorbidades chegar ao schema.
5118
5435
  VitaminD: {
5119
- default: { max: 100, min: 30, optimalMax: 70, optimalMin: 40, unit: "ng/mL" },
5120
- source: "sbem-vitamind-2014"
5436
+ default: { max: 100, min: 20, optimalMax: 70, optimalMin: 40, unit: "ng/mL" },
5437
+ source: "ferreira-vitd-2017",
5438
+ variants: [
5439
+ {
5440
+ ageMin: 60,
5441
+ range: { max: 100, min: 30, optimalMax: 70, optimalMin: 40, unit: "ng/mL" },
5442
+ sex: "all"
5443
+ }
5444
+ ]
5121
5445
  },
5122
5446
  VitaminD_1_25: {
5123
5447
  default: { max: 72, min: 18, optimalMax: 60, optimalMin: 25, unit: "pg/mL" },
@@ -5127,14 +5451,15 @@ var biomarkerRangeDefinitions = {
5127
5451
  default: { max: 17, min: 5.5, optimalMax: 14, optimalMin: 7, unit: "mg/L" },
5128
5452
  source: "tietz-7ed-2015"
5129
5453
  },
5130
- // VLDL: estimado via fórmula de Friedewald (TG/5)
5454
+ // VLDL estimado clinicamente via TG/5 (método Friedewald). O corte de
5455
+ // referência deriva de triglicérides <150 mg/dL (SBC 2025, dislipidemias),
5456
+ // portanto VLDL <30. Friedewald-1972 permanece registrada como fonte do
5457
+ // método de cálculo, mas a faixa de referência tem respaldo na diretriz
5458
+ // SBC 2025.
5131
5459
  VLDL: {
5132
5460
  default: { max: 30, min: 2, optimalMax: 20, optimalMin: 5, unit: "mg/dL" },
5133
- source: "friedewald-1972"
5461
+ source: "sbc-lipids-2025"
5134
5462
  },
5135
- // =============================================================================
5136
- // OTHER
5137
- // =============================================================================
5138
5463
  WBC: {
5139
5464
  default: { max: 11, min: 4, optimalMax: 8, optimalMin: 5, unit: "K/uL" },
5140
5465
  source: "pns-hemograma-2019"
@@ -5143,9 +5468,6 @@ var biomarkerRangeDefinitions = {
5143
5468
  default: { max: 120, min: 60, optimalMax: 100, optimalMin: 70, unit: "mcg/dL" },
5144
5469
  source: "tietz-7ed-2015"
5145
5470
  },
5146
- // =============================================================================
5147
- // BODY COMPOSITION (DXA)
5148
- // =============================================================================
5149
5471
  AndroidFatPct: {
5150
5472
  default: { max: 35, min: 10, optimalMax: 25, optimalMin: 15, unit: "%" },
5151
5473
  direction: "lower-better",
@@ -5384,9 +5706,6 @@ var biomarkerRangeDefinitions = {
5384
5706
  }
5385
5707
  ]
5386
5708
  },
5387
- // =============================================================================
5388
- // BONE DENSITOMETRY (DXA)
5389
- // =============================================================================
5390
5709
  BMD_Total: {
5391
5710
  default: { max: 1.4, min: 0.9, optimalMax: 1.3, optimalMin: 1, unit: "g/cm\xB2" },
5392
5711
  direction: "higher-better",
@@ -5402,9 +5721,6 @@ var biomarkerRangeDefinitions = {
5402
5721
  direction: "higher-better",
5403
5722
  source: "who-osteoporosis-1994"
5404
5723
  },
5405
- // =============================================================================
5406
- // MISSING LAB RANGES
5407
- // =============================================================================
5408
5724
  Amylase: {
5409
5725
  default: { max: 100, min: 28, optimalMax: 90, optimalMin: 35, unit: "U/L" },
5410
5726
  source: "tietz-7ed-2015"
@@ -5515,8 +5831,17 @@ function getReferenceRange(testCode, context) {
5515
5831
  if (!context || !definition.variants || definition.variants.length === 0) {
5516
5832
  return definition.default;
5517
5833
  }
5518
- const { age, biologicalSex } = context;
5834
+ const { age, biologicalSex, pregnancyTrimester, pregnant } = context;
5835
+ const hasPregnancyVariant = definition.variants.some((v) => v.pregnant === true);
5519
5836
  for (const variant of definition.variants) {
5837
+ if (variant.pregnant === true) {
5838
+ if (!pregnant) continue;
5839
+ if (variant.pregnancyTrimester !== void 0 && variant.pregnancyTrimester !== pregnancyTrimester) {
5840
+ continue;
5841
+ }
5842
+ } else if (pregnant && hasPregnancyVariant) {
5843
+ continue;
5844
+ }
5520
5845
  if (variant.sex !== "all" && variant.sex !== biologicalSex) {
5521
5846
  continue;
5522
5847
  }
@@ -5677,7 +6002,7 @@ async function main() {
5677
6002
  strict: false
5678
6003
  });
5679
6004
  if (values.version) {
5680
- process.stdout.write(`${"0.10.0"}
6005
+ process.stdout.write(`${"0.11.0"}
5681
6006
  `);
5682
6007
  return;
5683
6008
  }