@precisa-saude/fhir 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +85 -0
  2. package/dist/biomarkers.cjs +67 -0
  3. package/dist/biomarkers.cjs.map +1 -0
  4. package/dist/biomarkers.d.cts +226 -0
  5. package/dist/biomarkers.d.ts +226 -0
  6. package/dist/biomarkers.js +67 -0
  7. package/dist/biomarkers.js.map +1 -0
  8. package/dist/chunk-2EVQ2ESB.cjs +2692 -0
  9. package/dist/chunk-2EVQ2ESB.cjs.map +1 -0
  10. package/dist/chunk-2X6MT5KE.cjs +1464 -0
  11. package/dist/chunk-2X6MT5KE.cjs.map +1 -0
  12. package/dist/chunk-3ILBFLVQ.cjs +63 -0
  13. package/dist/chunk-3ILBFLVQ.cjs.map +1 -0
  14. package/dist/chunk-FDOBUUGY.js +1464 -0
  15. package/dist/chunk-FDOBUUGY.js.map +1 -0
  16. package/dist/chunk-GFXKYXHW.cjs +436 -0
  17. package/dist/chunk-GFXKYXHW.cjs.map +1 -0
  18. package/dist/chunk-I6H35QXI.js +2692 -0
  19. package/dist/chunk-I6H35QXI.js.map +1 -0
  20. package/dist/chunk-N3ZCOLG2.js +63 -0
  21. package/dist/chunk-N3ZCOLG2.js.map +1 -0
  22. package/dist/chunk-O25F6G3K.cjs +153 -0
  23. package/dist/chunk-O25F6G3K.cjs.map +1 -0
  24. package/dist/chunk-S6VJHXJF.js +153 -0
  25. package/dist/chunk-S6VJHXJF.js.map +1 -0
  26. package/dist/chunk-UIDSSWBJ.js +251 -0
  27. package/dist/chunk-UIDSSWBJ.js.map +1 -0
  28. package/dist/chunk-VPMT4MRS.js +436 -0
  29. package/dist/chunk-VPMT4MRS.js.map +1 -0
  30. package/dist/chunk-Z6YE6FJ4.cjs +251 -0
  31. package/dist/chunk-Z6YE6FJ4.cjs.map +1 -0
  32. package/dist/converter-C-QpCcTL.d.ts +99 -0
  33. package/dist/converter-Dee-qjBV.d.cts +99 -0
  34. package/dist/converter.cjs +15 -0
  35. package/dist/converter.cjs.map +1 -0
  36. package/dist/converter.d.cts +2 -0
  37. package/dist/converter.d.ts +2 -0
  38. package/dist/converter.js +15 -0
  39. package/dist/converter.js.map +1 -0
  40. package/dist/fhir-types-D9hUzGrc.d.cts +129 -0
  41. package/dist/fhir-types-D9hUzGrc.d.ts +129 -0
  42. package/dist/importer.cjs +17 -0
  43. package/dist/importer.cjs.map +1 -0
  44. package/dist/importer.d.cts +60 -0
  45. package/dist/importer.d.ts +60 -0
  46. package/dist/importer.js +17 -0
  47. package/dist/importer.js.map +1 -0
  48. package/dist/index.cjs +540 -0
  49. package/dist/index.cjs.map +1 -0
  50. package/dist/index.d.cts +163 -0
  51. package/dist/index.d.ts +163 -0
  52. package/dist/index.js +540 -0
  53. package/dist/index.js.map +1 -0
  54. package/dist/reference-ranges.cjs +18 -0
  55. package/dist/reference-ranges.cjs.map +1 -0
  56. package/dist/reference-ranges.d.cts +106 -0
  57. package/dist/reference-ranges.d.ts +106 -0
  58. package/dist/reference-ranges.js +18 -0
  59. package/dist/reference-ranges.js.map +1 -0
  60. package/dist/units.cjs +19 -0
  61. package/dist/units.cjs.map +1 -0
  62. package/dist/units.d.cts +46 -0
  63. package/dist/units.d.ts +46 -0
  64. package/dist/units.js +19 -0
  65. package/dist/units.js.map +1 -0
  66. package/dist/validators.cjs +11 -0
  67. package/dist/validators.cjs.map +1 -0
  68. package/dist/validators.d.cts +23 -0
  69. package/dist/validators.d.ts +23 -0
  70. package/dist/validators.js +11 -0
  71. package/dist/validators.js.map +1 -0
  72. package/package.json +105 -0
