@openhealth/oht-custom-parser-lib 0.4.3 → 0.5.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/index.d.ts +3 -1
- package/dist/index.js +21 -2
- package/dist/index.js.map +1 -1
- package/dist/service/auxiliaryFunctions.service.d.ts +2 -0
- package/dist/service/auxiliaryFunctions.service.js +4 -3
- package/dist/service/auxiliaryFunctions.service.js.map +1 -1
- package/dist/service/fileUploadErrorHandler.service.d.ts +26 -0
- package/dist/service/fileUploadErrorHandler.service.js +257 -0
- package/dist/service/fileUploadErrorHandler.service.js.map +1 -0
- package/dist/service/ohtMeasurementsExtractor.service.js +24 -25
- package/dist/service/ohtMeasurementsExtractor.service.js.map +1 -1
- package/dist/service/ohtReportMeasurementsExtractor.service.d.ts +1 -0
- package/dist/service/ohtReportMeasurementsExtractor.service.js +35 -39
- package/dist/service/ohtReportMeasurementsExtractor.service.js.map +1 -1
- package/dist/service/processingLogger.service.d.ts +150 -0
- package/dist/service/processingLogger.service.js +533 -0
- package/dist/service/processingLogger.service.js.map +1 -0
- package/dist/service/reportCreator.service.d.ts +1 -1
- package/dist/service/reportCreator.service.js +53 -65
- package/dist/service/reportCreator.service.js.map +1 -1
- package/dist/service/slackMessages.service.js +4 -5
- package/dist/service/slackMessages.service.js.map +1 -1
- package/dist/service/transformationRules.service.js +3 -10
- package/dist/service/transformationRules.service.js.map +1 -1
- package/dist/types/error.types.d.ts +82 -0
- package/dist/types/error.types.js +195 -0
- package/dist/types/error.types.js.map +1 -1
- package/dist/types/oht.types.d.ts +5 -1
- package/dist/types/oht.types.js +4 -0
- package/dist/types/oht.types.js.map +1 -1
- package/dist/util-ts/apiUtils.js +2 -3
- package/dist/util-ts/apiUtils.js.map +1 -1
- package/dist/util-ts/dataUtils.d.ts +4 -3
- package/dist/util-ts/dataUtils.js +30 -19
- package/dist/util-ts/dataUtils.js.map +1 -1
- package/dist/util-ts/extractionUtils.js +4 -8
- package/dist/util-ts/extractionUtils.js.map +1 -1
- package/dist/util-ts/pinoLogger.js +28 -1
- package/dist/util-ts/pinoLogger.js.map +1 -1
- package/package.json +36 -34
- package/readme.md +115 -99
- package/dist/service/ohtAgnosticMeasurementsExtractor.service.d.ts +0 -59
- package/dist/service/ohtAgnosticMeasurementsExtractor.service.js +0 -603
- package/dist/service/ohtAgnosticMeasurementsExtractor.service.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,8 +7,10 @@ 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, } 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, RejectReason, AnnotationLabKey, ExtractionPath, AnnotationConfig, } from './types/oht.types';
|
|
10
|
-
export { ErrorMessage } from './types/error.types';
|
|
10
|
+
export { ErrorMessage, ErrorCode, ERROR_CATALOG, ERROR_MESSAGES, getErrorMessage, getRejectReason, } from './types/error.types';
|
|
11
|
+
export { handleError, ValidationError, shouldSendSlackNotification, extractFormattedRejectReason, mapErrorToRejectReason, } from './service/fileUploadErrorHandler.service';
|
|
11
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';
|
|
12
14
|
export { makeApiCallWithRetry, parseErrorObj } from './util-ts/apiUtils';
|
|
13
15
|
export { extractValue, isBiomarkerValueNumerical, isBiomarkerExternalNoVisualRange, processAppendedMappings, fetchSynonymUnits, resolveUnitFromSynonyms, extractFromPath, applyFormat } from './util-ts/dataUtils';
|
|
14
16
|
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.parseRange = exports.getMappedBiomarkersLatest = exports.getMappedBiomarkers = exports.getLowerThanPatterns = exports.getGreaterThanPatterns = exports.pinoLogger = exports.uploadFileBufferToGCS = void 0;
|
|
6
|
+
exports.processingLogger = exports.mapErrorToRejectReason = exports.extractFormattedRejectReason = exports.shouldSendSlackNotification = exports.ValidationError = exports.handleError = 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.postFileUploadSetStatus = exports.queryFileUploadsWithFilters = exports.handleRejection = exports.isPatientAgeValid = exports.parseGender = exports.parseExternalPatientId = exports.postReportPreviewToCore = exports.postDataImportFileUploadToCore = void 0;
|
|
7
|
+
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 = 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; } });
|
|
@@ -55,6 +55,25 @@ Object.defineProperty(exports, "DataImportFileUploadStatus", { enumerable: true,
|
|
|
55
55
|
Object.defineProperty(exports, "Sex", { enumerable: true, get: function () { return oht_types_1.Sex; } });
|
|
56
56
|
Object.defineProperty(exports, "UploadType", { enumerable: true, get: function () { return oht_types_1.UploadType; } });
|
|
57
57
|
Object.defineProperty(exports, "RejectReason", { enumerable: true, get: function () { return oht_types_1.RejectReason; } });
|
|
58
|
+
var error_types_1 = require("./types/error.types");
|
|
59
|
+
Object.defineProperty(exports, "ErrorCode", { enumerable: true, get: function () { return error_types_1.ErrorCode; } });
|
|
60
|
+
Object.defineProperty(exports, "ERROR_CATALOG", { enumerable: true, get: function () { return error_types_1.ERROR_CATALOG; } });
|
|
61
|
+
Object.defineProperty(exports, "ERROR_MESSAGES", { enumerable: true, get: function () { return error_types_1.ERROR_MESSAGES; } });
|
|
62
|
+
Object.defineProperty(exports, "getErrorMessage", { enumerable: true, get: function () { return error_types_1.getErrorMessage; } });
|
|
63
|
+
Object.defineProperty(exports, "getRejectReason", { enumerable: true, get: function () { return error_types_1.getRejectReason; } });
|
|
64
|
+
var fileUploadErrorHandler_service_1 = require("./service/fileUploadErrorHandler.service");
|
|
65
|
+
Object.defineProperty(exports, "handleError", { enumerable: true, get: function () { return fileUploadErrorHandler_service_1.handleError; } });
|
|
66
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return fileUploadErrorHandler_service_1.ValidationError; } });
|
|
67
|
+
Object.defineProperty(exports, "shouldSendSlackNotification", { enumerable: true, get: function () { return fileUploadErrorHandler_service_1.shouldSendSlackNotification; } });
|
|
68
|
+
Object.defineProperty(exports, "extractFormattedRejectReason", { enumerable: true, get: function () { return fileUploadErrorHandler_service_1.extractFormattedRejectReason; } });
|
|
69
|
+
Object.defineProperty(exports, "mapErrorToRejectReason", { enumerable: true, get: function () { return fileUploadErrorHandler_service_1.mapErrorToRejectReason; } });
|
|
70
|
+
// ### PROCESSING LOGGER ###
|
|
71
|
+
var processingLogger_service_1 = require("./service/processingLogger.service");
|
|
72
|
+
Object.defineProperty(exports, "processingLogger", { enumerable: true, get: function () { return processingLogger_service_1.processingLogger; } });
|
|
73
|
+
Object.defineProperty(exports, "getRequestIdFromContext", { enumerable: true, get: function () { return processingLogger_service_1.getRequestIdFromContext; } });
|
|
74
|
+
Object.defineProperty(exports, "getRequestScopedFilename", { enumerable: true, get: function () { return processingLogger_service_1.getRequestScopedFilename; } });
|
|
75
|
+
Object.defineProperty(exports, "runWithContext", { enumerable: true, get: function () { return processingLogger_service_1.runWithContext; } });
|
|
76
|
+
Object.defineProperty(exports, "runWithContextAsync", { enumerable: true, get: function () { return processingLogger_service_1.runWithContextAsync; } });
|
|
58
77
|
// ### UTIL-TS ###
|
|
59
78
|
var apiUtils_1 = require("./util-ts/apiUtils");
|
|
60
79
|
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,mFAQ8C;AAP5C,oIAAA,sBAAsB,OAAA;AACtB,yHAAA,WAAW,OAAA;AACX,+HAAA,iBAAiB,OAAA;AACjB,6HAAA,eAAe,OAAA;AACf,yIAAA,2BAA2B,OAAA;AAC3B,qIAAA,uBAAuB,OAAA;AAIzB,2GAE0D;AADxD,wJAAA,8BAA8B,OAAA;AAGhC,+FASoD;AARlD,4IAAA,wBAAwB,OAAA;AACxB,gJAAA,4BAA4B,OAAA;AAC5B,0IAAA,sBAAsB,OAAA;AACtB,8IAAA,0BAA0B,OAAA;AAC1B,kIAAA,cAAc,OAAA;AACd,gJAAA,4BAA4B,OAAA;AAC5B,+HAAA,WAAW,OAAA;AACX,oJAAA,gCAAgC,OAAA;AAGlC,yEAEyC;AADvC,6IAAA,oCAAoC,OAAA;AAAE,2HAAA,kBAAkB,OAAA;AAE1D,yEAKyC;AAJvC,0HAAA,iBAAiB,OAAA;AACjB,4HAAA,mBAAmB,OAAA;AACnB,uHAAA,cAAc,OAAA;AACd,2HAAA,kBAAkB,OAAA;AAEpB,qFAG+C;AAF7C,uIAAA,UAAU,OAA4B;AACtC,mJAAA,yBAAyB,OAAwC;AAGnE,g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A;AAAE,wGAAA,WAAW,OAAA;AACpL,mEAAuF;AAA/E,wHAAA,kBAAkB,OAAA;AAAE,2HAAA,qBAAqB,OAAA;AACjD,mDAA2D;AAAnD,yHAAA,OAAO,OAAc;AAC7B,mDAAkF;AAA1E,oHAAA,sBAAsB,OAAA;AAAE,kHAAA,oBAAoB,OAAA;AACpD,iDAAmF;AAA3E,gHAAA,mBAAmB,OAAA;AAAE,sHAAA,yBAAyB,OAAA;AACtD,6DAAqD;AAA7C,6GAAA,UAAU,OAAA"}
|
|
@@ -15,6 +15,8 @@ declare function parseGender(patientGender?: string): {
|
|
|
15
15
|
*
|
|
16
16
|
* @param parseType - The type of parsing that failed (e.g., "age", "exam date", "units")
|
|
17
17
|
* @param errorMessages - Array to append error messages to
|
|
18
|
+
* @param notifySlack - notifySlack
|
|
19
|
+
* @param notifyNotes - notifyNotes
|
|
18
20
|
* @returns Object containing rejectedStatus and rejectReason
|
|
19
21
|
*/
|
|
20
22
|
declare function handleRejection(parseType: string, errorMessages: ErrorMessage[], notifySlack?: boolean, notifyNotes?: boolean, notifyBi?: boolean): {
|
|
@@ -13,14 +13,13 @@ exports.postFileUploadSetStatus = postFileUploadSetStatus;
|
|
|
13
13
|
exports.getPartnerTransformationRules = getPartnerTransformationRules;
|
|
14
14
|
const moment_1 = __importDefault(require("moment/moment"));
|
|
15
15
|
const apiUtils_1 = require("../util-ts/apiUtils");
|
|
16
|
-
const
|
|
16
|
+
const processingLogger_service_1 = require("./processingLogger.service");
|
|
17
17
|
const oht_types_1 = require("../types/oht.types");
|
|
18
18
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
19
19
|
const customParseFormat_1 = __importDefault(require("dayjs/plugin/customParseFormat"));
|
|
20
20
|
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
|
21
21
|
dayjs_1.default.extend(customParseFormat_1.default);
|
|
22
22
|
dayjs_1.default.extend(utc_1.default);
|
|
23
|
-
const logger = (0, pinoLogger_1.default)();
|
|
24
23
|
const OHT_CORE_URL = process.env.OHT_CORE_URL;
|
|
25
24
|
function getPatientAge(documentDate, patientBirthdate) {
|
|
26
25
|
if (!patientBirthdate || !documentDate)
|
|
@@ -61,6 +60,8 @@ function parseGender(patientGender) {
|
|
|
61
60
|
*
|
|
62
61
|
* @param parseType - The type of parsing that failed (e.g., "age", "exam date", "units")
|
|
63
62
|
* @param errorMessages - Array to append error messages to
|
|
63
|
+
* @param notifySlack - notifySlack
|
|
64
|
+
* @param notifyNotes - notifyNotes
|
|
64
65
|
* @returns Object containing rejectedStatus and rejectReason
|
|
65
66
|
*/
|
|
66
67
|
function handleRejection(parseType, errorMessages, notifySlack = true, notifyNotes = false, notifyBi = false) {
|
|
@@ -188,7 +189,7 @@ async function postFileUploadSetStatus(payload, fileUploadId, filename, ohtCoreA
|
|
|
188
189
|
formattedPayload.digitalization = digitalization;
|
|
189
190
|
}
|
|
190
191
|
const processingResponse = await (0, apiUtils_1.makeApiCallWithRetry)('post', ohtCoreFileUploadSetStatusUrl, formattedPayload, ohtCoreApiKey);
|
|
191
|
-
|
|
192
|
+
processingLogger_service_1.processingLogger.logInfo(`Resp: POST status: ${payload.status} /file-uploads/${fileUploadId}, filename: ${filename}`, { resp: processingResponse?.data });
|
|
192
193
|
return processingResponse?.data;
|
|
193
194
|
}
|
|
194
195
|
// getPartnerTransformationRules fetches all the available partner transformation rules
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auxiliaryFunctions.service.js","sourceRoot":"","sources":["../../service/auxiliaryFunctions.service.ts"],"names":[],"mappings":";;;;;AAiTE,wDAAsB;AACtB,kCAAW;AACX,8CAAiB;AACjB,sCAAa;AACb,0CAAe;AACf,kEAA2B;AAC3B,0DAAuB;AACvB,sEAA6B;AAxT/B,2DAAmC;AAEnC,kDAAyD;AACzD,
|
|
1
|
+
{"version":3,"file":"auxiliaryFunctions.service.js","sourceRoot":"","sources":["../../service/auxiliaryFunctions.service.ts"],"names":[],"mappings":";;;;;AAiTE,wDAA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,EAAE,KAAK,IAAI,EAAE,CAA+B;SACzE,MAAM,CAAC,CAAC,GAAG,EAAE,SAAgD,EAAE,EAAE;QAC9D,OAAO,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,OAAO;aAC7C,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YACZ,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YAClC,IAAI,CAAC,IAAI,EAAE,CAAC;gBACR,MAAM,IAAI,KAAK,CAAC,+BAA+B,MAAM,eAAe,SAAS,CAAC,MAAM,0BAA0B,SAAS,GAAG,CAAC,CAAC;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,26 @@
|
|
|
1
|
+
import { RejectReason } from '../types/oht.types';
|
|
2
|
+
/**
|
|
3
|
+
* Validation error for parser/report validation (rejectReason + optional field).
|
|
4
|
+
* Used by mapErrorToRejectReason and handleError.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ValidationError extends Error {
|
|
7
|
+
rejectReason: RejectReason;
|
|
8
|
+
fieldName?: string;
|
|
9
|
+
constructor(message: string, rejectReason: RejectReason, fieldName?: string);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Whether to send Slack notification for this reject reason (not in silent list).
|
|
13
|
+
*/
|
|
14
|
+
export declare function shouldSendSlackNotification(rejectReason: RejectReason | undefined, silentRejectReasons: RejectReason[]): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Formats reject reason with field name and context for better client messages.
|
|
17
|
+
*/
|
|
18
|
+
export declare function extractFormattedRejectReason(rejectReason: RejectReason, fieldName?: string, errorMessage?: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Maps error to an appropriate RejectReason.
|
|
21
|
+
*/
|
|
22
|
+
export declare function mapErrorToRejectReason(error: Error, errorMessage: string, statusCode?: number, responseData?: any): RejectReason;
|
|
23
|
+
/**
|
|
24
|
+
* Handles file-upload processing errors: updates status, notifies Slack, logs with error_code.
|
|
25
|
+
*/
|
|
26
|
+
export declare function handleError(error: Error, fileName: string, signedUploadId: string | undefined, apiKey: string, ohapiUrl: string, cloudEventId?: string, partnerName?: string, silentRejectReasons?: RejectReason[]): Promise<void>;
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ValidationError = void 0;
|
|
7
|
+
exports.shouldSendSlackNotification = shouldSendSlackNotification;
|
|
8
|
+
exports.extractFormattedRejectReason = extractFormattedRejectReason;
|
|
9
|
+
exports.mapErrorToRejectReason = mapErrorToRejectReason;
|
|
10
|
+
exports.handleError = handleError;
|
|
11
|
+
const oht_types_1 = require("../types/oht.types");
|
|
12
|
+
const slackMessages_service_1 = require("./slackMessages.service");
|
|
13
|
+
const auxiliaryFunctions_service_1 = require("./auxiliaryFunctions.service");
|
|
14
|
+
const apiUtils_1 = require("../util-ts/apiUtils");
|
|
15
|
+
const processingLogger_service_1 = require("./processingLogger.service");
|
|
16
|
+
const error_types_1 = require("../types/error.types");
|
|
17
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
18
|
+
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
|
19
|
+
dayjs_1.default.extend(utc_1.default);
|
|
20
|
+
/**
|
|
21
|
+
* Validation error for parser/report validation (rejectReason + optional field).
|
|
22
|
+
* Used by mapErrorToRejectReason and handleError.
|
|
23
|
+
*/
|
|
24
|
+
class ValidationError extends Error {
|
|
25
|
+
constructor(message, rejectReason, fieldName) {
|
|
26
|
+
super(message);
|
|
27
|
+
this.name = 'ValidationError';
|
|
28
|
+
this.rejectReason = rejectReason;
|
|
29
|
+
this.fieldName = fieldName;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.ValidationError = ValidationError;
|
|
33
|
+
/**
|
|
34
|
+
* Whether to send Slack notification for this reject reason (not in silent list).
|
|
35
|
+
*/
|
|
36
|
+
function shouldSendSlackNotification(rejectReason, silentRejectReasons) {
|
|
37
|
+
if (!rejectReason || silentRejectReasons.length === 0) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
return !silentRejectReasons.includes(rejectReason);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Formats reject reason with field name and context for better client messages.
|
|
44
|
+
*/
|
|
45
|
+
function extractFormattedRejectReason(rejectReason, fieldName, errorMessage) {
|
|
46
|
+
const baseRejectReason = String(rejectReason);
|
|
47
|
+
if (rejectReason === oht_types_1.RejectReason.INVALID_DATA_FORMAT && errorMessage) {
|
|
48
|
+
const formattedMatch = errorMessage.match(/Invalid Data Format \[expected: ([^\]]+), received: ([^\]]+)\]/);
|
|
49
|
+
if (formattedMatch) {
|
|
50
|
+
const expectedFormat = formattedMatch[1];
|
|
51
|
+
const receivedFormat = formattedMatch[2];
|
|
52
|
+
const fieldPart = fieldName ? ` for '${fieldName}'` : '';
|
|
53
|
+
return `Invalid Data Format${fieldPart} [expected: ${expectedFormat}, received: ${receivedFormat}]`;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (fieldName) {
|
|
57
|
+
switch (rejectReason) {
|
|
58
|
+
case oht_types_1.RejectReason.INCOMPLETE_DATA:
|
|
59
|
+
if (fieldName === 'patient.id') {
|
|
60
|
+
return `Patient external ID conflict: '${fieldName}' does not match user's external reference`;
|
|
61
|
+
}
|
|
62
|
+
return `${baseRejectReason} - Missing or invalid '${fieldName}'`;
|
|
63
|
+
case oht_types_1.RejectReason.MISSING_EXAM_DATE:
|
|
64
|
+
return `${baseRejectReason} - Missing '${fieldName}'`;
|
|
65
|
+
case oht_types_1.RejectReason.MISSING_LAB_ORDER_ID:
|
|
66
|
+
return `${baseRejectReason} - Missing '${fieldName}'`;
|
|
67
|
+
case oht_types_1.RejectReason.MISSING_EXTERNAL_PATIENT_ID:
|
|
68
|
+
return `${baseRejectReason} - Missing '${fieldName}'`;
|
|
69
|
+
case oht_types_1.RejectReason.MISSING_PATIENT_SEX:
|
|
70
|
+
return `${baseRejectReason} - Missing '${fieldName}'`;
|
|
71
|
+
case oht_types_1.RejectReason.INVALID_DATA_NO_BIOMARKER_DATA:
|
|
72
|
+
return `${baseRejectReason} - Invalid '${fieldName}'`;
|
|
73
|
+
default:
|
|
74
|
+
return `${baseRejectReason} - Issue with '${fieldName}'`;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return baseRejectReason;
|
|
78
|
+
}
|
|
79
|
+
function isPatientExternalIdConflict(statusCode, errorMessage, responseData) {
|
|
80
|
+
const lowerMessage = errorMessage.toLowerCase();
|
|
81
|
+
const is409Error = statusCode === 409 ||
|
|
82
|
+
lowerMessage.includes('status code 409') ||
|
|
83
|
+
lowerMessage.includes('409');
|
|
84
|
+
if (!is409Error)
|
|
85
|
+
return false;
|
|
86
|
+
const isExplicitlyNotPatientConflict = lowerMessage.includes('duplicate') &&
|
|
87
|
+
!lowerMessage.includes('patient') &&
|
|
88
|
+
!lowerMessage.includes('external');
|
|
89
|
+
return !isExplicitlyNotPatientConflict;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Maps error to an appropriate RejectReason.
|
|
93
|
+
*/
|
|
94
|
+
function mapErrorToRejectReason(error, errorMessage, statusCode, responseData) {
|
|
95
|
+
if (isPatientExternalIdConflict(statusCode, errorMessage, responseData)) {
|
|
96
|
+
return oht_types_1.RejectReason.INCOMPLETE_DATA;
|
|
97
|
+
}
|
|
98
|
+
const hasRejectReason = error instanceof ValidationError || 'rejectReason' in error;
|
|
99
|
+
if (hasRejectReason) {
|
|
100
|
+
const rejectReason = error.rejectReason;
|
|
101
|
+
if (rejectReason !== undefined && rejectReason !== null && rejectReason !== '') {
|
|
102
|
+
return rejectReason;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const lowerMessage = errorMessage.toLowerCase();
|
|
106
|
+
if (lowerMessage.includes('invalid data format') || lowerMessage.includes('invalid format') || lowerMessage.includes('iso 8601 format')) {
|
|
107
|
+
return oht_types_1.RejectReason.INVALID_DATA_FORMAT;
|
|
108
|
+
}
|
|
109
|
+
if (lowerMessage.includes('no biomarker') || lowerMessage.includes('invalid input') || lowerMessage.includes('no measurements')) {
|
|
110
|
+
return oht_types_1.RejectReason.INVALID_DATA_NO_BIOMARKER_DATA;
|
|
111
|
+
}
|
|
112
|
+
if (lowerMessage.includes('image quality') || lowerMessage.includes('low quality')) {
|
|
113
|
+
return oht_types_1.RejectReason.LOW_IMAGE_QUALITY;
|
|
114
|
+
}
|
|
115
|
+
if (lowerMessage.includes('underage') || (lowerMessage.includes('age') && lowerMessage.includes('invalid'))) {
|
|
116
|
+
return oht_types_1.RejectReason.UNDERAGE_PERSON;
|
|
117
|
+
}
|
|
118
|
+
if (lowerMessage.includes('language') || lowerMessage.includes('unsupported language')) {
|
|
119
|
+
return oht_types_1.RejectReason.LANGUAGE_NOT_SUPPORTED;
|
|
120
|
+
}
|
|
121
|
+
if (lowerMessage.includes('implausible') || lowerMessage.includes('invalid value')) {
|
|
122
|
+
return oht_types_1.RejectReason.IMPLAUSIBLE_DATA;
|
|
123
|
+
}
|
|
124
|
+
if (lowerMessage.includes('missing exam date') || lowerMessage.includes('no date') || lowerMessage.includes('date')) {
|
|
125
|
+
return oht_types_1.RejectReason.MISSING_EXAM_DATE;
|
|
126
|
+
}
|
|
127
|
+
if (lowerMessage.includes('missing unit') || lowerMessage.includes('incomplete') || lowerMessage.includes('missing data')) {
|
|
128
|
+
return oht_types_1.RejectReason.INCOMPLETE_DATA;
|
|
129
|
+
}
|
|
130
|
+
if (lowerMessage.includes('not an official') || lowerMessage.includes('not official')) {
|
|
131
|
+
return oht_types_1.RejectReason.NOT_AN_OFFICIAL_REPORT;
|
|
132
|
+
}
|
|
133
|
+
if (lowerMessage.includes('missing external patient') || lowerMessage.includes('missing patient id')) {
|
|
134
|
+
return oht_types_1.RejectReason.MISSING_EXTERNAL_PATIENT_ID;
|
|
135
|
+
}
|
|
136
|
+
if (lowerMessage.includes('unsupported') || lowerMessage.includes('not supported')) {
|
|
137
|
+
return oht_types_1.RejectReason.UNSUPPORTED_UPLOAD;
|
|
138
|
+
}
|
|
139
|
+
return oht_types_1.RejectReason.UNSUPPORTED_UPLOAD;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Handles file-upload processing errors: updates status, notifies Slack, logs with error_code.
|
|
143
|
+
*/
|
|
144
|
+
async function handleError(error, fileName, signedUploadId, apiKey, ohapiUrl, cloudEventId, partnerName, silentRejectReasons = []) {
|
|
145
|
+
const errorDetails = (0, apiUtils_1.parseErrorObj)(error);
|
|
146
|
+
const responseData = errorDetails.responseData;
|
|
147
|
+
const statusCode = errorDetails.status;
|
|
148
|
+
const axiosStatusCode = error.response?.status;
|
|
149
|
+
const finalStatusCode = statusCode || axiosStatusCode;
|
|
150
|
+
const errorMessage = responseData
|
|
151
|
+
? `${error.message} - Response: ${JSON.stringify(responseData)}`
|
|
152
|
+
: error.message || 'Unknown error occurred';
|
|
153
|
+
const isIngestionError = finalStatusCode === 409 ||
|
|
154
|
+
errorMessage.toLowerCase().includes('ingestion') ||
|
|
155
|
+
errorDetails.config?.url?.includes('/ingestion');
|
|
156
|
+
const pipelineStep = isIngestionError
|
|
157
|
+
? oht_types_1.PipelineStep.SENDING_RESULTS
|
|
158
|
+
: oht_types_1.PipelineStep.EXTRACTING_METADATA;
|
|
159
|
+
const errorType = error.constructor.name;
|
|
160
|
+
const rejectReason = mapErrorToRejectReason(error, errorMessage, finalStatusCode, responseData);
|
|
161
|
+
let fieldName;
|
|
162
|
+
if (error instanceof ValidationError) {
|
|
163
|
+
fieldName = error.fieldName;
|
|
164
|
+
}
|
|
165
|
+
else if (finalStatusCode === 409 && rejectReason === oht_types_1.RejectReason.INCOMPLETE_DATA) {
|
|
166
|
+
fieldName = 'patient.id';
|
|
167
|
+
}
|
|
168
|
+
const formattedRejectReason = extractFormattedRejectReason(rejectReason, fieldName, errorMessage);
|
|
169
|
+
if (!signedUploadId) {
|
|
170
|
+
const noUploadError = new Error((0, error_types_1.getErrorMessage)(error_types_1.ErrorCode.UPLOAD_MISSING_SIGNED_UPLOAD_ID));
|
|
171
|
+
processingLogger_service_1.processingLogger.addError(noUploadError, 'error_handling');
|
|
172
|
+
processingLogger_service_1.processingLogger.logError('Processing failed: Missing signed upload ID', noUploadError, {
|
|
173
|
+
error_code: error_types_1.ErrorCode.UPLOAD_MISSING_SIGNED_UPLOAD_ID,
|
|
174
|
+
cloud_event_id: cloudEventId,
|
|
175
|
+
partner_name: partnerName,
|
|
176
|
+
});
|
|
177
|
+
processingLogger_service_1.processingLogger.logEnd(false);
|
|
178
|
+
throw noUploadError;
|
|
179
|
+
}
|
|
180
|
+
try {
|
|
181
|
+
processingLogger_service_1.processingLogger.addError(error, 'error_handling');
|
|
182
|
+
const fileUploads = await (0, auxiliaryFunctions_service_1.queryFileUploadsWithFilters)([{ field: 'signedUploadId', search: signedUploadId }], apiKey);
|
|
183
|
+
const fileUploadId = fileUploads[0]?.id;
|
|
184
|
+
if (!fileUploadId) {
|
|
185
|
+
const notFoundError = new Error((0, error_types_1.getErrorMessage)(error_types_1.ErrorCode.UPLOAD_FILE_NOT_FOUND));
|
|
186
|
+
processingLogger_service_1.processingLogger.addError(notFoundError, 'error_handling');
|
|
187
|
+
processingLogger_service_1.processingLogger.logError('Processing failed: File upload not found', notFoundError, {
|
|
188
|
+
error_code: error_types_1.ErrorCode.UPLOAD_FILE_NOT_FOUND,
|
|
189
|
+
signed_upload_id: signedUploadId,
|
|
190
|
+
partner_name: partnerName,
|
|
191
|
+
});
|
|
192
|
+
processingLogger_service_1.processingLogger.logEnd(false);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
const fileUrl = `${ohapiUrl}/data-import/file-uploads/${fileUploadId}`;
|
|
196
|
+
const sendSlack = shouldSendSlackNotification(rejectReason, silentRejectReasons);
|
|
197
|
+
const fieldInfo = fieldName ? `\n*Field:* \`${fieldName}\`` : '';
|
|
198
|
+
const slackMessage = (0, slackMessages_service_1.getSlackFileIssueNotificationMessage)(`🚨 *AgnosticParser Processing Error*\n\n` +
|
|
199
|
+
`*Error:* ${errorType}: ${errorMessage}\n` +
|
|
200
|
+
`*Reject Reason:* ${formattedRejectReason}${fieldInfo}\n` +
|
|
201
|
+
`*File:* \`${fileName}\`\n` +
|
|
202
|
+
`*Partner:* ${partnerName || 'Unknown'}\n` +
|
|
203
|
+
`*File Upload ID:* \`${fileUploadId}\`\n` +
|
|
204
|
+
(cloudEventId ? `*Event ID:* \`${cloudEventId}\`\n` : ''), `AgnosticParser - ${partnerName || 'Unknown Partner'}`, fileUrl);
|
|
205
|
+
const [slackResult, statusResult] = await Promise.allSettled([
|
|
206
|
+
sendSlack ? (0, slackMessages_service_1.sendMessageToSlack)(slackMessage) : Promise.resolve(),
|
|
207
|
+
(0, auxiliaryFunctions_service_1.postFileUploadSetStatus)({
|
|
208
|
+
status: oht_types_1.DataImportFileUploadStatus.REJECTED,
|
|
209
|
+
digitalization: {
|
|
210
|
+
status: oht_types_1.DigitizationStatus.ERROR,
|
|
211
|
+
pipelineStep: pipelineStep,
|
|
212
|
+
pipelineStepData: formattedRejectReason,
|
|
213
|
+
timestamp: dayjs_1.default.utc().toISOString(),
|
|
214
|
+
},
|
|
215
|
+
...(formattedRejectReason && { rejectReason: formattedRejectReason }),
|
|
216
|
+
}, fileUploadId, fileName, apiKey),
|
|
217
|
+
]);
|
|
218
|
+
if (slackResult.status === 'rejected') {
|
|
219
|
+
processingLogger_service_1.processingLogger.logWarn('Slack notification failed', {
|
|
220
|
+
error_code: error_types_1.ErrorCode.UPLOAD_SLACK_FAILED,
|
|
221
|
+
file_upload_id: fileUploadId,
|
|
222
|
+
slack_error: (0, apiUtils_1.parseErrorObj)(slackResult.reason),
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
if (statusResult.status === 'rejected') {
|
|
226
|
+
const statusErrorDetails = (0, apiUtils_1.parseErrorObj)(statusResult.reason);
|
|
227
|
+
const statusResponseData = statusErrorDetails.responseData;
|
|
228
|
+
processingLogger_service_1.processingLogger.logError(`Failed to update file upload status: ${statusErrorDetails.message}${statusResponseData ? ` - ${JSON.stringify(statusResponseData)}` : ''}`, undefined, {
|
|
229
|
+
error_code: error_types_1.ErrorCode.UPLOAD_STATUS_UPDATE_FAILED,
|
|
230
|
+
file_upload_id: fileUploadId,
|
|
231
|
+
status_error: statusErrorDetails,
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
// Single "Processing failed" log from logEnd(false), with full error detail in processing_summary.errors (message, step, stack, error_type)
|
|
235
|
+
processingLogger_service_1.processingLogger.logEnd(false);
|
|
236
|
+
}
|
|
237
|
+
catch (handleErrorException) {
|
|
238
|
+
const exceptionMessage = handleErrorException instanceof Error
|
|
239
|
+
? handleErrorException.message
|
|
240
|
+
: String(handleErrorException);
|
|
241
|
+
const handlingError = handleErrorException instanceof Error
|
|
242
|
+
? handleErrorException
|
|
243
|
+
: new Error(String(handleErrorException));
|
|
244
|
+
processingLogger_service_1.processingLogger.addError(handlingError, 'error_handling_failure');
|
|
245
|
+
processingLogger_service_1.processingLogger.logError(`Error handling failed: ${exceptionMessage}`, handlingError, {
|
|
246
|
+
error_code: error_types_1.ErrorCode.UPLOAD_HANDLING_FAILED,
|
|
247
|
+
signed_upload_id: signedUploadId,
|
|
248
|
+
partner_name: partnerName,
|
|
249
|
+
original_error: errorMessage,
|
|
250
|
+
original_error_type: errorType,
|
|
251
|
+
handling_error: exceptionMessage,
|
|
252
|
+
});
|
|
253
|
+
processingLogger_service_1.processingLogger.logEnd(false);
|
|
254
|
+
throw error;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
//# sourceMappingURL=fileUploadErrorHandler.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileUploadErrorHandler.service.js","sourceRoot":"","sources":["../../service/fileUploadErrorHandler.service.ts"],"names":[],"mappings":";;;;;;AA2CA,kEAQC;AAKD,oEAwCC;AAoBD,wDAuDC;AAKD,kCAwJC;AAxUD,kDAK4B;AAC5B,mEAAmG;AACnG,6EAIsC;AACtC,kDAAoD;AACpD,yEAA8D;AAC9D,sDAAkE;AAClE,kDAA0B;AAC1B,2DAAmC;AAEnC,eAAK,CAAC,MAAM,CAAC,aAAG,CAAC,CAAC;AAElB;;;GAGG;AACH,MAAa,eAAgB,SAAQ,KAAK;IAIxC,YACE,OAAe,EACf,YAA0B,EAC1B,SAAkB;QAElB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF;AAdD,0CAcC;AAED;;GAEG;AACH,SAAgB,2BAA2B,CACzC,YAAsC,EACtC,mBAAmC;IAEnC,IAAI,CAAC,YAAY,IAAI,mBAAmB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AACrD,CAAC;AAED;;GAEG;AACH,SAAgB,4BAA4B,CAC1C,YAA0B,EAC1B,SAAkB,EAClB,YAAqB;IAErB,MAAM,gBAAgB,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;IAE9C,IAAI,YAAY,KAAK,wBAAY,CAAC,mBAAmB,IAAI,YAAY,EAAE,CAAC;QACtE,MAAM,cAAc,GA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