ezmedicationinput 0.1.63 → 0.1.64

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.
@@ -0,0 +1,20 @@
1
+ import { CanonicalCalendarEventExpr, MedicationDateResolver, ParseOptions } from "./types";
2
+ export type MedicationDateRelation = "event" | "start-inclusive" | "start-exclusive" | "end-inclusive" | "end-exclusive";
3
+ export interface MedicationDateListMatch {
4
+ start: number;
5
+ end: number;
6
+ sourceText: string;
7
+ relation: MedicationDateRelation;
8
+ events: CanonicalCalendarEventExpr[];
9
+ unresolved: boolean;
10
+ }
11
+ /** Register or replace a calendar resolver used by medication date interpretation. */
12
+ export declare function registerMedicationDateResolver(resolver: MedicationDateResolver): void;
13
+ /** Return the currently registered calendar resolver ids. */
14
+ export declare function listMedicationDateResolvers(): string[];
15
+ /** Scan structurally date-shaped numeric date lists, whether resolved or ambiguous. */
16
+ export declare function findMedicationDateListSpans(input: string, options?: ParseOptions): MedicationDateListMatch[];
17
+ /** Resolve a date list beginning exactly at the supplied source offset. */
18
+ export declare function parseMedicationDateListAt(input: string, start: number, options?: ParseOptions): MedicationDateListMatch | undefined;
19
+ /** True when a source range overlaps a recognized date-shaped list span. */
20
+ export declare function sourceRangeOverlapsMedicationDate(input: string, start: number, end: number, options?: ParseOptions): boolean;
package/dist/fhir.d.ts CHANGED
@@ -6,6 +6,7 @@ export declare const TIMING_OFFSET_MAX_EXTENSION_URL = "https://solublelabs.com/
6
6
  export declare const TIMING_OFFSET_EXACT_EXTENSION_URL = "https://solublelabs.com/fhir/StructureDefinition/medication-timing-offset-exact";
7
7
  export declare const TIMING_ACTIVITY_WINDOW_EXTENSION_URL = "https://solublelabs.com/fhir/StructureDefinition/medication-timing-activity-window";
8
8
  export declare const TIMING_OCCURRENCE_CAP_EXTENSION_URL = "https://solublelabs.com/fhir/StructureDefinition/medication-timing-occurrence-cap";
9
+ export declare const TIMING_EVENT_CALENDAR_SOURCE_EXTENSION_URL = "https://solublelabs.com/fhir/StructureDefinition/medication-timing-event-calendar-source";
9
10
  export declare const PRN_TRIGGER_PHASE_EXTENSION_URL = "https://solublelabs.com/fhir/StructureDefinition/medication-prn-trigger-phase";
10
11
  export declare function getExactTimingOffsetMinutes(repeat: FhirTimingRepeat | undefined): number | undefined;
11
12
  export declare function getTimingOccurrenceCap(repeat: FhirTimingRepeat | undefined): CanonicalOccurrenceCapExpr | undefined;
@@ -1,5 +1,6 @@
1
1
  import { Token, ParserState } from "../parser-state";
2
2
  import { ParseOptions } from "../types";
3
+ import type { MedicationDateListMatch } from "../date-interpretation";
3
4
  import { HpsgLexicalRule } from "./signature";
4
5
  import { HpsgProjectionDeps } from "./projection";
5
6
  import { HpsgUnificationContext } from "./unification";
@@ -7,10 +8,12 @@ export interface HpsgClauseContext {
7
8
  state: ParserState;
8
9
  tokens: Token[];
9
10
  options?: ParseOptions;
11
+ dateSpans: MedicationDateListMatch[];
10
12
  limit: number;
11
13
  deps: HpsgProjectionDeps & HpsgUnificationContext;
12
14
  project?: boolean;
13
15
  }
16
+ export declare function sourceRangeOverlapsContextDate(context: HpsgClauseContext, start: number, end: number): boolean;
14
17
  export declare function normalizeTokenLower(token: Token): string;
15
18
  export declare function isPunctuation(lower: string): boolean;
16
19
  export declare function isClockLikeLower(lower: string): boolean;
@@ -20,6 +20,7 @@ export declare function cadenceFirstFrequencyRule(): HpsgLexicalRule<HpsgClauseC
20
20
  export declare function singleOccurrencePhraseRule(): HpsgLexicalRule<HpsgClauseContext>;
21
21
  export declare function countFrequencyRule(): HpsgLexicalRule<HpsgClauseContext>;
22
22
  export declare function alternateEventCadenceRule(): HpsgLexicalRule<HpsgClauseContext>;
23
+ export declare function calendarDateListRule(): HpsgLexicalRule<HpsgClauseContext>;
23
24
  export declare function timingLexicalRule(): HpsgLexicalRule<HpsgClauseContext>;
24
25
  export declare function quantityFirstActivityTimingRule(): HpsgLexicalRule<HpsgClauseContext>;
25
26
  /**
@@ -1,4 +1,4 @@
1
- import { AdviceFrame, AdviceRelation, CanonicalDoseRange, CanonicalAdditionalInstructionExpr, CanonicalActivityTimingExpr, CanonicalOccurrenceCapExpr, BodySiteSpatialRelation, EventTiming, FhirCoding, FhirDayOfWeek, FhirPeriodUnit, FhirPrimitiveElement, RouteCode, PrnReasonLookupRequest, SiteCodeLookupRequest } from "../types";
1
+ import { AdviceFrame, AdviceRelation, CanonicalDoseRange, CanonicalAdditionalInstructionExpr, CanonicalActivityTimingExpr, CanonicalCalendarEventExpr, CanonicalOccurrenceCapExpr, BodySiteSpatialRelation, EventTiming, FhirCoding, FhirDayOfWeek, FhirPeriodUnit, FhirPrimitiveElement, RouteCode, PrnReasonLookupRequest, SiteCodeLookupRequest } from "../types";
2
2
  import { Token } from "../parser-state";
3
3
  import type { HpsgFeatureNode } from "./type-system";
4
4
  export type HpsgType = "sign" | "word-sign" | "phrase-sign" | "headed-phrase" | "head-complement-phrase" | "head-adjunct-phrase" | "head-marker-phrase" | "procedure-sequence-phrase" | "conditional-instruction-phrase" | "coordination-phrase" | "clause-sign" | "administration-clause" | "method-sign" | "route-sign" | "site-sign" | "dose-sign" | "schedule-sign" | "prn-sign" | "instruction-sign" | "conditional-sign" | "adjustment-sign" | "connector-sign";
@@ -88,6 +88,8 @@ export interface HpsgScheduleFeature {
88
88
  duration?: number;
89
89
  durationMax?: number;
90
90
  durationUnit?: FhirPeriodUnit;
91
+ boundsStart?: string;
92
+ boundsEnd?: string;
91
93
  frequency?: number;
92
94
  frequencyMax?: number;
93
95
  period?: number;
@@ -99,6 +101,7 @@ export interface HpsgScheduleFeature {
99
101
  when?: EventTiming[];
100
102
  dayOfWeek?: FhirDayOfWeek[];
101
103
  timeOfDay?: string[];
104
+ calendarEvents?: CanonicalCalendarEventExpr[];
102
105
  activityTiming?: CanonicalActivityTimingExpr[];
103
106
  occurrenceCap?: CanonicalOccurrenceCapExpr;
104
107
  }