@openhealth/oht-custom-parser-lib 0.5.55 → 0.5.57
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/index.d.ts +3 -2
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/service/auxiliaryFunctions.service.d.ts +1 -8
- package/dist/service/auxiliaryFunctions.service.js +40 -11
- package/dist/service/auxiliaryFunctions.service.js.map +1 -1
- package/dist/service/ohtAgnosticMeasurementsExtractor.service.d.ts +59 -0
- package/dist/service/ohtAgnosticMeasurementsExtractor.service.js +603 -0
- package/dist/service/ohtAgnosticMeasurementsExtractor.service.js.map +1 -0
- package/dist/service/ohtReportMeasurementsExtractor.service.d.ts +2 -4
- package/dist/service/ohtReportMeasurementsExtractor.service.js +52 -64
- package/dist/service/ohtReportMeasurementsExtractor.service.js.map +1 -1
- package/dist/service/parsingErrorService.service.d.ts +40 -0
- package/dist/service/parsingErrorService.service.js +251 -0
- package/dist/service/parsingErrorService.service.js.map +1 -0
- package/dist/service/processingLogger.service.d.ts +5 -0
- package/dist/service/processingLogger.service.js +52 -1
- package/dist/service/processingLogger.service.js.map +1 -1
- package/dist/types/error.types.d.ts +104 -0
- package/dist/types/error.types.js +240 -1
- package/dist/types/error.types.js.map +1 -1
- package/dist/util-ts/dataUtils.d.ts +1 -0
- package/dist/util-ts/dataUtils.js +15 -1
- package/dist/util-ts/dataUtils.js.map +1 -1
- package/dist/util-ts/mapperUtils.d.ts +2 -1
- package/dist/util-ts/mapperUtils.js +12 -3
- package/dist/util-ts/mapperUtils.js.map +1 -1
- package/package.json +1 -1
- package/dist/util-ts/loincMapping.d.ts +0 -5
- package/dist/util-ts/loincMapping.js +0 -81
- package/dist/util-ts/loincMapping.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,10 +7,11 @@ export { aggregateMessages, aggregateBiMessages, publishToTopic, generateBIMessa
|
|
|
7
7
|
export { applyRules as applyTransformationRules, validateJsonataExpression as validateTransformationRuleExpression, } from './service/transformationRules.service';
|
|
8
8
|
export { LabToOhtContract, LabToOhtMapper, UnknownMeasurementExtraction, ReferenceAsAnnotation, UnitExtraction, RangeExtraction, RangeExtractionResponse, ValueExtraction, unitSynonyms, ValueExtractionResponse, SynonymUnit, UnknownUnits, TransformationRulesChains, } from './types/custom-parser.types';
|
|
9
9
|
export { AcfBiomarkerRangeAnnotationCheck, AcfBiomarkerGenericDisclaimerLogic, ManualCheck, BiomarkerCompatibility, ReferenceRangeType, AcfReferenceRange, VisualRange, NameAlias, AlternativeUnit, BiomarkerAcf, Biomarker, PipelineStep, DigitizationStatus, MeasurementValueComparator, BiomarkerValueType, DataImportFileUploadStatus, Sex, Digitization, PatientInfo, UnknownMeasurement, UnmappedLabKey, Measurement, DataImportFileUpload, MessagePayload, SignedUpload, ReportStyleConfig, LanguageCode, BiomarkerCustomisation, PartnerCustomPanel, ReportDisplaySettings, ReportCustomisation, OHTPartner, UploadType, PartnerCustomization, RejectReason, AnnotationLabKey, ExtractionPath, AnnotationConfig, OhtReport, OhtMetadata, OhtPatient, Exam, OhtExam, ExamKind, OhtRange, OriginalExam, } from './types/oht.types';
|
|
10
|
-
export { ErrorMessage, ErrorCode, ERROR_CATALOG, ERROR_MESSAGES, getErrorMessage, getRejectReason, } from './types/error.types';
|
|
10
|
+
export { ErrorMessage, ErrorCode, ERROR_CATALOG, ERROR_MESSAGES, getErrorMessage, getRejectReason, ParsingErrorType, ParsingErrorSeverity, PARSING_ERROR_CATALOG, LocalParsingError, ErrorProfilePayload, RecordParsingErrorDetails, } from './types/error.types';
|
|
11
11
|
export { handleError, ValidationError, JSON_VALIDATION_ERROR_NAME, shouldSendSlackNotification, extractFormattedRejectReason, mapErrorToRejectReason, } from './service/fileUploadErrorHandler.service';
|
|
12
12
|
export type { TransformationRule, TransformationContext, ApplyRulesResult as TransformationApplyRulesResult, ApplyRulesOptions as TransformationApplyRulesOptions, ValidationResult as TransformationValidationResult, } from './types/transformationRules.types';
|
|
13
|
-
export { processingLogger, ProcessingContext, StageDuration, getRequestIdFromContext, getRequestScopedFilename, runWithContext, runWithContextAsync, } from './service/processingLogger.service';
|
|
13
|
+
export { processingLogger, ProcessingContext, StageDuration, getRequestIdFromContext, getCurrentRequestId, getRequestScopedFilename, runWithContext, runWithContextAsync, } from './service/processingLogger.service';
|
|
14
|
+
export { parsingErrorService, initParsingErrorRequestState, clearParsingErrorRequestState, } from './service/parsingErrorService.service';
|
|
14
15
|
export { makeApiCallWithRetry, parseErrorObj } from './util-ts/apiUtils';
|
|
15
16
|
export { extractValue, isBiomarkerValueNumerical, isBiomarkerExternalNoVisualRange, processAppendedMappings, fetchSynonymUnits, resolveUnitFromSynonyms, extractFromPath, applyFormat } from './util-ts/dataUtils';
|
|
16
17
|
export { readFileFromBucket, uploadFileBufferToGCS } from './util-ts/googleStorageUtils';
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
exports.mapToOhtReport = exports.fetchActiveMappingRules = exports.lisXmlToJson = exports.lisCsvToExamRows = exports.parseRange = exports.getMappedBiomarkersLatest = exports.getMappedBiomarkers = exports.getLowerThanPatterns = exports.getGreaterThanPatterns = exports.pinoLogger = exports.uploadFileBufferToGCS = exports.readFileFromBucket = exports.applyFormat = exports.extractFromPath = exports.resolveUnitFromSynonyms = exports.fetchSynonymUnits = exports.processAppendedMappings = exports.isBiomarkerExternalNoVisualRange = exports.isBiomarkerValueNumerical = exports.extractValue = exports.parseErrorObj = exports.makeApiCallWithRetry = exports.runWithContextAsync = exports.runWithContext = exports.getRequestScopedFilename = exports.getRequestIdFromContext = exports.processingLogger = exports.mapErrorToRejectReason = exports.extractFormattedRejectReason = void 0;
|
|
6
|
+
exports.ValidationError = exports.handleError = exports.PARSING_ERROR_CATALOG = exports.ParsingErrorType = exports.getRejectReason = exports.getErrorMessage = exports.ERROR_MESSAGES = exports.ERROR_CATALOG = exports.ErrorCode = exports.RejectReason = exports.UploadType = exports.Sex = exports.DataImportFileUploadStatus = exports.BiomarkerValueType = exports.MeasurementValueComparator = exports.DigitizationStatus = exports.PipelineStep = exports.ReferenceRangeType = exports.BiomarkerCompatibility = exports.ManualCheck = exports.AcfBiomarkerGenericDisclaimerLogic = exports.AcfBiomarkerRangeAnnotationCheck = exports.unitSynonyms = exports.validateTransformationRuleExpression = exports.applyTransformationRules = exports.generateBIMessages = exports.publishToTopic = exports.aggregateBiMessages = exports.aggregateMessages = exports.sendMessageToSlack = exports.getSlackFileIssueNotificationMessage = exports.extractValueFromGreaterLowerThan = exports.extractUnit = exports.getRangeFromPositionAndRegex = exports.parseExamValue = exports.extractReferenceAnnotation = exports.extractReferenceRanges = exports.checkValueForPlausibleValues = exports.ohtMeasurementsExtractor = exports.ohtReportMeasurementsExtractor = exports.getPartnerTransformationRules = exports.postFileUploadSetStatus = exports.queryFileUploadsWithFilters = exports.handleRejection = exports.getPatientAge = exports.isPatientAgeValid = exports.parseGender = exports.parseExternalPatientId = exports.postReportPreviewToCore = exports.postDataImportFileUploadToCore = void 0;
|
|
7
|
+
exports.mapToOhtReport = exports.fetchActiveMappingRules = exports.lisXmlToJson = exports.lisCsvToExamRows = exports.parseRange = exports.getMappedBiomarkersLatest = exports.getMappedBiomarkers = exports.getLowerThanPatterns = exports.getGreaterThanPatterns = exports.pinoLogger = exports.uploadFileBufferToGCS = exports.readFileFromBucket = exports.applyFormat = exports.extractFromPath = exports.resolveUnitFromSynonyms = exports.fetchSynonymUnits = exports.processAppendedMappings = exports.isBiomarkerExternalNoVisualRange = exports.isBiomarkerValueNumerical = exports.extractValue = exports.parseErrorObj = exports.makeApiCallWithRetry = exports.clearParsingErrorRequestState = exports.initParsingErrorRequestState = exports.parsingErrorService = exports.runWithContextAsync = exports.runWithContext = exports.getRequestScopedFilename = exports.getCurrentRequestId = exports.getRequestIdFromContext = exports.processingLogger = exports.mapErrorToRejectReason = exports.extractFormattedRejectReason = exports.shouldSendSlackNotification = exports.JSON_VALIDATION_ERROR_NAME = void 0;
|
|
8
8
|
// ### SERVICES ###
|
|
9
9
|
var reportCreator_service_1 = require("./service/reportCreator.service");
|
|
10
10
|
Object.defineProperty(exports, "postDataImportFileUploadToCore", { enumerable: true, get: function () { return reportCreator_service_1.postDataImportFileUploadToCore; } });
|
|
@@ -63,6 +63,8 @@ Object.defineProperty(exports, "ERROR_CATALOG", { enumerable: true, get: functio
|
|
|
63
63
|
Object.defineProperty(exports, "ERROR_MESSAGES", { enumerable: true, get: function () { return error_types_1.ERROR_MESSAGES; } });
|
|
64
64
|
Object.defineProperty(exports, "getErrorMessage", { enumerable: true, get: function () { return error_types_1.getErrorMessage; } });
|
|
65
65
|
Object.defineProperty(exports, "getRejectReason", { enumerable: true, get: function () { return error_types_1.getRejectReason; } });
|
|
66
|
+
Object.defineProperty(exports, "ParsingErrorType", { enumerable: true, get: function () { return error_types_1.ParsingErrorType; } });
|
|
67
|
+
Object.defineProperty(exports, "PARSING_ERROR_CATALOG", { enumerable: true, get: function () { return error_types_1.PARSING_ERROR_CATALOG; } });
|
|
66
68
|
var fileUploadErrorHandler_service_1 = require("./service/fileUploadErrorHandler.service");
|
|
67
69
|
Object.defineProperty(exports, "handleError", { enumerable: true, get: function () { return fileUploadErrorHandler_service_1.handleError; } });
|
|
68
70
|
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return fileUploadErrorHandler_service_1.ValidationError; } });
|
|
@@ -74,9 +76,14 @@ Object.defineProperty(exports, "mapErrorToRejectReason", { enumerable: true, get
|
|
|
74
76
|
var processingLogger_service_1 = require("./service/processingLogger.service");
|
|
75
77
|
Object.defineProperty(exports, "processingLogger", { enumerable: true, get: function () { return processingLogger_service_1.processingLogger; } });
|
|
76
78
|
Object.defineProperty(exports, "getRequestIdFromContext", { enumerable: true, get: function () { return processingLogger_service_1.getRequestIdFromContext; } });
|
|
79
|
+
Object.defineProperty(exports, "getCurrentRequestId", { enumerable: true, get: function () { return processingLogger_service_1.getCurrentRequestId; } });
|
|
77
80
|
Object.defineProperty(exports, "getRequestScopedFilename", { enumerable: true, get: function () { return processingLogger_service_1.getRequestScopedFilename; } });
|
|
78
81
|
Object.defineProperty(exports, "runWithContext", { enumerable: true, get: function () { return processingLogger_service_1.runWithContext; } });
|
|
79
82
|
Object.defineProperty(exports, "runWithContextAsync", { enumerable: true, get: function () { return processingLogger_service_1.runWithContextAsync; } });
|
|
83
|
+
var parsingErrorService_service_1 = require("./service/parsingErrorService.service");
|
|
84
|
+
Object.defineProperty(exports, "parsingErrorService", { enumerable: true, get: function () { return parsingErrorService_service_1.parsingErrorService; } });
|
|
85
|
+
Object.defineProperty(exports, "initParsingErrorRequestState", { enumerable: true, get: function () { return parsingErrorService_service_1.initParsingErrorRequestState; } });
|
|
86
|
+
Object.defineProperty(exports, "clearParsingErrorRequestState", { enumerable: true, get: function () { return parsingErrorService_service_1.clearParsingErrorRequestState; } });
|
|
80
87
|
// ### UTIL-TS ###
|
|
81
88
|
var apiUtils_1 = require("./util-ts/apiUtils");
|
|
82
89
|
Object.defineProperty(exports, "makeApiCallWithRetry", { enumerable: true, get: function () { return apiUtils_1.makeApiCallWithRetry; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;AAAA,mBAAmB;AACnB,yEAGyC;AAFvC,uIAAA,8BAA8B,OAAA;AAC9B,gIAAA,uBAAuB,OAAA;AAEzB,mFAU8C;AAT5C,oIAAA,sBAAsB,OAAA;AACtB,yHAAA,WAAW,OAAA;AACX,+HAAA,iBAAiB,OAAA;AACjB,2HAAA,aAAa,OAAA;AACb,6HAAA,eAAe,OAAA;AACf,yIAAA,2BAA2B,OAAA;AAC3B,qIAAA,u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ChB,2GAAA,YAAY,OAAA;AACZ,sHAAA,uBAAuB,OAAA;AAIzB,4BAA4B;AAC5B,6EAAmE;AAA1D,yHAAA,cAAc,OAAA"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ErrorMessage } from '../types/error.types';
|
|
2
1
|
import { DataImportFileUpload, DataImportFileUploadStatus, DigitizationStatus, PipelineStep, RejectReason, Sex } from "../types/oht.types";
|
|
3
2
|
import dayjs from 'dayjs';
|
|
4
3
|
import { TransformationRulesChains } from "../types/custom-parser.types";
|
|
@@ -12,14 +11,8 @@ declare function parseGender(patientGender?: string): {
|
|
|
12
11
|
/**
|
|
13
12
|
* Maps parse type and error context to appropriate rejection reason
|
|
14
13
|
* Uses a priority-based approach to ensure the most specific reason is selected
|
|
15
|
-
*
|
|
16
|
-
* @param parseType - The type of parsing that failed (e.g., "age", "exam date", "units")
|
|
17
|
-
* @param errorMessages - Array to append error messages to
|
|
18
|
-
* @param notifySlack - notifySlack
|
|
19
|
-
* @param notifyNotes - notifyNotes
|
|
20
|
-
* @returns Object containing rejectedStatus and rejectReason
|
|
21
14
|
*/
|
|
22
|
-
declare function handleRejection(parseType: string,
|
|
15
|
+
declare function handleRejection(parseType: string, notifySlack?: boolean, notifyNotes?: boolean, notifyBi?: boolean): {
|
|
23
16
|
rejectedStatus: string;
|
|
24
17
|
rejectReason: RejectReason.INVALID_DATA_NO_BIOMARKER_DATA | RejectReason.LOW_IMAGE_QUALITY | RejectReason.NO_IN_PANEL_BIOMARKER | RejectReason.UNDERAGE_PERSON | RejectReason.LANGUAGE_NOT_SUPPORTED | RejectReason.IMPLAUSIBLE_DATA | RejectReason.MISSING_EXAM_DATE | RejectReason.MISSING_LAB_ORDER_ID | RejectReason.MISSING_EXTERNAL_PATIENT_ID | RejectReason.MISSING_PATIENT_SEX | RejectReason.MISSING_PATIENT_BIRTHDATE | RejectReason.UNSUPPORTED_UPLOAD | RejectReason.INCOMPLETE_DATA | RejectReason.NOT_AN_OFFICIAL_REPORT;
|
|
25
18
|
};
|
|
@@ -14,6 +14,8 @@ exports.getPartnerTransformationRules = getPartnerTransformationRules;
|
|
|
14
14
|
const moment_1 = __importDefault(require("moment/moment"));
|
|
15
15
|
const apiUtils_1 = require("../util-ts/apiUtils");
|
|
16
16
|
const processingLogger_service_1 = require("./processingLogger.service");
|
|
17
|
+
const parsingErrorService_service_1 = require("./parsingErrorService.service");
|
|
18
|
+
const error_types_1 = require("../types/error.types");
|
|
17
19
|
const oht_types_1 = require("../types/oht.types");
|
|
18
20
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
19
21
|
const customParseFormat_1 = __importDefault(require("dayjs/plugin/customParseFormat"));
|
|
@@ -57,14 +59,8 @@ function parseGender(patientGender) {
|
|
|
57
59
|
/**
|
|
58
60
|
* Maps parse type and error context to appropriate rejection reason
|
|
59
61
|
* Uses a priority-based approach to ensure the most specific reason is selected
|
|
60
|
-
*
|
|
61
|
-
* @param parseType - The type of parsing that failed (e.g., "age", "exam date", "units")
|
|
62
|
-
* @param errorMessages - Array to append error messages to
|
|
63
|
-
* @param notifySlack - notifySlack
|
|
64
|
-
* @param notifyNotes - notifyNotes
|
|
65
|
-
* @returns Object containing rejectedStatus and rejectReason
|
|
66
62
|
*/
|
|
67
|
-
function handleRejection(parseType,
|
|
63
|
+
function handleRejection(parseType, notifySlack = true, notifyNotes = false, notifyBi = false) {
|
|
68
64
|
const rejectedStatus = 'REJECTED';
|
|
69
65
|
const lowerParseType = parseType.toLowerCase();
|
|
70
66
|
// Priority-based mapping: check most specific cases first
|
|
@@ -138,12 +134,45 @@ function handleRejection(parseType, errorMessages, notifySlack = true, notifyNot
|
|
|
138
134
|
else {
|
|
139
135
|
rejectReason = oht_types_1.RejectReason.INVALID_DATA_NO_BIOMARKER_DATA;
|
|
140
136
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
137
|
+
const errorType = resolveRejectionParsingErrorType(lowerParseType, rejectReason);
|
|
138
|
+
const messageSuffix = errorType === error_types_1.ParsingErrorType.FATAL_VALIDATION
|
|
139
|
+
? `File rejected: ${parseType} parsing failed. Reason: ${rejectReason}`
|
|
140
|
+
: String(rejectReason);
|
|
141
|
+
parsingErrorService_service_1.parsingErrorService.record(errorType, {
|
|
142
|
+
messageSuffix,
|
|
143
|
+
rejectReason,
|
|
144
|
+
}, { notifySlack, notifyNotes, notifyBi });
|
|
145
145
|
return { rejectedStatus, rejectReason };
|
|
146
146
|
}
|
|
147
|
+
function resolveRejectionParsingErrorType(lowerParseType, rejectReason) {
|
|
148
|
+
if (lowerParseType === 'patientage' || lowerParseType === 'patient age') {
|
|
149
|
+
return error_types_1.ParsingErrorType.REJECTED_UNDERAGE_PATIENT;
|
|
150
|
+
}
|
|
151
|
+
if (lowerParseType === 'patientexternalid' ||
|
|
152
|
+
lowerParseType === 'patient external id' ||
|
|
153
|
+
lowerParseType === 'patient externalid') {
|
|
154
|
+
return error_types_1.ParsingErrorType.REJECTED_MISSING_PATIENT_ID;
|
|
155
|
+
}
|
|
156
|
+
if (lowerParseType === 'patientsex' || lowerParseType === 'patient sex') {
|
|
157
|
+
return error_types_1.ParsingErrorType.REJECTED_MISSING_PATIENT_SEX;
|
|
158
|
+
}
|
|
159
|
+
if (lowerParseType.includes('biomarker')) {
|
|
160
|
+
return error_types_1.ParsingErrorType.REJECTED_NO_BIOMARKERS;
|
|
161
|
+
}
|
|
162
|
+
if (rejectReason === oht_types_1.RejectReason.UNDERAGE_PERSON) {
|
|
163
|
+
return error_types_1.ParsingErrorType.REJECTED_UNDERAGE_PATIENT;
|
|
164
|
+
}
|
|
165
|
+
if (rejectReason === oht_types_1.RejectReason.MISSING_EXTERNAL_PATIENT_ID) {
|
|
166
|
+
return error_types_1.ParsingErrorType.REJECTED_MISSING_PATIENT_ID;
|
|
167
|
+
}
|
|
168
|
+
if (rejectReason === oht_types_1.RejectReason.MISSING_PATIENT_SEX) {
|
|
169
|
+
return error_types_1.ParsingErrorType.REJECTED_MISSING_PATIENT_SEX;
|
|
170
|
+
}
|
|
171
|
+
if (rejectReason === oht_types_1.RejectReason.NO_IN_PANEL_BIOMARKER) {
|
|
172
|
+
return error_types_1.ParsingErrorType.REJECTED_NO_BIOMARKERS;
|
|
173
|
+
}
|
|
174
|
+
return error_types_1.ParsingErrorType.FATAL_VALIDATION;
|
|
175
|
+
}
|
|
147
176
|
async function queryFileUploadsWithFilters(filters, ohtCoreApiKey) {
|
|
148
177
|
const OHT_CORE_URL = process.env.OHT_CORE_URL;
|
|
149
178
|
const ohtCoreUrl = `${OHT_CORE_URL}/v1/file-uploads/query`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auxiliaryFunctions.service.js","sourceRoot":"","sources":["../../service/auxiliaryFunctions.service.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"auxiliaryFunctions.service.js","sourceRoot":"","sources":["../../service/auxiliaryFunctions.service.ts"],"names":[],"mappings":";;;;;AA8VE,wDAAsB;AACtB,kCAAW;AACX,8CAAiB;AACjB,sCAAa;AACb,0CAAe;AACf,kEAA2B;AAC3B,0DAAuB;AACvB,sEAA6B;AArW/B,2DAAmC;AACnC,kDAAyD;AACzD,yEAA8D;AAC9D,+EAAoE;AACpE,sDAAwD;AACxD,kDAA+M;AAC/M,kDAA0B;AAC1B,uFAA+D;AAC/D,2DAAmC;AAInC,eAAK,CAAC,MAAM,CAAC,2BAAiB,CAAC,CAAC;AAChC,eAAK,CAAC,MAAM,CAAC,aAAG,CAAC,CAAC;AAElB,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;AAE9C,SAAS,aAAa,CAAC,YAAmB,EAAE,gBAAuB;IAC/D,IAAI,CAAC,gBAAgB,IAAI,CAAC,YAAY;QAAE,OAAO,IAAI,CAAC;IAEpD,2DAA2D;IAC3D,MAAM,OAAO,GAAG,IAAA,gBAAM,EAAC,YAAY,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;I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AC;YAChI,CAAC;YAED,OAAO,IAAI,CAAC;QAChB,CAAC,CAAC;aACD,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CACxC,CAAC;IACN,CAAC,EAAE,IAAI,GAAG,EAAgC,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { LabToOhtContract, LabToOhtMapper, RangeExtractionResponse, SynonymUnit, UnknownUnits, TransformationRulesChains } from "../types/custom-parser.types";
|
|
2
|
+
import { Biomarker, BiomarkerValueType, Measurement, MeasurementValueComparator, PatientInfo, UnknownMeasurement, Exam } from "../types/oht.types";
|
|
3
|
+
/**
|
|
4
|
+
* Extracts unit from rawData (OhtExam object)
|
|
5
|
+
* @param rawData - OhtExam object (not a JSON string)
|
|
6
|
+
* @param ohtBiomarker - Biomarker information
|
|
7
|
+
* @param synonymUnits - Synonym units for unit resolution
|
|
8
|
+
* @param partnerId - Partner ID for synonym resolution
|
|
9
|
+
*/
|
|
10
|
+
declare function agnosticExtractUnit(rawData: any, ohtBiomarker: Biomarker, synonymUnits?: SynonymUnit[] | null, partnerId?: string | null | undefined): {
|
|
11
|
+
unit: string;
|
|
12
|
+
isUnitParsedCorrectly: boolean;
|
|
13
|
+
originalUnit: string;
|
|
14
|
+
isArbitraryUnit: boolean;
|
|
15
|
+
unknownUnit: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Extracts reference annotation from rawExam (OhtExam object)
|
|
19
|
+
* @param labToOhtMapper - Lab to OHT mapper configuration
|
|
20
|
+
* @param rawExam - OhtExam object (not a JSON string)
|
|
21
|
+
* @param patientInfo - Patient information
|
|
22
|
+
* @param documentDate - Document date
|
|
23
|
+
* @param exams - Array of exams for appended mappings
|
|
24
|
+
*/
|
|
25
|
+
declare function agnosticExtractReferenceAnnotation(labToOhtMapper: LabToOhtMapper, rawExam: any, patientInfo: PatientInfo, documentDate?: Date, exams?: Exam[]): string;
|
|
26
|
+
/**
|
|
27
|
+
* Extracts reference ranges from rawData (OhtExam object)
|
|
28
|
+
* Always uses parseRange function from extractionUtils for range extraction
|
|
29
|
+
*/
|
|
30
|
+
declare function agnosticExtractReferenceRanges(labToOhtMapper: LabToOhtMapper, rawData: any, patientInfo: PatientInfo, documentDate?: Date): RangeExtractionResponse;
|
|
31
|
+
declare function agnosticExtractValueFromGreaterLowerThan(value: string): {
|
|
32
|
+
extractedValue: number | null;
|
|
33
|
+
extractedValueComparator: MeasurementValueComparator | null;
|
|
34
|
+
valueParsedCorrectly: boolean;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Parses exam value from rawExamObj (OhtExam object)
|
|
38
|
+
* Now uses value directly from ohtExam
|
|
39
|
+
*/
|
|
40
|
+
declare function agnosticParseExamValue(rawExamObj: any, ohtBiomarker: Biomarker): {
|
|
41
|
+
valueType: BiomarkerValueType;
|
|
42
|
+
alphanumericalValue: string | null;
|
|
43
|
+
numberValue: number | null;
|
|
44
|
+
valueComparator: MeasurementValueComparator;
|
|
45
|
+
isValueParsedCorrectly: boolean;
|
|
46
|
+
};
|
|
47
|
+
declare function agnosticCheckValueForPlausibleValues(labToOhtMapper: LabToOhtMapper, ohtBiomarker: Biomarker, unit: string, value: number, isUnitParsedCorrectly: boolean): boolean;
|
|
48
|
+
type ApplyTransformationRulesResult = {
|
|
49
|
+
transformedExams: Exam[];
|
|
50
|
+
applicationErrorMessages: string[];
|
|
51
|
+
};
|
|
52
|
+
declare function ohtAgnosticMeasurementsExtractor(labToOhtContract: LabToOhtContract, exams: Exam[], transformationRules: TransformationRulesChains, ohtCoreApiKey: string, partnerId?: string | null | undefined): Promise<{
|
|
53
|
+
measurements: Measurement[];
|
|
54
|
+
unknownMeasurements: UnknownMeasurement[];
|
|
55
|
+
unknownUnits: UnknownUnits[];
|
|
56
|
+
isReportCorrectlyParsed: boolean;
|
|
57
|
+
transformationRulesErrors: string[];
|
|
58
|
+
}>;
|
|
59
|
+
export { ApplyTransformationRulesResult, ohtAgnosticMeasurementsExtractor, agnosticCheckValueForPlausibleValues, agnosticExtractReferenceRanges, agnosticExtractReferenceAnnotation, agnosticParseExamValue, agnosticExtractUnit, agnosticExtractValueFromGreaterLowerThan };
|