ezmedicationinput 0.1.31 → 0.1.32
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 +13 -0
- package/dist/parser.js +15 -4
- package/package.json +1 -1
package/dist/maps.js
CHANGED
|
@@ -701,6 +701,7 @@ exports.EVENT_TIMING_TOKENS = {
|
|
|
701
701
|
hs: types_1.EventTiming["Before Sleep"],
|
|
702
702
|
bedtime: types_1.EventTiming["Before Sleep"],
|
|
703
703
|
bed: types_1.EventTiming["Before Sleep"],
|
|
704
|
+
sleep: types_1.EventTiming["Before Sleep"],
|
|
704
705
|
wake: types_1.EventTiming.Wake,
|
|
705
706
|
waking: types_1.EventTiming.Wake,
|
|
706
707
|
stat: types_1.EventTiming.Immediate
|
|
@@ -1335,6 +1336,18 @@ const DEFAULT_PRN_REASON_SOURCE = [
|
|
|
1335
1336
|
i18n: { th: "นอนหลับ" }
|
|
1336
1337
|
}
|
|
1337
1338
|
},
|
|
1339
|
+
{
|
|
1340
|
+
names: ["sleepiness", "sleepy", "drowsiness", "drowsy"],
|
|
1341
|
+
definition: {
|
|
1342
|
+
coding: {
|
|
1343
|
+
system: SNOMED_SYSTEM,
|
|
1344
|
+
code: "79519003",
|
|
1345
|
+
display: "Drowsiness"
|
|
1346
|
+
},
|
|
1347
|
+
text: "Sleepiness",
|
|
1348
|
+
i18n: { th: "ง่วงนอน" }
|
|
1349
|
+
}
|
|
1350
|
+
},
|
|
1338
1351
|
{
|
|
1339
1352
|
names: ["cough", "coughing"],
|
|
1340
1353
|
definition: {
|
package/dist/parser.js
CHANGED
|
@@ -1499,10 +1499,14 @@ function applyWhenToken(internal, token, code) {
|
|
|
1499
1499
|
addWhen(internal.when, code);
|
|
1500
1500
|
mark(internal.consumed, token);
|
|
1501
1501
|
}
|
|
1502
|
-
function isTimingAnchorOrPrefix(tokens, index) {
|
|
1502
|
+
function isTimingAnchorOrPrefix(tokens, index, prnReasonStart) {
|
|
1503
1503
|
const token = tokens[index];
|
|
1504
1504
|
if (!token)
|
|
1505
1505
|
return false;
|
|
1506
|
+
// Cautious handling of "sleep" in PRN zone
|
|
1507
|
+
if (prnReasonStart !== undefined && index >= prnReasonStart && token.lower === "sleep") {
|
|
1508
|
+
return false;
|
|
1509
|
+
}
|
|
1506
1510
|
const lower = token.lower;
|
|
1507
1511
|
const nextToken = tokens[index + 1];
|
|
1508
1512
|
const comboKey = nextToken ? `${lower} ${nextToken.lower}` : undefined;
|
|
@@ -1933,7 +1937,7 @@ function parseInternal(input, options) {
|
|
|
1933
1937
|
}
|
|
1934
1938
|
// Skip connectors if they are followed by recognized timing tokens or prefixes
|
|
1935
1939
|
if (MEAL_CONTEXT_CONNECTORS.has(token.lower) || token.lower === ",") {
|
|
1936
|
-
if (isTimingAnchorOrPrefix(tokens, i + 1)) {
|
|
1940
|
+
if (isTimingAnchorOrPrefix(tokens, i + 1, prnReasonStart)) {
|
|
1937
1941
|
mark(internal.consumed, token);
|
|
1938
1942
|
continue;
|
|
1939
1943
|
}
|
|
@@ -1977,8 +1981,15 @@ function parseInternal(input, options) {
|
|
|
1977
1981
|
}
|
|
1978
1982
|
const whenCode = maps_1.EVENT_TIMING_TOKENS[token.lower];
|
|
1979
1983
|
if (whenCode) {
|
|
1980
|
-
|
|
1981
|
-
|
|
1984
|
+
// If we are in the PRN zone, be cautious about common reason words like "sleep"
|
|
1985
|
+
// unless they were already handled by combo/anchor logic (which happens above).
|
|
1986
|
+
if (prnReasonStart !== undefined && i >= prnReasonStart && token.lower === "sleep") {
|
|
1987
|
+
// Leave for PRN reason
|
|
1988
|
+
}
|
|
1989
|
+
else {
|
|
1990
|
+
applyWhenToken(internal, token, whenCode);
|
|
1991
|
+
continue;
|
|
1992
|
+
}
|
|
1982
1993
|
}
|
|
1983
1994
|
// Day of week
|
|
1984
1995
|
const day = maps_1.DAY_OF_WEEK_TOKENS[token.lower];
|