@@ -0,0 +1,163 @@
1
+ import { I as InterventionData, U as UserProfileData } from './converter-Dee-qjBV.cjs';
2
+ export { F as Flag, G as Gender, L as LabObservationData, a as LabReportData, O as OverallStatus, l as labObservationToFHIR, b as labReportToFHIR, c as labResultToFHIRBundle, u as userProfileToFHIR } from './converter-Dee-qjBV.cjs';
3
+ export { BIOMARKER_DEFINITIONS, BiomarkerDefinition, BiomarkerSearchPattern, CAC_INDICATOR_CODES, DEXA_CATEGORIES, DEXA_INDICATOR_CODES, SupportedBiomarker, codeToLoinc, filterVisibleBiomarkers, findCodeByName, generateCacFullReference, generateDexaFullReference, generateFilteredLLMReference, generateLLMReference, getAllCodes, getAllDefinitions, getAllLoincCodes, getAllSearchPatterns, getBiomarkersByCategory, getBiomarkersForCategories, getDefinitionByCode, getDefinitionByLoinc, getDefinitionsBySex, getSexForCode, getVisibleDefinitions, isBiomarkerVisible, isCacDocument, isDexaDocument, isValidCode, isValidLoinc, loincToCode, normalizeCode, toBiomarkerTests, validateLoincNameMatch } from './biomarkers.cjs';
4
+ export { BIOMARKER_DEFAULT_UNIT, BIOMARKER_UNITS, BiomarkerUnitConfig, UNIT_TO_UCUM, getCanonicalUnit, getDefaultUnit, getSIUnit, unitToUCUM } from './units.cjs';
5
+ import { F as FHIRMedicationStatement, a as FHIRObservation, b as FHIRBundle } from './fhir-types-D9hUzGrc.cjs';
6
+ export { c as FHIRAddress, d as FHIRAnnotation, e as FHIRAttachment, f as FHIRBundleEntry, g as FHIRCodeableConcept, h as FHIRCoding, i as FHIRContactPoint, j as FHIRDiagnosticReport, k as FHIRHumanName, l as FHIRPatient, m as FHIRPeriod, n as FHIRQuantity, o as FHIRReference, p as FHIRReferenceRange } from './fhir-types-D9hUzGrc.cjs';
7
+ export { FHIRImportResult, ImportError, ImportedObservation, MAX_FILE_SIZE, MAX_OBSERVATIONS, SkippedEntry, extractObservationsFromBundle, mapFHIRObservationToInternal, processImportBundle } from './importer.cjs';
8
+ export { validateFHIRDiagnosticReport, validateFHIRImportBundle, validateFHIRObservation } from './validators.cjs';
9
+ export { BiomarkerRangeDefinition, BiomarkerReferenceRange, RangeDirection, RangeVariant, ReferenceRangeContext, SexKey, applyFallbackReferenceRanges, biomarkerRangeDefinitions, defaultReferenceRanges, getFallbackReferenceRange, getRangeDirection, getReferenceRange } from './reference-ranges.cjs';
10
+
11
+ /**
12
+ * FHIR Intervention Converter
13
+ *
14
+ * Converts interventions (medication, supplement, diet, exercise, sleep)
15
+ * to FHIR R4 MedicationStatement and Observation resources.
16
+ */
17
+
18
+ /**
19
+ * Convert medication/supplement intervention to FHIR MedicationStatement
20
+ */
21
+ declare function interventionToFHIRMedicationStatement(intervention: InterventionData, patientId: string): FHIRMedicationStatement;
22
+ /**
23
+ * Convert diet/exercise/sleep intervention to FHIR Observation (social-history)
24
+ */
25
+ declare function interventionToFHIRObservation(intervention: InterventionData, patientId: string): FHIRObservation;
26
+ /**
27
+ * Convert all interventions to a FHIR Bundle
28
+ */
29
+ declare function interventionsToFHIRBundle(interventions: InterventionData[], userProfile: UserProfileData): FHIRBundle;
30
+
31
+ /**
32
+ * Structured zone data for DEXA body composition and bone density charts.
33
+ *
34
+ * Body fat zones derived from Gallagher et al. Am J Clin Nutr 2000;72:694-701 (PMID: 10966886)
35
+ * and ACSM Guidelines for Exercise Testing, 11th Ed (2021).
36
+ *
37
+ * T-Score zones from WHO criteria (Kanis JA, Osteoporos Int, PMID: 7696835).
38
+ */
39
+ interface BodyFatZone {
40
+ ageMax: number;
41
+ ageMin: number;
42
+ color: string;
43
+ fatPctMax: number;
44
+ fatPctMin: number;
45
+ label: string;
46
+ sex: 'F' | 'M';
47
+ }
48
+ interface AgeBracket {
49
+ ageMax: number;
50
+ ageMin: number;
51
+ label: string;
52
+ }
53
+ declare const AGE_BRACKETS: AgeBracket[];
54
+ interface ZoneDefinition {
55
+ color: string;
56
+ label: string;
57
+ }
58
+ declare const ZONE_DEFS: ZoneDefinition[];
59
+ declare const BODY_FAT_ZONES: BodyFatZone[];
60
+
61
+ interface TScoreZone {
62
+ color: string;
63
+ label: string;
64
+ max: number;
65
+ min: number;
66
+ }
67
+ declare const T_SCORE_ZONES: TScoreZone[];
68
+
69
+ /**
70
+ * Screening Intervals Configuration
71
+ *
72
+ * Defines recommended screening intervals for different biomarker categories
73
+ * based on clinical guidelines and best practices.
74
+ */
75
+ /**
76
+ * Screening interval in months
77
+ */
78
+ type ScreeningIntervalMonths = 3 | 6 | 12;
79
+ /**
80
+ * Biomarker category with its recommended screening interval
81
+ */
82
+ interface CategoryScreeningInterval {
83
+ category: string;
84
+ intervalMonths: ScreeningIntervalMonths;
85
+ nameEn: string;
86
+ namePt: string;
87
+ }
88
+ /**
89
+ * Screening interval configuration for each category
90
+ *
91
+ * Categories are grouped by their recommended screening intervals:
92
+ * - 3 months: Body composition and bone density (frequently changing metrics)
93
+ * - 6 months: Metabolic panel and nutrients (moderate change rate)
94
+ * - 12 months: Standard blood panels (stable long-term markers)
95
+ */
96
+ declare const CATEGORY_SCREENING_INTERVALS: CategoryScreeningInterval[];
97
+ /**
98
+ * Get screening interval for a category
99
+ */
100
+ declare const getScreeningInterval: (category: string) => CategoryScreeningInterval | undefined;
101
+ /**
102
+ * Get all categories with a specific interval
103
+ */
104
+ declare const getCategoriesByInterval: (intervalMonths: ScreeningIntervalMonths) => CategoryScreeningInterval[];
105
+ /**
106
+ * Calculate next screening date based on last test date and category
107
+ */
108
+ declare const calculateNextScreeningDate: (lastTestDate: Date, category: string) => Date | null;
109
+ /**
110
+ * Check if a category is due for screening
111
+ */
112
+ declare const isScreeningDue: (lastTestDate: Date, category: string, referenceDate?: Date) => boolean;
113
+ /**
114
+ * Get categories that are due for screening based on last test dates
115
+ */
116
+ declare const getDueCategories: (lastTestDates: Record<string, Date>, referenceDate?: Date) => CategoryScreeningInterval[];
117
+ /**
118
+ * Get days until next screening for a category
119
+ */
120
+ declare const getDaysUntilScreening: (lastTestDate: Date, category: string, referenceDate?: Date) => number | null;
121
+
122
+ /**
123
+ * Portuguese pluralization utility using native Intl.PluralRules
124
+ * Provides automatic pluralization for common words used in the app
125
+ */
126
+ /**
127
+ * Returns the correct singular or plural form based on count
128
+ * Uses Intl.PluralRules for proper locale-aware pluralization
129
+ *
130
+ * @example
131
+ * plural(1, 'usuário') // 'usuário'
132
+ * plural(3, 'usuário') // 'usuários'
133
+ * plural(0, 'registro') // 'registros'
134
+ */
135
+ declare const plural: (count: number, word: string) => string;
136
+ /**
137
+ * Returns count with the correct singular or plural form
138
+ *
139
+ * @example
140
+ * pluralCount(1, 'usuário') // '1 usuário'
141
+ * pluralCount(3, 'usuário') // '3 usuários'
142
+ */
143
+ declare const pluralCount: (count: number, word: string) => string;
144
+ /**
145
+ * Returns the correct form for compound phrases (noun + adjective)
146
+ * Both words are pluralized together
147
+ *
148
+ * @example
149
+ * pluralPhrase(1, 'usuário', 'cadastrado') // 'usuário cadastrado'
150
+ * pluralPhrase(3, 'usuário', 'cadastrado') // 'usuários cadastrados'
151
+ * pluralPhrase(2, 'revisão', 'excluída') // 'revisões excluídas'
152
+ */
153
+ declare const pluralPhrase: (count: number, noun: string, adjective: string) => string;
154
+ /**
155
+ * Returns count with the correct compound phrase form
156
+ *
157
+ * @example
158
+ * pluralPhraseCount(1, 'usuário', 'cadastrado') // '1 usuário cadastrado'
159
+ * pluralPhraseCount(3, 'convite', 'enviado') // '3 convites enviados'
160
+ */
161
+ declare const pluralPhraseCount: (count: number, noun: string, adjective: string) => string;
162
+
163
+ export { AGE_BRACKETS, BODY_FAT_ZONES, type BodyFatZone, CATEGORY_SCREENING_INTERVALS, type CategoryScreeningInterval, FHIRBundle, FHIRMedicationStatement, FHIRObservation, InterventionData, type ScreeningIntervalMonths, type TScoreZone, T_SCORE_ZONES, UserProfileData, ZONE_DEFS, calculateNextScreeningDate, getCategoriesByInterval, getDaysUntilScreening, getDueCategories, getScreeningInterval, interventionToFHIRMedicationStatement, interventionToFHIRObservation, interventionsToFHIRBundle, isScreeningDue, plural, pluralCount, pluralPhrase, pluralPhraseCount };
@@ -0,0 +1,163 @@
1
+ import { I as InterventionData, U as UserProfileData } from './converter-C-QpCcTL.js';
2
+ export { F as Flag, G as Gender, L as LabObservationData, a as LabReportData, O as OverallStatus, l as labObservationToFHIR, b as labReportToFHIR, c as labResultToFHIRBundle, u as userProfileToFHIR } from './converter-C-QpCcTL.js';
3
+ export { BIOMARKER_DEFINITIONS, BiomarkerDefinition, BiomarkerSearchPattern, CAC_INDICATOR_CODES, DEXA_CATEGORIES, DEXA_INDICATOR_CODES, SupportedBiomarker, codeToLoinc, filterVisibleBiomarkers, findCodeByName, generateCacFullReference, generateDexaFullReference, generateFilteredLLMReference, generateLLMReference, getAllCodes, getAllDefinitions, getAllLoincCodes, getAllSearchPatterns, getBiomarkersByCategory, getBiomarkersForCategories, getDefinitionByCode, getDefinitionByLoinc, getDefinitionsBySex, getSexForCode, getVisibleDefinitions, isBiomarkerVisible, isCacDocument, isDexaDocument, isValidCode, isValidLoinc, loincToCode, normalizeCode, toBiomarkerTests, validateLoincNameMatch } from './biomarkers.js';
4
+ export { BIOMARKER_DEFAULT_UNIT, BIOMARKER_UNITS, BiomarkerUnitConfig, UNIT_TO_UCUM, getCanonicalUnit, getDefaultUnit, getSIUnit, unitToUCUM } from './units.js';
5
+ import { F as FHIRMedicationStatement, a as FHIRObservation, b as FHIRBundle } from './fhir-types-D9hUzGrc.js';
6
+ export { c as FHIRAddress, d as FHIRAnnotation, e as FHIRAttachment, f as FHIRBundleEntry, g as FHIRCodeableConcept, h as FHIRCoding, i as FHIRContactPoint, j as FHIRDiagnosticReport, k as FHIRHumanName, l as FHIRPatient, m as FHIRPeriod, n as FHIRQuantity, o as FHIRReference, p as FHIRReferenceRange } from './fhir-types-D9hUzGrc.js';
7
+ export { FHIRImportResult, ImportError, ImportedObservation, MAX_FILE_SIZE, MAX_OBSERVATIONS, SkippedEntry, extractObservationsFromBundle, mapFHIRObservationToInternal, processImportBundle } from './importer.js';
8
+ export { validateFHIRDiagnosticReport, validateFHIRImportBundle, validateFHIRObservation } from './validators.js';
9
+ export { BiomarkerRangeDefinition, BiomarkerReferenceRange, RangeDirection, RangeVariant, ReferenceRangeContext, SexKey, applyFallbackReferenceRanges, biomarkerRangeDefinitions, defaultReferenceRanges, getFallbackReferenceRange, getRangeDirection, getReferenceRange } from './reference-ranges.js';
10
+
11
+ /**
12
+ * FHIR Intervention Converter
13
+ *
14
+ * Converts interventions (medication, supplement, diet, exercise, sleep)
15
+ * to FHIR R4 MedicationStatement and Observation resources.
16
+ */
17
+
18
+ /**
19
+ * Convert medication/supplement intervention to FHIR MedicationStatement
20
+ */
21
+ declare function interventionToFHIRMedicationStatement(intervention: InterventionData, patientId: string): FHIRMedicationStatement;
22
+ /**
23
+ * Convert diet/exercise/sleep intervention to FHIR Observation (social-history)
24
+ */
25
+ declare function interventionToFHIRObservation(intervention: InterventionData, patientId: string): FHIRObservation;
26
+ /**
27
+ * Convert all interventions to a FHIR Bundle
28
+ */
29
+ declare function interventionsToFHIRBundle(interventions: InterventionData[], userProfile: UserProfileData): FHIRBundle;
30
+
31
+ /**
32
+ * Structured zone data for DEXA body composition and bone density charts.
33
+ *
34
+ * Body fat zones derived from Gallagher et al. Am J Clin Nutr 2000;72:694-701 (PMID: 10966886)
35
+ * and ACSM Guidelines for Exercise Testing, 11th Ed (2021).
36
+ *
37
+ * T-Score zones from WHO criteria (Kanis JA, Osteoporos Int, PMID: 7696835).
38
+ */
39
+ interface BodyFatZone {
40
+ ageMax: number;
41
+ ageMin: number;
42
+ color: string;
43
+ fatPctMax: number;
44
+ fatPctMin: number;
45
+ label: string;
46
+ sex: 'F' | 'M';
47
+ }
48
+ interface AgeBracket {
49
+ ageMax: number;
50
+ ageMin: number;
51
+ label: string;
52
+ }
53
+ declare const AGE_BRACKETS: AgeBracket[];
54
+ interface ZoneDefinition {
55
+ color: string;
56
+ label: string;
57
+ }
58
+ declare const ZONE_DEFS: ZoneDefinition[];
59
+ declare const BODY_FAT_ZONES: BodyFatZone[];
60
+
61
+ interface TScoreZone {
62
+ color: string;
63
+ label: string;
64
+ max: number;
65
+ min: number;
66
+ }
67
+ declare const T_SCORE_ZONES: TScoreZone[];
68
+
69
+ /**
70
+ * Screening Intervals Configuration
71
+ *
72
+ * Defines recommended screening intervals for different biomarker categories
73
+ * based on clinical guidelines and best practices.
74
+ */
75
+ /**
76
+ * Screening interval in months
77
+ */
78
+ type ScreeningIntervalMonths = 3 | 6 | 12;
79
+ /**
80
+ * Biomarker category with its recommended screening interval
81
+ */
82
+ interface CategoryScreeningInterval {
83
+ category: string;
84
+ intervalMonths: ScreeningIntervalMonths;
85
+ nameEn: string;
86
+ namePt: string;
87
+ }
88
+ /**
89
+ * Screening interval configuration for each category
90
+ *
91
+ * Categories are grouped by their recommended screening intervals:
92
+ * - 3 months: Body composition and bone density (frequently changing metrics)
93
+ * - 6 months: Metabolic panel and nutrients (moderate change rate)
94
+ * - 12 months: Standard blood panels (stable long-term markers)
95
+ */
96
+ declare const CATEGORY_SCREENING_INTERVALS: CategoryScreeningInterval[];
97
+ /**
98
+ * Get screening interval for a category
99
+ */
100
+ declare const getScreeningInterval: (category: string) => CategoryScreeningInterval | undefined;
101
+ /**
102
+ * Get all categories with a specific interval
103
+ */
104
+ declare const getCategoriesByInterval: (intervalMonths: ScreeningIntervalMonths) => CategoryScreeningInterval[];
105
+ /**
106
+ * Calculate next screening date based on last test date and category
107
+ */
108
+ declare const calculateNextScreeningDate: (lastTestDate: Date, category: string) => Date | null;
109
+ /**
110
+ * Check if a category is due for screening
111
+ */
112
+ declare const isScreeningDue: (lastTestDate: Date, category: string, referenceDate?: Date) => boolean;
113
+ /**
114
+ * Get categories that are due for screening based on last test dates
115
+ */
116
+ declare const getDueCategories: (lastTestDates: Record<string, Date>, referenceDate?: Date) => CategoryScreeningInterval[];
117
+ /**
118
+ * Get days until next screening for a category
119
+ */
120
+ declare const getDaysUntilScreening: (lastTestDate: Date, category: string, referenceDate?: Date) => number | null;
121
+
122
+ /**
123
+ * Portuguese pluralization utility using native Intl.PluralRules
124
+ * Provides automatic pluralization for common words used in the app
125
+ */
126
+ /**
127
+ * Returns the correct singular or plural form based on count
128
+ * Uses Intl.PluralRules for proper locale-aware pluralization
129
+ *
130
+ * @example
131
+ * plural(1, 'usuário') // 'usuário'
132
+ * plural(3, 'usuário') // 'usuários'
133
+ * plural(0, 'registro') // 'registros'
134
+ */
135
+ declare const plural: (count: number, word: string) => string;
136
+ /**
137
+ * Returns count with the correct singular or plural form
138
+ *
139
+ * @example
140
+ * pluralCount(1, 'usuário') // '1 usuário'
141
+ * pluralCount(3, 'usuário') // '3 usuários'
142
+ */
143
+ declare const pluralCount: (count: number, word: string) => string;
144
+ /**
145
+ * Returns the correct form for compound phrases (noun + adjective)
146
+ * Both words are pluralized together
147
+ *
148
+ * @example
149
+ * pluralPhrase(1, 'usuário', 'cadastrado') // 'usuário cadastrado'
150
+ * pluralPhrase(3, 'usuário', 'cadastrado') // 'usuários cadastrados'
151
+ * pluralPhrase(2, 'revisão', 'excluída') // 'revisões excluídas'
152
+ */
153
+ declare const pluralPhrase: (count: number, noun: string, adjective: string) => string;
154
+ /**
155
+ * Returns count with the correct compound phrase form
156
+ *
157
+ * @example
158
+ * pluralPhraseCount(1, 'usuário', 'cadastrado') // '1 usuário cadastrado'
159
+ * pluralPhraseCount(3, 'convite', 'enviado') // '3 convites enviados'
160
+ */
161
+ declare const pluralPhraseCount: (count: number, noun: string, adjective: string) => string;
162
+
163
+ export { AGE_BRACKETS, BODY_FAT_ZONES, type BodyFatZone, CATEGORY_SCREENING_INTERVALS, type CategoryScreeningInterval, FHIRBundle, FHIRMedicationStatement, FHIRObservation, InterventionData, type ScreeningIntervalMonths, type TScoreZone, T_SCORE_ZONES, UserProfileData, ZONE_DEFS, calculateNextScreeningDate, getCategoriesByInterval, getDaysUntilScreening, getDueCategories, getScreeningInterval, interventionToFHIRMedicationStatement, interventionToFHIRObservation, interventionsToFHIRBundle, isScreeningDue, plural, pluralCount, pluralPhrase, pluralPhraseCount };