ezmedicationinput 0.1.44 → 0.1.46
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/README.md +265 -2
- package/dist/body-site-grammar.d.ts +39 -0
- package/dist/body-site-lookup.d.ts +84 -0
- package/dist/body-site-resolution.d.ts +9 -0
- package/dist/body-site-spatial.d.ts +6 -0
- package/dist/clause-tail-grammar.d.ts +18 -0
- package/dist/fhir-translations.d.ts +4 -1
- package/dist/fhir.d.ts +9 -1
- package/dist/hpsg/chart.d.ts +14 -0
- package/dist/hpsg/clause-parser.d.ts +3 -0
- package/dist/hpsg/defaults.d.ts +9 -0
- package/dist/hpsg/lexical-classes.d.ts +89 -0
- package/dist/hpsg/method-lexicon.d.ts +13 -0
- package/dist/hpsg/projection.d.ts +12 -0
- package/dist/hpsg/rule-context.d.ts +32 -0
- package/dist/hpsg/rules/core-rules.d.ts +8 -0
- package/dist/hpsg/rules/instruction-rules.d.ts +4 -0
- package/dist/hpsg/rules/prn-rules.d.ts +3 -0
- package/dist/hpsg/rules/product-route.d.ts +2 -0
- package/dist/hpsg/rules/site-rules.d.ts +4 -0
- package/dist/hpsg/rules/timing-rules.d.ts +12 -0
- package/dist/hpsg/segmenter.d.ts +6 -0
- package/dist/hpsg/signature.d.ts +116 -0
- package/dist/hpsg/timing-lexicon.d.ts +31 -0
- package/dist/hpsg/unification.d.ts +8 -0
- package/dist/index.cjs +21052 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +20865 -680
- package/dist/maps.d.ts +4 -2
- package/dist/parser-state.d.ts +4 -1
- package/dist/parser.d.ts +3 -13
- package/dist/prn-reason-coding.d.ts +8 -0
- package/dist/site-coding.d.ts +5 -0
- package/dist/snomed-postcoordination.d.ts +25 -0
- package/dist/snomed.d.ts +13 -0
- package/dist/types.d.ts +61 -16
- package/dist/unit-lexicon.d.ts +4 -0
- package/package.json +17 -6
- package/dist/advice-rules.json +0 -772
- package/dist/advice-terminology.json +0 -104
- package/dist/advice.js +0 -1375
- package/dist/context.js +0 -50
- package/dist/event-trigger.d.ts +0 -14
- package/dist/event-trigger.js +0 -501
- package/dist/fhir-translations.js +0 -117
- package/dist/fhir.js +0 -693
- package/dist/format.js +0 -1034
- package/dist/i18n.js +0 -1341
- package/dist/internal-types.d.ts +0 -60
- package/dist/internal-types.js +0 -2
- package/dist/ir.js +0 -178
- package/dist/lexer/lex.js +0 -401
- package/dist/lexer/meaning.js +0 -619
- package/dist/lexer/surface.js +0 -62
- package/dist/lexer/token-types.js +0 -19
- package/dist/maps.js +0 -2226
- package/dist/package.json +0 -3
- package/dist/parser-state.js +0 -441
- package/dist/parser.js +0 -5631
- package/dist/prn.js +0 -59
- package/dist/safety.js +0 -15
- package/dist/schedule.js +0 -1636
- package/dist/segment.d.ts +0 -6
- package/dist/segment.js +0 -203
- package/dist/site-phrases.js +0 -344
- package/dist/suggest.js +0 -907
- package/dist/timing-summary.js +0 -138
- package/dist/types.js +0 -276
- package/dist/utils/array.js +0 -11
- package/dist/utils/enum.d.ts +0 -2
- package/dist/utils/enum.js +0 -7
- package/dist/utils/object.js +0 -34
- package/dist/utils/strength.js +0 -149
- package/dist/utils/text.js +0 -48
- package/dist/utils/units.js +0 -82
package/dist/utils/text.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isWhitespaceChar = isWhitespaceChar;
|
|
4
|
-
exports.isLoosePhraseSeparatorChar = isLoosePhraseSeparatorChar;
|
|
5
|
-
exports.normalizeLoosePhraseKey = normalizeLoosePhraseKey;
|
|
6
|
-
function isWhitespaceChar(char) {
|
|
7
|
-
const code = char.charCodeAt(0);
|
|
8
|
-
return (code <= 0x20 ||
|
|
9
|
-
code === 0x00a0 ||
|
|
10
|
-
code === 0x1680 ||
|
|
11
|
-
(code >= 0x2000 && code <= 0x200a) ||
|
|
12
|
-
code === 0x2028 ||
|
|
13
|
-
code === 0x2029 ||
|
|
14
|
-
code === 0x202f ||
|
|
15
|
-
code === 0x205f ||
|
|
16
|
-
code === 0x3000);
|
|
17
|
-
}
|
|
18
|
-
function isAsciiPunctuationCode(code) {
|
|
19
|
-
return ((code >= 0x21 && code <= 0x2f) ||
|
|
20
|
-
(code >= 0x3a && code <= 0x40) ||
|
|
21
|
-
(code >= 0x5b && code <= 0x60) ||
|
|
22
|
-
(code >= 0x7b && code <= 0x7e));
|
|
23
|
-
}
|
|
24
|
-
function isLoosePhraseSeparatorChar(char) {
|
|
25
|
-
const code = char.charCodeAt(0);
|
|
26
|
-
return (isWhitespaceChar(char) ||
|
|
27
|
-
isAsciiPunctuationCode(code) ||
|
|
28
|
-
(code >= 0x2000 && code <= 0x206f) ||
|
|
29
|
-
(code >= 0x2e00 && code <= 0x2e7f) ||
|
|
30
|
-
(code >= 0x3000 && code <= 0x303f));
|
|
31
|
-
}
|
|
32
|
-
function normalizeLoosePhraseKey(value) {
|
|
33
|
-
const lowered = value.trim().toLowerCase();
|
|
34
|
-
let normalized = "";
|
|
35
|
-
let pendingSpace = false;
|
|
36
|
-
for (const char of lowered) {
|
|
37
|
-
if (isLoosePhraseSeparatorChar(char)) {
|
|
38
|
-
pendingSpace = normalized.length > 0;
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
if (pendingSpace) {
|
|
42
|
-
normalized += " ";
|
|
43
|
-
pendingSpace = false;
|
|
44
|
-
}
|
|
45
|
-
normalized += char;
|
|
46
|
-
}
|
|
47
|
-
return normalized.trim();
|
|
48
|
-
}
|
package/dist/utils/units.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VOLUME_UNITS = exports.MASS_UNITS = void 0;
|
|
4
|
-
exports.getUnitCategory = getUnitCategory;
|
|
5
|
-
exports.getBaseUnitFactor = getBaseUnitFactor;
|
|
6
|
-
exports.convertValue = convertValue;
|
|
7
|
-
exports.MASS_UNITS = {
|
|
8
|
-
kg: 1000000,
|
|
9
|
-
g: 1000,
|
|
10
|
-
mg: 1,
|
|
11
|
-
mcg: 0.001,
|
|
12
|
-
ug: 0.001,
|
|
13
|
-
microg: 0.001,
|
|
14
|
-
ng: 0.000001
|
|
15
|
-
};
|
|
16
|
-
exports.VOLUME_UNITS = {
|
|
17
|
-
l: 1000,
|
|
18
|
-
dl: 100,
|
|
19
|
-
ml: 1,
|
|
20
|
-
ul: 0.001,
|
|
21
|
-
microl: 0.001,
|
|
22
|
-
cm3: 1,
|
|
23
|
-
tsp: 5,
|
|
24
|
-
tbsp: 15
|
|
25
|
-
};
|
|
26
|
-
function getUnitCategory(unit) {
|
|
27
|
-
if (!unit)
|
|
28
|
-
return "other";
|
|
29
|
-
const u = unit.toLowerCase();
|
|
30
|
-
if (exports.MASS_UNITS[u] !== undefined)
|
|
31
|
-
return "mass";
|
|
32
|
-
if (exports.VOLUME_UNITS[u] !== undefined)
|
|
33
|
-
return "volume";
|
|
34
|
-
return "other";
|
|
35
|
-
}
|
|
36
|
-
function getBaseUnitFactor(unit) {
|
|
37
|
-
var _a, _b;
|
|
38
|
-
if (!unit)
|
|
39
|
-
return 1;
|
|
40
|
-
const u = unit.toLowerCase();
|
|
41
|
-
return (_b = (_a = exports.MASS_UNITS[u]) !== null && _a !== void 0 ? _a : exports.VOLUME_UNITS[u]) !== null && _b !== void 0 ? _b : 1;
|
|
42
|
-
}
|
|
43
|
-
function convertValue(value, fromUnit, toUnit, strength) {
|
|
44
|
-
const f = fromUnit.toLowerCase();
|
|
45
|
-
const t = toUnit.toLowerCase();
|
|
46
|
-
if (f === t)
|
|
47
|
-
return value;
|
|
48
|
-
const fCat = getUnitCategory(f);
|
|
49
|
-
const tCat = getUnitCategory(t);
|
|
50
|
-
// 1. Same category conversion
|
|
51
|
-
if (fCat === tCat && fCat !== "other") {
|
|
52
|
-
const fFactor = getBaseUnitFactor(f);
|
|
53
|
-
const tFactor = getBaseUnitFactor(t);
|
|
54
|
-
return (value * fFactor) / tFactor;
|
|
55
|
-
}
|
|
56
|
-
// 2. Cross-category conversion using strength
|
|
57
|
-
if (strength && ((fCat === "mass" && tCat === "volume") || (fCat === "volume" && tCat === "mass"))) {
|
|
58
|
-
const numUnit = strength.numerator.unit.toLowerCase();
|
|
59
|
-
const denUnit = strength.denominator.unit.toLowerCase();
|
|
60
|
-
const numCat = getUnitCategory(numUnit);
|
|
61
|
-
const denCat = getUnitCategory(denUnit);
|
|
62
|
-
if (numCat !== denCat && numCat !== "other" && denCat !== "other") {
|
|
63
|
-
const massSide = numCat === "mass" ? strength.numerator : strength.denominator;
|
|
64
|
-
const volSide = numCat === "volume" ? strength.numerator : strength.denominator;
|
|
65
|
-
// Normalize bridge to base units (mg/mL)
|
|
66
|
-
const bridgeDensity = (massSide.value * getBaseUnitFactor(massSide.unit)) / (volSide.value * getBaseUnitFactor(volSide.unit));
|
|
67
|
-
if (fCat === "mass") {
|
|
68
|
-
// Mass to Volume: value_mg / density_mg_per_ml
|
|
69
|
-
const valueMg = value * getBaseUnitFactor(fromUnit);
|
|
70
|
-
const valueMl = valueMg / bridgeDensity;
|
|
71
|
-
return valueMl / getBaseUnitFactor(toUnit);
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
// Volume to Mass: value_ml * density_mg_per_ml
|
|
75
|
-
const valueMl = value * getBaseUnitFactor(fromUnit);
|
|
76
|
-
const valueMg = valueMl * bridgeDensity;
|
|
77
|
-
return valueMg / getBaseUnitFactor(toUnit);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return null;
|
|
82
|
-
}
|