@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.
- package/README.md +85 -0
- package/dist/biomarkers.cjs +67 -0
- package/dist/biomarkers.cjs.map +1 -0
- package/dist/biomarkers.d.cts +226 -0
- package/dist/biomarkers.d.ts +226 -0
- package/dist/biomarkers.js +67 -0
- package/dist/biomarkers.js.map +1 -0
- package/dist/chunk-2EVQ2ESB.cjs +2692 -0
- package/dist/chunk-2EVQ2ESB.cjs.map +1 -0
- package/dist/chunk-2X6MT5KE.cjs +1464 -0
- package/dist/chunk-2X6MT5KE.cjs.map +1 -0
- package/dist/chunk-3ILBFLVQ.cjs +63 -0
- package/dist/chunk-3ILBFLVQ.cjs.map +1 -0
- package/dist/chunk-FDOBUUGY.js +1464 -0
- package/dist/chunk-FDOBUUGY.js.map +1 -0
- package/dist/chunk-GFXKYXHW.cjs +436 -0
- package/dist/chunk-GFXKYXHW.cjs.map +1 -0
- package/dist/chunk-I6H35QXI.js +2692 -0
- package/dist/chunk-I6H35QXI.js.map +1 -0
- package/dist/chunk-N3ZCOLG2.js +63 -0
- package/dist/chunk-N3ZCOLG2.js.map +1 -0
- package/dist/chunk-O25F6G3K.cjs +153 -0
- package/dist/chunk-O25F6G3K.cjs.map +1 -0
- package/dist/chunk-S6VJHXJF.js +153 -0
- package/dist/chunk-S6VJHXJF.js.map +1 -0
- package/dist/chunk-UIDSSWBJ.js +251 -0
- package/dist/chunk-UIDSSWBJ.js.map +1 -0
- package/dist/chunk-VPMT4MRS.js +436 -0
- package/dist/chunk-VPMT4MRS.js.map +1 -0
- package/dist/chunk-Z6YE6FJ4.cjs +251 -0
- package/dist/chunk-Z6YE6FJ4.cjs.map +1 -0
- package/dist/converter-C-QpCcTL.d.ts +99 -0
- package/dist/converter-Dee-qjBV.d.cts +99 -0
- package/dist/converter.cjs +15 -0
- package/dist/converter.cjs.map +1 -0
- package/dist/converter.d.cts +2 -0
- package/dist/converter.d.ts +2 -0
- package/dist/converter.js +15 -0
- package/dist/converter.js.map +1 -0
- package/dist/fhir-types-D9hUzGrc.d.cts +129 -0
- package/dist/fhir-types-D9hUzGrc.d.ts +129 -0
- package/dist/importer.cjs +17 -0
- package/dist/importer.cjs.map +1 -0
- package/dist/importer.d.cts +60 -0
- package/dist/importer.d.ts +60 -0
- package/dist/importer.js +17 -0
- package/dist/importer.js.map +1 -0
- package/dist/index.cjs +540 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +163 -0
- package/dist/index.d.ts +163 -0
- package/dist/index.js +540 -0
- package/dist/index.js.map +1 -0
- package/dist/reference-ranges.cjs +18 -0
- package/dist/reference-ranges.cjs.map +1 -0
- package/dist/reference-ranges.d.cts +106 -0
- package/dist/reference-ranges.d.ts +106 -0
- package/dist/reference-ranges.js +18 -0
- package/dist/reference-ranges.js.map +1 -0
- package/dist/units.cjs +19 -0
- package/dist/units.cjs.map +1 -0
- package/dist/units.d.cts +46 -0
- package/dist/units.d.ts +46 -0
- package/dist/units.js +19 -0
- package/dist/units.js.map +1 -0
- package/dist/validators.cjs +11 -0
- package/dist/validators.cjs.map +1 -0
- package/dist/validators.d.cts +23 -0
- package/dist/validators.d.ts +23 -0
- package/dist/validators.js +11 -0
- package/dist/validators.js.map +1 -0
- package/package.json +105 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Biomarker Reference Ranges
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for biomarker reference ranges used by both
|
|
5
|
+
* web app (for display) and API (for fallback when LLM doesn't extract ranges).
|
|
6
|
+
*
|
|
7
|
+
* Data sources (priority order):
|
|
8
|
+
* 1. Brazilian Government - SBPC/ML (Sociedade Brasileira de Patologia Clínica) guidelines
|
|
9
|
+
* 2. International Standards - WHO, clinical laboratory guidelines
|
|
10
|
+
* 3. Specific Labs - Fleury, Weinmann, Quest, LabCorp (when above unavailable)
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Sex-specific key for reference ranges
|
|
14
|
+
*/
|
|
15
|
+
type SexKey = 'M' | 'F' | 'all';
|
|
16
|
+
/**
|
|
17
|
+
* Reference range configuration for a biomarker
|
|
18
|
+
*/
|
|
19
|
+
interface BiomarkerReferenceRange {
|
|
20
|
+
max?: number;
|
|
21
|
+
min?: number;
|
|
22
|
+
optimalMax?: number;
|
|
23
|
+
optimalMin?: number;
|
|
24
|
+
unit: string;
|
|
25
|
+
warningMax?: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A variant of a reference range that applies to a specific sex and/or age group
|
|
29
|
+
*/
|
|
30
|
+
interface RangeVariant {
|
|
31
|
+
ageMax?: number;
|
|
32
|
+
ageMin?: number;
|
|
33
|
+
range: BiomarkerReferenceRange;
|
|
34
|
+
sex: SexKey;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Extended biomarker range definition with sex/age-specific variants
|
|
38
|
+
*/
|
|
39
|
+
/**
|
|
40
|
+
* Direction indicates whether exceeding the reference range on one side is benign.
|
|
41
|
+
* - 'range': both above-max and below-min are abnormal (default)
|
|
42
|
+
* - 'higher-better': above-max is normal (e.g., BMC, HDL)
|
|
43
|
+
* - 'lower-better': below-min is normal (e.g., LDL, CRP)
|
|
44
|
+
*/
|
|
45
|
+
type RangeDirection = 'range' | 'higher-better' | 'lower-better';
|
|
46
|
+
interface BiomarkerRangeDefinition {
|
|
47
|
+
default: BiomarkerReferenceRange;
|
|
48
|
+
direction?: RangeDirection;
|
|
49
|
+
source?: string;
|
|
50
|
+
variants?: RangeVariant[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* User context for personalized reference range lookup
|
|
54
|
+
*/
|
|
55
|
+
interface ReferenceRangeContext {
|
|
56
|
+
age?: number;
|
|
57
|
+
biologicalSex?: 'M' | 'F';
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Comprehensive biomarker reference range definitions with sex/age-specific variants
|
|
61
|
+
*
|
|
62
|
+
* Each marker has a default range (used as fallback) and optional variants
|
|
63
|
+
* for sex/age-specific ranges.
|
|
64
|
+
*/
|
|
65
|
+
declare const biomarkerRangeDefinitions: Record<string, BiomarkerRangeDefinition>;
|
|
66
|
+
/**
|
|
67
|
+
* Legacy flat reference ranges for backward compatibility
|
|
68
|
+
* This is derived from biomarkerRangeDefinitions defaults
|
|
69
|
+
*/
|
|
70
|
+
declare const defaultReferenceRanges: Record<string, BiomarkerReferenceRange>;
|
|
71
|
+
/**
|
|
72
|
+
* Get the reference range for a biomarker code, optionally personalized for user context
|
|
73
|
+
* @param testCode - The biomarker code (e.g., "HDL", "Testosterone")
|
|
74
|
+
* @param context - Optional user context for personalized ranges
|
|
75
|
+
* @returns Reference range or undefined if not found
|
|
76
|
+
*/
|
|
77
|
+
declare function getReferenceRange(testCode: string, context?: ReferenceRangeContext): BiomarkerReferenceRange | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Get the range direction for a biomarker code.
|
|
80
|
+
* Returns 'range' (default) if not specified.
|
|
81
|
+
*/
|
|
82
|
+
declare function getRangeDirection(testCode: string): RangeDirection;
|
|
83
|
+
/**
|
|
84
|
+
* Get fallback reference range for a biomarker code (default only, no personalization)
|
|
85
|
+
* Used by API when LLM doesn't extract reference values
|
|
86
|
+
* @param biomarkerCode - The biomarker code
|
|
87
|
+
* @returns Reference range with min/max/unit or undefined
|
|
88
|
+
*/
|
|
89
|
+
declare function getFallbackReferenceRange(biomarkerCode: string): {
|
|
90
|
+
min: number;
|
|
91
|
+
max: number;
|
|
92
|
+
unit: string;
|
|
93
|
+
} | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Apply fallback reference ranges to biomarkers that are missing them
|
|
96
|
+
* @param biomarkers - Array of parsed biomarkers
|
|
97
|
+
* @returns Count of biomarkers that received fallback references
|
|
98
|
+
*/
|
|
99
|
+
declare function applyFallbackReferenceRanges<T extends {
|
|
100
|
+
code: string;
|
|
101
|
+
referenceMin?: number | null;
|
|
102
|
+
referenceMax?: number | null;
|
|
103
|
+
unit?: string;
|
|
104
|
+
}>(biomarkers: T[]): number;
|
|
105
|
+
|
|
106
|
+
export { type BiomarkerRangeDefinition, type BiomarkerReferenceRange, type RangeDirection, type RangeVariant, type ReferenceRangeContext, type SexKey, applyFallbackReferenceRanges, biomarkerRangeDefinitions, defaultReferenceRanges, getFallbackReferenceRange, getRangeDirection, getReferenceRange };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Biomarker Reference Ranges
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for biomarker reference ranges used by both
|
|
5
|
+
* web app (for display) and API (for fallback when LLM doesn't extract ranges).
|
|
6
|
+
*
|
|
7
|
+
* Data sources (priority order):
|
|
8
|
+
* 1. Brazilian Government - SBPC/ML (Sociedade Brasileira de Patologia Clínica) guidelines
|
|
9
|
+
* 2. International Standards - WHO, clinical laboratory guidelines
|
|
10
|
+
* 3. Specific Labs - Fleury, Weinmann, Quest, LabCorp (when above unavailable)
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Sex-specific key for reference ranges
|
|
14
|
+
*/
|
|
15
|
+
type SexKey = 'M' | 'F' | 'all';
|
|
16
|
+
/**
|
|
17
|
+
* Reference range configuration for a biomarker
|
|
18
|
+
*/
|
|
19
|
+
interface BiomarkerReferenceRange {
|
|
20
|
+
max?: number;
|
|
21
|
+
min?: number;
|
|
22
|
+
optimalMax?: number;
|
|
23
|
+
optimalMin?: number;
|
|
24
|
+
unit: string;
|
|
25
|
+
warningMax?: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A variant of a reference range that applies to a specific sex and/or age group
|
|
29
|
+
*/
|
|
30
|
+
interface RangeVariant {
|
|
31
|
+
ageMax?: number;
|
|
32
|
+
ageMin?: number;
|
|
33
|
+
range: BiomarkerReferenceRange;
|
|
34
|
+
sex: SexKey;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Extended biomarker range definition with sex/age-specific variants
|
|
38
|
+
*/
|
|
39
|
+
/**
|
|
40
|
+
* Direction indicates whether exceeding the reference range on one side is benign.
|
|
41
|
+
* - 'range': both above-max and below-min are abnormal (default)
|
|
42
|
+
* - 'higher-better': above-max is normal (e.g., BMC, HDL)
|
|
43
|
+
* - 'lower-better': below-min is normal (e.g., LDL, CRP)
|
|
44
|
+
*/
|
|
45
|
+
type RangeDirection = 'range' | 'higher-better' | 'lower-better';
|
|
46
|
+
interface BiomarkerRangeDefinition {
|
|
47
|
+
default: BiomarkerReferenceRange;
|
|
48
|
+
direction?: RangeDirection;
|
|
49
|
+
source?: string;
|
|
50
|
+
variants?: RangeVariant[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* User context for personalized reference range lookup
|
|
54
|
+
*/
|
|
55
|
+
interface ReferenceRangeContext {
|
|
56
|
+
age?: number;
|
|
57
|
+
biologicalSex?: 'M' | 'F';
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Comprehensive biomarker reference range definitions with sex/age-specific variants
|
|
61
|
+
*
|
|
62
|
+
* Each marker has a default range (used as fallback) and optional variants
|
|
63
|
+
* for sex/age-specific ranges.
|
|
64
|
+
*/
|
|
65
|
+
declare const biomarkerRangeDefinitions: Record<string, BiomarkerRangeDefinition>;
|
|
66
|
+
/**
|
|
67
|
+
* Legacy flat reference ranges for backward compatibility
|
|
68
|
+
* This is derived from biomarkerRangeDefinitions defaults
|
|
69
|
+
*/
|
|
70
|
+
declare const defaultReferenceRanges: Record<string, BiomarkerReferenceRange>;
|
|
71
|
+
/**
|
|
72
|
+
* Get the reference range for a biomarker code, optionally personalized for user context
|
|
73
|
+
* @param testCode - The biomarker code (e.g., "HDL", "Testosterone")
|
|
74
|
+
* @param context - Optional user context for personalized ranges
|
|
75
|
+
* @returns Reference range or undefined if not found
|
|
76
|
+
*/
|
|
77
|
+
declare function getReferenceRange(testCode: string, context?: ReferenceRangeContext): BiomarkerReferenceRange | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Get the range direction for a biomarker code.
|
|
80
|
+
* Returns 'range' (default) if not specified.
|
|
81
|
+
*/
|
|
82
|
+
declare function getRangeDirection(testCode: string): RangeDirection;
|
|
83
|
+
/**
|
|
84
|
+
* Get fallback reference range for a biomarker code (default only, no personalization)
|
|
85
|
+
* Used by API when LLM doesn't extract reference values
|
|
86
|
+
* @param biomarkerCode - The biomarker code
|
|
87
|
+
* @returns Reference range with min/max/unit or undefined
|
|
88
|
+
*/
|
|
89
|
+
declare function getFallbackReferenceRange(biomarkerCode: string): {
|
|
90
|
+
min: number;
|
|
91
|
+
max: number;
|
|
92
|
+
unit: string;
|
|
93
|
+
} | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Apply fallback reference ranges to biomarkers that are missing them
|
|
96
|
+
* @param biomarkers - Array of parsed biomarkers
|
|
97
|
+
* @returns Count of biomarkers that received fallback references
|
|
98
|
+
*/
|
|
99
|
+
declare function applyFallbackReferenceRanges<T extends {
|
|
100
|
+
code: string;
|
|
101
|
+
referenceMin?: number | null;
|
|
102
|
+
referenceMax?: number | null;
|
|
103
|
+
unit?: string;
|
|
104
|
+
}>(biomarkers: T[]): number;
|
|
105
|
+
|
|
106
|
+
export { type BiomarkerRangeDefinition, type BiomarkerReferenceRange, type RangeDirection, type RangeVariant, type ReferenceRangeContext, type SexKey, applyFallbackReferenceRanges, biomarkerRangeDefinitions, defaultReferenceRanges, getFallbackReferenceRange, getRangeDirection, getReferenceRange };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
applyFallbackReferenceRanges,
|
|
3
|
+
biomarkerRangeDefinitions,
|
|
4
|
+
defaultReferenceRanges,
|
|
5
|
+
getFallbackReferenceRange,
|
|
6
|
+
getRangeDirection,
|
|
7
|
+
getReferenceRange
|
|
8
|
+
} from "./chunk-FDOBUUGY.js";
|
|
9
|
+
import "./chunk-VPMT4MRS.js";
|
|
10
|
+
export {
|
|
11
|
+
applyFallbackReferenceRanges,
|
|
12
|
+
biomarkerRangeDefinitions,
|
|
13
|
+
defaultReferenceRanges,
|
|
14
|
+
getFallbackReferenceRange,
|
|
15
|
+
getRangeDirection,
|
|
16
|
+
getReferenceRange
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=reference-ranges.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/units.cjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkGFXKYXHWcjs = require('./chunk-GFXKYXHW.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
exports.BIOMARKER_DEFAULT_UNIT = _chunkGFXKYXHWcjs.BIOMARKER_DEFAULT_UNIT; exports.BIOMARKER_UNITS = _chunkGFXKYXHWcjs.BIOMARKER_UNITS; exports.UNIT_TO_UCUM = _chunkGFXKYXHWcjs.UNIT_TO_UCUM; exports.getCanonicalUnit = _chunkGFXKYXHWcjs.getCanonicalUnit; exports.getDefaultUnit = _chunkGFXKYXHWcjs.getDefaultUnit; exports.getSIUnit = _chunkGFXKYXHWcjs.getSIUnit; exports.unitToUCUM = _chunkGFXKYXHWcjs.unitToUCUM;
|
|
19
|
+
//# sourceMappingURL=units.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/rafael/Github/precisa-saude/fhir-brasil/packages/core/dist/units.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACF,4ZAAC","file":"/Users/rafael/Github/precisa-saude/fhir-brasil/packages/core/dist/units.cjs"}
|
package/dist/units.d.cts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit Mappings and Biomarker Unit Definitions
|
|
3
|
+
*
|
|
4
|
+
* Maps units to UCUM format, provides default units for biomarkers,
|
|
5
|
+
* and defines canonical/SI unit configurations with aliases.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Map units to UCUM (Unified Code for Units of Measure)
|
|
9
|
+
* See: https://ucum.org/
|
|
10
|
+
*/
|
|
11
|
+
declare const UNIT_TO_UCUM: Record<string, string>;
|
|
12
|
+
/**
|
|
13
|
+
* Default units for biomarkers when source data doesn't provide one
|
|
14
|
+
* These are the most common units used in Brazilian labs
|
|
15
|
+
*/
|
|
16
|
+
declare const BIOMARKER_DEFAULT_UNIT: Record<string, string>;
|
|
17
|
+
/**
|
|
18
|
+
* Convert unit to UCUM format
|
|
19
|
+
*/
|
|
20
|
+
declare function unitToUCUM(unit: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Get default unit for a biomarker code
|
|
23
|
+
* @param biomarkerCode - The biomarker code (e.g., "Glucose", "HbA1c")
|
|
24
|
+
* @returns The default unit or empty string if not found
|
|
25
|
+
*/
|
|
26
|
+
declare function getDefaultUnit(biomarkerCode: string): string;
|
|
27
|
+
/** Biomarker unit definitions — canonical units match reference-ranges.ts (BR conventional). */
|
|
28
|
+
interface BiomarkerUnitConfig {
|
|
29
|
+
aliases: Record<string, string>;
|
|
30
|
+
canonicalUcum: string;
|
|
31
|
+
canonicalUnit: string;
|
|
32
|
+
molecularWeight?: number;
|
|
33
|
+
siUcum: string;
|
|
34
|
+
siUnit: string;
|
|
35
|
+
}
|
|
36
|
+
declare const BIOMARKER_UNITS: Record<string, BiomarkerUnitConfig>;
|
|
37
|
+
/**
|
|
38
|
+
* Get the canonical unit for a biomarker code.
|
|
39
|
+
*/
|
|
40
|
+
declare function getCanonicalUnit(code: string): string | null;
|
|
41
|
+
/**
|
|
42
|
+
* Get the SI unit for a biomarker code.
|
|
43
|
+
*/
|
|
44
|
+
declare function getSIUnit(code: string): string | null;
|
|
45
|
+
|
|
46
|
+
export { BIOMARKER_DEFAULT_UNIT, BIOMARKER_UNITS, type BiomarkerUnitConfig, UNIT_TO_UCUM, getCanonicalUnit, getDefaultUnit, getSIUnit, unitToUCUM };
|
package/dist/units.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit Mappings and Biomarker Unit Definitions
|
|
3
|
+
*
|
|
4
|
+
* Maps units to UCUM format, provides default units for biomarkers,
|
|
5
|
+
* and defines canonical/SI unit configurations with aliases.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Map units to UCUM (Unified Code for Units of Measure)
|
|
9
|
+
* See: https://ucum.org/
|
|
10
|
+
*/
|
|
11
|
+
declare const UNIT_TO_UCUM: Record<string, string>;
|
|
12
|
+
/**
|
|
13
|
+
* Default units for biomarkers when source data doesn't provide one
|
|
14
|
+
* These are the most common units used in Brazilian labs
|
|
15
|
+
*/
|
|
16
|
+
declare const BIOMARKER_DEFAULT_UNIT: Record<string, string>;
|
|
17
|
+
/**
|
|
18
|
+
* Convert unit to UCUM format
|
|
19
|
+
*/
|
|
20
|
+
declare function unitToUCUM(unit: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Get default unit for a biomarker code
|
|
23
|
+
* @param biomarkerCode - The biomarker code (e.g., "Glucose", "HbA1c")
|
|
24
|
+
* @returns The default unit or empty string if not found
|
|
25
|
+
*/
|
|
26
|
+
declare function getDefaultUnit(biomarkerCode: string): string;
|
|
27
|
+
/** Biomarker unit definitions — canonical units match reference-ranges.ts (BR conventional). */
|
|
28
|
+
interface BiomarkerUnitConfig {
|
|
29
|
+
aliases: Record<string, string>;
|
|
30
|
+
canonicalUcum: string;
|
|
31
|
+
canonicalUnit: string;
|
|
32
|
+
molecularWeight?: number;
|
|
33
|
+
siUcum: string;
|
|
34
|
+
siUnit: string;
|
|
35
|
+
}
|
|
36
|
+
declare const BIOMARKER_UNITS: Record<string, BiomarkerUnitConfig>;
|
|
37
|
+
/**
|
|
38
|
+
* Get the canonical unit for a biomarker code.
|
|
39
|
+
*/
|
|
40
|
+
declare function getCanonicalUnit(code: string): string | null;
|
|
41
|
+
/**
|
|
42
|
+
* Get the SI unit for a biomarker code.
|
|
43
|
+
*/
|
|
44
|
+
declare function getSIUnit(code: string): string | null;
|
|
45
|
+
|
|
46
|
+
export { BIOMARKER_DEFAULT_UNIT, BIOMARKER_UNITS, type BiomarkerUnitConfig, UNIT_TO_UCUM, getCanonicalUnit, getDefaultUnit, getSIUnit, unitToUCUM };
|
package/dist/units.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BIOMARKER_DEFAULT_UNIT,
|
|
3
|
+
BIOMARKER_UNITS,
|
|
4
|
+
UNIT_TO_UCUM,
|
|
5
|
+
getCanonicalUnit,
|
|
6
|
+
getDefaultUnit,
|
|
7
|
+
getSIUnit,
|
|
8
|
+
unitToUCUM
|
|
9
|
+
} from "./chunk-VPMT4MRS.js";
|
|
10
|
+
export {
|
|
11
|
+
BIOMARKER_DEFAULT_UNIT,
|
|
12
|
+
BIOMARKER_UNITS,
|
|
13
|
+
UNIT_TO_UCUM,
|
|
14
|
+
getCanonicalUnit,
|
|
15
|
+
getDefaultUnit,
|
|
16
|
+
getSIUnit,
|
|
17
|
+
unitToUCUM
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=units.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunk3ILBFLVQcjs = require('./chunk-3ILBFLVQ.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.validateFHIRDiagnosticReport = _chunk3ILBFLVQcjs.validateFHIRDiagnosticReport; exports.validateFHIRImportBundle = _chunk3ILBFLVQcjs.validateFHIRImportBundle; exports.validateFHIRObservation = _chunk3ILBFLVQcjs.validateFHIRObservation;
|
|
11
|
+
//# sourceMappingURL=validators.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/rafael/Github/precisa-saude/fhir-brasil/packages/core/dist/validators.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,kPAAC","file":"/Users/rafael/Github/precisa-saude/fhir-brasil/packages/core/dist/validators.cjs"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { j as FHIRDiagnosticReport, a as FHIRObservation } from './fhir-types-D9hUzGrc.cjs';
|
|
2
|
+
import { ImportError } from './importer.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* FHIR Validators
|
|
6
|
+
*
|
|
7
|
+
* Validation functions for FHIR R4 resources.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Validate FHIR DiagnosticReport
|
|
12
|
+
*/
|
|
13
|
+
declare function validateFHIRDiagnosticReport(report: FHIRDiagnosticReport): string[];
|
|
14
|
+
/**
|
|
15
|
+
* Validate FHIR Observation
|
|
16
|
+
*/
|
|
17
|
+
declare function validateFHIRObservation(observation: FHIRObservation): string[];
|
|
18
|
+
/**
|
|
19
|
+
* Validate that the input is a structurally valid FHIR Bundle
|
|
20
|
+
*/
|
|
21
|
+
declare function validateFHIRImportBundle(data: unknown): ImportError[];
|
|
22
|
+
|
|
23
|
+
export { validateFHIRDiagnosticReport, validateFHIRImportBundle, validateFHIRObservation };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { j as FHIRDiagnosticReport, a as FHIRObservation } from './fhir-types-D9hUzGrc.js';
|
|
2
|
+
import { ImportError } from './importer.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* FHIR Validators
|
|
6
|
+
*
|
|
7
|
+
* Validation functions for FHIR R4 resources.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Validate FHIR DiagnosticReport
|
|
12
|
+
*/
|
|
13
|
+
declare function validateFHIRDiagnosticReport(report: FHIRDiagnosticReport): string[];
|
|
14
|
+
/**
|
|
15
|
+
* Validate FHIR Observation
|
|
16
|
+
*/
|
|
17
|
+
declare function validateFHIRObservation(observation: FHIRObservation): string[];
|
|
18
|
+
/**
|
|
19
|
+
* Validate that the input is a structurally valid FHIR Bundle
|
|
20
|
+
*/
|
|
21
|
+
declare function validateFHIRImportBundle(data: unknown): ImportError[];
|
|
22
|
+
|
|
23
|
+
export { validateFHIRDiagnosticReport, validateFHIRImportBundle, validateFHIRObservation };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
validateFHIRDiagnosticReport,
|
|
3
|
+
validateFHIRImportBundle,
|
|
4
|
+
validateFHIRObservation
|
|
5
|
+
} from "./chunk-N3ZCOLG2.js";
|
|
6
|
+
export {
|
|
7
|
+
validateFHIRDiagnosticReport,
|
|
8
|
+
validateFHIRImportBundle,
|
|
9
|
+
validateFHIRObservation
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=validators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@precisa-saude/fhir",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Brazilian FHIR R4 types, biomarker definitions, reference ranges, and converters",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./dist/index.d.cts",
|
|
17
|
+
"default": "./dist/index.cjs"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"./biomarkers": {
|
|
21
|
+
"import": {
|
|
22
|
+
"types": "./dist/biomarkers.d.ts",
|
|
23
|
+
"default": "./dist/biomarkers.js"
|
|
24
|
+
},
|
|
25
|
+
"require": {
|
|
26
|
+
"types": "./dist/biomarkers.d.cts",
|
|
27
|
+
"default": "./dist/biomarkers.cjs"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"./reference-ranges": {
|
|
31
|
+
"import": {
|
|
32
|
+
"types": "./dist/reference-ranges.d.ts",
|
|
33
|
+
"default": "./dist/reference-ranges.js"
|
|
34
|
+
},
|
|
35
|
+
"require": {
|
|
36
|
+
"types": "./dist/reference-ranges.d.cts",
|
|
37
|
+
"default": "./dist/reference-ranges.cjs"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"./converter": {
|
|
41
|
+
"import": {
|
|
42
|
+
"types": "./dist/converter.d.ts",
|
|
43
|
+
"default": "./dist/converter.js"
|
|
44
|
+
},
|
|
45
|
+
"require": {
|
|
46
|
+
"types": "./dist/converter.d.cts",
|
|
47
|
+
"default": "./dist/converter.cjs"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"./importer": {
|
|
51
|
+
"import": {
|
|
52
|
+
"types": "./dist/importer.d.ts",
|
|
53
|
+
"default": "./dist/importer.js"
|
|
54
|
+
},
|
|
55
|
+
"require": {
|
|
56
|
+
"types": "./dist/importer.d.cts",
|
|
57
|
+
"default": "./dist/importer.cjs"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"./units": {
|
|
61
|
+
"import": {
|
|
62
|
+
"types": "./dist/units.d.ts",
|
|
63
|
+
"default": "./dist/units.js"
|
|
64
|
+
},
|
|
65
|
+
"require": {
|
|
66
|
+
"types": "./dist/units.d.cts",
|
|
67
|
+
"default": "./dist/units.cjs"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"./validators": {
|
|
71
|
+
"import": {
|
|
72
|
+
"types": "./dist/validators.d.ts",
|
|
73
|
+
"default": "./dist/validators.js"
|
|
74
|
+
},
|
|
75
|
+
"require": {
|
|
76
|
+
"types": "./dist/validators.d.cts",
|
|
77
|
+
"default": "./dist/validators.cjs"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"files": ["dist"],
|
|
82
|
+
"scripts": {
|
|
83
|
+
"build": "tsup",
|
|
84
|
+
"lint": "tsc --noEmit",
|
|
85
|
+
"typecheck": "tsc --noEmit",
|
|
86
|
+
"test": "vitest run",
|
|
87
|
+
"test:coverage": "vitest run --coverage",
|
|
88
|
+
"clean": "rm -rf dist .turbo"
|
|
89
|
+
},
|
|
90
|
+
"keywords": ["fhir", "r4", "brazil", "biomarker", "loinc", "sbpc-ml", "health"],
|
|
91
|
+
"license": "Apache-2.0",
|
|
92
|
+
"repository": {
|
|
93
|
+
"type": "git",
|
|
94
|
+
"url": "https://github.com/precisa-saude/fhir-brasil.git",
|
|
95
|
+
"directory": "packages/core"
|
|
96
|
+
},
|
|
97
|
+
"publishConfig": {
|
|
98
|
+
"access": "public"
|
|
99
|
+
},
|
|
100
|
+
"devDependencies": {
|
|
101
|
+
"tsup": "^8.3.5",
|
|
102
|
+
"typescript": "~5.7.3",
|
|
103
|
+
"vitest": "^2.1.8"
|
|
104
|
+
}
|
|
105
|
+
}
|