@precisa-saude/fhir 0.31.6 → 0.33.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 (69) hide show
  1. package/README.md +9 -9
  2. package/dist/biomarkers.cjs +2 -2
  3. package/dist/biomarkers.js +1 -1
  4. package/dist/{chunk-WDDW2WCY.js → chunk-4FKZG5GZ.js} +116 -25
  5. package/dist/chunk-4FKZG5GZ.js.map +1 -0
  6. package/dist/chunk-5FMR2U7P.cjs +342 -0
  7. package/dist/chunk-5FMR2U7P.cjs.map +1 -0
  8. package/dist/{chunk-AZTZYOAV.cjs → chunk-5RC7C7HJ.cjs} +199 -57
  9. package/dist/chunk-5RC7C7HJ.cjs.map +1 -0
  10. package/dist/{chunk-N3ZCOLG2.js → chunk-E6MXDQXW.js} +19 -1
  11. package/dist/chunk-E6MXDQXW.js.map +1 -0
  12. package/dist/{chunk-OTVCOSCK.cjs → chunk-FGZXQWSR.cjs} +14 -20
  13. package/dist/chunk-FGZXQWSR.cjs.map +1 -0
  14. package/dist/chunk-HQ26GOLI.js +342 -0
  15. package/dist/chunk-HQ26GOLI.js.map +1 -0
  16. package/dist/{chunk-MNUQ57JR.js → chunk-KS2YZBAS.js} +15 -21
  17. package/dist/chunk-KS2YZBAS.js.map +1 -0
  18. package/dist/{chunk-555WKD6J.cjs → chunk-LXKFVJF4.cjs} +3 -3
  19. package/dist/{chunk-555WKD6J.cjs.map → chunk-LXKFVJF4.cjs.map} +1 -1
  20. package/dist/{chunk-3ILBFLVQ.cjs → chunk-OAFAERDY.cjs} +20 -2
  21. package/dist/chunk-OAFAERDY.cjs.map +1 -0
  22. package/dist/{chunk-3XIMPALK.js → chunk-Q3H5C6UR.js} +198 -56
  23. package/dist/chunk-Q3H5C6UR.js.map +1 -0
  24. package/dist/{chunk-MKH4Q735.cjs → chunk-T75NZM56.cjs} +116 -25
  25. package/dist/chunk-T75NZM56.cjs.map +1 -0
  26. package/dist/{chunk-PLR54334.js → chunk-WXCX5TJJ.js} +2 -2
  27. package/dist/{chunk-GBAY6P5P.js → chunk-X5WVIJGG.js} +5 -5
  28. package/dist/{chunk-PC4NNGBM.cjs → chunk-ZCIZUBMR.cjs} +10 -10
  29. package/dist/{chunk-PC4NNGBM.cjs.map → chunk-ZCIZUBMR.cjs.map} +1 -1
  30. package/dist/cli.js +738 -110
  31. package/dist/converter.cjs +4 -4
  32. package/dist/converter.js +3 -3
  33. package/dist/importer.cjs +5 -4
  34. package/dist/importer.cjs.map +1 -1
  35. package/dist/importer.js +4 -3
  36. package/dist/index.cjs +20 -10
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.d.cts +2 -1
  39. package/dist/index.d.ts +2 -1
  40. package/dist/index.js +36 -26
  41. package/dist/index.js.map +1 -1
  42. package/dist/reference-ranges.cjs +4 -3
  43. package/dist/reference-ranges.cjs.map +1 -1
  44. package/dist/reference-ranges.js +3 -2
  45. package/dist/sources.cjs +9 -0
  46. package/dist/sources.cjs.map +1 -0
  47. package/dist/sources.d.cts +41 -0
  48. package/dist/sources.d.ts +41 -0
  49. package/dist/sources.js +9 -0
  50. package/dist/sources.js.map +1 -0
  51. package/dist/units.cjs +7 -2
  52. package/dist/units.cjs.map +1 -1
  53. package/dist/units.d.cts +53 -5
  54. package/dist/units.d.ts +53 -5
  55. package/dist/units.js +6 -1
  56. package/dist/validators.cjs +4 -2
  57. package/dist/validators.cjs.map +1 -1
  58. package/dist/validators.js +3 -1
  59. package/package.json +11 -1
  60. package/dist/chunk-3ILBFLVQ.cjs.map +0 -1
  61. package/dist/chunk-3XIMPALK.js.map +0 -1
  62. package/dist/chunk-AZTZYOAV.cjs.map +0 -1
  63. package/dist/chunk-MKH4Q735.cjs.map +0 -1
  64. package/dist/chunk-MNUQ57JR.js.map +0 -1
  65. package/dist/chunk-N3ZCOLG2.js.map +0 -1
  66. package/dist/chunk-OTVCOSCK.cjs.map +0 -1
  67. package/dist/chunk-WDDW2WCY.js.map +0 -1
  68. /package/dist/{chunk-PLR54334.js.map → chunk-WXCX5TJJ.js.map} +0 -0
  69. /package/dist/{chunk-GBAY6P5P.js.map → chunk-X5WVIJGG.js.map} +0 -0
package/dist/cli.js CHANGED
@@ -1,8 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // src/cli/index.ts
4
- import { parseArgs as parseArgs3 } from "util";
5
-
6
3
  // src/cli-utils.ts
