ezmedicationinput 0.1.25 → 0.1.26

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 CHANGED
@@ -663,6 +663,9 @@ exports.EVENT_TIMING_TOKENS = {
663
663
  pcv: types_1.EventTiming["After Dinner"],
664
664
  wm: types_1.EventTiming.Meal,
665
665
  "with meals": types_1.EventTiming.Meal,
666
+ "with meal": types_1.EventTiming.Meal,
667
+ "with food": types_1.EventTiming.Meal,
668
+ cc: types_1.EventTiming.Meal,
666
669
  "@m": types_1.EventTiming.Meal,
667
670
  "@meal": types_1.EventTiming.Meal,
668
671
  "@meals": types_1.EventTiming.Meal,
package/dist/parser.js CHANGED
@@ -1925,13 +1925,20 @@ function parseInternal(input, options) {
1925
1925
  }
1926
1926
  const nextToken = tokens[i + 1];
1927
1927
  if (nextToken && !internal.consumed.has(nextToken.index)) {
1928
- const combo = `${token.lower} ${nextToken.lower}`;
1928
+ const lowerNext = nextToken.lower;
1929
+ const combo = `${token.lower} ${lowerNext}`;
1929
1930
  const comboWhen = (_e = COMBO_EVENT_TIMINGS[combo]) !== null && _e !== void 0 ? _e : maps_1.EVENT_TIMING_TOKENS[combo];
1930
1931
  if (comboWhen) {
1931
1932
  applyWhenToken(internal, token, comboWhen);
1932
1933
  mark(internal.consumed, nextToken);
1933
1934
  continue;
1934
1935
  }
1936
+ // Issue 2: Support "with meal" and "with food" combos explicitly if needed
1937
+ if (token.lower === "with" && (lowerNext === "meal" || lowerNext === "food")) {
1938
+ applyWhenToken(internal, token, types_1.EventTiming.Meal);
1939
+ mark(internal.consumed, nextToken);
1940
+ continue;
1941
+ }
1935
1942
  }
1936
1943
  const customWhen = (_f = options === null || options === void 0 ? void 0 : options.whenMap) === null || _f === void 0 ? void 0 : _f[token.lower];
1937
1944
  if (customWhen) {
@@ -2216,10 +2223,19 @@ function parseInternal(input, options) {
2216
2223
  const reasonTokens = [];
2217
2224
  const reasonIndices = [];
2218
2225
  const reasonObjects = [];
2226
+ const PRN_RECLAIMABLE_CONNECTORS = new Set(["at", "to", "in", "into", "on", "onto"]);
2219
2227
  for (let i = prnReasonStart; i < tokens.length; i++) {
2220
2228
  const token = tokens[i];
2221
2229
  if (internal.consumed.has(token.index)) {
2222
- internal.consumed.delete(token.index);
2230
+ // We only allow reclaiming certain generic connectors if they were used
2231
+ // as standalone markers (like 'at' or 'to') and not if they were clearly
2232
+ // part of a frequency/period instruction (which would be skipped here
2233
+ // if they were consumed by those specific logic paths).
2234
+ if (!PRN_RECLAIMABLE_CONNECTORS.has(token.lower)) {
2235
+ continue;
2236
+ }
2237
+ // If it is a reclaimable connector, we can pull it back into the reason
2238
+ // if it helps form a coherent phrase like 'irritation at rectum'.
2223
2239
  }
2224
2240
  reasonTokens.push(token.original);
2225
2241
  reasonIndices.push(token.index);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ezmedicationinput",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "description": "Parse concise medication sigs into FHIR R5 Dosage JSON",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",