@precisa-saude/fhir 0.38.1 → 0.38.3
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/dist/biomarkers.cjs +2 -2
- package/dist/biomarkers.js +1 -1
- package/dist/{chunk-2J3V7DCF.js → chunk-4AV7A6EV.js} +2 -2
- package/dist/{chunk-77N3LQNM.js → chunk-75D5AXRH.js} +3 -3
- package/dist/{chunk-NUFN24W4.cjs → chunk-7LF5NR2G.cjs} +3 -3
- package/dist/{chunk-NUFN24W4.cjs.map → chunk-7LF5NR2G.cjs.map} +1 -1
- package/dist/{chunk-46PNS7KW.cjs → chunk-FTIECHT4.cjs} +9 -9
- package/dist/{chunk-46PNS7KW.cjs.map → chunk-FTIECHT4.cjs.map} +1 -1
- package/dist/{chunk-SIXIWFC5.js → chunk-GRT73XV7.js} +2 -2
- package/dist/{chunk-VMID6CDC.cjs → chunk-IUZBIR2G.cjs} +28 -11
- package/dist/chunk-IUZBIR2G.cjs.map +1 -0
- package/dist/{chunk-IY6BZX2V.cjs → chunk-J5EPYPJR.cjs} +3 -3
- package/dist/{chunk-IY6BZX2V.cjs.map → chunk-J5EPYPJR.cjs.map} +1 -1
- package/dist/{chunk-LUGMRMWY.cjs → chunk-PD6M52FO.cjs} +10 -10
- package/dist/{chunk-LUGMRMWY.cjs.map → chunk-PD6M52FO.cjs.map} +1 -1
- package/dist/{chunk-4O3QE7DU.cjs → chunk-QKZOPHNA.cjs} +3 -3
- package/dist/{chunk-4O3QE7DU.cjs.map → chunk-QKZOPHNA.cjs.map} +1 -1
- package/dist/{chunk-GG3MOT3C.js → chunk-R2COZZUN.js} +2 -2
- package/dist/{chunk-XVXLDN4Q.js → chunk-RZ6VA3AD.js} +28 -11
- package/dist/chunk-RZ6VA3AD.js.map +1 -0
- package/dist/{chunk-X2BYLSNK.js → chunk-YRHMV222.js} +4 -4
- package/dist/cli.js +28 -11
- package/dist/converter.cjs +5 -5
- package/dist/converter.js +4 -4
- package/dist/importer.cjs +5 -5
- package/dist/importer.js +4 -4
- package/dist/index.cjs +16 -16
- package/dist/index.js +6 -6
- package/dist/reference-ranges.cjs +4 -4
- package/dist/reference-ranges.js +3 -3
- package/dist/units.cjs +3 -3
- package/dist/units.js +2 -2
- package/dist/validators.cjs +4 -4
- package/dist/validators.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-VMID6CDC.cjs.map +0 -1
- package/dist/chunk-XVXLDN4Q.js.map +0 -1
- /package/dist/{chunk-2J3V7DCF.js.map → chunk-4AV7A6EV.js.map} +0 -0
- /package/dist/{chunk-77N3LQNM.js.map → chunk-75D5AXRH.js.map} +0 -0
- /package/dist/{chunk-SIXIWFC5.js.map → chunk-GRT73XV7.js.map} +0 -0
- /package/dist/{chunk-GG3MOT3C.js.map → chunk-R2COZZUN.js.map} +0 -0
- /package/dist/{chunk-X2BYLSNK.js.map → chunk-YRHMV222.js.map} +0 -0
package/dist/biomarkers.cjs
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
var
|
|
34
|
+
var _chunkIUZBIR2Gcjs = require('./chunk-IUZBIR2G.cjs');
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
@@ -65,5 +65,5 @@ var _chunkVMID6CDCcjs = require('./chunk-VMID6CDC.cjs');
|
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
|
|
68
|
-
exports.BIOMARKER_DEFINITIONS =
|
|
68
|
+
exports.BIOMARKER_DEFINITIONS = _chunkIUZBIR2Gcjs.BIOMARKER_DEFINITIONS; exports.CAC_INDICATOR_CODES = _chunkIUZBIR2Gcjs.CAC_INDICATOR_CODES; exports.DEXA_CATEGORIES = _chunkIUZBIR2Gcjs.DEXA_CATEGORIES; exports.DEXA_INDICATOR_CODES = _chunkIUZBIR2Gcjs.DEXA_INDICATOR_CODES; exports.codeToLoinc = _chunkIUZBIR2Gcjs.codeToLoinc; exports.filterVisibleBiomarkers = _chunkIUZBIR2Gcjs.filterVisibleBiomarkers; exports.findCodeByName = _chunkIUZBIR2Gcjs.findCodeByName; exports.generateCacFullReference = _chunkIUZBIR2Gcjs.generateCacFullReference; exports.generateDexaFullReference = _chunkIUZBIR2Gcjs.generateDexaFullReference; exports.generateFilteredLLMReference = _chunkIUZBIR2Gcjs.generateFilteredLLMReference; exports.generateLLMReference = _chunkIUZBIR2Gcjs.generateLLMReference; exports.getAllCodes = _chunkIUZBIR2Gcjs.getAllCodes; exports.getAllDefinitions = _chunkIUZBIR2Gcjs.getAllDefinitions; exports.getAllLoincCodes = _chunkIUZBIR2Gcjs.getAllLoincCodes; exports.getAllSearchPatterns = _chunkIUZBIR2Gcjs.getAllSearchPatterns; exports.getBiomarkersByCategory = _chunkIUZBIR2Gcjs.getBiomarkersByCategory; exports.getBiomarkersForCategories = _chunkIUZBIR2Gcjs.getBiomarkersForCategories; exports.getDefinitionByCode = _chunkIUZBIR2Gcjs.getDefinitionByCode; exports.getDefinitionByLoinc = _chunkIUZBIR2Gcjs.getDefinitionByLoinc; exports.getDefinitionsBySex = _chunkIUZBIR2Gcjs.getDefinitionsBySex; exports.getSexForCode = _chunkIUZBIR2Gcjs.getSexForCode; exports.getVisibleDefinitions = _chunkIUZBIR2Gcjs.getVisibleDefinitions; exports.isBiomarkerVisible = _chunkIUZBIR2Gcjs.isBiomarkerVisible; exports.isCacDocument = _chunkIUZBIR2Gcjs.isCacDocument; exports.isDexaDocument = _chunkIUZBIR2Gcjs.isDexaDocument; exports.isValidCode = _chunkIUZBIR2Gcjs.isValidCode; exports.isValidLoinc = _chunkIUZBIR2Gcjs.isValidLoinc; exports.loincToCode = _chunkIUZBIR2Gcjs.loincToCode; exports.methodVariantOf = _chunkIUZBIR2Gcjs.methodVariantOf; exports.normalizeCode = _chunkIUZBIR2Gcjs.normalizeCode; exports.toBiomarkerTests = _chunkIUZBIR2Gcjs.toBiomarkerTests; exports.validateLoincNameMatch = _chunkIUZBIR2Gcjs.validateLoincNameMatch;
|
|
69
69
|
//# sourceMappingURL=biomarkers.cjs.map
|
package/dist/biomarkers.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BIOMARKER_DEFINITIONS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RZ6VA3AD.js";
|
|
4
4
|
|
|
5
5
|
// src/units.ts
|
|
6
6
|
var UNIT_TO_UCUM = {
|
|
@@ -1092,4 +1092,4 @@ export {
|
|
|
1092
1092
|
convertUnit,
|
|
1093
1093
|
resolveUcum
|
|
1094
1094
|
};
|
|
1095
|
-
//# sourceMappingURL=chunk-
|
|
1095
|
+
//# sourceMappingURL=chunk-4AV7A6EV.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
validateFHIRImportBundle
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-R2COZZUN.js";
|
|
4
4
|
import {
|
|
5
5
|
BIOMARKER_CODE_SYSTEM,
|
|
6
6
|
LOINC_SYSTEM
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
loincToCode,
|
|
13
13
|
methodVariantOf,
|
|
14
14
|
normalizeCode
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-RZ6VA3AD.js";
|
|
16
16
|
|
|
17
17
|
// src/importer.ts
|
|
18
18
|
var MAX_OBSERVATIONS = 5e3;
|
|
@@ -171,4 +171,4 @@ export {
|
|
|
171
171
|
mapFHIRObservationToInternal,
|
|
172
172
|
processImportBundle
|
|
173
173
|
};
|
|
174
|
-
//# sourceMappingURL=chunk-
|
|
174
|
+
//# sourceMappingURL=chunk-75D5AXRH.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkJ5EPYPJRcjs = require('./chunk-J5EPYPJR.cjs');
|
|
4
4
|
|
|
5
5
|
// src/validators.ts
|
|
6
6
|
var UCUM_SYSTEM = "http://unitsofmeasure.org";
|
|
7
7
|
function ucumErrors(quantity, where) {
|
|
8
8
|
if (!quantity || quantity.system !== UCUM_SYSTEM) return [];
|
|
9
9
|
if (!quantity.code) return [`${where}: UCUM system declared without a code`];
|
|
10
|
-
if (!
|
|
10
|
+
if (!_chunkJ5EPYPJRcjs.isUcumCode.call(void 0, quantity.code)) {
|
|
11
11
|
return [`${where}: "${quantity.code}" is not a UCUM code`];
|
|
12
12
|
}
|
|
13
13
|
return [];
|
|
@@ -78,4 +78,4 @@ function validateFHIRImportBundle(data) {
|
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
exports.validateFHIRDiagnosticReport = validateFHIRDiagnosticReport; exports.validateFHIRObservation = validateFHIRObservation; exports.validateFHIRImportBundle = validateFHIRImportBundle;
|
|
81
|
-
//# sourceMappingURL=chunk-
|
|
81
|
+
//# sourceMappingURL=chunk-7LF5NR2G.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/fhir-brasil/fhir-brasil/packages/core/dist/chunk-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/fhir-brasil/fhir-brasil/packages/core/dist/chunk-7LF5NR2G.cjs","../src/validators.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACMA,IAAM,YAAA,EAAc,2BAAA;AAYpB,SAAS,UAAA,CAAW,QAAA,EAAoC,KAAA,EAAyB;AAC/E,EAAA,GAAA,CAAI,CAAC,SAAA,GAAY,QAAA,CAAS,OAAA,IAAW,WAAA,EAAa,OAAO,CAAC,CAAA;AAC1D,EAAA,GAAA,CAAI,CAAC,QAAA,CAAS,IAAA,EAAM,OAAO,CAAC,CAAA,EAAA;AACC,EAAA;AACL,IAAA;AACxB,EAAA;AACQ,EAAA;AACV;AAKgB;AACY,EAAA;AAEE,EAAA;AACd,IAAA;AACd,EAAA;AAEoB,EAAA;AACN,IAAA;AACd,EAAA;AAE4B,EAAA;AACd,IAAA;AACd,EAAA;AAEwB,EAAA;AACV,IAAA;AACd,EAAA;AAEO,EAAA;AACT;AAKgB;AACY,EAAA;AAET,EAAA;AACH,IAAA;AACd,EAAA;AAEyB,EAAA;AACX,IAAA;AACd,EAAA;AAE0B,EAAA;AACZ,IAAA;AACd,EAAA;AAE6B,EAAA;AACf,IAAA;AACd,EAAA;AAEiB,EAAA;AACH,IAAA;AACd,EAAA;AAE0B,EAAA;AACA,EAAA;AACE,IAAA;AACA,IAAA;AAC5B,EAAA;AAEO,EAAA;AACT;AAKgB;AACiB,EAAA;AAEF,EAAA;AACJ,IAAA;AAChB,IAAA;AACT,EAAA;AAEe,EAAA;AAEa,EAAA;AACd,IAAA;AACD,MAAA;AACF,MAAA;AACR,IAAA;AACH,EAAA;AAE0B,EAAA;AACD,IAAA;AACD,EAAA;AACC,IAAA;AACzB,EAAA;AAEO,EAAA;AACT;AD5C+B;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/fhir-brasil/fhir-brasil/packages/core/dist/chunk-7LF5NR2G.cjs","sourcesContent":[null,"/**\n * FHIR Validators\n *\n * Validation functions for FHIR R4 resources.\n */\n\nimport type { FHIRDiagnosticReport, FHIRObservation, FHIRQuantity } from './fhir-types';\nimport type { ImportError } from './importer';\nimport { isUcumCode } from './units';\n\nconst UCUM_SYSTEM = 'http://unitsofmeasure.org';\n\n/**\n * Um `Quantity` que afirma o system do UCUM precisa de um `code` que seja\n * UCUM. Sem `code` a afirmação está vazia; com `code` que não é UCUM ela está\n * errada, e foi o caso durante meses: `uIU/mL`, `K/uL` e `razão` saíam sob\n * `http://unitsofmeasure.org` porque o conversor devolvia a grafia do laudo\n * intacta quando não a conhecia.\n *\n * `Quantity` sem `system` passa: unidade só em texto é legítima, e é o que o\n * conversor emite quando não sabe traduzir.\n */\nfunction ucumErrors(quantity: FHIRQuantity | undefined, where: string): string[] {\n if (!quantity || quantity.system !== UCUM_SYSTEM) return [];\n if (!quantity.code) return [`${where}: UCUM system declared without a code`];\n if (!isUcumCode(quantity.code)) {\n return [`${where}: \"${quantity.code}\" is not a UCUM code`];\n }\n return [];\n}\n\n/**\n * Validate FHIR DiagnosticReport\n */\nexport function validateFHIRDiagnosticReport(report: FHIRDiagnosticReport): string[] {\n const errors: string[] = [];\n\n if (!report.resourceType || report.resourceType !== 'DiagnosticReport') {\n errors.push('Invalid resourceType');\n }\n\n if (!report.status) {\n errors.push('Missing status');\n }\n\n if (!report.code || !report.code.coding || report.code.coding.length === 0) {\n errors.push('Missing or invalid code');\n }\n\n if (!report.subject || !report.subject.reference) {\n errors.push('Missing subject reference');\n }\n\n return errors;\n}\n\n/**\n * Validate FHIR Observation\n */\nexport function validateFHIRObservation(observation: FHIRObservation): string[] {\n const errors: string[] = [];\n\n if (!observation.resourceType || observation.resourceType !== 'Observation') {\n errors.push('Invalid resourceType');\n }\n\n if (!observation.status) {\n errors.push('Missing status');\n }\n\n if (!observation.code || !observation.code.coding || observation.code.coding.length === 0) {\n errors.push('Missing or invalid code');\n }\n\n if (!observation.subject || !observation.subject.reference) {\n errors.push('Missing subject reference');\n }\n\n if (!observation.valueQuantity && !observation.valueString) {\n errors.push('Missing value (valueQuantity or valueString)');\n }\n\n errors.push(...ucumErrors(observation.valueQuantity, 'valueQuantity'));\n for (const [i, range] of (observation.referenceRange ?? []).entries()) {\n errors.push(...ucumErrors(range.low, `referenceRange[${i}].low`));\n errors.push(...ucumErrors(range.high, `referenceRange[${i}].high`));\n }\n\n return errors;\n}\n\n/**\n * Validate that the input is a structurally valid FHIR Bundle\n */\nexport function validateFHIRImportBundle(data: unknown): ImportError[] {\n const errors: ImportError[] = [];\n\n if (!data || typeof data !== 'object') {\n errors.push({ details: 'Input must be a JSON object', field: 'root' });\n return errors;\n }\n\n const bundle = data as Record<string, unknown>;\n\n if (bundle.resourceType !== 'Bundle') {\n errors.push({\n details: `Expected resourceType \"Bundle\", got \"${String(bundle.resourceType)}\"`,\n field: 'resourceType',\n });\n }\n\n if (!Array.isArray(bundle.entry)) {\n errors.push({ details: 'Bundle must contain an \"entry\" array', field: 'entry' });\n } else if (bundle.entry.length === 0) {\n errors.push({ details: 'Bundle entry array is empty', field: 'entry' });\n }\n\n return errors;\n}\n"]}
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
var _chunkOR67NJDZcjs = require('./chunk-OR67NJDZ.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkQKZOPHNAcjs = require('./chunk-QKZOPHNA.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkJ5EPYPJRcjs = require('./chunk-J5EPYPJR.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkIUZBIR2Gcjs = require('./chunk-IUZBIR2G.cjs');
|
|
16
16
|
|
|
17
17
|
// src/bundle-urls.ts
|
|
18
18
|
var BUNDLE_BASE_URL = "https://precisa-saude.com.br/fhir";
|
|
@@ -2596,16 +2596,16 @@ var buildReferenceRanges = (observation, quantity) => {
|
|
|
2596
2596
|
if (observation.referenceRanges && observation.referenceRanges.length > 0) {
|
|
2597
2597
|
return observation.referenceRanges.flatMap((r) => toRanges(r.low, r.high, r.appliesTo));
|
|
2598
2598
|
}
|
|
2599
|
-
const meaning = observation.referenceKind &&
|
|
2599
|
+
const meaning = observation.referenceKind && _chunkQKZOPHNAcjs.referenceRangeMeaning.call(void 0, observation.referenceKind);
|
|
2600
2600
|
return toRanges(observation.referenceMin, observation.referenceMax).map(
|
|
2601
2601
|
(range) => meaning ? { ...range, type: { coding: [meaning] } } : range
|
|
2602
2602
|
);
|
|
2603
2603
|
};
|
|
2604
2604
|
function labObservationToFHIR(observation, patientId, laboratoryName) {
|
|
2605
|
-
const methodLoinc = observation.methodLoinc &&
|
|
2606
|
-
const loincCode = _nullishCoalesce(methodLoinc, () => (
|
|
2607
|
-
const sourceUnit = observation.unit ||
|
|
2608
|
-
const ucumUnit =
|
|
2605
|
+
const methodLoinc = observation.methodLoinc && _chunkIUZBIR2Gcjs.methodVariantOf.call(void 0, observation.biomarkerCode, observation.methodLoinc) ? observation.methodLoinc : void 0;
|
|
2606
|
+
const loincCode = _nullishCoalesce(methodLoinc, () => ( _chunkIUZBIR2Gcjs.codeToLoinc.call(void 0, observation.biomarkerCode)));
|
|
2607
|
+
const sourceUnit = observation.unit || _chunkJ5EPYPJRcjs.getDefaultUnit.call(void 0, observation.biomarkerCode) || observation.unit;
|
|
2608
|
+
const ucumUnit = _chunkJ5EPYPJRcjs.resolveUcum.call(void 0, sourceUnit, observation.biomarkerCode);
|
|
2609
2609
|
const quantity = (value) => ({
|
|
2610
2610
|
...ucumUnit ? { code: ucumUnit, system: "http://unitsofmeasure.org" } : {},
|
|
2611
2611
|
...sourceUnit ? { unit: sourceUnit } : {},
|
|
@@ -2814,4 +2814,4 @@ function labResultToFHIRBundle(report, observations, userProfile) {
|
|
|
2814
2814
|
|
|
2815
2815
|
|
|
2816
2816
|
exports.BUNDLE_BASE_URL = BUNDLE_BASE_URL; exports.entryFullUrl = entryFullUrl; exports.LOINC_SNAPSHOT = LOINC_SNAPSHOT; exports.getLoincEntry = getLoincEntry; exports.labObservationToFHIR = labObservationToFHIR; exports.labReportToFHIR = labReportToFHIR; exports.userProfileToFHIR = userProfileToFHIR; exports.labResultToFHIRBundle = labResultToFHIRBundle;
|
|
2817
|
-
//# sourceMappingURL=chunk-
|
|
2817
|
+
//# sourceMappingURL=chunk-FTIECHT4.cjs.map
|