ezmedicationinput 0.1.19 → 0.1.20
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/maps.js +11 -0
- package/dist/parser.js +23 -7
- package/package.json +1 -1
package/dist/maps.js
CHANGED
|
@@ -1349,6 +1349,17 @@ const DEFAULT_PRN_REASON_SOURCE = [
|
|
|
1349
1349
|
text: "Constipation"
|
|
1350
1350
|
}
|
|
1351
1351
|
},
|
|
1352
|
+
{
|
|
1353
|
+
names: ["irritation", "irritated"],
|
|
1354
|
+
definition: {
|
|
1355
|
+
coding: {
|
|
1356
|
+
system: SNOMED_SYSTEM,
|
|
1357
|
+
code: "257553007",
|
|
1358
|
+
display: "Irritation"
|
|
1359
|
+
},
|
|
1360
|
+
text: "Irritation"
|
|
1361
|
+
}
|
|
1362
|
+
},
|
|
1352
1363
|
{
|
|
1353
1364
|
names: ["dyspnea", "shortness of breath", "sob", "breathlessness"],
|
|
1354
1365
|
definition: {
|
package/dist/parser.js
CHANGED
|
@@ -1413,7 +1413,7 @@ function applyCountLimit(internal, value) {
|
|
|
1413
1413
|
return true;
|
|
1414
1414
|
}
|
|
1415
1415
|
function parseInternal(input, options) {
|
|
1416
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1416
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1417
1417
|
const tokens = tokenize(input);
|
|
1418
1418
|
const internal = {
|
|
1419
1419
|
input,
|
|
@@ -1952,13 +1952,25 @@ function parseInternal(input, options) {
|
|
|
1952
1952
|
}
|
|
1953
1953
|
}
|
|
1954
1954
|
}
|
|
1955
|
+
let canonicalPrefix;
|
|
1955
1956
|
if (reasonTokens.length > 0) {
|
|
1956
|
-
const
|
|
1957
|
-
if (
|
|
1958
|
-
for (const token of
|
|
1957
|
+
const suffixInfo = findTrailingPrnSiteSuffix(reasonObjects, internal, options);
|
|
1958
|
+
if ((_g = suffixInfo === null || suffixInfo === void 0 ? void 0 : suffixInfo.tokens) === null || _g === void 0 ? void 0 : _g.length) {
|
|
1959
|
+
for (const token of suffixInfo.tokens) {
|
|
1959
1960
|
prnSiteSuffixIndices.add(token.index);
|
|
1960
1961
|
}
|
|
1961
1962
|
}
|
|
1963
|
+
if (suffixInfo && suffixInfo.startIndex > 0) {
|
|
1964
|
+
const prefixTokens = reasonObjects
|
|
1965
|
+
.slice(0, suffixInfo.startIndex)
|
|
1966
|
+
.map((token) => token.original)
|
|
1967
|
+
.join(" ")
|
|
1968
|
+
.replace(/\s+/g, " ")
|
|
1969
|
+
.trim();
|
|
1970
|
+
if (prefixTokens) {
|
|
1971
|
+
canonicalPrefix = prefixTokens.replace(/[{}]/g, " ").replace(/\s+/g, " ").trim();
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1962
1974
|
}
|
|
1963
1975
|
if (reasonTokens.length > 0) {
|
|
1964
1976
|
const joined = reasonTokens.join(" ").trim();
|
|
@@ -1974,8 +1986,9 @@ function parseInternal(input, options) {
|
|
|
1974
1986
|
const text = sanitized || joined;
|
|
1975
1987
|
internal.asNeededReason = text;
|
|
1976
1988
|
const normalized = text.toLowerCase();
|
|
1977
|
-
const
|
|
1978
|
-
|
|
1989
|
+
const canonicalSource = canonicalPrefix || sanitized || text;
|
|
1990
|
+
const canonical = canonicalSource
|
|
1991
|
+
? (0, maps_1.normalizePrnReasonKey)(canonicalSource)
|
|
1979
1992
|
: (0, maps_1.normalizePrnReasonKey)(text);
|
|
1980
1993
|
internal.prnReasonLookupRequest = {
|
|
1981
1994
|
originalText: joined,
|
|
@@ -2932,7 +2945,10 @@ function findTrailingPrnSiteSuffix(tokens, internal, options) {
|
|
|
2932
2945
|
if (!definition) {
|
|
2933
2946
|
return undefined;
|
|
2934
2947
|
}
|
|
2935
|
-
return
|
|
2948
|
+
return {
|
|
2949
|
+
tokens: siteHintTokens,
|
|
2950
|
+
startIndex: suffixStart
|
|
2951
|
+
};
|
|
2936
2952
|
}
|
|
2937
2953
|
function lookupPrnReasonDefinition(map, canonical) {
|
|
2938
2954
|
if (!map) {
|