ezmedicationinput 0.1.63 → 0.1.65

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/types.d.ts CHANGED
@@ -326,8 +326,10 @@ export interface FhirTimingRepeat extends FhirElement {
326
326
  /** Exact event offset in minutes. */
327
327
  offset?: number;
328
328
  }
329
- export interface FhirTiming {
329
+ export interface FhirTiming extends FhirElement {
330
330
  event?: string[];
331
+ /** Primitive metadata corresponding positionally to event. */
332
+ _event?: FhirPrimitiveElement[];
331
333
  repeat?: FhirTimingRepeat;
332
334
  code?: FhirCodeableConcept;
333
335
  }
@@ -847,12 +849,61 @@ export interface InstructionSemanticResolverRequest {
847
849
  existingGraph: CanonicalInstructionGraph;
848
850
  }
849
851
  export type InstructionSemanticResolver = (request: InstructionSemanticResolverRequest) => InstructionSemanticResolution | null | undefined | Promise<InstructionSemanticResolution | null | undefined>;
852
+ export type MedicationDateOrder = "DMY" | "MDY";
853
+ export interface MedicationDatePlausibleWindow {
854
+ /** Maximum inferred-year distance into the past. Defaults to 5 years. */
855
+ pastYears?: number;
856
+ /** Maximum inferred-year distance into the future. Defaults to 10 years. */
857
+ futureYears?: number;
858
+ }
859
+ export interface MedicationDatePolicy {
860
+ /** Enabled calendar resolver ids, in preference order. Defaults by detected locale. */
861
+ calendars?: string[];
862
+ /**
863
+ * Numeric date field order. Defaults to DMY for every locale.
864
+ * MDY is accepted only when explicitly requested by the caller.
865
+ */
866
+ dateOrder?: MedicationDateOrder;
867
+ /** ISO date used to resolve two-digit years. Defaults to the current date. */
868
+ referenceDate?: string;
869
+ /** Plausibility window applied only to inferred two-digit years. */
870
+ plausibleWindow?: MedicationDatePlausibleWindow;
871
+ /** How to handle multiple valid calendar interpretations. Defaults to prefer-first. */
872
+ ambiguity?: "prefer-first" | "reject";
873
+ }
874
+ export interface MedicationDateResolverContext {
875
+ locale: string;
876
+ referenceDate: string;
877
+ }
878
+ export interface MedicationDateResolverResult {
879
+ /** Gregorian year used in the normalized ISO date. */
880
+ isoYear: number;
881
+ /** Full year in the resolver's source calendar. */
882
+ calendarYear: number;
883
+ /** Whether a two-digit source year was expanded. */
884
+ inferredYear: boolean;
885
+ }
886
+ export interface MedicationDateResolver {
887
+ /** Stable resolver/calendar id, e.g. gregory or buddhist. */
888
+ id: string;
889
+ resolveYear(sourceYear: number, sourceYearDigits: number, context: MedicationDateResolverContext): MedicationDateResolverResult | undefined;
890
+ /**
891
+ * Optional reverse mapping used when the source omitted a year and the
892
+ * parser inferred an ISO year from the reference date.
893
+ */
894
+ calendarYearFromIsoYear?(isoYear: number): number | undefined;
895
+ }
850
896
  export interface ParseOptions extends FormatOptions {
851
897
  /**
852
898
  * Optional medication context that assists with default unit inference.
853
899
  * May be omitted or explicitly set to null when no contextual clues exist.
854
900
  */
855
901
  context?: MedicationContext | null;
902
+ /**
903
+ * Advanced date interpretation overrides. Ordinary callers can omit this:
904
+ * locale-relevant calendar resolvers are enabled automatically.
905
+ */
906
+ datePolicy?: MedicationDatePolicy;
856
907
  routeMap?: Record<string, RouteCode>;
857
908
  unitMap?: Record<string, string>;
858
909
  /**
@@ -1029,6 +1080,22 @@ export interface CanonicalActivityTimingExpr {
1029
1080
  /** Maximum offset from the activity in minutes. */
1030
1081
  offsetMax?: number;
1031
1082
  }
1083
+ export interface CanonicalCalendarEventExpr {
1084
+ /** Gregorian ISO calendar date used for date-only FHIR Timing.event values and display. */
1085
+ isoDate: string;
1086
+ /** Original timestamp-valued FHIR Timing.event value, retained losslessly when present. */
1087
+ fhirDateTime?: string;
1088
+ /** Resolver/calendar that interpreted the source year. */
1089
+ calendar: string;
1090
+ /** Full source-calendar year after any two-digit expansion. */
1091
+ calendarYear: number;
1092
+ month: number;
1093
+ day: number;
1094
+ /** Exact source fragment representing this event or inherited day. */
1095
+ sourceText: string;
1096
+ /** True when a two-digit source year was expanded using the reference date. */
1097
+ inferredYear?: boolean;
1098
+ }
1032
1099
  export interface CanonicalScheduleExpr {
1033
1100
  timingCode?: string;
1034
1101
  count?: number;
@@ -1036,6 +1103,10 @@ export interface CanonicalScheduleExpr {
1036
1103
  duration?: number;
1037
1104
  durationMax?: number;
1038
1105
  durationUnit?: FhirPeriodUnit;
1106
+ /** Earliest calendar date/time on which this schedule becomes active. */
1107
+ boundsStart?: string;
1108
+ /** Latest inclusive calendar date/time on which this schedule remains active. */
1109
+ boundsEnd?: string;
1039
1110
  /** Duration of each administration occurrence, distinct from regimen bounds duration. */
1040
1111
  administrationDuration?: number;
1041
1112
  administrationDurationMax?: number;
@@ -1054,6 +1125,8 @@ export interface CanonicalScheduleExpr {
1054
1125
  dayOfWeek?: FhirDayOfWeek[];
1055
1126
  when?: EventTiming[];
1056
1127
  timeOfDay?: string[];
1128
+ /** Explicit calendar occurrences, projected to FHIR Timing.event. */
1129
+ calendarEvents?: CanonicalCalendarEventExpr[];
1057
1130
  activityTiming?: CanonicalActivityTimingExpr[];
1058
1131
  occurrenceCap?: CanonicalOccurrenceCapExpr;
1059
1132
  evidence?: CanonicalEvidence[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ezmedicationinput",
3
- "version": "0.1.63",
3
+ "version": "0.1.65",
4
4
  "description": "Parse concise medication sigs into FHIR R5 Dosage JSON",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",