@openhealth/oht-custom-parser-lib 0.2.76 → 0.2.78
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 +1 -3
- package/dist/index.js +2 -6
- package/dist/index.js.map +1 -1
- package/dist/service/reportCreator.service.js +14 -7
- package/dist/service/reportCreator.service.js.map +1 -1
- package/dist/types/custom-parser.types.d.ts +1 -1
- package/dist/types/oht.types.d.ts +3 -5
- package/dist/types/oht.types.js.map +1 -1
- package/package.json +34 -34
- package/readme.md +99 -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/service/ohtReportMeasurementsExtractor.service.d.ts +0 -157
- package/dist/service/ohtReportMeasurementsExtractor.service.js +0 -661
- package/dist/service/ohtReportMeasurementsExtractor.service.js.map +0 -1
- package/dist/util-ts/extractionUtils.d.ts +0 -69
- package/dist/util-ts/extractionUtils.js +0 -666
- package/dist/util-ts/extractionUtils.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
export { postDataImportFileUploadToCore, postReportPreviewToCore } from './service/reportCreator.service';
|
|
2
2
|
export { parseExternalPatientId, parseGender, isPatientAgeValid, handleRejection, queryFileUploadsWithFilters, postFileUploadSetStatus, DigitalizationUpdateFields } from './service/auxiliaryFunctions.service';
|
|
3
|
-
export { ohtReportMeasurementsExtractor, } from './service/ohtReportMeasurementsExtractor.service';
|
|
4
3
|
export { ohtMeasurementsExtractor, checkValueForPlausibleValues, extractReferenceRanges, extractReferenceAnnotation, parseExamValue, getRangeFromPositionAndRegex, extractUnit, extractValueFromGreaterLowerThan } from './service/ohtMeasurementsExtractor.service';
|
|
5
4
|
export { getSlackFileIssueNotificationMessage, sendMessageToSlack } from './service/slackMessages.service';
|
|
6
5
|
export { aggregateMessages, aggregateBiMessages, publishToTopic, generateBIMessages } from './service/errorHandling.service';
|
|
7
6
|
export { applyRules as applyTransformationRules, validateJsonataExpression as validateTransformationRuleExpression, } from './service/transformationRules.service';
|
|
8
7
|
export { LabToOhtContract, LabToOhtMapper, UnknownMeasurementExtraction, ReferenceAsAnnotation, UnitExtraction, RangeExtraction, RangeExtractionResponse, ValueExtraction, unitSynonyms, ValueExtractionResponse, SynonymUnit, UnknownUnits, } from './types/custom-parser.types';
|
|
9
|
-
export { AcfBiomarkerRangeAnnotationCheck, AcfBiomarkerGenericDisclaimerLogic, ManualCheck, BiomarkerCompatibility, ReferenceRangeType, AcfReferenceRange, VisualRange, NameAlias, AlternativeUnit, BiomarkerAcf, Biomarker, PipelineStep, DigitizationStatus, MeasurementValueComparator, BiomarkerValueType, DataImportFileUploadStatus, Sex, Digitization, PatientInfo, UnknownMeasurement,
|
|
8
|
+
export { AcfBiomarkerRangeAnnotationCheck, AcfBiomarkerGenericDisclaimerLogic, ManualCheck, BiomarkerCompatibility, ReferenceRangeType, AcfReferenceRange, VisualRange, NameAlias, AlternativeUnit, BiomarkerAcf, Biomarker, PipelineStep, DigitizationStatus, MeasurementValueComparator, BiomarkerValueType, DataImportFileUploadStatus, Sex, Digitization, PatientInfo, UnknownMeasurement, Measurement, DataImportFileUpload, MessagePayload, SignedUpload, ReportStyleConfig, LanguageCode, BiomarkerCustomisation, PartnerCustomPanel, ReportDisplaySettings, ReportCustomisation, OHTPartner, UploadType, RejectReason, } from './types/oht.types';
|
|
10
9
|
export { ErrorMessage } from './types/error.types';
|
|
11
10
|
export type { TransformationRule, TransformationContext, ApplyRulesResult as TransformationApplyRulesResult, ApplyRulesOptions as TransformationApplyRulesOptions, ValidationResult as TransformationValidationResult, } from './types/transformationRules.types';
|
|
12
11
|
export { makeApiCallWithRetry, parseErrorObj } from './util-ts/apiUtils';
|
|
@@ -15,4 +14,3 @@ export { readFileFromBucket, uploadFileBufferToGCS } from './util-ts/googleStora
|
|
|
15
14
|
export { default as pinoLogger } from './util-ts/pinoLogger';
|
|
16
15
|
export { getGreaterThanPatterns, getLowerThanPatterns } from './util-ts/regexUtils';
|
|
17
16
|
export { getMappedBiomarkers, } from './util-ts/dataUtils';
|
|
18
|
-
export { parseRange } from './util-ts/extractionUtils';
|
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.pinoLogger = exports.uploadFileBufferToGCS = exports.readFileFromBucket = exports.resolveUnitFromSynonyms = exports.fetchSynonymUnits = exports.processAppendedMappings = exports.isBiomarkerExternalNoVisualRange = exports.isBiomarkerValueNumerical = exports.extractValue = exports.parseErrorObj = exports.makeApiCallWithRetry = 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.
|
|
7
|
-
exports.
|
|
6
|
+
exports.getGreaterThanPatterns = exports.pinoLogger = exports.uploadFileBufferToGCS = exports.readFileFromBucket = exports.resolveUnitFromSynonyms = exports.fetchSynonymUnits = exports.processAppendedMappings = exports.isBiomarkerExternalNoVisualRange = exports.isBiomarkerValueNumerical = exports.extractValue = exports.parseErrorObj = exports.makeApiCallWithRetry = 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.postFileUploadSetStatus = exports.queryFileUploadsWithFilters = exports.handleRejection = exports.isPatientAgeValid = exports.parseGender = exports.parseExternalPatientId = exports.postReportPreviewToCore = exports.postDataImportFileUploadToCore = void 0;
|
|
7
|
+
exports.getMappedBiomarkers = exports.getLowerThanPatterns = 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; } });
|
|
@@ -16,8 +16,6 @@ Object.defineProperty(exports, "isPatientAgeValid", { enumerable: true, get: fun
|
|
|
16
16
|
Object.defineProperty(exports, "handleRejection", { enumerable: true, get: function () { return auxiliaryFunctions_service_1.handleRejection; } });
|
|
17
17
|
Object.defineProperty(exports, "queryFileUploadsWithFilters", { enumerable: true, get: function () { return auxiliaryFunctions_service_1.queryFileUploadsWithFilters; } });
|
|
18
18
|
Object.defineProperty(exports, "postFileUploadSetStatus", { enumerable: true, get: function () { return auxiliaryFunctions_service_1.postFileUploadSetStatus; } });
|
|
19
|
-
var ohtReportMeasurementsExtractor_service_1 = require("./service/ohtReportMeasurementsExtractor.service");
|
|
20
|
-
Object.defineProperty(exports, "ohtReportMeasurementsExtractor", { enumerable: true, get: function () { return ohtReportMeasurementsExtractor_service_1.ohtReportMeasurementsExtractor; } });
|
|
21
19
|
var ohtMeasurementsExtractor_service_1 = require("./service/ohtMeasurementsExtractor.service");
|
|
22
20
|
Object.defineProperty(exports, "ohtMeasurementsExtractor", { enumerable: true, get: function () { return ohtMeasurementsExtractor_service_1.ohtMeasurementsExtractor; } });
|
|
23
21
|
Object.defineProperty(exports, "checkValueForPlausibleValues", { enumerable: true, get: function () { return ohtMeasurementsExtractor_service_1.checkValueForPlausibleValues; } });
|
|
@@ -76,6 +74,4 @@ Object.defineProperty(exports, "getGreaterThanPatterns", { enumerable: true, get
|
|
|
76
74
|
Object.defineProperty(exports, "getLowerThanPatterns", { enumerable: true, get: function () { return regexUtils_1.getLowerThanPatterns; } });
|
|
77
75
|
var dataUtils_2 = require("./util-ts/dataUtils");
|
|
78
76
|
Object.defineProperty(exports, "getMappedBiomarkers", { enumerable: true, get: function () { return dataUtils_2.getMappedBiomarkers; } });
|
|
79
|
-
var extractionUtils_1 = require("./util-ts/extractionUtils");
|
|
80
|
-
Object.defineProperty(exports, "parseRange", { enumerable: true, get: function () { return extractionUtils_1.parseRange; } });
|
|
81
77
|
//# sourceMappingURL=index.js.map
|
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;AAC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AAG,OAAA;AAeH,uGAAA,UAAU,OAAA;AACV,yGAAA,YAAY,OAAA;AAWd,kBAAkB;AAClB,+CAAuE;AAA/D,gHAAA,oBAAoB,OAAA;AAAE,yGAAA,aAAa,OAAA;AAC3C,iDAAmL;AAA3K,yGAAA,YAAY,OAAA;AAAE,sHAAA,yBAAyB,OAAA;AAAE,6HAAA,gCAAgC,OAAA;AAAE,oHAAA,uBAAuB,OAAA;AAAE,8GAAA,iBAAiB,OAAA;AAAE,oHAAA,uBAAuB,OAAA;AACtJ,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,iDAA0D;AAAlD,gHAAA,mBAAmB,OAAA"}
|
|
@@ -160,13 +160,20 @@ async function postDataImportFileUploadToCore(dataImportFileUpload, unknownMeasu
|
|
|
160
160
|
catch (error) {
|
|
161
161
|
const errorDetail = (0, apiUtils_1.parseErrorObj)(error);
|
|
162
162
|
logger.error({ patchStatus, resp: errorDetail }, `ERROR: on report generation url:${ohtCoreIngestionUrl} filename: ${filename}`);
|
|
163
|
-
//
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
163
|
+
// Set digitalization error for tracking
|
|
164
|
+
try {
|
|
165
|
+
await (0, apiUtils_1.makeApiCallWithRetry)('patch', ohtCoreDigitalizationUrl, {
|
|
166
|
+
status: oht_types_1.DigitizationStatus.ERROR,
|
|
167
|
+
pipelineStep: oht_types_1.PipelineStep.SENDING_RESULTS,
|
|
168
|
+
pipelineStepData: rejectReason,
|
|
169
|
+
}, ohtCoreApiKey);
|
|
170
|
+
}
|
|
171
|
+
catch (digitalizationError) {
|
|
172
|
+
logger.error({ digitalizationError: (0, apiUtils_1.parseErrorObj)(digitalizationError) }, `Failed to update digitalization status, filename: ${filename}`);
|
|
173
|
+
}
|
|
174
|
+
// Re-throw error so it can be handled by the error handler in agnostic-parser
|
|
175
|
+
// The error handler will detect 409 conflicts and update file upload status appropriately
|
|
176
|
+
throw error;
|
|
170
177
|
}
|
|
171
178
|
}
|
|
172
179
|
//# sourceMappingURL=reportCreator.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reportCreator.service.js","sourceRoot":"","sources":["../../service/reportCreator.service.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"reportCreator.service.js","sourceRoot":"","sources":["../../service/reportCreator.service.ts"],"names":[],"mappings":";;;;;AAsSS,wEAA8B;AAAE,0DAAuB;AAtShE,kDAQ4B;AAG5B,uEAA+C;AAC/C,MAAM,MAAM,GAAG,IAAA,oBAAU,GAAE,CAAC;AAE5B,oDAA4B;AAC5B,oDAAoH;AACpH,kDAA0E;AAC1E,gBAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;AAEtC,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;AAE9C;;;GAGG;AACH,KAAK,UAAU,uBAAuB,CACpC,eAAuB,EACvB,YAA2B,EAC3B,mBAAyC,EACzC,QAAgB,EAChB,aAAqB;IAErB,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CACb,iEAAiE,QAAQ,EAAE,CAC5E,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,GAAG,YAAY,sBAAsB,eAAe,EAAE,CAAC;IAEtE,wDAAwD;IACxD,MAAM,WAAW,GAAG;QAClB,MAAM,EAAE,OAAO;QACf,YAAY,EAAE,YAAY,IAAI,EAAE;QAChC,mBAAmB,EAAE,mBAAmB,IAAI,EAAE;KAC/C,CAAC;IAEF,MAAM,CAAC,IAAI,CACT;QACE,QAAQ;QACR,eAAe;QACf,iBAAiB,EAAE,CAAC,YAAY,IAAI,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AA8E;QAC9E,0FAA0F;QAC1F,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -182,7 +182,6 @@ export interface OhtRange {
|
|
|
182
182
|
text: string;
|
|
183
183
|
age?: string;
|
|
184
184
|
sex?: string;
|
|
185
|
-
noSourceRanges?: boolean;
|
|
186
185
|
}
|
|
187
186
|
export interface OriginalExam {
|
|
188
187
|
contentType: string;
|
|
@@ -445,9 +444,6 @@ export interface BackendBiomarkerMapping {
|
|
|
445
444
|
jsonBlob?: any;
|
|
446
445
|
isIgnored?: boolean;
|
|
447
446
|
keepAsUnmapped?: boolean;
|
|
448
|
-
/** Optional tagged LOINC code */
|
|
449
|
-
taggedLoincCode?: string;
|
|
450
|
-
/** all the following configurations will be deleted */
|
|
451
447
|
/** Range extraction configuration */
|
|
452
448
|
rangeExtraction: RangeExtractionConfig;
|
|
453
449
|
/** Unit extraction configuration */
|
|
@@ -457,7 +453,9 @@ export interface BackendBiomarkerMapping {
|
|
|
457
453
|
/** Reference as annotation configuration */
|
|
458
454
|
referenceAsAnnotation: ReferenceAsAnnotationConfig;
|
|
459
455
|
/** Annotation configuration for appended biomarkers */
|
|
460
|
-
annotationConfig
|
|
456
|
+
annotationConfig?: AnnotationConfig;
|
|
457
|
+
/** Optional tagged LOINC code */
|
|
458
|
+
taggedLoincCode?: string;
|
|
461
459
|
}
|
|
462
460
|
/** Custom parser transformation rules */
|
|
463
461
|
export type TransformationRule = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oht.types.js","sourceRoot":"","sources":["../../types/oht.types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"oht.types.js","sourceRoot":"","sources":["../../types/oht.types.ts"],"names":[],"mappings":";;;AA8OA,IAAY,GAIX;AAJD,WAAY,GAAG;IACb,oBAAa,CAAA;IACb,wBAAiB,CAAA;IACjB,sBAAe,CAAA;AACjB,CAAC,EAJW,GAAG,mBAAH,GAAG,QAId;AAED,IAAY,UA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gCAAgC,gDAAhC,gCAAgC,QAM3C"}
|
package/package.json
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@openhealth/oht-custom-parser-lib",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Shared nodejs lib with with reusable functions",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"/dist"
|
|
9
|
-
],
|
|
10
|
-
"scripts": {
|
|
11
|
-
"test": "jest"
|
|
12
|
-
},
|
|
13
|
-
"keywords": [],
|
|
14
|
-
"author": "",
|
|
15
|
-
"license": "ISC",
|
|
16
|
-
"dependencies": {
|
|
17
|
-
"@google-cloud/pubsub": "^4.10.0",
|
|
18
|
-
"@google-cloud/storage": "^7.7.0",
|
|
19
|
-
"axios": "^1.6.7",
|
|
20
|
-
"bottleneck": "^2.19.5",
|
|
21
|
-
"dayjs": "^1.11.13",
|
|
22
|
-
"dotenv": "^16.4.5",
|
|
23
|
-
"jsonata": "^2.1.0",
|
|
24
|
-
"moment": "^2.30.1",
|
|
25
|
-
"mongodb": "^6.3.0",
|
|
26
|
-
"pino": "^8.19.0"
|
|
27
|
-
},
|
|
28
|
-
"devDependencies": {
|
|
29
|
-
"@types/jest": "^29.5.14",
|
|
30
|
-
"axios-mock-adapter": "^2.1.0",
|
|
31
|
-
"jest": "^29.7.0",
|
|
32
|
-
"ts-jest": "^29.2.5"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@openhealth/oht-custom-parser-lib",
|
|
3
|
+
"version": "0.2.78",
|
|
4
|
+
"description": "Shared nodejs lib with with reusable functions",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"/dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"test": "jest"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [],
|
|
14
|
+
"author": "",
|
|
15
|
+
"license": "ISC",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@google-cloud/pubsub": "^4.10.0",
|
|
18
|
+
"@google-cloud/storage": "^7.7.0",
|
|
19
|
+
"axios": "^1.6.7",
|
|
20
|
+
"bottleneck": "^2.19.5",
|
|
21
|
+
"dayjs": "^1.11.13",
|
|
22
|
+
"dotenv": "^16.4.5",
|
|
23
|
+
"jsonata": "^2.1.0",
|
|
24
|
+
"moment": "^2.30.1",
|
|
25
|
+
"mongodb": "^6.3.0",
|
|
26
|
+
"pino": "^8.19.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/jest": "^29.5.14",
|
|
30
|
+
"axios-mock-adapter": "^2.1.0",
|
|
31
|
+
"jest": "^29.7.0",
|
|
32
|
+
"ts-jest": "^29.2.5"
|
|
33
|
+
}
|
|
34
|
+
}
|
package/readme.md
CHANGED
|
@@ -1,99 +1,99 @@
|
|
|
1
|
-
# oht-custom-parser-lib
|
|
2
|
-
|
|
3
|
-
`oht-custom-parser-lib` is a shared library designed for use across multiple Node.js cloud functions. It contains common MongoDB connectors and data utilities that can be reused to avoid code duplication and ensure consistency.
|
|
4
|
-
|
|
5
|
-
## Table of Contents
|
|
6
|
-
|
|
7
|
-
- [Installation](#installation)
|
|
8
|
-
- [Usage](#usage)
|
|
9
|
-
- [Development](#development)
|
|
10
|
-
- [Patch Versions](#patch-versions)
|
|
11
|
-
- [Publish to npm Registry](#publish-to-npm-registry)
|
|
12
|
-
- [Using the Library in Cloud Functions](#using-the-library-in-cloud-functions)
|
|
13
|
-
|
|
14
|
-
## Installation
|
|
15
|
-
|
|
16
|
-
To install `oht-custom-parser-lib`, you can add it as a dependency in your project using npm:
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
npm install oht-custom-parser-lib
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Or, if you want to install a specific version:
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
npm install oht-custom-parser-lib@<version>
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Usage
|
|
29
|
-
|
|
30
|
-
After installing, you can import and use the library in your cloud functions:
|
|
31
|
-
|
|
32
|
-
```javascript
|
|
33
|
-
const { connectToMongoDB } = require('oht-custom-parser-lib');
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## Development
|
|
37
|
-
|
|
38
|
-
### Patch Versions
|
|
39
|
-
|
|
40
|
-
When making changes to the `oht-custom-parser-lib`, you need to update the version number before publishing. Follow these steps:
|
|
41
|
-
|
|
42
|
-
1. **Update the version number**: Use npm's version command to bump the version:
|
|
43
|
-
- **Patch** for bug fixes:
|
|
44
|
-
```bash
|
|
45
|
-
npm version patch
|
|
46
|
-
```
|
|
47
|
-
- **Minor** for new features:
|
|
48
|
-
```bash
|
|
49
|
-
npm version minor
|
|
50
|
-
```
|
|
51
|
-
- **Major** for breaking changes:
|
|
52
|
-
```bash
|
|
53
|
-
npm version major
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
This command will automatically update the version in the `package.json` and create a git tag.
|
|
57
|
-
|
|
58
|
-
2. **Commit Changes**: Ensure your changes and the version bump are committed to the repository.
|
|
59
|
-
|
|
60
|
-
### Publish to npm Registry
|
|
61
|
-
|
|
62
|
-
After updating the version, you can publish the library to the npm registry:
|
|
63
|
-
|
|
64
|
-
1. **Login to npm** (if you haven't already):
|
|
65
|
-
```bash
|
|
66
|
-
npm login
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
2. **Publish the package**:
|
|
70
|
-
```bash
|
|
71
|
-
npm publish
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
If this is a private package, use:
|
|
75
|
-
```bash
|
|
76
|
-
npm publish --access restricted
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
3. **Verify the publish**: You can check the package on [npmjs.com](https://www.npmjs.com/) to verify that the new version is available.
|
|
80
|
-
|
|
81
|
-
## Using the Library in Cloud Functions
|
|
82
|
-
|
|
83
|
-
To use `oht-custom-parser-lib` in your cloud functions:
|
|
84
|
-
|
|
85
|
-
1. **Install the Library**: Add `oht-custom-parser-lib` as a dependency in the cloud function's `package.json`:
|
|
86
|
-
|
|
87
|
-
```json
|
|
88
|
-
{
|
|
89
|
-
"dependencies": {
|
|
90
|
-
"oht-custom-parser-lib": "^1.0.0"
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
Replace `^1.0.0` with the appropriate version as needed.
|
|
96
|
-
|
|
97
|
-
2. **Install Dependencies**: Run `npm install` to install the library along with other dependencies.
|
|
98
|
-
|
|
99
|
-
3. **Deploy Your Function**: Deploy your cloud function as usual, ensuring that the updated dependencies are included.
|
|
1
|
+
# oht-custom-parser-lib
|
|
2
|
+
|
|
3
|
+
`oht-custom-parser-lib` is a shared library designed for use across multiple Node.js cloud functions. It contains common MongoDB connectors and data utilities that can be reused to avoid code duplication and ensure consistency.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Installation](#installation)
|
|
8
|
+
- [Usage](#usage)
|
|
9
|
+
- [Development](#development)
|
|
10
|
+
- [Patch Versions](#patch-versions)
|
|
11
|
+
- [Publish to npm Registry](#publish-to-npm-registry)
|
|
12
|
+
- [Using the Library in Cloud Functions](#using-the-library-in-cloud-functions)
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
To install `oht-custom-parser-lib`, you can add it as a dependency in your project using npm:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install oht-custom-parser-lib
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Or, if you want to install a specific version:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install oht-custom-parser-lib@<version>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
After installing, you can import and use the library in your cloud functions:
|
|
31
|
+
|
|
32
|
+
```javascript
|
|
33
|
+
const { connectToMongoDB } = require('oht-custom-parser-lib');
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Development
|
|
37
|
+
|
|
38
|
+
### Patch Versions
|
|
39
|
+
|
|
40
|
+
When making changes to the `oht-custom-parser-lib`, you need to update the version number before publishing. Follow these steps:
|
|
41
|
+
|
|
42
|
+
1. **Update the version number**: Use npm's version command to bump the version:
|
|
43
|
+
- **Patch** for bug fixes:
|
|
44
|
+
```bash
|
|
45
|
+
npm version patch
|
|
46
|
+
```
|
|
47
|
+
- **Minor** for new features:
|
|
48
|
+
```bash
|
|
49
|
+
npm version minor
|
|
50
|
+
```
|
|
51
|
+
- **Major** for breaking changes:
|
|
52
|
+
```bash
|
|
53
|
+
npm version major
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
This command will automatically update the version in the `package.json` and create a git tag.
|
|
57
|
+
|
|
58
|
+
2. **Commit Changes**: Ensure your changes and the version bump are committed to the repository.
|
|
59
|
+
|
|
60
|
+
### Publish to npm Registry
|
|
61
|
+
|
|
62
|
+
After updating the version, you can publish the library to the npm registry:
|
|
63
|
+
|
|
64
|
+
1. **Login to npm** (if you haven't already):
|
|
65
|
+
```bash
|
|
66
|
+
npm login
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
2. **Publish the package**:
|
|
70
|
+
```bash
|
|
71
|
+
npm publish
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
If this is a private package, use:
|
|
75
|
+
```bash
|
|
76
|
+
npm publish --access restricted
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
3. **Verify the publish**: You can check the package on [npmjs.com](https://www.npmjs.com/) to verify that the new version is available.
|
|
80
|
+
|
|
81
|
+
## Using the Library in Cloud Functions
|
|
82
|
+
|
|
83
|
+
To use `oht-custom-parser-lib` in your cloud functions:
|
|
84
|
+
|
|
85
|
+
1. **Install the Library**: Add `oht-custom-parser-lib` as a dependency in the cloud function's `package.json`:
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"dependencies": {
|
|
90
|
+
"oht-custom-parser-lib": "^1.0.0"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Replace `^1.0.0` with the appropriate version as needed.
|
|
96
|
+
|
|
97
|
+
2. **Install Dependencies**: Run `npm install` to install the library along with other dependencies.
|
|
98
|
+
|
|
99
|
+
3. **Deploy Your Function**: Deploy your cloud function as usual, ensuring that the updated dependencies are included.
|
|
@@ -1,59 +0,0 @@
|
|
|
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 };
|