7
4
  async function readStdin() {
8
5
  if (process.stdin.isTTY) return "";
@@ -52,6 +49,23 @@ function exitWithError(message, code = 1) {
52
49
  process.exit(code);
53
50
  }
54
51
 
52
+ // src/cli/argv.ts
53
+ function dividirArgv(argv) {
54
+ let command;
55
+ let help = false;
56
+ let json = false;
57
+ let version = false;
58
+ const resto = [];
59
+ for (const token of argv) {
60
+ if (token === "--json") json = true;
61
+ else if (token === "--help" || token === "-h") help = true;
62
+ else if (token === "--version" || token === "-v") version = true;
63
+ else if (command === void 0 && !token.startsWith("-")) command = token;
64
+ else resto.push(token);
65
+ }
66
+ return { command, help, json, resto, version };
67
+ }
68
+
55
69
  // src/biomarkers.ts
56
70
  var BIOMARKER_DEFINITIONS = [
57
71
  // ============================================================================
@@ -110,6 +124,10 @@ var BIOMARKER_DEFINITIONS = [
110
124
  {
111
125
  category: "coracao",
112
126
  code: "LDL_Medium",
127
+ // 96735-6 é "in Serum" só, enquanto as vizinhas LDL_Small (43727-7),
128
+ // LDL_ParticleNumber (54434-6) e HDL_Large (43729-3) são Ser/Plas. É o
129
+ // único código para a subfração média, e o perfil por RMN roda em soro.
130
+ // Material registrado de propósito.
113
131
  loinc: "96735-6",
114
132
  names: {
115
133
  en: ["LDL Medium", "Medium LDL Particles"],
@@ -1077,14 +1095,16 @@ var BIOMARKER_DEFINITIONS = [
1077
1095
  },
1078
1096
  {
1079
1097
  // LOINC 99620-7 = "Omega 3 fatty acids (w3) [Moles/volume] in RBC.lysate".
1080
- // Alinha à matriz das entradas irmãs Omega3_EPA (75097-6) e Omega3_DHA
1081
- // (75095-0), ambas em hemácias. Anteriormente 35178-3 (mesmo analito em
1082
- // Ser/Plas), incompatível com o uso clínico do Índice Ômega-3 (Harris &
1083
- // von Schacky 2004), que é definido em membranas de hemácias.
1084
- // Ressalva: LOINC declara moles/volume; o biomarcador armazena %.
1085
- // Não há LOINC vigente para "Omega 3 total em % em RBC" — o `Omega3_Index`
1086
- // (88998-0) cobre apenas EPA+DHA. Mantemos `unit: '%'` por consistência
1087
- // com EPA/DHA (75095-0/75097-6 são [Entitic substance], também não-%).
1098
+ // Anteriormente 35178-3 (mesmo analito em Ser/Plas), incompatível com o
1099
+ // uso clínico do Índice Ômega-3 (Harris & von Schacky 2004), que é
1100
+ // definido em membranas de hemácias.
1101
+ //
1102
+ // Compromisso declarado, e não erro: o LOINC 2.82 não tem código de fração
1103
+ // ("ômega-3 total / ácidos graxos totais") para o total, só para os ácidos
1104
+ // individuais e para EPA+DPA+DHA (90911-9). O componente confere; a
1105
+ // propriedade é moles/volume enquanto o laudo imprime %. O teste de eixos
1106
+ // (`loinc-axes.test.ts`) lista esta entrada como exceção com este motivo.
1107
+ // Mesmo compromisso em `Omega6_Total` (99621-5).
1088
1108
  category: "nutrientes",
1089
1109
  code: "Omega3_Total",
1090
1110
  loinc: "99620-7",
@@ -1098,7 +1118,18 @@ var BIOMARKER_DEFINITIONS = [
1098
1118
  category: "nutrientes",
1099
1119
  code: "Omega3_DHA",
1100
1120
  codeAliases: ["DHA"],
1101
- loinc: "75095-0",
1121
+ // Ácidos graxos individuais: fração do total (% dos ácidos graxos C14-C22),
1122
+ // que é o que o perfil de ácidos graxos e o Índice Ômega-3 imprimem. Os
1123
+ // códigos vêm do painel 90918-4 ("Fatty acid omega-3 and omega-6 panel -
1124
+ // Blood"), o mesmo de onde já saem as razões AA/EPA (90909-3) e ω6/ω3
1125
+ // (90910-1). Até out/2026 apontavam para os códigos [Entitic substance]
1126
+ // em hemácias (75095-0, 75097-6, 75110-7, 75117-2), que são quantidade por
1127
+ // célula, e para 48371-9, que é moles/volume em soro: componente certo,
1128
+ // propriedade errada nos cinco, desde mar/2026. Ficam como alias porque o
1129
+ // analito é o mesmo. Material: o painel em soro/plasma (88884-2, C14-C24)
1130
+ // existe, e é a troca a fazer se um laboratório imprimir o perfil em soro.
1131
+ loinc: "90914-3",
1132
+ loincAliases: ["75095-0"],
1102
1133
  names: {
1103
1134
  en: ["Omega-3 DHA", "DHA", "Docosahexaenoic Acid"],
1104
1135
  pt: ["\xD4mega-3: DHA", "DHA", "\xC1cido Docosahexaenoico"]
@@ -1109,7 +1140,9 @@ var BIOMARKER_DEFINITIONS = [
1109
1140
  category: "nutrientes",
1110
1141
  code: "Omega3_DPA",
1111
1142
  codeAliases: ["DPA"],
1112
- loinc: "48371-9",
1143
+ // Fração em sangue, painel 90918-4. Ver `Omega3_DHA`.
1144
+ loinc: "90913-5",
1145
+ loincAliases: ["48371-9"],
1113
1146
  names: {
1114
1147
  en: ["Omega-3 DPA", "DPA", "Docosapentaenoic Acid"],
1115
1148
  pt: ["\xD4mega-3: DPA", "DPA", "\xC1cido Docosapentaenoico"]
@@ -1120,7 +1153,9 @@ var BIOMARKER_DEFINITIONS = [
1120
1153
  category: "nutrientes",
1121
1154
  code: "Omega3_EPA",
1122
1155
  codeAliases: ["EPA"],
1123
- loinc: "75097-6",
1156
+ // Fração em sangue, painel 90918-4. Ver `Omega3_DHA`.
1157
+ loinc: "90912-7",
1158
+ loincAliases: ["75097-6"],
1124
1159
  names: {
1125
1160
  en: ["Omega-3 EPA", "EPA", "Eicosapentaenoic Acid"],
1126
1161
  pt: ["\xD4mega-3: EPA", "EPA", "\xC1cido Eicosapentaenoico"]
@@ -1130,7 +1165,12 @@ var BIOMARKER_DEFINITIONS = [
1130
1165
  {
1131
1166
  category: "nutrientes",
1132
1167
  code: "EPADPADHA",
1133
- loinc: "90908-5",
1168
+ // 90911-9 é a fração EPA+DPA+DHA / ácidos graxos C14-C22 em sangue, o
1169
+ // valor em %. Até out/2026 apontava para 90908-5, que é a *interpretação*
1170
+ // desse mesmo valor (ordinal: risco alto, moderado, baixo), e não o
1171
+ // número. Sem alias: código ordinal carregando valor numérico é o erro
1172
+ // que se quer parar de aceitar.
1173
+ loinc: "90911-9",
1134
1174
  names: {
1135
1175
  en: ["Omega-3 EPA+DPA+DHA", "EPA+DPA+DHA"],
1136
1176
  pt: ["\xD4mega-3: EPA+DPA+DHA"]
@@ -1151,7 +1191,12 @@ var BIOMARKER_DEFINITIONS = [
1151
1191
  {
1152
1192
  category: "nutrientes",
1153
1193
  code: "Omega6_Total",
1154
- loinc: "35177-5",
1194
+ // 99621-5 é "Omega 6 fatty acids (w6) [Moles/volume] in RBC.lysate", o
1195
+ // par exato do 99620-7 de `Omega3_Total`, com o mesmo compromisso de
1196
+ // propriedade documentado lá. Até out/2026 apontava para 35177-5, que é
1197
+ // ácidos graxos poli-insaturados totais em soro: ômega-3 e ômega-6
1198
+ // somados, outro componente. Sem alias.
1199
+ loinc: "99621-5",
1155
1200
  names: {
1156
1201
  en: ["Omega-6 Total", "Total Omega-6"],
1157
1202
  pt: ["\xD4mega-6 Total"]
@@ -1162,7 +1207,9 @@ var BIOMARKER_DEFINITIONS = [
1162
1207
  category: "nutrientes",
1163
1208
  code: "Omega6_AA",
1164
1209
  codeAliases: ["Arachidonic_Acid"],
1165
- loinc: "75110-7",
1210
+ // Fração em sangue, painel 90918-4. Ver `Omega3_DHA`.
1211
+ loinc: "90916-8",
1212
+ loincAliases: ["75110-7"],
1166
1213
  names: {
1167
1214
  en: ["Omega-6 Arachidonic Acid", "Arachidonic Acid", "AA"],
1168
1215
  pt: ["\xD4mega-6: \xC1cido Araquid\xF4nico", "\xC1cido Araquid\xF4nico", "AA"]
@@ -1173,7 +1220,9 @@ var BIOMARKER_DEFINITIONS = [
1173
1220
  category: "nutrientes",
1174
1221
  code: "Omega6_LA",
1175
1222
  codeAliases: ["Linoleic_Acid"],
1176
- loinc: "75117-2",
1223
+ // Fração em sangue, painel 90918-4. Ver `Omega3_DHA`.
1224
+ loinc: "90917-6",
1225
+ loincAliases: ["75117-2"],
1177
1226
  names: {
1178
1227
  en: ["Omega-6 Linoleic Acid", "Linoleic Acid", "LA"],
1179
1228
  pt: ["\xD4mega-6: \xC1cido Linoleico", "\xC1cido Linoleico", "LA"]
@@ -1254,7 +1303,11 @@ var BIOMARKER_DEFINITIONS = [
1254
1303
  {
1255
1304
  category: "nutrientes",
1256
1305
  code: "Zinc",
1257
- loinc: "8245-3",
1306
+ // 5763-8 é "Zinc [Mass/volume] in Serum or Plasma", o zinco sérico da
1307
+ // rotina brasileira (o nome em inglês já dizia "Serum Zinc"). Até out/2026
1308
+ // apontava para 8245-3, o mesmo analito em sangue total, que tem faixa de
1309
+ // referência própria. Sem alias: sangue total é outro material.
1310
+ loinc: "5763-8",
1258
1311
  names: {
1259
1312
  en: ["Zinc", "Serum Zinc"],
1260
1313
  pt: ["Zinco"]
@@ -1355,6 +1408,9 @@ var BIOMARKER_DEFINITIONS = [
1355
1408
  {
1356
1409
  category: "figado",
1357
1410
  code: "Globulin",
1411
+ // 2336-6 é "Globulin [Mass/volume] in Serum", soro só: o LOINC 2.82 não
1412
+ // tem a versão Ser/Plas da globulina total (as frações alfa, beta e gama
1413
+ // têm). Material registrado de propósito.
1358
1414
  loinc: "2336-6",
1359
1415
  names: {
1360
1416
  en: ["Globulin", "Serum Globulin"],
@@ -1634,6 +1690,13 @@ var BIOMARKER_DEFINITIONS = [
1634
1690
  {
1635
1691
  category: "rins",
1636
1692
  code: "BUN_Creatinine_Ratio",
1693
+ // 3097-3 é "Urea nitrogen/Creatinine [Mass Ratio]", a razão BUN/creatinina,
1694
+ // e a faixa de referência (10-20, Tietz) é a dessa convenção. O laudo
1695
+ // brasileiro imprime "Relação Ureia/Creatinina", cuja faixa é outra (cerca
1696
+ // de 21-43) e cujo código é 56997-0 ("Urea/Creatinine [Mass Ratio] in
1697
+ // Serum or Plasma"). Trocar só o código deixaria a faixa errada do outro
1698
+ // lado; a separação em duas grandezas, como em `Glucose_Fasting`, é
1699
+ // decisão à parte, registrada em `reference-ranges.ts`.
1637
1700
  loinc: "3097-3",
1638
1701
  names: {
1639
1702
  en: ["BUN/Creatinine Ratio", "Urea/Creatinine Ratio"],
@@ -1801,7 +1864,12 @@ var BIOMARKER_DEFINITIONS = [
1801
1864
  category: "urina",
1802
1865
  code: "Bacteria_Urine",
1803
1866
  codeAliases: ["UrineBacteria"],
1804
- loinc: "630-4",
1867
+ // 5769-5 é "Bacteria [#/area] in Urine sediment by Microscopy high power
1868
+ // field", a contagem do sedimento que a unidade /HPF declara. Até out/2026
1869
+ // apontava para 630-4, "Bacteria identified in Urine by Culture": outro
1870
+ // exame, nominal, que identifica a espécie em cultura. Sem alias:
1871
+ // urocultura não é sedimento.
1872
+ loinc: "5769-5",
1805
1873
  names: {
1806
1874
  en: ["Urine Bacteria", "Bacteria Urine", "Bacteria, Urine", "Bacteria"],
1807
1875
  pt: ["Bact\xE9rias na Urina", "Bact\xE9rias"]
@@ -1920,7 +1988,14 @@ var BIOMARKER_DEFINITIONS = [
1920
1988
  {
1921
1989
  category: "urina",
1922
1990
  code: "RBC_Urine",
1923
- loinc: "5808-1",
1991
+ // 13945-1 é "Erythrocytes [#/area] in Urine sediment by Microscopy high
1992
+ // power field", o /HPF que o laudo imprime e que `Leukocytes_Urine` já usa
1993
+ // em 5821-4. Até out/2026 apontava para 5808-1, o mesmo exame em #/volume
1994
+ // (por mL): analito e material certos, propriedade errada. Fica como alias
1995
+ // porque o analito é o mesmo, e laudo de analisador automático que conte
1996
+ // por mL continua resolvendo em RBC_Urine.
1997
+ loinc: "13945-1",
1998
+ loincAliases: ["5808-1"],
1924
1999
  names: {
1925
2000
  en: ["Urine RBC", "Red Blood Cells in Urine", "RBC Urine", "RBC, Urine"],
1926
2001
  pt: ["Hem\xE1cias na Urina"]
@@ -2015,6 +2090,10 @@ var BIOMARKER_DEFINITIONS = [
2015
2090
  {
2016
2091
  category: "autoimunidade",
2017
2092
  code: "Gliadin_Deamidated_IgA",
2093
+ // 63453-5 e 63459-2 (IgG) afirmam método, "by Immunoassay", e material,
2094
+ // "Serum". É o que os kits de DGP usam. A propriedade é unidades
2095
+ // arbitrárias por volume, e o laudo imprime U/mL; até out/2026 a unidade
2096
+ // declarada era "U", sem o volume.
2018
2097
  loinc: "63453-5",
2019
2098
  names: {
2020
2099
  en: [
@@ -2028,7 +2107,7 @@ var BIOMARKER_DEFINITIONS = [
2028
2107
  ],
2029
2108
  pt: ["Anticorpos Anti-Gliadina Deamidada IgA", "DGP IgA"]
2030
2109
  },
2031
- unit: "U"
2110
+ unit: "U/mL"
2032
2111
  },
2033
2112
  {
2034
2113
  category: "autoimunidade",
@@ -2046,7 +2125,7 @@ var BIOMARKER_DEFINITIONS = [
2046
2125
  ],
2047
2126
  pt: ["Anticorpos Anti-Gliadina Deamidada IgG", "DGP IgG"]
2048
2127
  },
2049
- unit: "U"
2128
+ unit: "U/mL"
2050
2129
  },
2051
2130
  {
2052
2131
  category: "autoimunidade",
@@ -2437,6 +2516,10 @@ var BIOMARKER_DEFINITIONS = [
2437
2516
  {
2438
2517
  category: "composicao-corporal",
2439
2518
  code: "TotalBodyWater",
2519
+ // 101683-1 é "Body water mass", em kg; o aparelho de bioimpedância imprime
2520
+ // litros. É o único código de água corporal total no LOINC 2.82 (o outro,
2521
+ // 101684-9, é o percentual), e para água 1 L pesa 1 kg, então o número não
2522
+ // muda. O teste de eixos lista a entrada como exceção com este motivo.
2440
2523
  loinc: "101683-1",
2441
2524
  names: {
2442
2525
  en: ["Total Body Water", "Body Water", "TBW", "Total Water"],
@@ -2502,6 +2585,10 @@ var BIOMARKER_DEFINITIONS = [
2502
2585
  {
2503
2586
  category: "composicao-corporal",
2504
2587
  code: "PhaseAngle",
2588
+ // 107160-4 é "Phase angle Xc/R [Ratio] Bioelectrical impedance analysis",
2589
+ // único código de ângulo de fase. O aparelho imprime graus (arctan Xc/R)
2590
+ // e o LOINC declara razão com unidade-exemplo %. Fica em graus, que é o
2591
+ // que o laudo traz, e o teste de eixos lista a entrada como exceção.
2505
2592
  loinc: "107160-4",
2506
2593
  names: {
2507
2594
  en: ["Phase Angle", "Whole Body Phase Angle", "PhA", "AnglePhase"],
@@ -2592,9 +2679,9 @@ var BIOMARKER_DEFINITIONS = [
2592
2679
  {
2593
2680
  category: "composicao-corporal",
2594
2681
  code: "WaistCircumference",
2595
- // 8280-0 é a medida em si. 56086-2, que parecia o óbvio pela busca, é
2596
- // "Adult Waist Circumference Protocol", um protocolo PhenX e não um
2597
- // resultado.
2682
+ // 8280-0 é a medida em si, e afirma sítio e método: "at umbilicus by Tape
2683
+ // measure". 56086-2, que parecia o óbvio pela busca, é "Adult Waist
2684
+ // Circumference Protocol", um protocolo PhenX e não um resultado.
2598
2685
  loinc: "8280-0",
2599
2686
  names: {
2600
2687
  en: ["Waist Circumference", "Abdominal Circumference", "Waist"],
@@ -3004,6 +3091,10 @@ var BIOMARKER_DEFINITIONS = [
3004
3091
  {
3005
3092
  category: "coracao",
3006
3093
  code: "TroponinI",
3094
+ // 49563-0 afirma método: limite de detecção ≤ 0,01 ng/mL, o ensaio de alta
3095
+ // sensibilidade. Um resultado de troponina I convencional pede o código
3096
+ // sem método, 10839-9. Assimétrico com `TroponinT`, que fica no 6598-7 sem
3097
+ // método de propósito: a hs-cTnT em ng/L é a convenção dos laudos.
3007
3098
  loinc: "49563-0",
3008
3099
  names: {
3009
3100
  en: ["Troponin I", "cTnI", "Cardiac Troponin I", "hs-TnI", "High-Sensitivity Troponin I"],
@@ -3014,6 +3105,9 @@ var BIOMARKER_DEFINITIONS = [
3014
3105
  {
3015
3106
  category: "coracao",
3016
3107
  code: "TroponinT",
3108
+ // 6598-7 não afirma método. A unidade ng/L é a convenção do ensaio de alta
3109
+ // sensibilidade (hs-cTnT), e o ensaio convencional em ng/mL converte por
3110
+ // fator exato (ver `units.ts`). Ver `TroponinI` para a assimetria.
3017
3111
  loinc: "6598-7",
3018
3112
  names: {
3019
3113
  en: ["Troponin T", "cTnT", "Cardiac Troponin T", "hs-TnT", "High-Sensitivity Troponin T"],
@@ -3050,6 +3144,11 @@ var BIOMARKER_DEFINITIONS = [
3050
3144
  {
3051
3145
  category: "figado",
3052
3146
  code: "LDH",
3147
+ // 14804-9 afirma método: reação lactato → piruvato (L→P). O código sem
3148
+ // método, 2532-0, está DISCOURAGED, então um método tem que ser escolhido,
3149
+ // e L→P é o do procedimento de referência IFCC que os laboratórios
3150
+ // brasileiros usam, ainda que o laudo raramente imprima a direção. Se um
3151
+ // laudo declarar P→L, o código é outro (14805-6).
3053
3152
  loinc: "14804-9",
3054
3153
  // 2532-0 é o código genérico anterior, que o LOINC marca como DISCOURAGED.
3055
3154
  // Fica como alias para que laudo antigo e dado já armazenado continuem
@@ -3180,7 +3279,13 @@ var BIOMARKER_DEFINITIONS = [
3180
3279
  {
3181
3280
  category: "pancreas",
3182
3281
  code: "BetaHydroxybutyrate",
3183
- loinc: "53060-0",
3282
+ // 6873-4 é "Beta hydroxybutyrate [Moles/volume] in Serum or Plasma", o
3283
+ // que o laudo dosa em mmol/L. Até out/2026 apontava para 53060-0, que é
3284
+ // butirilcarnitina (C4) em líquido amniótico: analito e material errados
3285
+ // desde abr/2026, e nenhum check pegou porque o código existe e está
3286
+ // ACTIVE. Sem alias para o código antigo: ele nunca significou BHB, e
3287
+ // aceitá-lo na importação faria um laudo de carnitina virar cetona.
3288
+ loinc: "6873-4",
3184
3289
  names: {
3185
3290
  en: ["Beta-Hydroxybutyrate", "\u03B2-Hydroxybutyrate", "BHB", "Ketone Bodies"],
3186
3291
  pt: ["Beta-Hidroxibutirato", "\u03B2-Hidroxibutirato", "BHB", "Corpos Cet\xF4nicos"]
@@ -3311,97 +3416,99 @@ var BIOMARKER_CODE_SYSTEM = "http://fhir-brasil.dev/biomarker-codes";
3311
3416
  var UNIT_TO_UCUM = {
3312
3417
  // Dimensionless / special measurements
3313
3418
  "[pH]": "[pH]",
3419
+ "{index}": "{index}",
3314
3420
  "{ratio}": "{ratio}",
3421
+ "{score}": "{score}",
3315
3422
  "{specific gravity}": "{specific gravity}",
3423
+ "/HPF": "/[HPF]",
3424
+ "/LPF": "/[LPF]",
3316
3425
  "/\xB5L": "/uL",
3317
3426
  // Percentage
3318
3427
  "%": "%",
3319
3428
  // Count units
3320
3429
  "10\xB3/\xB5L": "10*3/uL",
3321
3430
  "10\u2076/\xB5L": "10*6/uL",
3431
+ Angstrom: "Ao",
3432
+ AU: "{score}",
3433
+ cm: "cm",
3434
+ "cm\xB3": "cm3",
3435
+ deg: "deg",
3322
3436
  // Volume
3323
3437
  fL: "fL",
3324
3438
  g: "g",
3439
+ "g/cm\xB2": "g/cm2",
3325
3440
  // Mass concentration
3326
3441
  "g/dL": "g/dL",
3442
+ "g/L": "g/L",
3443
+ "IU/L": "[IU]/L",
3444
+ "IU/mL": "[IU]/mL",
3445
+ "K/uL": "10*3/uL",
3446
+ "kcal/d": "kcal/d",
3447
+ kg: "kg",
3448
+ "kg/m2": "kg/m2",
3449
+ "kg/m\xB2": "kg/m2",
3450
+ "kU/L": "k[IU]/L",
3327
3451
  L: "L",
3452
+ "M/uL": "10*6/uL",
3453
+ "mcg/dL": "ug/dL",
3454
+ "mcg/L": "ug/L",
3455
+ "mcg/mL": "ug/mL",
3328
3456
  // Molar concentration
3329
3457
  "mEq/L": "meq/L",
3330
3458
  mg: "mg",
3331
3459
  "mg/dL": "mg/dL",
3460
+ "mg/g": "mg/g",
3461
+ "mg/L": "mg/L",
3462
+ "mIU/L": "m[IU]/L",
3463
+ "mIU/mL": "m[IU]/mL",
3332
3464
  mL: "mL",
3465
+ "mL/min/1.73m\xB2": "mL/min/{1.73_m2}",
3466
+ mm: "mm",
3467
+ "mm/h": "mm/h",
3468
+ "mm/hr": "mm/h",
3333
3469
  "mmol/L": "mmol/L",
3470
+ "mUI/L": "m[IU]/L",
3334
3471
  "mUI/mL": "m[IU]/mL",
3335
3472
  ng: "ng",
3336
3473
  "ng/dL": "ng/dL",
3474
+ "ng/L": "ng/L",
3337
3475
  "ng/mL": "ng/mL",
3338
3476
  "nmol/L": "nmol/L",
3339
3477
  // Mass
3340
3478
  pg: "pg",
3341
3479
  "pg/mL": "pg/mL",
3342
3480
  pH: "[pH]",
3481
+ "pmol/L": "pmol/L",
3482
+ raz\u00E3o: "{ratio}",
3483
+ score: "{score}",
3484
+ segundos: "s",
3343
3485
  // Enzyme activity
3486
+ U: "U",
3344
3487
  "U/L": "U/L",
3345
3488
  // Special units
3346
3489
  "U/mL": "U/mL",
3490
+ "ug/dL": "ug/dL",
3491
+ "ug/L": "ug/L",
3347
3492
  "UI/L": "[IU]/L",
3348
3493
  "UI/mL": "[IU]/mL",
3494
+ "uIU/mL": "u[IU]/mL",
3495
+ "umol/L": "umol/L",
3349
3496
  \u00B5g: "ug",
3350
3497
  "\xB5g/dL": "ug/dL",
3498
+ "\xB5g/L": "ug/L",
3351
3499
  "\xB5mol/L": "umol/L",
3352
- "\xB5UI/mL": "u[IU]/mL"
3500
+ "\xB5UI/mL": "u[IU]/mL",
3501
+ \u00EDndice: "{index}"
3353
3502
  };
3354
- var BIOMARKER_DEFAULT_UNIT = {
3355
- // Proteins
3356
- Albumin: "g/dL",
3357
- AlkalinePhosphatase: "U/L",
3358
- // Liver
3359
- ALT: "U/L",
3360
- AST: "U/L",
3361
- Calcium: "mg/dL",
3362
- Chloride: "mEq/L",
3363
- // Lipids
3364
- Cholesterol: "mg/dL",
3365
- // Kidney
3366
- Creatinine: "mg/dL",
3367
- eAG: "mg/dL",
3368
- Ferritin: "ng/mL",
3369
- FolicAcid: "ng/mL",
3370
- GGT: "U/L",
3371
- // Glucose/Diabetes
3372
- Glucose: "mg/dL",
3373
- HbA1c: "%",
3374
- Hct: "%",
3375
- HDL: "mg/dL",
3376
- // Hematology
3377
- Hgb: "g/dL",
3378
- Insulin: "\xB5UI/mL",
3379
- // Iron studies
3380
- Iron: "\xB5g/dL",
3381
- LDL: "mg/dL",
3382
- Magnesium: "mg/dL",
3383
- NonHDL_Cholesterol: "mg/dL",
3384
- // Urinalysis - dimensionless
3503
+ var DIMENSIONLESS_DEFAULTS = {
3385
3504
  pH_Urine: "[pH]",
3386
- Potassium: "mEq/L",
3387
- RDW: "%",
3388
- // Electrolytes
3389
- Sodium: "mEq/L",
3390
- SpecificGravity_Urine: "{specific gravity}",
3391
- T3Free: "pg/mL",
3392
- T4Free: "ng/dL",
3393
- TIBC: "\xB5g/dL",
3394
- TotalProtein: "g/dL",
3395
- TransferrinSaturation: "%",
3396
- Triglycerides: "mg/dL",
3397
- // Thyroid
3398
- TSH: "\xB5UI/mL",
3399
- Urea: "mg/dL",
3400
- UricAcid: "mg/dL",
3401
- // Vitamins
3402
- VitaminB12: "pg/mL",
3403
- VitaminD: "ng/mL",
3404
- VLDL: "mg/dL"
3505
+ SpecificGravity_Urine: "{specific gravity}"
3506
+ };
3507
+ var BIOMARKER_DEFAULT_UNIT = {
3508
+ ...Object.fromEntries(
3509
+ BIOMARKER_DEFINITIONS.filter((b) => b.unit).map((b) => [b.code, b.unit])
3510
+ ),
3511
+ ...DIMENSIONLESS_DEFAULTS
3405
3512
  };
3406
3513
  function unitToUCUM(unit) {
3407
3514
  return UNIT_TO_UCUM[unit] || unit;
@@ -3409,6 +3516,128 @@ function unitToUCUM(unit) {
3409
3516
  function getDefaultUnit(biomarkerCode) {
3410
3517
  return BIOMARKER_DEFAULT_UNIT[biomarkerCode] || "";
3411
3518
  }
3519
+ var UCUM_ATOMS = /* @__PURE__ */ new Set([
3520
+ "m",
3521
+ "g",
3522
+ "s",
3523
+ "L",
3524
+ "l",
3525
+ "mol",
3526
+ "eq",
3527
+ "U",
3528
+ "cal",
3529
+ "h",
3530
+ "d",
3531
+ "min",
3532
+ "wk",
3533
+ "mo",
3534
+ "a",
3535
+ "Ao",
3536
+ "deg",
3537
+ "K",
3538
+ "A",
3539
+ "N",
3540
+ "Pa",
3541
+ "J",
3542
+ "W",
3543
+ "Hz",
3544
+ "V",
3545
+ "C",
3546
+ "osm",
3547
+ "t",
3548
+ "u",
3549
+ "bar",
3550
+ "atm",
3551
+ "rad",
3552
+ "sr",
3553
+ "cd",
3554
+ "Bq",
3555
+ "Gy",
3556
+ "Sv",
3557
+ "lm",
3558
+ "lx",
3559
+ "Cel",
3560
+ "B",
3561
+ "Np"
3562
+ ]);
3563
+ var UCUM_PREFIXES = /* @__PURE__ */ new Set([
3564
+ "Y",
3565
+ "Z",
3566
+ "E",
3567
+ "P",
3568
+ "T",
3569
+ "G",
3570
+ "M",
3571
+ "k",
3572
+ "h",
3573
+ "da",
3574
+ "d",
3575
+ "c",
3576
+ "m",
3577
+ "u",
3578
+ "n",
3579
+ "p",
3580
+ "f",
3581
+ "a",
3582
+ "z",
3583
+ "y"
3584
+ ]);
3585
+ function isUcumAtom(token) {
3586
+ if (token === "%" || /^10\*-?\d+$/.test(token) || /^\d+$/.test(token)) return true;
3587
+ const bracket = /^([A-Za-z]{0,2})\[[^[\]{}\s]+\]$/.exec(token);
3588
+ if (bracket) return bracket[1] === "" || UCUM_PREFIXES.has(bracket[1]);
3589
+ if (UCUM_ATOMS.has(token)) return true;
3590
+ for (const prefix of UCUM_PREFIXES) {
3591
+ if (token.startsWith(prefix) && UCUM_ATOMS.has(token.slice(prefix.length))) return true;
3592
+ }
3593
+ return false;
3594
+ }
3595
+ function isUcumComponent(token) {
3596
+ const m = /^(.*?)(\{[^{}]*\})?$/.exec(token);
3597
+ if (!m) return false;
3598
+ const [, body, annotation] = m;
3599
+ if (!body) return annotation !== void 0;
3600
+ const exp = /^(.+?)([+-]?\d+)?$/.exec(body);
3601
+ if (!exp) return false;
3602
+ const [, atom, exponent] = exp;
3603
+ if (isUcumAtom(body)) return true;
3604
+ if (exponent === void 0) return false;
3605
+ return isUcumAtom(atom);
3606
+ }
3607
+ function isUcumCode(code) {
3608
+ if (!code || /[^\x21-\x7E ]/.test(code)) return false;
3609
+ const terms = [];
3610
+ let current = "";
3611
+ let braces = 0;
3612
+ let inBracket = false;
3613
+ for (const ch of code) {
3614
+ if (ch === "{") braces++;
3615
+ else if (ch === "}") {
3616
+ if (braces === 0) return false;
3617
+ braces--;
3618
+ } else if (ch === "[") inBracket = true;
3619
+ else if (ch === "]") inBracket = false;
3620
+ if ((ch === "." || ch === "/") && braces === 0 && !inBracket) {
3621
+ terms.push(current, ch);
3622
+ current = "";
3623
+ continue;
3624
+ }
3625
+ current += ch;
3626
+ }
3627
+ if (braces !== 0 || inBracket) return false;
3628
+ terms.push(current);
3629
+ if (terms[0] === "" && terms[1] === "/") terms[0] = "1";
3630
+ let expectOperand = true;
3631
+ for (const t of terms) {
3632
+ if (expectOperand) {
3633
+ if (!isUcumComponent(t)) return false;
3634
+ } else if (t !== "." && t !== "/") {
3635
+ return false;
3636
+ }
3637
+ expectOperand = !expectOperand;
3638
+ }
3639
+ return !expectOperand;
3640
+ }
3412
3641
  var CBC_DIFF_ALIASES = {
3413
3642
  "/ul": "/uL",
3414
3643
  "/\xB5l": "/uL",
@@ -3710,7 +3939,7 @@ var BIOMARKER_UNITS = {
3710
3939
  "miu/ml": "mIU/mL",
3711
3940
  "ui/l": "mIU/mL"
3712
3941
  },
3713
- canonicalUcum: "mIU/mL",
3942
+ canonicalUcum: "m[iU]/mL",
3714
3943
  canonicalUnit: "mIU/mL",
3715
3944
  siUcum: "[iU]/L",
3716
3945
  siUnit: "IU/L"
@@ -3845,7 +4074,7 @@ var BIOMARKER_UNITS = {
3845
4074
  "miu/ml": "mIU/mL",
3846
4075
  "ui/l": "mIU/mL"
3847
4076
  },
3848
- canonicalUcum: "mIU/mL",
4077
+ canonicalUcum: "m[iU]/mL",
3849
4078
  canonicalUnit: "mIU/mL",
3850
4079
  siUcum: "[iU]/L",
3851
4080
  siUnit: "IU/L"
@@ -4112,7 +4341,7 @@ var BIOMARKER_UNITS = {
4112
4341
  },
4113
4342
  canonicalUcum: "u[iU]/mL",
4114
4343
  canonicalUnit: "uIU/mL",
4115
- siUcum: "mIU/L",
4344
+ siUcum: "m[iU]/L",
4116
4345
  siUnit: "mIU/L"
4117
4346
  },
4118
4347
  Urea: {
@@ -4167,6 +4396,21 @@ var BIOMARKER_UNITS = {
4167
4396
  function getCanonicalUnit(code) {
4168
4397
  return BIOMARKER_UNITS[code]?.canonicalUnit ?? null;
4169
4398
  }
4399
+ function normalizeUnit(unit, config) {
4400
+ return config.aliases[unit.toLowerCase()] ?? config.aliases[unit] ?? unit;
4401
+ }
4402
+ function resolveUcum(unit, biomarkerCode) {
4403
+ if (!unit) return void 0;
4404
+ const config = biomarkerCode ? BIOMARKER_UNITS[biomarkerCode] : void 0;
4405
+ if (config) {
4406
+ const normalized = normalizeUnit(unit, config);
4407
+ if (normalized === config.canonicalUnit) return config.canonicalUcum;
4408
+ if (normalized === config.siUnit) return config.siUcum;
4409
+ }
4410
+ const mapped = UNIT_TO_UCUM[unit];
4411
+ if (mapped) return mapped;
4412
+ return isUcumCode(unit) ? unit : void 0;
4413
+ }
4170
4414
 
4171
4415
  // src/converter.ts
4172
4416
  function interpretationCode(flag) {
@@ -4199,13 +4443,7 @@ var SEX_CODING = {
4199
4443
  },
4200
4444
  male: { code: "male", display: "Male", system: "http://hl7.org/fhir/administrative-gender" }
4201
4445
  };
4202
- var buildReferenceRanges = (observation, sourceUnit, ucumUnit) => {
4203
- const quantity = (value) => ({
4204
- code: ucumUnit,
4205
- system: "http://unitsofmeasure.org",
4206
- unit: sourceUnit,
4207
- value
4208
- });
4446
+ var buildReferenceRanges = (observation, quantity) => {
4209
4447
  const toRanges = (low, high, sex) => {
4210
4448
  if (low === void 0 && high === void 0) return [];
4211
4449
  return [
@@ -4224,7 +4462,12 @@ var buildReferenceRanges = (observation, sourceUnit, ucumUnit) => {
4224
4462
  function labObservationToFHIR(observation, patientId, laboratoryName) {
4225
4463
  const loincCode = codeToLoinc(observation.biomarkerCode);
4226
4464
  const sourceUnit = observation.unit || getDefaultUnit(observation.biomarkerCode) || observation.unit;
4227
- const ucumUnit = unitToUCUM(sourceUnit);
4465
+ const ucumUnit = resolveUcum(sourceUnit, observation.biomarkerCode);
4466
+ const quantity = (value) => ({
4467
+ ...ucumUnit ? { code: ucumUnit, system: "http://unitsofmeasure.org" } : {},
4468
+ ...sourceUnit ? { unit: sourceUnit } : {},
4469
+ value
4470
+ });
4228
4471
  const isQualitative = observation.isQualitative || typeof observation.value === "string";
4229
4472
  const fhirObs = {
4230
4473
  category: [
@@ -4283,13 +4526,8 @@ function labObservationToFHIR(observation, patientId, laboratoryName) {
4283
4526
  if (isQualitative) {
4284
4527
  fhirObs.valueString = String(observation.value);
4285
4528
  } else {
4286
- fhirObs.valueQuantity = {
4287
- code: ucumUnit,
4288
- system: "http://unitsofmeasure.org",
4289
- unit: sourceUnit,
4290
- value: observation.value
4291
- };
4292
- const referenceRange = buildReferenceRanges(observation, sourceUnit, ucumUnit);
4529
+ fhirObs.valueQuantity = quantity(observation.value);
4530
+ const referenceRange = buildReferenceRanges(observation, quantity);
4293
4531
  if (referenceRange.length > 0) fhirObs.referenceRange = referenceRange;
4294
4532
  }
4295
4533
  return fhirObs;
@@ -6765,6 +7003,403 @@ async function range(args, json) {
6765
7003
  );
6766
7004
  }
6767
7005
 
7006
+ // src/cli/commands/source.ts
7007
+ import { parseArgs as parseArgs3 } from "util";
7008
+
7009
+ // src/sources.ts
7010
+ var SOURCE_REGISTRY = {
7011
+ // ---------------------------------------------------------------------------
7012
+ // Fontes internacionais — Cardiovascular
7013
+ // ---------------------------------------------------------------------------
7014
+ "agatston-1990": {
7015
+ abnt: "AGATSTON, A. S. et al. Quantification of coronary artery calcium using ultrafast computed tomography. Journal of the American College of Cardiology, v. 15, n. 4, p. 827-832, 1990.",
7016
+ doi: "10.1016/0735-1097(90)90282-T",
7017
+ key: "agatston-1990",
7018
+ url: "https://pubmed.ncbi.nlm.nih.gov/2407762/"
7019
+ },
7020
+ "browning-ashwell-2010": {
7021
+ abnt: "BROWNING, L. M.; HSIEH, S. D.; ASHWELL, M. A systematic review of waist-to-height ratio as a screening tool for the prediction of cardiovascular disease and diabetes: 0,5 could be a suitable global boundary value. Nutrition Research Reviews, v. 23, n. 2, p. 247-269, 2010.",
7022
+ doi: "10.1017/S0954422410000144",
7023
+ key: "browning-ashwell-2010",
7024
+ url: "https://pubmed.ncbi.nlm.nih.gov/20819243/"
7025
+ },
7026
+ "castelli-ratio-1992": {
7027
+ abnt: "CASTELLI, W. P. et al. Lipids and risk of coronary heart disease: the Framingham Study. Annals of Epidemiology, v. 2, n. 1-2, p. 23-28, 1992.",
7028
+ doi: "10.1016/1047-2797(92)90033-M",
7029
+ key: "castelli-ratio-1992",
7030
+ url: "https://pubmed.ncbi.nlm.nih.gov/1342260/"
7031
+ },
7032
+ "caulfield-ionmobility-2008": {
7033
+ abnt: "CAULFIELD, M. P. et al. Direct determination of lipoprotein particle sizes and concentrations by ion mobility analysis. Clinical Chemistry, v. 54, n. 8, p. 1307-1316, 2008.",
7034
+ doi: "10.1373/clinchem.2007.100586",
7035
+ key: "caulfield-ionmobility-2008",
7036
+ url: "https://pubmed.ncbi.nlm.nih.gov/18515257/"
7037
+ },
7038
+ "contois-apoa1-1996": {
7039
+ abnt: "CONTOIS, J. H. et al. Reference intervals for plasma apolipoprotein A-1 determined with a standardized commercial immunoturbidimetric assay: results from the Framingham Offspring Study. Clinical Chemistry, v. 42, n. 4, p. 507-514, 1996.",
7040
+ doi: "10.1093/clinchem/42.4.507",
7041
+ key: "contois-apoa1-1996",
7042
+ url: "https://pubmed.ncbi.nlm.nih.gov/8605666/"
7043
+ },
7044
+ "ewgsop2-2019": {
7045
+ abnt: "CRUZ-JENTOFT, A. J. et al. Sarcopenia: revised European consensus on definition and diagnosis. Age and Ageing, v. 48, n. 1, p. 16-31, 2019.",
7046
+ doi: "10.1093/ageing/afy169",
7047
+ key: "ewgsop2-2019",
7048
+ url: "https://pubmed.ncbi.nlm.nih.gov/30312372/"
7049
+ },
7050
+ "ferreira-vitd-2017": {
7051
+ abnt: "FERREIRA, C. E. S. et al. Posicionamento oficial da Sociedade Brasileira de Patologia Cl\xEDnica/Medicina Laboratorial e da Sociedade Brasileira de Endocrinologia e Metabologia sobre intervalos de refer\xEAncia da vitamina D [25(OH)D]. Archives of Endocrinology and Metabolism, v. 61, n. 6, p. 527-542, 2017.",
7052
+ doi: "10.1590/2359-3997000000310",
7053
+ key: "ferreira-vitd-2017",
7054
+ url: "https://pubmed.ncbi.nlm.nih.gov/29412389/"
7055
+ },
7056
+ "friedewald-1972": {
7057
+ abnt: "FRIEDEWALD, W. T.; LEVY, R. I.; FREDRICKSON, D. S. Estimation of the concentration of low-density lipoprotein cholesterol in plasma, without use of the preparative ultracentrifuge. Clinical Chemistry, v. 18, n. 6, p. 499-502, 1972.",
7058
+ doi: "10.1093/clinchem/18.6.499",
7059
+ key: "friedewald-1972",
7060
+ url: "https://pubmed.ncbi.nlm.nih.gov/4337382/"
7061
+ },
7062
+ "gallagher-bodyfat-2000": {
7063
+ abnt: "GALLAGHER, D. et al. Healthy percentage body fat ranges: an approach for developing guidelines based on body mass index. American Journal of Clinical Nutrition, v. 72, n. 3, p. 694-701, 2000.",
7064
+ key: "gallagher-bodyfat-2000",
7065
+ url: "https://pubmed.ncbi.nlm.nih.gov/10966886/"
7066
+ },
7067
+ "ge-corescan": {
7068
+ abnt: "GE HEALTHCARE. enCORE Software CoreScan: Visceral Adipose Tissue (VAT) assessment. Madison: GE Medical Systems Lunar, [s. d.]. (Documenta\xE7\xE3o do fabricante do DEXA Lunar Prodigy; classifica\xE7\xE3o Healthy 0\u201352 in\xB3, Increased Risk 52,15\u2013112,10 in\xB3, At Risk 112,10+ in\xB3, equivalente a 0\u2013852 cm\xB3, 854\u20131.837 cm\xB3, 1.837+ cm\xB3.)",
7069
+ key: "ge-corescan",
7070
+ url: "https://www.gehealthcare.com/products/bone-and-metabolic-health/encore"
7071
+ },
7072
+ "geloneze-brams-2009": {
7073
+ abnt: "GELONEZE, B. et al. HOMA1-IR and HOMA2-IR indexes in identifying insulin resistance and metabolic syndrome \u2014 Brazilian Metabolic Syndrome Study (BRAMS). Arquivos Brasileiros de Endocrinologia & Metabologia, v. 53, n. 2, p. 281-287, 2009.",
7074
+ doi: "10.1590/S0004-27302009000200020",
7075
+ key: "geloneze-brams-2009",
7076
+ url: "https://pubmed.ncbi.nlm.nih.gov/19466221/"
7077
+ },
7078
+ "george-ck-2016": {
7079
+ abnt: "GEORGE, M. D.; MCGILL, N. K.; BAKER, J. F. Creatine kinase in the U.S. population: impact of demographics, comorbidities, and body composition on the normal range. Medicine, v. 95, n. 33, e4344, 2016.",
7080
+ doi: "10.1097/MD.0000000000004344",
7081
+ key: "george-ck-2016",
7082
+ url: "https://pubmed.ncbi.nlm.nih.gov/27537560/"
7083
+ },
7084
+ "giannitsis-hstnt-2010": {
7085
+ abnt: "GIANNITSIS, E. et al. Analytical validation of a high-sensitivity cardiac troponin T assay. Clinical Chemistry, v. 56, n. 2, p. 254-261, 2010.",
7086
+ doi: "10.1373/clinchem.2009.132654",
7087
+ key: "giannitsis-hstnt-2010",
7088
+ url: "https://pubmed.ncbi.nlm.nih.gov/19959623/"
7089
+ },
7090
+ "glis-2024": {
7091
+ abnt: "KIRK, B. et al. The conceptual definition of sarcopenia: Delphi consensus from the Global Leadership Initiative in Sarcopenia (GLIS). Age and Ageing, v. 53, n. 3, afae052, 2024.",
7092
+ doi: "10.1093/ageing/afae052",
7093
+ key: "glis-2024",
7094
+ url: "https://pubmed.ncbi.nlm.nih.gov/38520141/"
7095
+ },
7096
+ // ---------------------------------------------------------------------------
7097
+ // Fontes internacionais — Ácidos graxos ômega
7098
+ // ---------------------------------------------------------------------------
7099
+ "harris-omega3-2004": {
7100
+ abnt: "HARRIS, W. S.; VON SCHACKY, C. The Omega-3 Index: a new risk factor for death from coronary heart disease? Preventive Medicine, v. 39, n. 1, p. 212-220, 2004.",
7101
+ doi: "10.1016/j.ypmed.2004.02.030",
7102
+ key: "harris-omega3-2004",
7103
+ url: "https://pubmed.ncbi.nlm.nih.gov/15208005/"
7104
+ },
7105
+ // ---------------------------------------------------------------------------
7106
+ // Referência laboratorial geral
7107
+ // ---------------------------------------------------------------------------
7108
+ "kalaria-ck-ri-2026": {
7109
+ abnt: "KALARIA, T. et al. Age, sex and ethnicity changes in creatine kinase and sex- and ethnicity-specific reference intervals of creatine kinase. Clinical Medicine, v. 26, n. 4, p. 100596, 2026.",
7110
+ doi: "10.1016/j.clinme.2026.100596",
7111
+ key: "kalaria-ck-ri-2026",
7112
+ url: "https://pubmed.ncbi.nlm.nih.gov/42142664/"
7113
+ },
7114
+ // ---------------------------------------------------------------------------
7115
+ // Fontes internacionais — Nefrologia
7116
+ // ---------------------------------------------------------------------------
7117
+ "kdigo-ckd-2024": {
7118
+ abnt: "KIDNEY DISEASE: IMPROVING GLOBAL OUTCOMES (KDIGO) CKD Work Group. KDIGO 2024 Clinical Practice Guideline for the Evaluation and Management of Chronic Kidney Disease. Kidney International, v. 105, n. 4S, p. S117-S314, 2024.",
7119
+ doi: "10.1016/j.kint.2023.10.018",
7120
+ key: "kdigo-ckd-2024",
7121
+ url: "https://pubmed.ncbi.nlm.nih.gov/38490803/"
7122
+ },
7123
+ "keller-tni-2013": {
7124
+ abnt: "KELLER, T. et al. Defining a reference population to determine the 99th percentile of a contemporary sensitive cardiac troponin I assay. International Journal of Cardiology, v. 167, n. 4, p. 1423-1429, 2013.",
7125
+ doi: "10.1016/j.ijcard.2012.04.063",
7126
+ key: "keller-tni-2013",
7127
+ url: "https://pubmed.ncbi.nlm.nih.gov/22560907/"
7128
+ },
7129
+ "kelly-dxa-2009": {
7130
+ abnt: "KELLY, T. L. et al. Dual energy X-ray absorptiometry body composition reference values from NHANES. PLoS One, v. 4, n. 9, e7038, 2009.",
7131
+ doi: "10.1371/journal.pone.0007038",
7132
+ key: "kelly-dxa-2009",
7133
+ url: "https://pubmed.ncbi.nlm.nih.gov/19753111/"
7134
+ },
7135
+ "khetarpal-apociii-2016": {
7136
+ abnt: "KHETARPAL, S. A. et al. Why is apolipoprotein CIII emerging as a novel therapeutic target to reduce the burden of cardiovascular disease? Current Atherosclerosis Reports, v. 18, n. 10, p. 59, 2016.",
7137
+ key: "khetarpal-apociii-2016",
7138
+ url: "https://pmc.ncbi.nlm.nih.gov/articles/PMC5018018/"
7139
+ },
7140
+ "klee-bhb-2020": {
7141
+ abnt: "KLEE, P. et al. Test validation, method comparison and reference range for the measurement of \u03B2-hydroxybutyrate in peripheral blood samples. Practical Laboratory Medicine, v. 18, e00146, 2020.",
7142
+ doi: "10.1016/j.plabm.2019.e00146",
7143
+ key: "klee-bhb-2020",
7144
+ url: "https://pmc.ncbi.nlm.nih.gov/articles/PMC6999181/"
7145
+ },
7146
+ "maisel-bnp-2002": {
7147
+ abnt: "MAISEL, A. S. et al. Rapid measurement of B-type natriuretic peptide in the emergency diagnosis of heart failure. New England Journal of Medicine, v. 347, n. 3, p. 161-167, 2002.",
7148
+ doi: "10.1056/NEJMoa020233",
7149
+ key: "maisel-bnp-2002",
7150
+ url: "https://pubmed.ncbi.nlm.nih.gov/12124404/"
7151
+ },
7152
+ "meuwese-mpo-2007": {
7153
+ abnt: "MEUWESE, M. C. et al. Serum myeloperoxidase levels are associated with the future risk of coronary artery disease in apparently healthy individuals: the EPIC-Norfolk Prospective Population Study. Journal of the American College of Cardiology, v. 50, n. 2, p. 159-165, 2007.",
7154
+ doi: "10.1016/j.jacc.2007.03.033",
7155
+ key: "meuwese-mpo-2007",
7156
+ url: "https://pubmed.ncbi.nlm.nih.gov/17616301/"
7157
+ },
7158
+ // ---------------------------------------------------------------------------
7159
+ // Fontes internacionais — Marcadores metabólicos e inflamatórios
7160
+ // ---------------------------------------------------------------------------
7161
+ "nemeth-adma-2017": {
7162
+ abnt: "NEMETH, B. et al. The issue of plasma asymmetric dimethylarginine reference range: a systematic review and meta-analysis. PLoS One, v. 12, n. 5, e0177493, 2017.",
7163
+ doi: "10.1371/journal.pone.0177493",
7164
+ key: "nemeth-adma-2017",
7165
+ url: "https://pubmed.ncbi.nlm.nih.gov/28494019/"
7166
+ },
7167
+ // ---------------------------------------------------------------------------
7168
+ // Fontes brasileiras — Metais pesados (NR-7)
7169
+ // ---------------------------------------------------------------------------
7170
+ "nr7-pcmso-2020": {
7171
+ abnt: "BRASIL. Minist\xE9rio do Trabalho e Emprego. NR-7 \u2014 PCMSO, Quadro 1: Indicadores biol\xF3gicos. Portaria n. 6.734, de 9 de mar\xE7o de 2020. Di\xE1rio Oficial da Uni\xE3o, Bras\xEDlia, 13 mar. 2020.",
7172
+ key: "nr7-pcmso-2020",
7173
+ url: "https://www.gov.br/trabalho-e-emprego/pt-br/assuntos/inspecao-do-trabalho/seguranca-e-saude-no-trabalho/sst-portarias/2022/portaria-no-567-de-10-de-marco-de-2022-alteracoes-na-nr-7.pdf"
7174
+ },
7175
+ "ofenheimer-vat-2020": {
7176
+ abnt: "OFENHEIMER, A. et al. Reference values of body composition parameters and visceral adipose tissue (VAT) by DXA in adults aged 18-81 years: results from the LEAD cohort. European Journal of Clinical Nutrition, v. 74, p. 1181-1191, 2020.",
7177
+ doi: "10.1038/s41430-020-0596-5",
7178
+ key: "ofenheimer-vat-2020",
7179
+ url: "https://pubmed.ncbi.nlm.nih.gov/32123345/"
7180
+ },
7181
+ "pns-bioquimica-2019": {
7182
+ abnt: "SZWARCWALD, C. L. et al. Valores de refer\xEAncia para exames laboratoriais de colesterol, hemoglobina glicosilada e creatinina da popula\xE7\xE3o adulta brasileira. Revista Brasileira de Epidemiologia, v. 22, supl. 2, e190002.supl.2, 2019.",
7183
+ doi: "10.1590/1980-549720190002.supl.2",
7184
+ key: "pns-bioquimica-2019",
7185
+ url: "https://pubmed.ncbi.nlm.nih.gov/31596373/"
7186
+ },
7187
+ // ---------------------------------------------------------------------------
7188
+ // Pesquisa Nacional de Saúde (PNS) — Intervalos de referência brasileiros
7189
+ // ---------------------------------------------------------------------------
7190
+ "pns-hemograma-2019": {
7191
+ abnt: "ROSENFELD, L. G. et al. Valores de refer\xEAncia para exames laboratoriais de hemograma da popula\xE7\xE3o adulta brasileira: Pesquisa Nacional de Sa\xFAde. Revista Brasileira de Epidemiologia, v. 22, supl. 2, e190003.supl.2, 2019.",
7192
+ doi: "10.1590/1980-549720190003.supl.2",
7193
+ key: "pns-hemograma-2019",
7194
+ url: "https://pubmed.ncbi.nlm.nih.gov/31596374/"
7195
+ },
7196
+ "pns-renal-2019": {
7197
+ abnt: "MALTA, D. C. et al. Evaluation of renal function in the Brazilian adult population, according to laboratory criteria from the National Health Survey. Revista Brasileira de Epidemiologia, v. 22, supl. 2, e190010.supl.2, 2019.",
7198
+ doi: "10.1590/1980-549720190010.supl.2",
7199
+ key: "pns-renal-2019",
7200
+ url: "https://pubmed.ncbi.nlm.nih.gov/31596381/"
7201
+ },
7202
+ "rumberger-cac-1999": {
7203
+ abnt: "RUMBERGER, J. A. et al. Electron beam computed tomographic coronary calcium scanning: a review and guidelines for use in asymptomatic persons. Mayo Clinic Proceedings, v. 74, n. 3, p. 243-252, 1999.",
7204
+ doi: "10.4065/74.3.243",
7205
+ key: "rumberger-cac-1999",
7206
+ url: "https://pubmed.ncbi.nlm.nih.gov/10089993/"
7207
+ },
7208
+ "sbc-ic-2018": {
7209
+ abnt: "ROHDE, L. E. P. et al. Diretriz Brasileira de Insufici\xEAncia Card\xEDaca Cr\xF4nica e Aguda. Arquivos Brasileiros de Cardiologia, S\xE3o Paulo, v. 111, n. 3, p. 436-539, set. 2018.",
7210
+ doi: "10.5935/abc.20180190",
7211
+ key: "sbc-ic-2018",
7212
+ url: "https://pubmed.ncbi.nlm.nih.gov/30379264/"
7213
+ },
7214
+ // ---------------------------------------------------------------------------
7215
+ // Sociedade Brasileira de Cardiologia
7216
+ // ---------------------------------------------------------------------------
7217
+ "sbc-lipids-2017": {
7218
+ abnt: "FALUDI, A. A. et al. Atualiza\xE7\xE3o da Diretriz Brasileira de Dislipidemias e Preven\xE7\xE3o da Aterosclerose \u2013 2017. Arquivos Brasileiros de Cardiologia, S\xE3o Paulo, v. 109, n. 2, supl. 1, p. 1-76, ago. 2017.",
7219
+ doi: "10.5935/abc.20170121",
7220
+ key: "sbc-lipids-2017",
7221
+ url: "https://www.scielo.br/j/abc/a/whBsCyzTDzGYJcsBY7YVkWn/?lang=pt"
7222
+ },
7223
+ "sbc-lipids-2025": {
7224
+ abnt: "RACHED, F. H. et al. Diretriz Brasileira de Dislipidemias e Preven\xE7\xE3o da Aterosclerose \u2013 2025. Arquivos Brasileiros de Cardiologia, S\xE3o Paulo, v. 122, n. 9, e20250640, out. 2025.",
7225
+ doi: "10.36660/abc.20250640",
7226
+ key: "sbc-lipids-2025",
7227
+ url: "https://pmc.ncbi.nlm.nih.gov/articles/PMC12674852/"
7228
+ },
7229
+ // ---------------------------------------------------------------------------
7230
+ // Sociedade Brasileira de Diabetes
7231
+ // ---------------------------------------------------------------------------
7232
+ "sbd-diabetes-2024": {
7233
+ // Chave mantida como 'sbd-diabetes-2024' para compatibilidade com
7234
+ // consumidores publicados; a diretriz correspondente é o documento vivo
7235
+ // de diretriz.diabetes.org.br, cuja edição citada quando este registro foi
7236
+ // atualizado é "Edição 2025". Semelhante ao caso de sbpc-ml-2021 abaixo.
7237
+ abnt: "SOCIEDADE BRASILEIRA DE DIABETES (SBD). Diretriz da Sociedade Brasileira de Diabetes \u2014 Edi\xE7\xE3o 2025. S\xE3o Paulo: SBD, 2025.",
7238
+ doi: "10.29327/5660187",
7239
+ isbn: "978-65-272-1932-3",
7240
+ key: "sbd-diabetes-2024",
7241
+ url: "https://diretriz.diabetes.org.br"
7242
+ },
7243
+ // ---------------------------------------------------------------------------
7244
+ // Sociedade Brasileira de Endocrinologia e Metabologia
7245
+ // ---------------------------------------------------------------------------
7246
+ "sbem-thyroid-2013": {
7247
+ abnt: "SGARBI, J. A. et al. Consenso brasileiro para a abordagem cl\xEDnica e tratamento do hipotireoidismo subcl\xEDnico em adultos. Arquivos Brasileiros de Endocrinologia & Metabologia, v. 57, n. 3, p. 166-183, 2013.",
7248
+ doi: "10.1590/S0004-27302013000300003",
7249
+ key: "sbem-thyroid-2013",
7250
+ url: "https://pubmed.ncbi.nlm.nih.gov/23681263/"
7251
+ },
7252
+ "sbem-vitamind-2014": {
7253
+ abnt: "MAEDA, S. S. et al. Recomenda\xE7\xF5es da Sociedade Brasileira de Endocrinologia e Metabologia (SBEM) para o diagn\xF3stico e tratamento da hipovitaminose D. Arquivos Brasileiros de Endocrinologia & Metabologia, v. 58, n. 5, p. 411-433, 2014.",
7254
+ doi: "10.1590/0004-2730000003388",
7255
+ key: "sbem-vitamind-2014",
7256
+ url: "https://pubmed.ncbi.nlm.nih.gov/25166032/"
7257
+ },
7258
+ // ---------------------------------------------------------------------------
7259
+ // Sociedade Brasileira de Patologia Clínica / Medicina Laboratorial
7260
+ // ---------------------------------------------------------------------------
7261
+ "sbpc-ml-2021": {
7262
+ // Chave mantida como 'sbpc-ml-2021' para compatibilidade com consumidores;
7263
+ // a edição autoritativa é de 2020 (verificada na Biblioteca Digital SBPC/ML
7264
+ // em 2026-04-18). Ano na citação ABNT reflete a edição real.
7265
+ abnt: "SOCIEDADE BRASILEIRA DE PATOLOGIA CL\xCDNICA/MEDICINA LABORATORIAL (SBPC/ML). Recomenda\xE7\xF5es da Sociedade Brasileira de Patologia Cl\xEDnica/Medicina Laboratorial (SBPC/ML): Boas Pr\xE1ticas em Laborat\xF3rio Cl\xEDnico. S\xE3o Paulo: SBPC/ML, 2020.",
7266
+ key: "sbpc-ml-2021",
7267
+ url: "https://bibliotecasbpc.org.br/index.php?P=4&C=0.2.443"
7268
+ },
7269
+ "schumann-ifcc-ldh-2002": {
7270
+ abnt: "SCHUMANN, G.; KLAUKE, R. New IFCC reference procedures for the determination of catalytic activity concentrations of five enzymes in serum: preliminary upper reference limits obtained in hospitalized subjects. Clinica Chimica Acta, v. 327, n. 1-2, p. 69-79, 2003.",
7271
+ doi: "10.1016/S0009-8981(02)00341-8",
7272
+ key: "schumann-ifcc-ldh-2002",
7273
+ url: "https://pubmed.ncbi.nlm.nih.gov/12482620/"
7274
+ },
7275
+ "schwedhelm-sdma-2011": {
7276
+ abnt: "SCHWEDHELM, E. et al. Plasma symmetric dimethylarginine reference limits from the Framingham Offspring Cohort. Clinical Chemistry and Laboratory Medicine, v. 49, n. 11, p. 1907-1910, 2011.",
7277
+ doi: "10.1515/CCLM.2011.679",
7278
+ key: "schwedhelm-sdma-2011",
7279
+ url: "https://pubmed.ncbi.nlm.nih.gov/21864208/"
7280
+ },
7281
+ "selhub-homocysteine-1999": {
7282
+ abnt: "SELHUB, J. et al. Serum total homocysteine concentrations in the third National Health and Nutrition Examination Survey (1991-1994): population reference ranges and contribution of vitamin status to high serum concentrations. Annals of Internal Medicine, v. 131, n. 5, p. 331-339, 1999.",
7283
+ doi: "10.7326/0003-4819-131-5-199909070-00003",
7284
+ key: "selhub-homocysteine-1999",
7285
+ url: "https://pubmed.ncbi.nlm.nih.gov/10475885/"
7286
+ },
7287
+ "simopoulos-omega-ratio-2002": {
7288
+ abnt: "SIMOPOULOS, A. P. The importance of the ratio of omega-6/omega-3 essential fatty acids. Biomedicine & Pharmacotherapy, v. 56, n. 8, p. 365-379, 2002.",
7289
+ doi: "10.1016/S0753-3322(02)00253-6",
7290
+ key: "simopoulos-omega-ratio-2002",
7291
+ url: "https://pubmed.ncbi.nlm.nih.gov/12442909/"
7292
+ },
7293
+ // ---------------------------------------------------------------------------
7294
+ // Fontes internacionais — Marcadores tumorais
7295
+ // ---------------------------------------------------------------------------
7296
+ "sturgeon-nacb-2008": {
7297
+ abnt: "STURGEON, C. M. et al. National Academy of Clinical Biochemistry Laboratory Medicine Practice Guidelines for use of tumor markers in testicular, prostate, colorectal, breast, and ovarian cancers. Clinical Chemistry, v. 54, n. 12, p. e11-e79, 2008.",
7298
+ doi: "10.1373/clinchem.2008.105601",
7299
+ key: "sturgeon-nacb-2008",
7300
+ url: "https://pubmed.ncbi.nlm.nih.gov/19042984/"
7301
+ },
7302
+ "tietz-7ed-2015": {
7303
+ abnt: "BURTIS, C. A.; BRUNS, D. E. Tietz Fundamentals of Clinical Chemistry and Molecular Diagnostics. 7. ed. St. Louis: Elsevier Saunders, 2015.",
7304
+ isbn: "978-1-4557-4165-6",
7305
+ key: "tietz-7ed-2015"
7306
+ },
7307
+ "torrissen-omega3-dbs-2025": {
7308
+ abnt: "TORRISSEN, M. et al. Global variations in omega-3 fatty acid status and omega-6:omega-3 ratios: insights from > 500,000 whole-blood dried blood spot samples. Lipids in Health and Disease, v. 24, n. 1, p. 260, 2025.",
7309
+ doi: "10.1186/s12944-025-02676-6",
7310
+ key: "torrissen-omega3-dbs-2025",
7311
+ url: "https://pubmed.ncbi.nlm.nih.gov/40783537/"
7312
+ },
7313
+ // ---------------------------------------------------------------------------
7314
+ // Fontes internacionais — Coagulação
7315
+ // ---------------------------------------------------------------------------
7316
+ "wells-ddimer-2003": {
7317
+ abnt: "WELLS, P. S. et al. Evaluation of D-dimer in the diagnosis of suspected deep-vein thrombosis. New England Journal of Medicine, v. 349, p. 1227-1235, 2003.",
7318
+ doi: "10.1056/NEJMoa023153",
7319
+ key: "wells-ddimer-2003",
7320
+ url: "https://pubmed.ncbi.nlm.nih.gov/14507948/"
7321
+ },
7322
+ // ---------------------------------------------------------------------------
7323
+ // Fontes internacionais — OMS
7324
+ // ---------------------------------------------------------------------------
7325
+ "who-iron-2020": {
7326
+ abnt: "WORLD HEALTH ORGANIZATION. WHO guideline on use of ferritin concentrations to assess iron status in individuals and populations. Geneva: WHO, 2020.",
7327
+ isbn: "978-92-4-000012-4",
7328
+ key: "who-iron-2020",
7329
+ url: "https://www.who.int/publications/i/item/9789240000124"
7330
+ },
7331
+ "who-obesity-2000": {
7332
+ abnt: "WORLD HEALTH ORGANIZATION. Obesity: preventing and managing the global epidemic. WHO Technical Report Series, n. 894. Geneva: WHO, 2000.",
7333
+ isbn: "92-4-120894-5",
7334
+ key: "who-obesity-2000"
7335
+ },
7336
+ "who-osteoporosis-1994": {
7337
+ abnt: "WHO STUDY GROUP. Assessment of fracture risk and its application to screening for postmenopausal osteoporosis. WHO Technical Report Series, n. 843. Geneva: WHO, 1994.",
7338
+ key: "who-osteoporosis-1994",
7339
+ url: "https://pubmed.ncbi.nlm.nih.gov/7941614/"
7340
+ }
7341
+ };
7342
+ function extractSourceKey(source2) {
7343
+ return source2.split(":")[0] ?? source2;
7344
+ }
7345
+
7346
+ // src/cli/commands/source.ts
7347
+ function render(ref) {
7348
+ const linhas = [`Fonte: ${ref.key}`, "", ref.abnt];
7349
+ if (ref.doi) linhas.push("", `DOI: ${ref.doi}`);
7350
+ if (ref.isbn) linhas.push(`ISBN: ${ref.isbn}`);
7351
+ if (ref.url) linhas.push(`URL: ${ref.url}`);
7352
+ return linhas.join("\n");
7353
+ }
7354
+ async function source(args, json) {
7355
+ const { positionals, values } = parseArgs3({
7356
+ allowPositionals: true,
7357
+ args,
7358
+ options: { biomarker: { short: "b", type: "string" } },
7359
+ strict: false
7360
+ });
7361
+ if (values.biomarker) {
7362
+ const code = values.biomarker;
7363
+ if (!getDefinitionByCode(code)) exitWithError(`Biomarcador n\xE3o encontrado: ${code}`);
7364
+ const def = biomarkerRangeDefinitions[code];
7365
+ if (!def?.source) exitWithError(`Sem faixa de refer\xEAncia com fonte para: ${code}`);
7366
+ const chave2 = extractSourceKey(def.source);
7367
+ const ref2 = SOURCE_REGISTRY[chave2];
7368
+ if (!ref2) exitWithError(`Fonte n\xE3o encontrada no registro: ${chave2}`);
7369
+ if (json) outputJson(ref2);
7370
+ else outputText(render(ref2));
7371
+ return;
7372
+ }
7373
+ const chave = positionals[0];
7374
+ if (!chave) {
7375
+ const todas = Object.values(SOURCE_REGISTRY).sort((a, b) => a.key.localeCompare(b.key));
7376
+ if (json) {
7377
+ outputJson(todas);
7378
+ return;
7379
+ }
7380
+ outputText(
7381
+ [
7382
+ `Fontes no registro: ${todas.length}`,
7383
+ "",
7384
+ ...todas.map((r) => ` ${r.key.padEnd(28)} ${r.abnt.slice(0, 60)}\u2026`),
7385
+ "",
7386
+ "Detalhe de uma: fhir-bio source <chave>",
7387
+ "A partir do exame: fhir-bio source --biomarker TSH"
7388
+ ].join("\n")
7389
+ );
7390
+ return;
7391
+ }
7392
+ const limpa = extractSourceKey(chave);
7393
+ const ref = SOURCE_REGISTRY[limpa];
7394
+ if (!ref) {
7395
+ const alvo = limpa === chave ? chave : `${chave} (procurado como ${limpa})`;
7396
+ exitWithError(`Fonte n\xE3o encontrada: ${alvo}
7397
+ Veja a lista com: fhir-bio source`);
7398
+ }
7399
+ if (json) outputJson(ref);
7400
+ else outputText(render(ref));
7401
+ }
7402
+
6768
7403
  // src/cli/commands/units.ts
6769
7404
  async function units(args, json) {
6770
7405
  const code = args[0];
@@ -6824,6 +7459,7 @@ Comandos:
6824
7459
  list Listar todos os biomarcadores
6825
7460
  categories Listar biomarcadores agrupados por categoria
6826
7461
  range <c\xF3digo> Faixa de refer\xEAncia para um biomarcador
7462
+ source [chave] Cita\xE7\xE3o de uma fonte, ou a lista toda
6827
7463
  units <c\xF3digo> Informa\xE7\xF5es de unidade de um biomarcador
6828
7464
  convert <arquivo> Converter dados lab (JSON) para FHIR Bundle
6829
7465
  validate <arquivo> Validar recurso FHIR (Bundle, Observation ou DiagnosticReport)
@@ -6844,26 +7480,18 @@ var COMMANDS = {
6844
7480
  lookup,
6845
7481
  "lookup-loinc": lookupLoinc,
6846
7482
  range,
7483
+ source,
6847
7484
  units,
6848
7485
  validate
6849
7486
  };
6850
7487
  async function main() {
6851
- const { positionals, values } = parseArgs3({
6852
- allowPositionals: true,
6853
- options: {
6854
- help: { default: false, short: "h", type: "boolean" },
6855
- json: { default: false, type: "boolean" },
6856
- version: { default: false, short: "v", type: "boolean" }
6857
- },
6858
- strict: false
6859
- });
6860
- if (values.version) {
6861
- process.stdout.write(`${"0.31.6"}
7488
+ const { command, help, json, resto, version } = dividirArgv(process.argv.slice(2));
7489
+ if (version) {
7490
+ process.stdout.write(`${"0.33.0"}
6862
7491
  `);
6863
7492
  return;
6864
7493
  }
6865
- const [command, ...rest] = positionals;
6866
- if (values.help || !command) {
7494
+ if (help || !command) {
6867
7495
  process.stdout.write(HELP);
6868
7496
  return;
6869
7497
  }
@@ -6872,6 +7500,6 @@ async function main() {
6872
7500
  exitWithError(`Comando desconhecido: ${command}
6873
7501
  Use --help para ver os comandos dispon\xEDveis.`);
6874
7502
  }
6875
- await handler(rest, Boolean(values.json));
7503
+ await handler(resto, json);
6876
7504
  }
6877
7505
  main().catch((err) => exitWithError(err.message));