ezmedicationinput 0.1.61 → 0.1.63

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.
@@ -21,6 +21,7 @@ export interface MedicationInstructionActionCodeSystem {
21
21
  export declare function normalizeActionSurface(value: string): string;
22
22
  export declare function cloneMedicationInstructionActionRealizerConfig(config: MedicationInstructionActionDefinition["realizerConfig"]): MedicationInstructionActionDefinition["realizerConfig"];
23
23
  export declare function medicationInstructionActionLocaleRealizerConfig(config: MedicationInstructionActionDefinition["realizerConfig"], locale: string): import("./types").MedicationInstructionActionLocaleRealizerConfig | undefined;
24
+ export declare function resolveMedicationInstructionSequenceAction(surface: string, options?: ParseOptions): MedicationInstructionActionDefinition | undefined;
24
25
  export declare function resolveMedicationInstructionSeparableAction(lead: string, particle: string, options?: ParseOptions): MedicationInstructionActionDefinition | undefined;
25
26
  export declare function medicationInstructionActionIsSafetyScopeTarget(surface: string, options?: ParseOptions): boolean;
26
27
  export declare function resolveMedicationInstructionAction(surface: string, options?: ParseOptions): MedicationInstructionActionDefinition | undefined;
package/dist/types.d.ts CHANGED
@@ -313,6 +313,10 @@ export interface FhirTimingRepeat extends FhirElement {
313
313
  boundsRange?: FhirRange;
314
314
  frequency?: number;
315
315
  frequencyMax?: number;
316
+ /** Duration of each administration occurrence. */
317
+ duration?: number;
318
+ durationMax?: number;
319
+ durationUnit?: FhirPeriodUnit;
316
320
  period?: number;
317
321
  periodMax?: number;
318
322
  periodUnit?: FhirPeriodUnit;
@@ -706,6 +710,12 @@ export interface MedicationInstructionActionLocaleRealizerConfig {
706
710
  suppressSiteConcepts?: string[];
707
711
  implicitMedicationObject?: boolean;
708
712
  directSiteObject?: boolean;
713
+ /** Realize the dose as a direct amount instead of adding a locale-default per-dose prefix. */
714
+ directDose?: boolean;
715
+ /** Route-specific phrase overrides keyed by canonical RouteCode value. */
716
+ routePhrases?: Record<string, string>;
717
+ /** Prefix for the duration of each administration occurrence. */
718
+ administrationDurationPrefix?: string;
709
719
  }
710
720
  export interface MedicationInstructionActionRealizerConfig {
711
721
  /** Locale-specific realization behavior keyed by BCP-47-ish language tag. */
@@ -722,6 +732,8 @@ export interface MedicationInstructionActionDefinition {
722
732
  roundtripI18n?: Record<string, string>;
723
733
  /** Surface forms that should resolve to this action. */
724
734
  aliases?: string[];
735
+ /** Surface forms licensed only when immediately sequence-scoped (e.g. `then off`). */
736
+ sequenceAliases?: string[];
725
737
  /** Locale-specific parser lexemes. Display translation belongs in `i18n`; parsing aliases are explicit. */
726
738
  localeAliases?: Record<string, string[]>;
727
739
  /** Discontinuous surface forms such as Thai `เอา X ออก` (remove X). */
@@ -749,6 +761,8 @@ export interface MedicationInstructionActionDefinition {
749
761
  nextConcepts?: string[];
750
762
  }>;
751
763
  continuationAfterRelations?: string[];
764
+ /** Surface introducers that make a parsed duration describe each administration occurrence. */
765
+ administrationDurationIntroducers?: string[];
752
766
  /** Preferred relation semantic classes used to resolve lexically ambiguous relation surfaces. */
753
767
  preferredRelationSemanticClasses?: string[];
754
768
  /** Exact coding for FHIR Dosage.method when this action can head administration. */
@@ -879,13 +893,14 @@ export interface ParseOptions extends FormatOptions {
879
893
  */
880
894
  assumeSingleDiscreteDose?: boolean;
881
895
  /**
882
- * Enables inferring with-meal timings when explicit meal language is present
883
- * or implied by cadence alone. Generic meal abbreviations (AC/PC/C) and
884
- * cadence-only instructions expand into specific breakfast/lunch/dinner (and
885
- * bedtime) EventTiming entries. Works in conjunction with
886
- * `context.mealRelation` when provided.
896
+ * Enables inferring with-meal timings. `true` and `"cadence"` preserve the
897
+ * legacy behavior: explicit meal abbreviations (AC/PC/C) and cadence-only
898
+ * instructions may expand into breakfast/lunch/dinner/(bedtime). `"explicit"`
899
+ * expands only explicit generic meal timing and never invents meal anchors
900
+ * from cadence alone. Works with `context.mealRelation` when cadence expansion
901
+ * is enabled.
887
902
  */
888
- smartMealExpansion?: boolean;
903
+ smartMealExpansion?: boolean | "explicit" | "cadence";
889
904
  /**
890
905
  * Optional route/dosage-form policy overrides for smart meal expansion.
891
906
  * When omitted, the parser uses its built-in default heuristic.
@@ -1021,6 +1036,10 @@ export interface CanonicalScheduleExpr {
1021
1036
  duration?: number;
1022
1037
  durationMax?: number;
1023
1038
  durationUnit?: FhirPeriodUnit;
1039
+ /** Duration of each administration occurrence, distinct from regimen bounds duration. */
1040
+ administrationDuration?: number;
1041
+ administrationDurationMax?: number;
1042
+ administrationDurationUnit?: FhirPeriodUnit;
1024
1043
  frequency?: number;
1025
1044
  frequencyMax?: number;
1026
1045
  period?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ezmedicationinput",
3
- "version": "0.1.61",
3
+ "version": "0.1.63",
4
4
  "description": "Parse concise medication sigs into FHIR R5 Dosage JSON",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -14,6 +14,15 @@
14
14
  "default": "./dist/index.js"
15
15
  }
16
16
  },
17
+ "scripts": {
18
+ "test:dist": "npm run build && vitest run test-dist",
19
+ "build": "tsup && tsc -p tsconfig.types.json",
20
+ "test": "vitest run --dir test",
21
+ "bench:torture": "npm run build && node bench/real-world-torture.mjs",
22
+ "bench:adversarial": "npm run build && node bench/adversarial.mjs",
23
+ "bench:roundtrip": "npm run build && node bench/roundtrip.mjs",
24
+ "bench:suggest": "npm run build && node --expose-gc bench/suggest.mjs"
25
+ },
17
26
  "files": [
18
27
  "dist"
19
28
  ],
@@ -34,14 +43,5 @@
34
43
  "tsup": "^8.5.1",
35
44
  "typescript": "^5.4.0",
36
45
  "vitest": "^1.5.0"
37
- },
38
- "scripts": {
39
- "test:dist": "npm run build && vitest run test-dist",
40
- "build": "tsup && tsc -p tsconfig.types.json",
41
- "test": "vitest run --dir test",
42
- "bench:torture": "npm run build && node bench/real-world-torture.mjs",
43
- "bench:adversarial": "npm run build && node bench/adversarial.mjs",
44
- "bench:roundtrip": "npm run build && node bench/roundtrip.mjs",
45
- "bench:suggest": "npm run build && node --expose-gc bench/suggest.mjs"
46
46
  }
47
- }
47
+ }