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.
Files changed (75) hide show
  1. package/README.md +265 -2
  2. package/dist/body-site-grammar.d.ts +39 -0
  3. package/dist/body-site-lookup.d.ts +84 -0
  4. package/dist/body-site-resolution.d.ts +9 -0
  5. package/dist/body-site-spatial.d.ts +6 -0
  6. package/dist/clause-tail-grammar.d.ts +18 -0
  7. package/dist/fhir-translations.d.ts +4 -1
  8. package/dist/fhir.d.ts +9 -1
  9. package/dist/hpsg/chart.d.ts +14 -0
  10. package/dist/hpsg/clause-parser.d.ts +3 -0
  11. package/dist/hpsg/defaults.d.ts +9 -0
  12. package/dist/hpsg/lexical-classes.d.ts +89 -0
  13. package/dist/hpsg/method-lexicon.d.ts +13 -0
  14. package/dist/hpsg/projection.d.ts +12 -0
  15. package/dist/hpsg/rule-context.d.ts +32 -0
  16. package/dist/hpsg/rules/core-rules.d.ts +8 -0
  17. package/dist/hpsg/rules/instruction-rules.d.ts +4 -0
  18. package/dist/hpsg/rules/prn-rules.d.ts +3 -0
  19. package/dist/hpsg/rules/product-route.d.ts +2 -0
  20. package/dist/hpsg/rules/site-rules.d.ts +4 -0
  21. package/dist/hpsg/rules/timing-rules.d.ts +12 -0
  22. package/dist/hpsg/segmenter.d.ts +6 -0
  23. package/dist/hpsg/signature.d.ts +116 -0
  24. package/dist/hpsg/timing-lexicon.d.ts +31 -0
  25. package/dist/hpsg/unification.d.ts +8 -0
  26. package/dist/index.cjs +21052 -0
  27. package/dist/index.d.ts +5 -0
  28. package/dist/index.js +20865 -680
  29. package/dist/maps.d.ts +4 -2
  30. package/dist/parser-state.d.ts +4 -1
  31. package/dist/parser.d.ts +3 -13
  32. package/dist/prn-reason-coding.d.ts +8 -0
  33. package/dist/site-coding.d.ts +5 -0
  34. package/dist/snomed-postcoordination.d.ts +25 -0
  35. package/dist/snomed.d.ts +13 -0
  36. package/dist/types.d.ts +61 -16
  37. package/dist/unit-lexicon.d.ts +4 -0
  38. package/package.json +17 -6
  39. package/dist/advice-rules.json +0 -772
  40. package/dist/advice-terminology.json +0 -104
  41. package/dist/advice.js +0 -1375
  42. package/dist/context.js +0 -50
  43. package/dist/event-trigger.d.ts +0 -14
  44. package/dist/event-trigger.js +0 -501
  45. package/dist/fhir-translations.js +0 -117
  46. package/dist/fhir.js +0 -693
  47. package/dist/format.js +0 -1034
  48. package/dist/i18n.js +0 -1341
  49. package/dist/internal-types.d.ts +0 -60
  50. package/dist/internal-types.js +0 -2
  51. package/dist/ir.js +0 -178
  52. package/dist/lexer/lex.js +0 -401
  53. package/dist/lexer/meaning.js +0 -619
  54. package/dist/lexer/surface.js +0 -62
  55. package/dist/lexer/token-types.js +0 -19
  56. package/dist/maps.js +0 -2226
  57. package/dist/package.json +0 -3
  58. package/dist/parser-state.js +0 -441
  59. package/dist/parser.js +0 -5631
  60. package/dist/prn.js +0 -59
  61. package/dist/safety.js +0 -15
  62. package/dist/schedule.js +0 -1636
  63. package/dist/segment.d.ts +0 -6
  64. package/dist/segment.js +0 -203
  65. package/dist/site-phrases.js +0 -344
  66. package/dist/suggest.js +0 -907
  67. package/dist/timing-summary.js +0 -138
  68. package/dist/types.js +0 -276
  69. package/dist/utils/array.js +0 -11
  70. package/dist/utils/enum.d.ts +0 -2
  71. package/dist/utils/enum.js +0 -7
  72. package/dist/utils/object.js +0 -34
  73. package/dist/utils/strength.js +0 -149
  74. package/dist/utils/text.js +0 -48
  75. package/dist/utils/units.js +0 -82
@@ -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
- }
@@ -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
- }