ezmedicationinput 0.3.1 → 0.3.2-beta.0

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.
@@ -65,6 +65,9 @@ export interface BodySitePhraseContext {
65
65
  allowTerminalModifierInheritance?: boolean;
66
66
  }
67
67
  export declare function isBodySiteNominalModifier(word: string): boolean;
68
+ /** A locative governor with only determiner/modifier daughters still awaits
69
+ * its anatomical head. An ambiguous route word cannot close that nominal. */
70
+ export declare function bodySiteModifierHasLocativeGovernor(parts: readonly Token[], index: number): boolean;
68
71
  /** Complete registered nominal evidence only. A caller must still license its
69
72
  * grammatical role; this lookup does not attach a site or suppress an action. */
70
73
  export declare function bodySiteModifierNominalAt(parts: readonly Token[], index: number, customSiteMap?: Record<string, BodySiteDefinition>, context?: BodySitePhraseContext, limit?: number): {
@@ -76,8 +79,9 @@ export declare function lookupBodySiteDefinition(map: Record<string, BodySiteDef
76
79
  /** Articles belong to a nominal constituent, including a spatial target.
77
80
  * Callers retain exact whole matches and require recognized remainder meaning. */
78
81
  export declare function withoutBodySiteNominalArticles(text: string): string;
79
- /** Position already resolved nominal modifiers through their registered class. */
80
- export declare function composeBodySiteNominalModifiers(text: string, modifiers: readonly string[]): string;
82
+ /** Compose resolved modifiers in the selected wording's registered locale.
83
+ * A missing capability leaves the caller's complete authored wording intact. */
84
+ export declare function composeBodySiteNominalModifiers(text: string, modifiers: readonly string[]): string | undefined;
81
85
  /** Exact anatomy retains precedence over focus-only modifier inheritance. */
82
86
  export declare function resolveBodySiteAnatomyDefinition(canonical: string, customSiteMap?: Record<string, BodySiteDefinition>): BodySiteDefinition | undefined;
83
87
  /** One lexical interpretation for standalone and clause-level site predicates.
@@ -154,7 +154,10 @@ export interface CanonicalBoundary {
154
154
  * Other non-treatment anchors need an external resolver; never reinterpret
155
155
  * them as treatment-relative dates. */
156
156
  anchor: "treatment-start" | "treatment-day-start" | "previous-phase-next-day" | "previous-phase-end" | "coded-event" | "resource-reference" | "definition" | "path" | "unresolved";
157
- contextCode?: CanonicalConcept;
157
+ contextCode?: CanonicalConcept & {
158
+ /** Whole event-label translations selected by the originating provider. */
159
+ i18n?: Record<string, string>;
160
+ };
158
161
  contextReference?: CanonicalReference;
159
162
  contextDefinition?: string;
160
163
  contextPath?: string;
@@ -3,12 +3,13 @@
3
3
  * Display stays separate from executable interpretation: unknown expressions
4
4
  * and boundaries remain visible without inventing values or event dates. */
5
5
  import type { FormatBatchOptions, FormatOptions, MedicationCondition, FhirDayOfWeek, CanonicalSigClause, CanonicalScheduleExpr } from "../types";
6
- import type { CanonicalCourse, CanonicalAdministration, CanonicalRange, CanonicalExpression, CanonicalSafety } from "./course";
6
+ import type { CanonicalCourse, CanonicalAdministration, CanonicalRange, CanonicalExpression, CanonicalDoseLimit, CanonicalSafety } from "./course";
7
7
  import { type SigLocalization, type CourseLanguage } from "../i18n";
8
8
  /** Resolved once per invocation; recursive clinical composition reuses it. */
9
9
  interface CourseFormatEnvironment {
10
10
  localization?: SigLocalization;
11
11
  words: CourseLanguage;
12
+ locale?: string;
12
13
  }
13
14
  export declare function joinGeneratedClauses(clauses: readonly string[], separator?: string): string;
14
15
  export declare function appendMedicationExcludedDatesText(text: string, dates: readonly string[], options?: FormatOptions, environment?: CourseFormatEnvironment): string;
@@ -25,6 +26,12 @@ export declare function rateRangePreview(range: CanonicalRange): string | undefi
25
26
  export declare function prefersSourceInstruction(course: CanonicalCourse): boolean;
26
27
  /** Unconditional membership owns a shared allowance across every selectable path. */
27
28
  export declare function formatCourseChoices<T>(members: readonly T[], render: (member: T, sharedCountAlreadyDisplayed?: boolean) => string, choiceOf: (member: T) => CanonicalAdministration["choice"], words: CourseLanguage, separator?: string, courseLabels?: ReadonlyMap<string, ReadonlyMap<string, string>>, sharedCountOf?: (member: T) => CanonicalScheduleExpr["sharedCount"], memberFormatOverride?: boolean, localization?: SigLocalization): string;
29
+ /** Render the value and scope of each authored limit without evaluating it.
30
+ * Member, stage and course owners share this value rendering; their enclosing
31
+ * wording remains separate so a shared allowance is never repeated per dose.
32
+ * Partial quantities and expressions remain visible rather than disappearing
33
+ * merely because numeric execution cannot use them. */
34
+ export declare function formatDoseLimits(limits: readonly CanonicalDoseLimit[], style: "short" | "long", environment: CourseFormatEnvironment): string;
28
35
  /** Transient renderer result for callers retaining independently authored text. */
29
36
  interface AuthoredDirectionsState {
30
37
  text: string;
@@ -10,7 +10,9 @@ export declare function resolveEventTimingExpression(parts: readonly string[], s
10
10
  /** A dose head owns its complete registered event modifiers. Return the
11
11
  * selected nominal end so an adjacent calendar daughter can keep its own role.
12
12
  * Withholding valence can also select the whole-medication noun without an event. */
13
- export declare function medicationDoseSlotNominalEnd(words: readonly string[], options?: ParseOptions, requireEvent?: boolean): number | undefined;
13
+ export declare function medicationDoseSlotNominalEnd(words: readonly string[], options?: ParseOptions, requireEvent?: boolean, selectedEvent?: {
14
+ timing?: EventTiming;
15
+ }): number | undefined;
14
16
  /** Complete source coverage prevents an unrelated food or opaque noun from
15
17
  * borrowing a contained event as proof of a medication target. */
16
18
  export declare function isMedicationDoseSlotNominal(words: readonly string[], options?: ParseOptions): boolean;
package/dist/format.d.ts CHANGED
@@ -5,6 +5,9 @@ import { type InstructionGraphPrimaryCondition } from "./instruction-graph";
5
5
  import { type AdviceFrame, type CanonicalAdditionalInstructionExpr, CanonicalScheduleExpr, CanonicalSigClause, EventTiming, FhirPeriodUnit, type MedicationCondition, type FhirDayOfWeek } from "./types";
6
6
  import { type TimingSummaryOptions } from "./timing-summary";
7
7
  export declare function scheduleOf(clause: CanonicalSigClause): CanonicalScheduleExpr;
8
+ /** The explicit exclusion owns a complete weekday-complement label.
9
+ * Keep the full schedule for cadence and execution; only its list is redundant. */
10
+ export declare function calendarExclusionOwnsWeekdayDisplay(clause: CanonicalSigClause): boolean;
8
11
  /** A method can name a registered manner rather than an action head. */
9
12
  export declare function registeredMethodManner(method: CanonicalSigClause["method"], resolvedMethod?: SigLongContext["resolvedMethod"]): import("./types").AdditionalInstructionDefinition | undefined;
10
13
  export declare function alternateDayEvent(schedule: CanonicalScheduleExpr | undefined): EventTiming | undefined;
@@ -92,7 +95,7 @@ export declare function richGraphAdministrationTail(clause: CanonicalSigClause,
92
95
  export declare function instructionGraphMatchesDose(clause: CanonicalSigClause): boolean;
93
96
  export declare function instructionGraphActionHasSequenceSuccessor(clause: CanonicalSigClause, action: AdviceFrame | undefined): boolean;
94
97
  export declare function hasExplicitAdministrationMethod(clause: CanonicalSigClause): boolean;
95
- export declare function instructionGraphCanStandAlone(clause: CanonicalSigClause, timingText: string | undefined, graphRepresentsDose: boolean, richPrimaryAction: AdviceFrame | undefined, graphText: string | undefined, primaryConditions: InstructionGraphPrimaryCondition[] | undefined): boolean;
98
+ export declare function instructionGraphCanStandAlone(clause: CanonicalSigClause, timingText: string | undefined, richPrimaryAction: AdviceFrame | undefined, graphText: string | undefined, primaryConditions: InstructionGraphPrimaryCondition[] | undefined, preparationSuppliesDose?: boolean): boolean;
96
99
  /** Calendar qualifiers use locale-owned labels and stay on their medication
97
100
  * primary before independent instructions are composed. */
98
101
  export declare function appendClinicalCalendarText(text: string, dates: readonly string[] | undefined, weekdays: readonly FhirDayOfWeek[] | undefined, words: CourseLanguage): string;
@@ -140,6 +140,7 @@ export declare const OCCURRENCE_CAP_PERIOD_PHRASES: {
140
140
  parts: string[];
141
141
  period: number;
142
142
  periodUnit: string;
143
+ unitDenominator: boolean | undefined;
143
144
  }[];
144
145
  export declare const FREQUENCY_SIMPLE_WORDS_DATA: Record<string, number>;
145
146
  export declare const FREQUENCY_NUMBER_WORDS_DATA: Record<string, number>;
@@ -460,6 +461,11 @@ export declare function additiveDoseNumberAt(tokens: readonly LexToken[], start:
460
461
  value: number;
461
462
  numericIndex: number;
462
463
  } | undefined;
464
+ /** The connector and fractional part can also continue a compact range. */
465
+ export declare function additiveDoseContinuationAt(tokens: readonly LexToken[], start: number, limit: number, whole: number, allowMillion: boolean): {
466
+ value: number;
467
+ numericIndex: number;
468
+ } | undefined;
463
469
  /** A million is a numeric multiplier, never a medication unit.
464
470
  * Shared by exact/comparative scalar and dimensional quantities. Source
465
471
  * position advances past a separately spelled multiplier only when present. */
@@ -1,6 +1,6 @@
1
1
  import { type InstructionActionProgram } from "../instruction-action-parser";
2
2
  import { frameActionDefinition } from "../instruction-graph";
3
- import { type AdviceFrame } from "../types";
3
+ import { AdviceRelation, type AdviceFrame } from "../types";
4
4
  import { type HpsgClauseContext } from "./rule-context";
5
5
  type OpaqueSpans = NonNullable<InstructionActionProgram["opaqueSpans"]>;
6
6
  type ProceduralProgram = InstructionActionProgram & {
@@ -46,10 +46,10 @@ export declare function proceduralInstructionProgram(context: HpsgClauseContext,
46
46
  export declare function unownedDoseLexicalEnd(context: Pick<HpsgClauseContext, "tokens" | "options"> & {
47
47
  limit?: number;
48
48
  }, frames: readonly AdviceFrame[], start: number, limit?: number): number | undefined;
49
- /** A measured procedure's independently selected cadence licenses exact
50
- * elapsed coverage. Without that proof, retain ordinary primary selection.
51
- * Methods with registered administration runtime keep their timing owner. */
49
+ /** Independent selected cadence licenses administration coverage; other heads retain primary selection. */
52
50
  export declare function localAdministrationDurationSpan(frame: AdviceFrame, definition: ReturnType<typeof frameActionDefinition>, program: InstructionActionProgram): import("../types").TextRange | undefined;
51
+ /** A selected relative clock belongs to its measured Time argument. */
52
+ export declare function procedureOwnsRelativeClock(context: HpsgClauseContext, sourceStart: number, value: string, relation: AdviceRelation): boolean;
53
53
  /** Return the conditional's existing action owner, if it is advice rather
54
54
  * than a newly quantified administration. */
55
55
  export declare function conditionalAdviceProgramAt(context: HpsgClauseContext, index: number): AdviceFrame[] | undefined;
@@ -68,5 +68,5 @@ export declare function followingProcedureOwnsTemporalAdjunct(context: HpsgClaus
68
68
  export type HpsgAttachmentClass = "administration" | "procedure";
69
69
  export declare function sourceRangeAttachmentClass(context: HpsgClauseContext, start: number, end: number, selectedNominal?: boolean, selectedPhaseOnset?: boolean, selectedSchedule?: boolean): HpsgAttachmentClass;
70
70
  /** A temporal linker between two complete action events is not an opaque condition. */
71
- export declare function actionEventRelationAt(context: HpsgClauseContext, index: number): import("../types").AdviceRelation | undefined;
71
+ export declare function actionEventRelationAt(context: HpsgClauseContext, index: number): AdviceRelation | undefined;
72
72
  export {};
@@ -1,11 +1,11 @@
1
1
  import { ParserState, Token } from "../parser-state";
2
- import { EventTiming, FhirDayOfWeek, RouteCode, type CanonicalSigClause, type CanonicalSiteExpr, type CanonicalLexicalCategory, type CanonicalScheduleSemanticField } from "../types";
2
+ import { EventTiming, FhirDayOfWeek, RouteCode, type CanonicalSigClause, type CanonicalSiteExpr, type CanonicalSourceSpan, type CanonicalLexicalCategory, type CanonicalScheduleSemanticField } from "../types";
3
3
  import { HpsgScheduleFeature, HpsgSign } from "./signature";
4
4
  export interface HpsgProjectionDeps {
5
5
  addDayOfWeekList: (state: ParserState, days: FhirDayOfWeek[]) => void;
6
6
  addWhen: (target: EventTiming[], whenCode: EventTiming) => void;
7
7
  markToken: (state: ParserState, token: Token) => void;
8
- recordEvidence: (state: ParserState, rule: string, startIndex: number, endIndex: number, scheduleFields?: CanonicalScheduleSemanticField[], lexicalCategory?: CanonicalLexicalCategory) => void;
8
+ recordEvidence: (state: ParserState, rule: string, startIndex: number, endIndex: number, scheduleFields?: CanonicalScheduleSemanticField[], lexicalCategory?: CanonicalLexicalCategory, coordination?: CanonicalSourceSpan["coordination"]) => void;
9
9
  refreshMethodSurface: (state: ParserState) => void;
10
10
  setRoute: (state: ParserState, code: RouteCode, text?: string) => void;
11
11
  }
@@ -5,7 +5,7 @@ import { type FhirCoding, EventTiming, FhirPeriodUnit, ParseOptions, type Canoni
5
5
  import { type LexToken } from "../lexer/token-types";
6
6
  import type { MedicationDateListMatch } from "../date-interpretation";
7
7
  import { type ParsedMedicationGuard } from "./constructions";
8
- import { MEAL_RELATION_BY_TOKEN } from "./lexical-classes";
8
+ import { ADMINISTRATION_WINDOW_INSTRUCTIONS, MEAL_RELATION_BY_TOKEN } from "./lexical-classes";
9
9
  export { normalizeTokenLower, parseClockToken } from "./lexical-classes";
10
10
  import { HpsgLexicalRule, HpsgSign } from "./signature";
11
11
  import { HpsgProjectionDeps } from "./projection";
@@ -33,6 +33,8 @@ export interface HpsgClauseContext {
33
33
  /** Complete administration schedules already admitted by the lexical chart.
34
34
  * Generic source-tail fallback cannot detach their internal words. */
35
35
  scheduleTokenIndices?: Set<number>;
36
+ /** Exact timing daughters owned by a complete, admitted unguarded schedule. */
37
+ ownedScheduleDaughterStarts?: Set<number>;
36
38
  /** Typed nominal signs requested before generic instruction fallback. */
37
39
  siteLookahead?: Map<number, HpsgSign[]>;
38
40
  medicationGuardScanned?: true;
@@ -72,14 +74,16 @@ export declare function infusionDurationAt(context: HpsgClauseContext, start: nu
72
74
  } | undefined;
73
75
  /** The nearest selected action or clause boundary owns a following complement. */
74
76
  export declare function precedingMedicationInstructionAction(context: HpsgClauseContext, start: number): MedicationInstructionActionDefinition | undefined;
75
- /** The selected action licenses both the current duration and any disambiguating runtime. */
76
- export declare function selectedMethodOwnsAdministrationDuration(context: HpsgClauseContext, start: number, relation: string, definition: MedicationInstructionActionDefinition | undefined): boolean;
77
- export declare function precedingMethodOwnsAdministrationDuration(context: HpsgClauseContext, start: number, relation: string): boolean;
77
+ /** The selected method contributes the exact elapsed daughter it licenses. */
78
+ export declare function selectedMethodDurationAt(context: HpsgClauseContext, start: number, relation: string, definition: MedicationInstructionActionDefinition | undefined, recognized?: ClinicalDurationMatch): ClinicalDurationMatch | undefined;
79
+ export declare function precedingMethodDurationAt(context: HpsgClauseContext, start: number, relation: string, recognized?: ClinicalDurationMatch): ClinicalDurationMatch | undefined;
78
80
  export declare function isClockLikeLower(lower: string): boolean;
79
81
  export declare function isAmPmLower(lower: string): boolean;
80
82
  export declare function isAnteMeridiemLower(lower: string): boolean;
81
83
  export declare function isPostMeridiemLower(lower: string): boolean;
82
84
  export declare function tokensAvailable(context: QuantityLexicalContext, start: number, span: number): Token[] | undefined;
85
+ /** Select the longest eligible stock window before its construction takes the tokens. */
86
+ export declare function administrationWindowTemplateAt(context: QuantityLexicalContext, start: number, use: "instruction" | "activity" | "offset"): typeof ADMINISTRATION_WINDOW_INSTRUCTIONS[number] | undefined;
83
87
  /** Read the longest registered activity noun while retaining original tokens.
84
88
  * @param context Shared clause and caller vocabulary.
85
89
  * @param start First noun token, after any separate nominal modifier.
@@ -160,6 +164,7 @@ export declare function occurrenceCapPeriodAt(context: QuantityLexicalContext, s
160
164
  tokens: Token[];
161
165
  period: number;
162
166
  periodUnit: FhirPeriodUnit;
167
+ unitDenominator?: boolean;
163
168
  } | undefined;
164
169
  type MaximumDosePeriod = ({
165
170
  tokens: Token[];
@@ -1,7 +1,7 @@
1
1
  import { Token } from "../../parser-state";
2
2
  import { type ParseOptions } from "../../types";
3
3
  import { HpsgClauseContext } from "../rule-context";
4
- import { HpsgLexicalRule } from "../signature";
4
+ import { HpsgLexicalRule, HpsgSign } from "../signature";
5
5
  /** Bounded lexical recognition shared by chart and boundary candidacy.
6
6
  * @param tokens Source tokens with the existing locale normalization.
7
7
  * @param start Candidate head index; never searches arbitrary later text.
@@ -22,8 +22,10 @@ export declare function directiveMarkerLexicalRule(): HpsgLexicalRule<HpsgClause
22
22
  export declare function methodLexicalRule(): HpsgLexicalRule<HpsgClauseContext>;
23
23
  /** An exact end lets an adjacent constituent request this same route owner. */
24
24
  export declare function routeLexicalRule(exactEnd?: number): HpsgLexicalRule<HpsgClauseContext>;
25
- /** Complete governed route boundary; the route lexical rule still owns its value. */
26
- export declare function governedRouteLexicalEnd(tokens: readonly Token[], start: number, options?: ParseOptions, limit?: number): number | undefined;
25
+ /** A licensed compound can replace two adjacent lexical mentions of the same route. */
26
+ export declare function configuredRouteCoveringSplit(routes: ReadonlyMap<number, readonly HpsgSign[]>, left: HpsgSign, right: HpsgSign): HpsgSign | undefined;
27
+ /** An action needs a route boundary. The chart selects its extent and value. */
28
+ export declare function hasGovernedRouteAt(tokens: readonly Token[], start: number, options?: ParseOptions): boolean;
27
29
  export declare function fillerLexicalRule(): HpsgLexicalRule<HpsgClauseContext>;
28
30
  export declare function productLexicalRule(cacheLookahead?: boolean): HpsgLexicalRule<HpsgClauseContext>;
29
31
  /**
@@ -12,7 +12,8 @@ export declare function matchContextualPrnReasonLead(context: HpsgClauseContext,
12
12
  export declare function tokenBelongsToContextualPrnReasonLead(context: HpsgClauseContext, tokenIndex: number): boolean;
13
13
  export declare function hasSymptomOnsetPrnAt(context: HpsgClauseContext, start: number): boolean;
14
14
  export declare function symptomOnsetPrnRule(): HpsgLexicalRule<HpsgClauseContext>;
15
- /** Offer an established indication before the conditional target is selected. */
15
+ /** Locate the end of an established indication before conditional attachment. */
16
+ export declare function knownPrnNominalEndBefore(context: HpsgClauseContext, start: number, boundary: number): number | undefined;
16
17
  export declare function hasKnownPrnNominalBefore(context: HpsgClauseContext, start: number, boundary: number): boolean;
17
18
  /** Existing maximum-boundary callers use the same complete nominal proof. */
18
19
  export declare const prnEndsBeforeMaximum: typeof hasKnownPrnNominalBefore;
@@ -1,8 +1,9 @@
1
1
  import { type QuantityLexicalContext } from "../quantity-lexicon";
2
2
  import { Token } from "../../parser-state";
3
3
  import { type AdviceFrame, AdviceRelation, EventTiming, FhirDayOfWeek, FhirPeriodUnit, type CanonicalCalendarEventExpr, type CanonicalAdditionalInstructionExpr, type FhirCoding, type FhirQuantity, type ParseOptions } from "../../types";
4
+ import { type EventTimingExpression } from "../../event-timing-expression";
4
5
  import { HpsgClauseContext, maximumCountLeadAt, maximumDosePerPeriodAt, maximumDosePeriodAt, clinicalDurationAt } from "../rule-context";
5
- import { HpsgLexicalRule, HpsgSign } from "../signature";
6
+ import { HpsgLexicalRule, HpsgScheduleFeature, HpsgSign } from "../signature";
6
7
  export { followingCourseDurationHeaderAt } from "../timing-lexicon";
7
8
  export interface OrdinalWeekStageHeader {
8
9
  tokenStart: number;
@@ -28,6 +29,14 @@ export declare function monthlyOrdinalWeekdayParts(context: HpsgClauseContext, s
28
29
  } | undefined;
29
30
  export declare function multiplicativeDoseFrequencyRule(): HpsgLexicalRule<HpsgClauseContext>;
30
31
  export declare function compactIntervalRule(): HpsgLexicalRule<HpsgClauseContext>;
32
+ interface CadenceNominal {
33
+ end: number;
34
+ schedule: HpsgScheduleFeature;
35
+ rule: string;
36
+ score: number;
37
+ scheduleDefault?: HpsgSign["evidence"][number]["scheduleDefault"];
38
+ countedIntervalStart?: number;
39
+ }
31
40
  export declare function separatedIntervalRule(): HpsgLexicalRule<HpsgClauseContext>;
32
41
  /** One complete occurrence maximum is shared by the schedule chart and guard scope. */
33
42
  export declare function maximumOccurrenceAt(context: Parameters<typeof maximumCountLeadAt>[0], start: number, lead?: {
@@ -51,7 +60,6 @@ export type MaximumPredicateScope = "unresolved" | "condition" | "measurement" |
51
60
  * an opaque Boolean predicate. Explicit separators/maximum heads retain their
52
61
  * independent instruction license. */
53
62
  export declare function isIndependentMaximum(context: Parameters<typeof maximumCountLeadAt>[0], start: number, maximum: NonNullable<ReturnType<typeof maximumOccurrenceAt> | ReturnType<typeof maximumDosePerPeriodAt>>, predicateScope?: MaximumPredicateScope, endSource?: number): boolean;
54
- export declare function separatedFrequencyRangeRule(): HpsgLexicalRule<HpsgClauseContext>;
55
63
  /**
56
64
  * A distributive cadence followed directly by a discrete unit licenses an
57
65
  * elided cardinal one: Thai `วันละเม็ด` => one tablet daily. This is narrower
@@ -60,45 +68,41 @@ export declare function separatedFrequencyRangeRule(): HpsgLexicalRule<HpsgClaus
60
68
  export declare function cadenceFirstImplicitSingleDoseRule(): HpsgLexicalRule<HpsgClauseContext>;
61
69
  export declare function cadenceFirstFrequencyRule(): HpsgLexicalRule<HpsgClauseContext>;
62
70
  export declare function singleOccurrencePhraseRule(): HpsgLexicalRule<HpsgClauseContext>;
63
- /** Complete declared cardinal/cadence nominal, shared with local action
64
- * boundaries. HPSG's contextual ownership guards remain at its lexical rule. */
65
- export declare function countFrequencyNominalAt(context: QuantityLexicalContext, start: number): HpsgSign | undefined;
66
- /** Complete recurrence morphology shared with action-valence boundaries.
67
- * The lexical productions below still own the schedule meaning and evidence. */
71
+ /** A complete count selects a cadence daughter or denotes the course count.
72
+ * Action boundaries share this reading without allocating a chart sign. */
73
+ export declare function countFrequencyNominalAt(context: QuantityLexicalContext, start: number): CadenceNominal | undefined;
74
+ /** Reuse the provider's annotated abbreviation while keeping exact compact
75
+ * spellings available to consumers of raw (unannotated) action tokens. */
76
+ export declare function timingAbbreviationAt(token: Token, lower: string): import("../../maps").FrequencyDescriptor;
77
+ /** Complete recurrence morphology shared with action-valence boundaries. */
68
78
  export declare function cadenceNominalEnd(context: QuantityLexicalContext, start: number): number | undefined;
69
79
  export declare function countFrequencyRule(): HpsgLexicalRule<HpsgClauseContext>;
80
+ /** A complete standalone cadence between two independently owned constituents. */
81
+ export declare function recurrenceFillsSpan(context: HpsgClauseContext, start: number, end: number): boolean;
70
82
  export declare function alternateEventCadenceRule(): HpsgLexicalRule<HpsgClauseContext>;
71
83
  export declare function calendarDateListRule(): HpsgLexicalRule<HpsgClauseContext>;
72
84
  export declare function timingLexicalRule(): HpsgLexicalRule<HpsgClauseContext>;
73
85
  /** The same relation-selected event owns bare, immediate, and quantified
74
86
  * timing constituents. Sleep and wake keep their established lexical aliases. */
75
- export declare function relatedEventTimingExpression(parts: readonly string[], relation: "before" | "after" | "with"): {
76
- timing: EventTiming;
77
- length: number;
78
- } | undefined;
87
+ export declare function relatedEventTimingExpression(parts: readonly string[], relation: "before" | "after" | "with"): EventTimingExpression | undefined;
79
88
  interface QualifiedEventAdvice {
80
89
  start: number;
81
90
  end: number;
82
91
  frame?: AdviceFrame;
83
92
  alternative?: true;
93
+ measuredAlternative?: {
94
+ left: EventTiming;
95
+ right: EventTiming;
96
+ quantity: EventOffsetQuantity;
97
+ };
84
98
  registeredInstruction?: CanonicalAdditionalInstructionExpr;
85
99
  }
86
100
  /** A selected MealState owns its complete nominal before a contained generic
87
101
  * event. Reuse the selected argument's provider and occurrence proof; unheaded
88
102
  * stock compounds keep their existing lexical fallback. */
89
103
  export declare function qualifiedEventAdviceAt(context: HpsgClauseContext, index: number): QualifiedEventAdvice | undefined;
90
- interface CoordinatedRelatedEvents {
91
- timings: EventTiming[];
92
- members: Token[];
93
- next: number;
94
- }
95
- /**
96
- * Compose a relation-scoped list of event daughters. English commonly names
97
- * every meal (`breakfast, lunch and dinner`), while Thai commonly shares the
98
- * nominal head (`อาหารเช้า กลางวัน และเย็น`). Both are the same typed list;
99
- * disjunction remains outside this conjunctive construction.
100
- */
101
- export declare function coordinatedRelatedEventsAt(context: QuantityLexicalContext, start: number, relation: "before" | "after" | "with", measuredOffset?: boolean): CoordinatedRelatedEvents | undefined;
104
+ /** Action lookahead admits an unqualified event, then extends its measured meal list. */
105
+ export declare function measuredActionEventEnd(tokens: readonly Token[], start: number, relation: AdviceRelation | undefined): number | undefined;
102
106
  type EventOffsetQuantity = {
103
107
  value: number;
104
108
  unit: FhirPeriodUnit;
@@ -9,7 +9,12 @@ export interface HpsgEvidence {
9
9
  rule: string;
10
10
  /** Canonical provenance comes from the typed lexical sign, not its rule ID. */
11
11
  lexicalCategory?: CanonicalLexicalCategory;
12
+ /** Selected connective retained for canonical graph projection. */
13
+ coordination?: HpsgCoordinationMarkerFeature["coordination"];
12
14
  tokenIndices: number[];
15
+ /** Route lexical evidence identifies a registered constituent at a chart split. */
16
+ routeLexeme?: RouteCode;
17
+ configuredRoute?: true;
13
18
  /** Lexical evidence that a schedule field is an inferred, construction-local default. */
14
19
  scheduleDefault?: "daily-frequency" | "weekday-recurrence";
15
20
  /** Exact typed schedule fields contributed by this lexical evidence. */
@@ -107,12 +112,24 @@ export interface HpsgConditionFeature {
107
112
  * sign. This is distinct from HpsgConditionFeature, which scopes procedural
108
113
  * instruction programs such as "if irritation occurs, stop use".
109
114
  */
115
+ /** Selected procedural meaning travels with its lexical predicate daughter. */
116
+ export interface HpsgInstructionPredicateSelection {
117
+ condition: Extract<CanonicalInstructionCondition, {
118
+ text: string;
119
+ }>;
120
+ /** A bare nominal may share the following source-final aspect. */
121
+ bareNominal?: boolean;
122
+ closingAspect?: Extract<CanonicalInstructionCondition, {
123
+ text: string;
124
+ }>["aspect"];
125
+ }
110
126
  /** A predicate daughter can require a measurement head from an adjacent
111
127
  * coordinate. Only the HPSG coordination construction may discharge it. */
112
128
  export type HpsgGuardExpression = {
113
129
  kind: "predicate";
114
130
  value: MedicationCondition;
115
131
  dayInvariant?: true;
132
+ instruction?: HpsgInstructionPredicateSelection;
116
133
  } | {
117
134
  kind: "measurement-complement";
118
135
  operation: "gt" | "ge" | "lt" | "le" | "eq";
@@ -136,6 +153,8 @@ export interface HpsgGuardFeature {
136
153
  licensesBareIf?: true;
137
154
  }
138
155
  export interface HpsgClinicalAdjunctFeature {
156
+ courseStart?: CanonicalClinicalAdjuncts["courseStart"];
157
+ courseEnd?: CanonicalClinicalAdjuncts["courseEnd"];
139
158
  treatmentPause?: CanonicalClinicalAdjuncts["treatmentPause"];
140
159
  condition?: MedicationCondition;
141
160
  /** Day-domain meaning retained separately for typed anaphoric complements. */
@@ -238,6 +257,7 @@ declare module "../types" {
238
257
  }
239
258
  }
240
259
  export interface HpsgScheduleFeature {
260
+ eventAlternatives?: CanonicalScheduleExpr["eventAlternatives"];
241
261
  cycleDayConstraint?: CanonicalCycleDayConstraint;
242
262
  /** Typed whole-course interval for a recurring active/rest construction. */
243
263
  repeatCycle?: FhirQuantity;
@@ -351,6 +371,8 @@ export interface HpsgSign {
351
371
  fs: HpsgFeatureNode;
352
372
  /** Immediate phrase-construction provenance for non-lexical signs. */
353
373
  construction?: HpsgConstruction;
374
+ /** Clause-local start of an exact schedule daughter selected by this sign. */
375
+ ownedScheduleDaughterStart?: number;
354
376
  consumedTokenIndices: number[];
355
377
  siteTokenIndices?: number[];
356
378
  warnings?: string[];
@@ -28,6 +28,10 @@ export declare function periodUnitSuffix(unit: FhirPeriodUnit): string | undefin
28
28
  export declare function applyPeriod(internal: ParserState, period: number, unit: FhirPeriodUnit): void;
29
29
  export declare function buildPeriodScheduleFeature(period: number, unit: FhirPeriodUnit, when?: EventTiming): HpsgScheduleFeature;
30
30
  export declare function mapIntervalUnit(token: string): FhirPeriodUnit.Minute | FhirPeriodUnit.Hour | FhirPeriodUnit.Day | FhirPeriodUnit.Week | FhirPeriodUnit.Month | undefined;
31
+ /** Complete remaining-day nominal shared by calendar and preposition ownership. */
32
+ export declare function weekdayComplementNominalEnd(tokens: readonly LexToken[], start: number, limit?: number): number | undefined;
33
+ /** A course licenses temporal units from the shared instruction vocabulary. */
34
+ export declare function courseDurationUnit(surface: string): FhirPeriodUnit | undefined;
31
35
  /** Bounded lexical constituent for a fronted following treatment course.
32
36
  * The planner reuses its source extent; duration consumers retain the
33
37
  * same selected numeric daughter.
@@ -38,6 +42,7 @@ export declare function followingCourseDurationHeaderAt(tokens: readonly LexToke
38
42
  valueIndex: number;
39
43
  tokenEnd: number;
40
44
  implicitSingle?: boolean;
45
+ prospective?: true;
41
46
  range?: {
42
47
  low: number;
43
48
  high: number;
package/dist/i18n.d.ts CHANGED
@@ -53,6 +53,8 @@ interface NativeClauseRendering {
53
53
  short: typeof formatShortEnglish;
54
54
  timing: typeof ENGLISH_CLAUSE_TIMING;
55
55
  dose: NonNullable<SigLocalization["formatDose"]>;
56
+ /** An amount without administration or per-target wording, for scoped limits. */
57
+ quantity: NonNullable<SigLocalization["formatDose"]>;
56
58
  }
57
59
  export declare function registerSigLocalization(localization: SigLocalization): void;
58
60
  export declare function getRegisteredSigLocalizations(): SigLocalization[];