@openhealth/oht-custom-parser-lib 0.5.46 → 0.5.47
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 +2 -2
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/service/auxiliaryFunctions.service.d.ts +1 -1
- package/dist/service/auxiliaryFunctions.service.js +8 -10
- 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 +4 -15
- package/dist/service/ohtReportMeasurementsExtractor.service.js +20 -139
- package/dist/service/ohtReportMeasurementsExtractor.service.js.map +1 -1
- package/dist/service/reportCreator.service.js +4 -45
- package/dist/service/reportCreator.service.js.map +1 -1
- package/package.json +40 -40
- package/readme.md +115 -115
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export { postDataImportFileUploadToCore, postReportPreviewToCore } from './service/reportCreator.service';
|
|
2
|
-
export { parseExternalPatientId, parseGender, isPatientAgeValid, handleRejection, queryFileUploadsWithFilters, postFileUploadSetStatus, DigitalizationUpdateFields } from './service/auxiliaryFunctions.service';
|
|
2
|
+
export { parseExternalPatientId, parseGender, isPatientAgeValid, getPatientAge, handleRejection, queryFileUploadsWithFilters, postFileUploadSetStatus, DigitalizationUpdateFields, getPartnerTransformationRules, } from './service/auxiliaryFunctions.service';
|
|
3
3
|
export { ohtReportMeasurementsExtractor, } from './service/ohtReportMeasurementsExtractor.service';
|
|
4
4
|
export { ohtMeasurementsExtractor, checkValueForPlausibleValues, extractReferenceRanges, extractReferenceAnnotation, parseExamValue, getRangeFromPositionAndRegex, extractUnit, extractValueFromGreaterLowerThan } from './service/ohtMeasurementsExtractor.service';
|
|
5
5
|
export { getSlackFileIssueNotificationMessage, sendMessageToSlack } from './service/slackMessages.service';
|
|
6
6
|
export { aggregateMessages, aggregateBiMessages, publishToTopic, generateBIMessages } from './service/errorHandling.service';
|
|
7
7
|
export { applyRules as applyTransformationRules, validateJsonataExpression as validateTransformationRuleExpression, } from './service/transformationRules.service';
|
|
8
|
-
export { LabToOhtContract, LabToOhtMapper, UnknownMeasurementExtraction, ReferenceAsAnnotation, UnitExtraction, RangeExtraction, RangeExtractionResponse, ValueExtraction, unitSynonyms, ValueExtractionResponse, SynonymUnit, UnknownUnits, } from './types/custom-parser.types';
|
|
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, OhtRange, OriginalExam, } from './types/oht.types';
|
|
10
10
|
export { ErrorMessage, ErrorCode, ERROR_CATALOG, ERROR_MESSAGES, getErrorMessage, getRejectReason, } from './types/error.types';
|
|
11
11
|
export { handleError, ValidationError, JSON_VALIDATION_ERROR_NAME, shouldSendSlackNotification, extractFormattedRejectReason, mapErrorToRejectReason, } from './service/fileUploadErrorHandler.service';
|
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 = void 0;
|
|
6
|
+
exports.shouldSendSlackNotification = exports.JSON_VALIDATION_ERROR_NAME = 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.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.runWithContextAsync = exports.runWithContext = exports.getRequestScopedFilename = exports.getRequestIdFromContext = exports.processingLogger = exports.mapErrorToRejectReason = exports.extractFormattedRejectReason = 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; } });
|
|
@@ -13,9 +13,11 @@ var auxiliaryFunctions_service_1 = require("./service/auxiliaryFunctions.service
|
|
|
13
13
|
Object.defineProperty(exports, "parseExternalPatientId", { enumerable: true, get: function () { return auxiliaryFunctions_service_1.parseExternalPatientId; } });
|
|
14
14
|
Object.defineProperty(exports, "parseGender", { enumerable: true, get: function () { return auxiliaryFunctions_service_1.parseGender; } });
|
|
15
15
|
Object.defineProperty(exports, "isPatientAgeValid", { enumerable: true, get: function () { return auxiliaryFunctions_service_1.isPatientAgeValid; } });
|
|
16
|
+
Object.defineProperty(exports, "getPatientAge", { enumerable: true, get: function () { return auxiliaryFunctions_service_1.getPatientAge; } });
|
|
16
17
|
Object.defineProperty(exports, "handleRejection", { enumerable: true, get: function () { return auxiliaryFunctions_service_1.handleRejection; } });
|
|
17
18
|
Object.defineProperty(exports, "queryFileUploadsWithFilters", { enumerable: true, get: function () { return auxiliaryFunctions_service_1.queryFileUploadsWithFilters; } });
|
|
18
19
|
Object.defineProperty(exports, "postFileUploadSetStatus", { enumerable: true, get: function () { return auxiliaryFunctions_service_1.postFileUploadSetStatus; } });
|
|
20
|
+
Object.defineProperty(exports, "getPartnerTransformationRules", { enumerable: true, get: function () { return auxiliaryFunctions_service_1.getPartnerTransformationRules; } });
|
|
19
21
|
var ohtReportMeasurementsExtractor_service_1 = require("./service/ohtReportMeasurementsExtractor.service");
|
|
20
22
|
Object.defineProperty(exports, "ohtReportMeasurementsExtractor", { enumerable: true, get: function () { return ohtReportMeasurementsExtractor_service_1.ohtReportMeasurementsExtractor; } });
|
|
21
23
|
var ohtMeasurementsExtractor_service_1 = require("./service/ohtMeasurementsExtractor.service");
|
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,
|
|
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;AAC3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A,0BAA0B,OAAA;AAC1B,6IAAA,2BAA2B,OAAA;AAC3B,8IAAA,4BAA4B,OAAA;AAC5B,wIAAA,sBAAsB,OAAA;AAUxB,4BAA4B;AAC5B,+EAQ4C;AAP1C,4HAAA,gBAAgB,OAAA;AAGhB,mIAAA,uBAAuB,OAAA;AACvB,oIAAA,wBAAwB,OAAA;AACxB,0HAAA,cAAc,OAAA;AACd,+HAAA,mBAAmB,OAAA;AAGrB,kBAAkB;AAClB,+CAAuE;AAA/D,gHAAA,oBAAoB,OAAA;AAAE,yGAAA,aAAa,OAAA;AAC3C,iDAAiN;AAAzM,yGAAA,YAAY,OAAA;AAAE,sHAAA,yBAAyB,OAAA;AAAE,6HAAA,gCAAgC,OAAA;AAAE,oHAAA,uBAAuB,OAAA;AAAE,8GAAA,iBAAiB,OAAA;AAAE,oHAAA,uBAAuB,OAAA;AAAE,4GAAA,eAAe,OAAA;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;AAClB,qDAI+B;AAH7B,+GAAA,gBAAgB,OAAA;AAChB,2GAAA,YAAY,OAAA;AACZ,sHAAA,uBAAuB,OAAA;AAIzB,4BAA4B;AAC5B,6EAAmE;AAA1D,yHAAA,cAAc,OAAA"}
|
|
@@ -46,5 +46,5 @@ declare function postFileUploadSetStatus(payload: {
|
|
|
46
46
|
rejectReason?: string;
|
|
47
47
|
isArchived?: boolean;
|
|
48
48
|
}, fileUploadId: string, filename: string, ohtCoreApiKey: string): Promise<DataImportFileUpload>;
|
|
49
|
-
declare function getPartnerTransformationRules(partnerId: string, labKeys: string[], ohtCoreApiKey: string): Promise<TransformationRulesChains>;
|
|
49
|
+
declare function getPartnerTransformationRules(partnerId: string, labKeys: string[] | undefined, ohtCoreApiKey: string): Promise<TransformationRulesChains>;
|
|
50
50
|
export { parseExternalPatientId, parseGender, isPatientAgeValid, getPatientAge, handleRejection, queryFileUploadsWithFilters, postFileUploadSetStatus, getPartnerTransformationRules, };
|
|
@@ -193,7 +193,9 @@ async function postFileUploadSetStatus(payload, fileUploadId, filename, ohtCoreA
|
|
|
193
193
|
processingLogger_service_1.processingLogger.logInfo(`Resp: POST status: ${payload.status} /file-uploads/${fileUploadId}, filename: ${filename}`, { resp: processingResponse?.data });
|
|
194
194
|
return processingResponse?.data;
|
|
195
195
|
}
|
|
196
|
-
// getPartnerTransformationRules fetches all the available partner transformation rules
|
|
196
|
+
// getPartnerTransformationRules fetches all the available partner transformation rules.
|
|
197
|
+
// When labKeys is undefined, all chains for the partner are returned (no labKey filter applied),
|
|
198
|
+
// which includes ohtReport.* chains used to build the OhtReport from raw JSON.
|
|
197
199
|
async function getPartnerTransformationRules(partnerId, labKeys, ohtCoreApiKey) {
|
|
198
200
|
// Fetch every partner transformation rule
|
|
199
201
|
const ohtCoreTransformationRulesUrl = `${OHT_CORE_URL}/v1/customparser/partners/${partnerId}/transformation-rules`;
|
|
@@ -212,16 +214,12 @@ async function getPartnerTransformationRules(partnerId, labKeys, ohtCoreApiKey)
|
|
|
212
214
|
updatedAt: dayjs_1.default.utc(rule.updatedAt).toDate(),
|
|
213
215
|
});
|
|
214
216
|
}, new Map());
|
|
215
|
-
// Fetch the rule chains
|
|
217
|
+
// Fetch the rule chains — when labKeys is provided, filter by them; otherwise fetch all chains
|
|
216
218
|
const ohtCoreTransformationRulesChainsUrl = `${OHT_CORE_URL}/v1/customparser/partners/${partnerId}/transformation-rules-chains/query`;
|
|
217
|
-
const
|
|
218
|
-
filters: [
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
multiSearch: labKeys,
|
|
222
|
-
}
|
|
223
|
-
],
|
|
224
|
-
}, ohtCoreApiKey);
|
|
219
|
+
const chainsBody = labKeys !== undefined
|
|
220
|
+
? { filters: [{ field: 'labKey', multiSearch: labKeys }] }
|
|
221
|
+
: {};
|
|
222
|
+
const rulesChainsResponse = await (0, apiUtils_1.makeApiCallWithRetry)('POST', ohtCoreTransformationRulesChainsUrl, chainsBody, ohtCoreApiKey);
|
|
225
223
|
// Hydrate the rules chains with the actual rules
|
|
226
224
|
return (rulesChainsResponse?.data?.items ?? [])
|
|
227
225
|
.reduce((map, chainItem) => {
|
|
@@ -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":";;;;;AAkTE,wDAAsB;AACtB,kCAAW;AACX,8CAAiB;AACjB,sCAAa;AACb,0CAAe;AACf,kEAA2B;AAC3B,0DAAuB;AACvB,sEAA6B;AAzT/B,2DAAmC;AAEnC,kDAAyD;AACzD,yEAA8D;AAC9D,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;IACpD,MAAM,SAAS,GAAG,IAAA,gBAAM,E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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,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 };
|