ezmedicationinput 0.3.0-beta.1 → 0.3.1

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.
Files changed (79) hide show
  1. package/README.md +155 -10
  2. package/dist/adapters/canonical-course.d.ts +7 -4
  3. package/dist/adapters/r5-course.d.ts +11 -2
  4. package/dist/advice-locale-adapter.d.ts +24 -0
  5. package/dist/advice.d.ts +39 -3
  6. package/dist/body-site-grammar.d.ts +21 -2
  7. package/dist/body-site-lookup.d.ts +6 -1
  8. package/dist/body-site-spatial.d.ts +7 -1
  9. package/dist/body-site-target.d.ts +35 -3
  10. package/dist/canonical/compile.d.ts +22 -3
  11. package/dist/canonical/course.d.ts +43 -7
  12. package/dist/canonical/dosage-agreement.d.ts +84 -0
  13. package/dist/canonical/format-course.d.ts +4 -2
  14. package/dist/clause-tail-grammar.d.ts +2 -0
  15. package/dist/combine-multilingual-dosages.d.ts +32 -0
  16. package/dist/date-interpretation.d.ts +36 -2
  17. package/dist/dosage-course.d.ts +26 -17
  18. package/dist/event-timing-expression.d.ts +26 -1
  19. package/dist/execution/engine.d.ts +2 -1
  20. package/dist/fhir-quantity-operator.d.ts +37 -1
  21. package/dist/fhir-translations.d.ts +14 -1
  22. package/dist/fhir.d.ts +25 -5
  23. package/dist/format.d.ts +23 -24
  24. package/dist/hpsg/constructions.d.ts +27 -5
  25. package/dist/hpsg/lexical-classes.d.ts +94 -33
  26. package/dist/hpsg/method-lexicon.d.ts +3 -0
  27. package/dist/hpsg/procedural-context.d.ts +51 -3
  28. package/dist/hpsg/projection.d.ts +7 -3
  29. package/dist/hpsg/quantity-lexicon.d.ts +51 -0
  30. package/dist/hpsg/rule-context.d.ts +101 -33
  31. package/dist/hpsg/rules/clinical-quantity-rules.d.ts +1 -1
  32. package/dist/hpsg/rules/condition-rules.d.ts +13 -2
  33. package/dist/hpsg/rules/core-rules.d.ts +5 -2
  34. package/dist/hpsg/rules/prn-rules.d.ts +10 -1
  35. package/dist/hpsg/rules/site-rules.d.ts +10 -1
  36. package/dist/hpsg/rules/timing-rules.d.ts +108 -24
  37. package/dist/hpsg/segmenter.d.ts +2 -2
  38. package/dist/hpsg/signature.d.ts +50 -5
  39. package/dist/hpsg/timing-lexicon.d.ts +18 -2
  40. package/dist/i18n.d.ts +8 -7
  41. package/dist/index.cjs +84275 -66589
  42. package/dist/index.d.ts +13 -3
  43. package/dist/index.js +84263 -66588
  44. package/dist/instruction-action-locale-adapter.d.ts +69 -5
  45. package/dist/instruction-action-parser.d.ts +48 -0
  46. package/dist/instruction-action-terminology.d.ts +22 -1
  47. package/dist/instruction-concept-terminology.d.ts +14 -1
  48. package/dist/instruction-graph-fhir.d.ts +4 -2
  49. package/dist/instruction-graph-ownership.d.ts +96 -0
  50. package/dist/instruction-graph.d.ts +19 -42
  51. package/dist/lexer/lex.d.ts +5 -1
  52. package/dist/lexer/locale.d.ts +14 -0
  53. package/dist/lexer/locales/en.d.ts +11 -0
  54. package/dist/lexer/surface.d.ts +3 -1
  55. package/dist/lexer/token-types.d.ts +6 -0
  56. package/dist/locale-detection.d.ts +4 -2
  57. package/dist/locales/clause/en.d.ts +14 -0
  58. package/dist/locales/course/en.d.ts +5 -0
  59. package/dist/localization.d.ts +6 -0
  60. package/dist/localized-timing.d.ts +1 -1
  61. package/dist/maps.d.ts +38 -12
  62. package/dist/medication-condition.d.ts +105 -11
  63. package/dist/parser-state.d.ts +10 -0
  64. package/dist/parser.d.ts +5 -3
  65. package/dist/prn.d.ts +15 -2
  66. package/dist/regimen/coordination-scope.d.ts +13 -1
  67. package/dist/regimen/grammar.d.ts +7 -1
  68. package/dist/regimen/parallel-course.d.ts +6 -2
  69. package/dist/regimen/planner.d.ts +2 -3
  70. package/dist/regimen/regimen.d.ts +2 -0
  71. package/dist/schedule.d.ts +5 -2
  72. package/dist/snomed.d.ts +3 -0
  73. package/dist/suggest-locale-adapter.d.ts +15 -0
  74. package/dist/symptom-terminology.d.ts +5 -1
  75. package/dist/timing-summary.d.ts +43 -10
  76. package/dist/types.d.ts +213 -16
  77. package/dist/unit-lexicon.d.ts +2 -6
  78. package/dist/utils/units.d.ts +3 -0
  79. package/package.json +1 -1
@@ -1,16 +1,21 @@
1
- import { AdviceArgument, AdviceFrame, AdviceModality, AdviceRelation, MedicationInstructionActionDefinition, MedicationInstructionActionRealizer } from "./types";
1
+ import type { BodySiteFeatureStructure } from "./body-site-grammar";
2
+ import { type BodySiteRestriction, AdviceArgument, AdviceFrame, AdviceModality, EventTiming, AdviceRelation, MedicationInstructionActionDefinition, MedicationInstructionActionRealizer } from "./types";
2
3
  export interface InstructionActionRealizationInput {
3
4
  frame: AdviceFrame;
4
5
  locale: string;
5
6
  label: string;
7
+ modalityText?: string;
6
8
  amount?: string;
7
9
  theme?: string;
10
+ /** Nominal selected by the shared action valence, independent of its lexical role. */
11
+ selectedObject?: AdviceArgument;
8
12
  container?: string;
9
13
  destination?: string;
10
14
  site?: string;
11
15
  substance?: string;
12
16
  result?: string;
13
17
  activity?: string;
18
+ selectedActivity?: AdviceArgument;
14
19
  time?: string;
15
20
  /** Selected Time's explicit or licensed inherited relation. */
16
21
  timeRelation?: AdviceRelation;
@@ -25,26 +30,70 @@ export interface InstructionActionRealizationInput {
25
30
  translateArgumentConcept: (arg: AdviceArgument) => string;
26
31
  translateQuantity: (quantity: NonNullable<AdviceArgument["quantity"]>) => string;
27
32
  }
33
+ export interface BodySiteRestrictionRealizationInput {
34
+ restriction: BodySiteRestriction;
35
+ relation: string;
36
+ predicateTranslation?: string;
37
+ conditionTranslation?: string;
38
+ symptomTranslation?: string;
39
+ }
40
+ type InstructionObjectDeterminer = "definite" | "indefinite" | "addressee";
28
41
  export interface InstructionActionLocaleAdapter {
29
42
  locale: string;
30
43
  selectLexicalRealization?(input: InstructionActionRealizationInput): InstructionActionRealizationInput;
44
+ /** Select a registered noun under a local determiner. A lexical action
45
+ * compound can already contain the noun at the end of its matched head. */
46
+ qualifiedObjectNominal?(source: string, actionHead: string): {
47
+ head: string;
48
+ determiner: InstructionObjectDeterminer;
49
+ incorporatedHeadLength?: number;
50
+ } | undefined;
51
+ realizeObjectDeterminer?(head: string, determiner: InstructionObjectDeterminer): string;
52
+ /** License a direction qualifier as a separate complement of the action. */
53
+ directionQualifier?(source: string): "bare" | "attributed" | undefined;
31
54
  render(realizer: MedicationInstructionActionRealizer, input: InstructionActionRealizationInput): string | undefined;
32
55
  renderNegated(input: InstructionActionRealizationInput, completeAction?: string): string;
33
- applyPositiveModality(text: string, frame: AdviceFrame): string;
56
+ applyPositiveModality(text: string, frame: AdviceFrame, modalityText?: string): string;
34
57
  parseConditionPersistence(body: string): {
35
58
  body: string;
36
59
  persists: boolean;
37
60
  };
38
61
  renderConditionBody(base: string, conditionForm: string | undefined, persists: boolean): string;
62
+ parseConditionWorsening?(body: string): string | undefined;
63
+ renderConditionWorsening?(body: string): string;
64
+ renderCountedAdviceSituation?(condition: AdviceArgument): string | undefined;
65
+ joinConditionOperands?(operator: "all" | "any" | "not", operands: string[]): string;
39
66
  joinConditionLead(lead: string, body: string): string;
40
- conditionalContinuation(text: string, imperative: boolean): string;
67
+ conditionalContinuation(text: string, imperative: boolean, precedingText?: string): string;
41
68
  postposedCondition(text: string, precedingText?: string): string;
42
- sequenceSeparator(): string;
69
+ sequenceSeparator(sharedGuard?: boolean): string;
70
+ coordinatedAdviceSeparator?(moreSiblings?: boolean): string;
43
71
  continuationText(text: string, understood: boolean): string;
44
72
  withAuthoredDirections?(current: string, source: string): string;
45
- directTime?(time: string): string;
73
+ /** Return undefined to retain an explicit relation for an unrecognized Time. */
74
+ directTime?(time: string, selected?: AdviceArgument, relation?: AdviceRelation, locale?: string): string | undefined;
75
+ /** Wording for a typed meal qualification beside an authored clock. */
76
+ mealInstruction?(events: readonly EventTiming[], defaultText: string): string | undefined;
77
+ /** Language-owned completeness decision for an opaque nominal complement.
78
+ * The graph retains responsibility for polarity, modality and source scope. */
79
+ prefersAuthoredAction?(frame: AdviceFrame, locale: string, translateArgument: (argument: AdviceArgument, locale: string) => string): boolean;
80
+ fallbackConceptDisplay?(display: string): string;
81
+ removeAmountLinker?(text: string): string;
82
+ hasContrastiveNominal?(text: string): boolean;
83
+ composeAttributiveSite?(head: string, qualifiers: readonly string[], source: string): string;
84
+ /** Realize registered nominal modifiers outside a translated anatomical head. */
85
+ bodySiteNominalModifiers?(head: string, modifiers: readonly string[]): string;
86
+ /** Registered wording for an already recognized anatomy; this does not admit input aliases. */
87
+ bodySiteTranslation?(text: string, code?: string): string | undefined;
88
+ bodySiteRestriction?(input: BodySiteRestrictionRealizationInput): string | undefined;
89
+ bodySiteObject?(features: BodySiteFeatureStructure): string;
90
+ bodySiteDisplay?(features: BodySiteFeatureStructure): string;
91
+ bodySiteLaterality?(text: string, laterality: "left" | "right" | "both"): string;
92
+ bodySiteSpatialText?(relation: string, target: string, kind: "locative" | "modifier"): string;
46
93
  }
47
94
  export declare function registerInstructionActionLocaleAdapter(adapter: InstructionActionLocaleAdapter): void;
95
+ export declare function instructionActionLocaleAdapterRevision(): number;
96
+ export declare function registeredInstructionActionLocaleAdapters(): IterableIterator<InstructionActionLocaleAdapter>;
48
97
  export declare function getInstructionActionLocaleAdapter(locale: string): InstructionActionLocaleAdapter;
49
98
  export declare function instructionActionDefinitionForRealization(frame: AdviceFrame): MedicationInstructionActionDefinition | undefined;
50
99
  /** The selected valence determines which daughter owns the frame relation. */
@@ -52,6 +101,8 @@ export declare function instructionFrameRelationOwnsTemporalArgument(frame: Advi
52
101
  /** Resolve Site attachment before locale realization or Time consumption. */
53
102
  export declare function instructionFrameSiteRelation(frame: AdviceFrame, site?: AdviceArgument): AdviceRelation | undefined;
54
103
  export declare function instructionSiteRelation(input: InstructionActionRealizationInput, site?: AdviceArgument): string | undefined;
104
+ /** The selected material owns its attachment independently of other complements. */
105
+ export declare function instructionFrameMaterialRelation(frame: AdviceFrame, material?: AdviceArgument): AdviceRelation;
55
106
  export declare const EN_POSITIVE_MODALITY_PREFIX: Partial<Record<AdviceModality, string>>;
56
107
  /** Internal selection metadata; public locale inputs and callbacks stay unchanged. */
57
108
  type SelectedTimeInput = Pick<InstructionActionRealizationInput, "locale" | "time" | "timeRelation" | "timeWasRendered"> & {
@@ -60,10 +111,23 @@ type SelectedTimeInput = Pick<InstructionActionRealizationInput, "locale" | "tim
60
111
  };
61
112
  /** Consume the selected typed Time once; locale adapters own direct wording. */
62
113
  export declare function realizeTimeArgument(c: SelectedTimeInput): string | undefined;
114
+ /** A Duration keeps its own governor in every registered action valence.
115
+ * A supplied elapsed prefix retains the valence's existing For wording;
116
+ * other explicit governors always use their registered duration wording. */
117
+ export declare function realizeDurationArgument(input: Pick<InstructionActionRealizationInput, "frame" | "locale" | "duration" | "realizerConfig">, elapsedPrefix?: string): string | undefined;
63
118
  export declare function quantityOnlyInstructionArgument(arg: AdviceArgument | undefined): boolean;
64
119
  /** A typed measured nominal without its own noun label retains the opaque
65
120
  * argument separately; its source text cannot override the current quantity. */
66
121
  export declare function instructionArgumentNeedsAuthoredDirections(arg: AdviceArgument, locale: string): boolean;
122
+ /** Realize an already selected weekday Time through the existing locale labels. */
123
+ export declare function localizedWeekdayArgument(value: string, locale: string | undefined, weekdayName?: (day: string) => string): string | undefined;
124
+ /** These lexical valences use shared composition for a selected relative
125
+ * activity. Providers may retain their own realization of that constituent. */
126
+ export declare function hasRelativeActivityRealization(realizer: MedicationInstructionActionRealizer, input: InstructionActionRealizationInput): boolean;
127
+ /** Shared stock wording; registered advice/action callbacks keep their own output. */
128
+ export declare function thaiNegatedModalityPrefix(frame: AdviceFrame): string;
67
129
  export declare const TH_POSITIVE_MODALITY_PREFIX: Partial<Record<AdviceModality, string>>;
68
130
  export declare function selectThaiApplyLabel(actionCode: string | undefined, label: string, unit?: string, args?: readonly AdviceArgument[]): string | undefined;
131
+ /** Reuse the registered nominal classes for both site and action realization. */
132
+ export declare function applyBodySiteNominalModifiersThai(translatedBase: string, modifierWords: readonly string[] | undefined): string;
69
133
  export {};
@@ -0,0 +1,48 @@
1
+ import type { CanonicalSourceSpan } from "./types";
2
+ import { lexInput } from "./lexer/lex";
3
+ import { AdviceArgument, AdviceFrame, MedicationInstructionActionDefinition, ParseOptions, TextRange } from "./types";
4
+ export type ActionDefinition = MedicationInstructionActionDefinition;
5
+ type Lexeme = ReturnType<typeof lexInput>[number];
6
+ export declare const SNOMED_SYSTEM = "http://snomed.info/sct";
7
+ export declare function key(part: Lexeme | undefined): string;
8
+ interface ActionMatch {
9
+ definition: ActionDefinition;
10
+ length: number;
11
+ separableParticleIndex?: number;
12
+ }
13
+ /** A declared nonfinite form inside a fronted condition supplies an
14
+ * activity to the predicate. A written consequent boundary or explicit
15
+ * directive still licenses the following administration or procedure. */
16
+ export declare function isInstructionConditionActivity(parts: Lexeme[], index: number, definition: ActionDefinition, surface: string): boolean;
17
+ export declare function actionMatchAt(parts: Lexeme[], index: number, options?: ParseOptions, includeGovernedProcedure?: boolean, directivePrefixEnd?: number, productComplement?: boolean): ActionMatch | undefined;
18
+ export declare function codingFromSite(text: string, options?: ParseOptions): AdviceArgument | undefined;
19
+ export declare function trimSemanticText(value: string): string;
20
+ /** A temporal governor can select a complete registered Activity nominal
21
+ * without introducing an executable clock or an opaque connector Time. */
22
+ export declare function knownTemporalActivity(parts: Lexeme[], start: number, end: number, input: string, options?: ParseOptions, measuredOnly?: boolean): AdviceArgument | undefined;
23
+ export declare function parseQuantityArgument(parts: Lexeme[], start: number, endExclusive: number, input: string, offset: number, options?: ParseOptions, numberEndExclusive?: number): AdviceArgument | undefined;
24
+ type MeasuredTemporalReference = TextRange & {
25
+ timing?: TextRange;
26
+ };
27
+ type InterleavedCadence = TextRange & {
28
+ meal?: TextRange;
29
+ measuredReference?: MeasuredTemporalReference;
30
+ };
31
+ /** A bounded predicate can describe inability to perform a registered
32
+ * administration. Reuse the same modal/action valence as directive selection. */
33
+ export declare function isNegativeAdministrationAbility(parts: Lexeme[], options?: ParseOptions): boolean;
34
+ /** An overt, licensed directive prefix can close a fronted advice condition. */
35
+ export declare function actionFrameHasExplicitDirective(parts: Lexeme[], frame: AdviceFrame, options?: ParseOptions): boolean;
36
+ /** Preserve the lexical daughter while the conditional owner selects whether
37
+ * its modal predicate belongs to an antecedent or an independent directive. */
38
+ export declare function actionFrameHasEmbeddedModal(parts: Lexeme[], frame: AdviceFrame, options?: ParseOptions): boolean;
39
+ /** Internal selected action/source result; public action parsing still returns frames. */
40
+ export interface InstructionActionProgram {
41
+ frames: AdviceFrame[];
42
+ opaqueSpans?: CanonicalSourceSpan[];
43
+ interleavedCadences?: Map<AdviceFrame, InterleavedCadence>;
44
+ }
45
+ export declare function parseInstructionActionProgram(sourceText: string, baseOffset?: number, options?: ParseOptions, parts?: import("./lexer/token-types").LexToken[]): InstructionActionProgram;
46
+ export declare function parseInstructionActions(sourceText: string, baseOffset?: number, options?: ParseOptions): AdviceFrame[];
47
+ export declare function definitionCanRepresentPrimaryAdministration(definition: ActionDefinition | undefined): boolean;
48
+ export {};
@@ -1,5 +1,20 @@
1
- import { AdviceArgument, CanonicalMethodExpr, FhirCoding, FhirR6Coding, MedicationInstructionActionDefinition, ParseOptions } from "./types";
1
+ import { AdviceArgument, AdviceFrame, CanonicalMethodExpr, FhirCoding, FhirPeriodUnit, FhirR6Coding, MedicationInstructionActionDefinition, ParseOptions } from "./types";
2
2
  export declare const MEDICATION_INSTRUCTION_ACTION_SYSTEM: string;
3
+ /** A registered Repeat operation on an administration head licenses an
4
+ * additional use when the grammar supplies a compatible antecedent. */
5
+ export declare function isRepeatedAdministrationAction(definition: MedicationInstructionActionDefinition | undefined): boolean;
6
+ /** Lexical candidate capability only. The selected HPSG target/argument must
7
+ * still prove medication withholding; a physical object or ordinary drinking
8
+ * warning cannot become a clinical guard from this preliminary head test. */
9
+ export declare function isMedicationWithholdingHeadCandidate(definition: MedicationInstructionActionDefinition | undefined, negated: boolean): boolean;
10
+ /** The selected nominal owns the medication/physical distinction. Unknown
11
+ * qualifiers still require the condition grammar's source proof; a complete
12
+ * physical noun cannot become a dose merely because its name is also a unit. */
13
+ export declare function medicationInstructionActionTypedWithholdingTarget(definition: MedicationInstructionActionDefinition, args: readonly AdviceArgument[], prohibitedAdministration?: boolean): boolean | undefined;
14
+ /** Refine an output-owned selected frame only after its medication target is
15
+ * proved. Stock HOLD has a physical default; custom definitions keep their
16
+ * supplied meaning and wording. Conditional ellipsis is proved by HPSG. */
17
+ export declare function refineMedicationInstructionWithholdingSense(frame: AdviceFrame, definition: MedicationInstructionActionDefinition | undefined): void;
3
18
  export interface MedicationInstructionActionCodeSystem {
4
19
  resourceType: "CodeSystem";
5
20
  url: string;
@@ -23,6 +38,8 @@ export interface MedicationInstructionActionCodeSystem {
23
38
  */
24
39
  export declare function medicationInstructionActionSpanLimit(lead: string, options?: ParseOptions): number;
25
40
  export declare function normalizeActionSurface(value: string): string;
41
+ /** These declared aliases denote an activity without licensing its imperative. */
42
+ export declare function isMedicationInstructionActivityOnlyAlias(definition: MedicationInstructionActionDefinition, surface: string): boolean;
26
43
  /** Preserve coded constituents separately from equivalent whole-action codings. */
27
44
  export declare function cloneMedicationInstructionActionSemanticComponents(components: MedicationInstructionActionDefinition["semanticComponents"]): MedicationInstructionActionDefinition["semanticComponents"];
28
45
  export declare function cloneMedicationInstructionActionRealizerConfig(config: MedicationInstructionActionDefinition["realizerConfig"]): MedicationInstructionActionDefinition["realizerConfig"];
@@ -36,6 +53,8 @@ export declare function medicationInstructionActionContextualCodings(definition:
36
53
  /** Combine only constituents justified by this action's actual typed arguments.
37
54
  * Do not place fragment/finding/qualifier codes in whole-predicate Codings. */
38
55
  export declare function medicationInstructionActionSemanticComponentsForArgs(definition: MedicationInstructionActionDefinition, args: readonly AdviceArgument[]): MedicationInstructionActionDefinition["semanticComponents"];
56
+ /** The selected action owns occurrence duration; a unit restriction never grants a new introducer. */
57
+ export declare function licensesAdministrationDuration(definition: MedicationInstructionActionDefinition | undefined, introducer: string, unit?: FhirPeriodUnit): boolean;
39
58
  export declare function resolveMedicationInstructionSequenceAction(surface: string, options?: ParseOptions): MedicationInstructionActionDefinition | undefined;
40
59
  export declare function resolveMedicationInstructionSeparableAction(lead: string, particle: string, options?: ParseOptions): MedicationInstructionActionDefinition | undefined;
41
60
  export declare function medicationInstructionActionIsSafetyScopeTarget(surface: string, options?: ParseOptions): boolean;
@@ -52,6 +71,8 @@ export declare function resolveMedicationInstructionActionByMethod(coding: FhirR
52
71
  * the fallback for wholly unfamiliar concepts. A display-only Coding remains
53
72
  * a text fallback when no identity is supplied. The source array is untouched. */
54
73
  export declare function selectMedicationInstructionMethodCoding<TCoding extends FhirR6Coding>(codings: readonly TCoding[] | undefined, options?: ParseOptions): TCoding | undefined;
74
+ /** An exact registered method label is compatible only with its supplied identity. */
75
+ export declare function matchesMedicationInstructionMethodDisplay(definition: MedicationInstructionActionDefinition, coding: FhirR6Coding | undefined, text: string): boolean;
55
76
  /** Keep compatible authored verbs (Drink and Swallow share a method), while
56
77
  * a recognized edited code replaces an incompatible retained verb. */
57
78
  export declare function resolveMedicationInstructionActionForMethod(method: (Omit<CanonicalMethodExpr, "coding"> & {
@@ -1,5 +1,9 @@
1
- import { FhirCoding, MedicationInstructionConceptDefinition, ParseOptions } from "./types";
1
+ import { AdviceArgument, FhirCoding, MedicationInstructionConceptDefinition, ParseOptions } from "./types";
2
2
  export declare const MEDICATION_INSTRUCTION_CONCEPT_SYSTEM: string;
3
+ export declare function isAuthoredMeasuredTime(argument: AdviceArgument): boolean;
4
+ /** Both resolved and unresolved relative instruction times remain review-only. */
5
+ export declare function isFirstAdministrationReference(argument: AdviceArgument): boolean;
6
+ export declare function isMedicationDosageFormConcept(conceptId: string | undefined): boolean;
3
7
  export interface MedicationInstructionConceptCodeSystem {
4
8
  resourceType: "CodeSystem";
5
9
  url: string;
@@ -19,11 +23,14 @@ export interface MedicationInstructionConceptCodeSystem {
19
23
  }>;
20
24
  }
21
25
  export declare function normalizeConceptSurface(value: string): string;
26
+ /** Bound complete nominal arbitration by the same registered surfaces as exact lookup. */
27
+ export declare function medicationInstructionConceptSpanLimit(anchor: string, options?: ParseOptions, edge?: "start" | "end"): number;
22
28
  export declare function cloneMedicationInstructionConceptComponents(components: MedicationInstructionConceptDefinition["components"]): MedicationInstructionConceptDefinition["components"];
23
29
  /** Dictionary definitions are immutable by caller contract. Repeated
24
30
  * lexical resolution must not recursively clone the same vocabulary tree.
25
31
  * Explicit frame construction still copies only the fields it later edits. */
26
32
  export declare function resolveMedicationInstructionConcept(surface: string, options?: ParseOptions): MedicationInstructionConceptDefinition | undefined;
33
+ export declare function argumentFromConceptDefinition(definition: MedicationInstructionConceptDefinition, sourceText: string): AdviceArgument;
27
34
  export declare function getMedicationInstructionConcept(code: string, system?: string): MedicationInstructionConceptDefinition | undefined;
28
35
  export declare function listMedicationInstructionConcepts(): MedicationInstructionConceptDefinition[];
29
36
  /** The public CodeSystem is freshly returned, but its published concepts
@@ -31,3 +38,9 @@ export declare function listMedicationInstructionConcepts(): MedicationInstructi
31
38
  * This avoids filter->map and map->filter intermediary arrays per call. */
32
39
  export declare function buildMedicationInstructionConceptCodeSystem(): MedicationInstructionConceptCodeSystem;
33
40
  export declare function medicationInstructionConceptCodings(definition: MedicationInstructionConceptDefinition): FhirCoding[];
41
+ /** Keep a selected qualifier while translating only registered whole-concept labels. */
42
+ export declare function localizedInstructionConceptText(value: {
43
+ text?: string;
44
+ coding?: FhirCoding;
45
+ i18n?: Record<string, string>;
46
+ }, locale: string): string | undefined;
@@ -6,5 +6,7 @@ export declare function buildInstructionGraphExtension(graph: CanonicalInstructi
6
6
  /** One traversal per known graph/action/argument node. Repeated children retain
7
7
  * order, first scalar fields retain ownership, and unknown metadata remains
8
8
  * outside interpreted clinical meaning. No indexed heap copies or cached
9
- * input identities are needed to read the same mutable external input again. */
10
- export declare function parseInstructionGraphExtension<T extends Pick<FhirExtension, "url">>(extensions: readonly T[] | undefined): CanonicalInstructionGraph | undefined;
9
+ * input identities are needed to read the same mutable external input again.
10
+ * Infer the complete input array so a union of R5/R6 arrays retains its own
11
+ * element types until the existing URL discriminator selects this graph. */
12
+ export declare function parseInstructionGraphExtension<T extends readonly Pick<FhirExtension, "url">[]>(extensions: T | undefined): CanonicalInstructionGraph | undefined;
@@ -0,0 +1,96 @@
1
+ import { AdviceArgument, AdviceFrame, AdviceModality, AdviceRelation, CanonicalDoseExpr, CanonicalInstructionGraph, CanonicalSigClause, CanonicalAdditionalInstructionExpr, CanonicalSourceSpan, EventTiming, ParseOptions, TextRange } from "./types";
2
+ import { type ActionDefinition } from "./instruction-action-parser";
3
+ export declare function frameActionDefinition(frame: AdviceFrame, options?: ParseOptions): ActionDefinition | undefined;
4
+ export declare function sameArgumentQuantity(left: AdviceArgument, right: AdviceArgument): boolean;
5
+ /** The selected nominal and Amount describe the same measured occurrence. */
6
+ export declare function argumentContainsAmountOccurrence(argument: AdviceArgument, amount: AdviceArgument): boolean;
7
+ /** One source-contained measured companion can also supply a standalone Amount. */
8
+ export declare function amountSharesMeasuredAccompaniment(frame: AdviceFrame, amount: AdviceArgument): boolean;
9
+ export declare function sourceBackedTimeExtension(existing: AdviceFrame, candidate: AdviceFrame): boolean;
10
+ export declare function defaultActionArguments(frame: AdviceFrame): {
11
+ objectArg: AdviceArgument | undefined;
12
+ additionalObjects: AdviceArgument[] | undefined;
13
+ relationTargetArg: AdviceArgument | undefined;
14
+ amountArg: AdviceArgument | undefined;
15
+ additionalAccompaniments: AdviceArgument[] | undefined;
16
+ frameRelationOwner: AdviceArgument | undefined;
17
+ };
18
+ /** An explicitly governed nominal owns its frame relation independently of a Time. */
19
+ export declare function inheritedFrameTimeRelation(frame: AdviceFrame, selected?: ReturnType<typeof defaultActionArguments>): AdviceRelation | undefined;
20
+ export declare function normalizedInstructionSurface(value: string): string;
21
+ export declare function sameAdviceArgumentMeaning(left: AdviceArgument, right: AdviceArgument): boolean;
22
+ /** Typed warning equivalence retains complete qualifiers and the established negative-force tolerance. */
23
+ export declare function sameTypedWarning(left: AdviceFrame, right: AdviceFrame): boolean;
24
+ /** The selected occurrence may gain presentation/coding facts during graph
25
+ * composition. Absent facts permit enrichment; supplied conflicting facts do not. */
26
+ export declare function selectedAdviceFrameMatchesGraph(selected: AdviceFrame, actual: AdviceFrame): boolean;
27
+ /** Locate an authored fragment; this is correspondence, not action identity. */
28
+ export declare function instructionSourceRange(graph: Pick<CanonicalInstructionGraph, "sourceText">, text: string | undefined, source?: string): TextRange | undefined;
29
+ /** Selected instruction evidence covers exactly its complete typed frames. */
30
+ export declare function instructionHasCompleteFrameEvidence(instruction: CanonicalAdditionalInstructionExpr): boolean;
31
+ /** Exact source-backed discourse connector that introduces the first action
32
+ * after the canonical administration. This lets realization preserve contrast
33
+ * without pretending that it is the temporal THEN relation. */
34
+ export declare function instructionGraphPostAdministrationDiscourseConnector(graph: CanonicalInstructionGraph): CanonicalSourceSpan | undefined;
35
+ export declare function codingEquivalent(left: {
36
+ system?: string;
37
+ code?: string;
38
+ } | undefined, right: {
39
+ system?: string;
40
+ code?: string;
41
+ } | undefined): boolean;
42
+ export declare function quantityCoveredByDose(arg: AdviceArgument, dose: CanonicalDoseExpr | undefined): boolean;
43
+ export declare function actionMatchesCanonicalMethod(frame: AdviceFrame, clause: Pick<CanonicalSigClause, "method">, options?: Pick<ParseOptions, "instructionActionMap">): boolean;
44
+ export declare function argumentEventTiming(arg: AdviceArgument): EventTiming | undefined;
45
+ /** Counted or qualified sites use the canonical site's complete dose scope. */
46
+ export declare function canonicalSiteOwnsPrimaryPhrase(clause: CanonicalSigClause): boolean;
47
+ /** Apply the selected primary's live schedule/site in one display-only pass.
48
+ * A source graph clock is independent unless the wire source established
49
+ * structured clock ownership. Source arguments and other actions stay intact. */
50
+ export declare function frameWithCanonicalPrimaryContext(frame: AdviceFrame, clause: CanonicalSigClause): AdviceFrame;
51
+ /**
52
+ * A rich administration frame and its canonical HPSG schedule can refer to
53
+ * the same meal event using different typed relations: CM + before = ACM.
54
+ * Both localizers share this compositional check instead of reparsing the
55
+ * displayed text independently.
56
+ */
57
+ export declare function timeArgumentCoversSingleScheduledEvent(frame: AdviceFrame, arg: AdviceArgument, clause: CanonicalSigClause): boolean;
58
+ export declare function primaryActionCoveredByCanonicalClause(frame: AdviceFrame, actions: readonly AdviceFrame[], clause: CanonicalSigClause, selectedOwner?: AdviceFrame | null, sourceFrame?: AdviceFrame): boolean;
59
+ /** The normalized and source-preserving primary selectors must honor the
60
+ * same current dose, while leaving superseded graph/source data untouched. */
61
+ export declare function primaryAmountConflicts(amount: AdviceArgument | undefined, dose: CanonicalDoseExpr | undefined, removed?: boolean): boolean;
62
+ /** Realize the current Amount without rewriting its saved graph.
63
+ * Its source label may also be embedded in a larger Object ('1 tablet of
64
+ * amoxicillin'); remove only the owned amount, keeping the drug name and the
65
+ * action's independent material/target. Numeric edits and forced localized
66
+ * display use the same typed ownership. */
67
+ export declare function frameWithReconciledAmount(frame: AdviceFrame, sourceAmount: AdviceArgument, currentDose: CanonicalDoseExpr | undefined, replaceAtOwner?: boolean): AdviceFrame;
68
+ type PrimaryInstructionOwnership = NonNullable<CanonicalInstructionGraph["primaryOwnership"]>;
69
+ /** Resolve the selected source head and Amount once while HPSG/action facts
70
+ * and the original vocabulary are available. Older saved graphs reuse this
71
+ * conservative inference; an explicit binding never depends on edited values. */
72
+ export declare function inferPrimaryOwnership(graph: CanonicalInstructionGraph, clause: Pick<CanonicalSigClause, "dose" | "method" | "sourceProjectionVerified">, options?: Pick<ParseOptions, "instructionActionMap">): PrimaryInstructionOwnership;
73
+ export declare function primaryInstructionOwnership(graph: CanonicalInstructionGraph, clause: Pick<CanonicalSigClause, "dose" | "method" | "sourceProjectionVerified">, options?: Pick<ParseOptions, "instructionActionMap">): PrimaryInstructionOwnership;
74
+ export declare function primaryDoseAmountOwner(graph: CanonicalInstructionGraph, clause: Pick<CanonicalSigClause, "dose" | "method" | "sourceProjectionVerified">, options?: Pick<ParseOptions, "instructionActionMap">): {
75
+ action: AdviceFrame;
76
+ argument: AdviceArgument;
77
+ } | undefined;
78
+ /** A sole typed preparation owns the amount before a later administration.
79
+ * Ordinary primary-only graphs return before the ownership walk. */
80
+ export declare function instructionGraphPreparationOwnsDose(clause: CanonicalSigClause, options?: Pick<ParseOptions, "instructionActionMap">): boolean;
81
+ /** Whole-source replay and action realization have the same amount owner.
82
+ * Unrelated later-stage Amounts are not evidence the canonical dose changed. */
83
+ export declare function instructionGraphSourceConflictsWithDose(clause: CanonicalSigClause, options?: Pick<ParseOptions, "instructionActionMap">): boolean;
84
+ export declare function instructionGraphRichPrimaryAction(clause: CanonicalSigClause): AdviceFrame | undefined;
85
+ export declare function instructionGraphRoundTripPrimaryAction(clause: CanonicalSigClause): AdviceFrame | undefined;
86
+ export declare function instructionGraphPrimarySiteRelation(clause: CanonicalSigClause): AdviceRelation | undefined;
87
+ export declare function instructionGraphPrimaryAdministrationModality(clause: CanonicalSigClause): AdviceModality | undefined;
88
+ /** The selected primary span owns overlapping positive action semantics. */
89
+ export declare function instructionGraphPrimaryOverlap(graph: CanonicalInstructionGraph, frame: AdviceFrame): boolean;
90
+ /** Presentation classification only; action licensing and scope use their own typed facts. */
91
+ export declare function isInstructionGraphDisplayWarning(frame: AdviceFrame): boolean;
92
+ export declare function sourceTextCoversFrameMeaning(frame: AdviceFrame): boolean;
93
+ /** A named region is not an injection depth. Only a rendered anatomical
94
+ * compartment under an injection's INTO attachment can convey that route. */
95
+ export declare function injectionSiteConveysRoute(clause: CanonicalSigClause, compartmentCode: string): boolean;
96
+ export {};
@@ -1,20 +1,14 @@
1
- import { lexInput } from "./lexer/lex";
2
- import { AdviceFrame, AdviceModality, AdviceRelation, CanonicalInstructionCoverage, CanonicalInstructionGraph, CanonicalInstructionRelation, CanonicalSigClause, CanonicalAdditionalInstructionExpr, CanonicalSourceSpan, FhirCodeableConcept, MedicationInstructionActionDefinition, ParseOptions, TextRange } from "./types";
3
- type ActionDefinition = MedicationInstructionActionDefinition;
4
- type Lexeme = ReturnType<typeof lexInput>[number];
5
- interface ActionMatch {
6
- definition: ActionDefinition;
7
- length: number;
8
- separableParticleIndex?: number;
9
- }
10
- export declare function actionMatchAt(parts: Lexeme[], index: number, options?: ParseOptions): ActionMatch | undefined;
11
- export declare function parseInstructionActions(sourceText: string, baseOffset?: number, options?: ParseOptions): AdviceFrame[];
12
- export declare function frameActionDefinition(frame: AdviceFrame, options?: ParseOptions): ActionDefinition | undefined;
13
- export declare function isSupplementalHydrationInstruction(frame: AdviceFrame): boolean;
1
+ import { AdviceFrame, AdviceRelation, CanonicalInstructionCoverage, CanonicalInstructionGraph, CanonicalInstructionRelation, CanonicalSigClause, CanonicalAdditionalInstructionExpr, CanonicalSourceSpan, FhirCodeableConcept, ParseOptions, TextRange } from "./types";
2
+ export { actionMatchAt, parseQuantityArgument, actionFrameHasEmbeddedModal, parseInstructionActions } from "./instruction-action-parser";
3
+ export { frameActionDefinition, sameTypedWarning, instructionSourceRange, instructionHasCompleteFrameEvidence, instructionGraphPostAdministrationDiscourseConnector, canonicalSiteOwnsPrimaryPhrase, instructionGraphPreparationOwnsDose, instructionGraphSourceConflictsWithDose, instructionGraphRichPrimaryAction, instructionGraphRoundTripPrimaryAction, instructionGraphPrimarySiteRelation, instructionGraphPrimaryAdministrationModality, instructionGraphPrimaryOverlap, isInstructionGraphDisplayWarning } from "./instruction-graph-ownership";
4
+ /** An undosed administration frame can supply counsel about an existing dose.
5
+ * Its typed manner/accompaniment stays distinct from a new dose or clock. */
6
+ export declare function isMedicationAdministrationAdvice(frame: AdviceFrame, options?: ParseOptions): boolean;
7
+ export declare function isSupplementalHydrationInstruction(frame: AdviceFrame, allowMeasured?: boolean): boolean;
14
8
  export declare function relationFromSourceText(text: string): AdviceRelation | undefined;
15
9
  export declare function buildInstructionCoverage(actions: AdviceFrame[], relations: CanonicalInstructionRelation[], opaqueSpans: CanonicalSourceSpan[]): CanonicalInstructionCoverage;
16
- export declare function refreshInstructionGraphDerivedState(graph: CanonicalInstructionGraph): void;
17
- export declare function buildInstructionGraph(input: string, clause: CanonicalSigClause, options?: ParseOptions, semanticOwnershipRanges?: readonly TextRange[], proceduralFrames?: readonly AdviceFrame[]): CanonicalInstructionGraph | undefined;
10
+ export declare function refreshInstructionGraphDerivedState(graph: CanonicalInstructionGraph, selectedOpaqueSpans?: readonly CanonicalSourceSpan[], selectedGapSpans?: readonly TextRange[]): void;
11
+ export declare function buildInstructionGraph(input: string, clause: CanonicalSigClause, options?: ParseOptions, semanticOwnershipRanges?: readonly TextRange[], proceduralFrames?: readonly AdviceFrame[], proceduralOpaqueSpans?: readonly CanonicalSourceSpan[]): CanonicalInstructionGraph | undefined;
18
12
  /** Select complete administration techniques from the already-composed clause
19
13
  * and action program. Interchange only projects these selected codings. */
20
14
  export declare function instructionGraphAdministrationTechnique(clause: CanonicalSigClause): {
@@ -22,7 +16,7 @@ export declare function instructionGraphAdministrationTechnique(clause: Canonica
22
16
  method?: FhirCodeableConcept;
23
17
  } | undefined;
24
18
  /** Realize one selected action with its existing external graph scope, when supplied. */
25
- export declare function realizeInstructionAction(frame: AdviceFrame, locale?: string, graph?: CanonicalInstructionGraph): string;
19
+ export declare function realizeInstructionAction(frame: AdviceFrame, locale?: string, graph?: CanonicalInstructionGraph, useAdviceWording?: boolean): string;
26
20
  /** A rich source action can carry its own Manner/Time but no Amount because a
27
21
  * preceding preparatory verb supplied the original quantity. When the
28
22
  * clinician edits the canonical dose, never let that amountless rich action
@@ -31,46 +25,30 @@ export declare function realizeInstructionAction(frame: AdviceFrame, locale?: st
31
25
  export declare function realizeRichPrimaryWithCanonicalDose(frame: AdviceFrame, clause: CanonicalSigClause, locale: string, options?: Pick<ParseOptions, "instructionActionMap" | "realizationMode">, coverage?: {
32
26
  singleScheduledEvent: boolean;
33
27
  }): string;
34
- /** Typed warning equivalence retains complete qualifiers and the established negative-force tolerance. */
35
- export declare function sameTypedWarning(left: AdviceFrame, right: AdviceFrame): boolean;
36
- /** Locate an authored fragment; this is correspondence, not action identity. */
37
- export declare function instructionSourceRange(graph: CanonicalInstructionGraph, text: string | undefined, source?: string): TextRange | undefined;
38
- /** Selected instruction evidence covers exactly its complete typed frames. */
39
- export declare function instructionHasCompleteFrameEvidence(instruction: CanonicalAdditionalInstructionExpr): boolean;
40
- /** Exact source-backed discourse connector that introduces the first action
41
- * after the canonical administration. This lets realization preserve contrast
42
- * without pretending that it is the temporal THEN relation. */
43
- export declare function instructionGraphPostAdministrationDiscourseConnector(graph: CanonicalInstructionGraph): CanonicalSourceSpan | undefined;
44
- /** Counted or qualified sites use the canonical site's complete dose scope. */
45
- export declare function canonicalSiteOwnsPrimaryPhrase(clause: CanonicalSigClause): boolean;
46
- /** A sole typed preparation owns the amount before a later administration.
47
- * Ordinary primary-only graphs return before the ownership walk. */
48
- export declare function instructionGraphPreparationOwnsDose(clause: CanonicalSigClause, options?: Pick<ParseOptions, "instructionActionMap">): boolean;
49
- /** Whole-source replay and action realization have the same amount owner.
50
- * Unrelated later-stage Amounts are not evidence the canonical dose changed. */
51
- export declare function instructionGraphSourceConflictsWithDose(clause: CanonicalSigClause, options?: Pick<ParseOptions, "instructionActionMap">): boolean;
52
- export declare function instructionGraphRichPrimaryAction(clause: CanonicalSigClause): AdviceFrame | undefined;
53
- export declare function instructionGraphRoundTripPrimaryAction(clause: CanonicalSigClause): AdviceFrame | undefined;
54
- export declare function instructionGraphPrimarySiteRelation(clause: CanonicalSigClause): AdviceRelation | undefined;
55
- export declare function instructionGraphPrimaryAdministrationModality(clause: CanonicalSigClause): AdviceModality | undefined;
56
- /** Presentation classification only; action licensing and scope use their own typed facts. */
57
- export declare function isInstructionGraphDisplayWarning(frame: AdviceFrame): boolean;
58
28
  /** A graph condition whose primary action is rendered by the clause formatter. */
59
29
  export interface InstructionGraphPrimaryCondition {
60
30
  text: string;
61
31
  position: "pre" | "post";
62
32
  start: number;
63
33
  imperative: boolean;
34
+ /** Present only when this condition retains untranslated source wording. */
35
+ sourceLocale?: string;
64
36
  }
65
37
  /** Attach only conditions owned by that primary, before independent graph
66
38
  * actions/advice are composed. Ordinary clauses do not allocate this report. */
67
39
  export declare function attachInstructionGraphPrimaryConditions(text: string, conditions: InstructionGraphPrimaryCondition[] | undefined, locale: string, guardedPrimary?: boolean): string;
68
40
  /** Associate selected advice with current typed action occurrences; no display coverage is inferred. */
69
- export declare function instructionGraphAdviceAssociation(graph: CanonicalInstructionGraph, instruction: CanonicalAdditionalInstructionExpr, includeRepresentation?: boolean): {
41
+ export declare function instructionGraphAdviceAssociation(graph: {
42
+ actions: readonly AdviceFrame[];
43
+ relations?: CanonicalInstructionGraph["relations"];
44
+ }, instruction: CanonicalAdditionalInstructionExpr, includeRepresentation?: boolean): {
70
45
  actionIndices: number[];
71
46
  representedActionIndices: number[];
72
47
  codingProved: boolean;
73
48
  };
49
+ /** Generate only new row labels; complete selected groups retain their own
50
+ * localization instead of competing with a partial single-action label. */
51
+ export declare function generateInstructionAdviceTranslations(clause: CanonicalSigClause): Map<CanonicalAdditionalInstructionExpr, Record<string, string>>;
74
52
  interface ClauseInstructionRealization {
75
53
  pre?: string;
76
54
  post?: string;
@@ -101,4 +79,3 @@ export declare function realizeInstructionGraph(graph: CanonicalInstructionGraph
101
79
  roundtripSafe?: boolean;
102
80
  instructionActionMap?: ParseOptions["instructionActionMap"];
103
81
  }): string | undefined;
104
- export {};
@@ -1,2 +1,6 @@
1
+ import type { ParseOptions } from "../types";
1
2
  import { LexToken } from "./token-types";
2
- export declare function lexInput(input: string): LexToken[];
3
+ /** Lexical unit punctuation only; the calling constituent licenses continuation. */
4
+ export declare function dottedDoseUnitAt(tokens: readonly LexToken[], index: number): string | undefined;
5
+ /** Detected source language takes precedence; the selected locale fills undetected input. */
6
+ export declare function lexInput(input: string, options?: ParseOptions): LexToken[];
@@ -1,3 +1,4 @@
1
+ import { type MedicationDateLexicon, type MedicationDateLexicalFeatures } from "../date-interpretation";
1
2
  import { LexToken } from "./token-types";
2
3
  export interface MedicationLocaleLexeme {
3
4
  surface: string;
@@ -6,9 +7,22 @@ export interface MedicationLocaleLexeme {
6
7
  export interface MedicationLexerLocalePack {
7
8
  locale: string;
8
9
  apply(tokens: readonly LexToken[], input: string): LexToken[];
10
+ /** Provider-owned canonical token completion retained by vocabulary replacements. */
11
+ completeTokens?(tokens: readonly LexToken[], input: string): LexToken[];
9
12
  listLexemes?(): MedicationLocaleLexeme[];
13
+ /** Canonical support heads that can join an adjacent medication method. */
14
+ joinedMethodAuxiliaries?: readonly string[];
15
+ /** Word boundaries require this pack before advice can select lexical heads. */
16
+ requiresWordSegmentation?: boolean;
17
+ defaultCalendars?: string[];
18
+ /** Declarative lexical slots for the existing structural date grammar.
19
+ * Omitting both date fields retains prior capabilities; explicit undefined clears them. */
20
+ dateLexicon?: MedicationDateLexicon;
21
+ /** Prepared once by registration, never compiled on a parse path. */
22
+ dateLexicalFeatures?: MedicationDateLexicalFeatures;
10
23
  }
11
24
  export declare function registerMedicationLexerLocalePack(pack: MedicationLexerLocalePack): void;
25
+ export declare function getJoinedMedicationMethodLocales(lead: string): ReadonlySet<string> | undefined;
12
26
  export declare function medicationLexerLocalePackRevision(): number;
13
27
  export declare function getMedicationLexerLocalePack(locale: string): MedicationLexerLocalePack | undefined;
14
28
  export declare function applyLocaleLexicon(tokens: readonly LexToken[], input: string, locale?: string): LexToken[];
@@ -0,0 +1,11 @@
1
+ import { type LexToken } from "../token-types";
2
+ /** English compact meridiem spellings contribute an explicit canonical clock.
3
+ * Numeric validation and conversion remain in the shared clock grammar. */
4
+ export declare function englishCompactClockLexeme(value: string): string | undefined;
5
+ /** Match one registered phrase at the current provider cursor. Selected
6
+ * canonical members retain precedence; the merged token keeps the full source. */
7
+ export declare function englishRelationPhraseAt(tokens: readonly LexToken[], cursor: number, input: string): {
8
+ token: LexToken;
9
+ length: number;
10
+ } | undefined;
11
+ export declare function applyEnglishLocaleLexicon(tokens: readonly LexToken[], input: string): LexToken[];
@@ -1,3 +1,5 @@
1
- import { SurfaceToken } from "./token-types";
1
+ import { SurfaceToken, type LexToken } from "./token-types";
2
2
  export declare function isSentenceBoundaryChar(input: string, index: number): boolean;
3
3
  export declare function scanSurfaceTokens(input: string): SurfaceToken[];
4
+ /** Preserve the complete original source when a registered locale phrase is one lexeme. */
5
+ export declare function mergeLexicalSourceSpan(tokens: readonly LexToken[], start: number, endInclusive: number, input: string, canonical?: string): LexToken;
@@ -25,9 +25,15 @@ export interface LexToken {
25
25
  lower: string;
26
26
  /** Canonical grammar lexeme when locale-aware normalization has one. */
27
27
  canonical?: string;
28
+ /** Canonical meaning of an explicitly registered adjacent dotted spelling. */
29
+ dottedCanonical?: string;
30
+ /** Provider license for compact punctuation between typed event daughters. */
31
+ compactEventCoordination?: true;
28
32
  index: number;
29
33
  kind: LexKind;
30
34
  value?: number;
35
+ /** A numeric slash lexeme can supply the proper fractional part of a mixed amount. */
36
+ fractionNumeral?: true;
31
37
  low?: number;
32
38
  high?: number;
33
39
  sourceStart: number;
@@ -3,10 +3,12 @@ export interface MedicationLocaleDetector {
3
3
  test(text: string): boolean;
4
4
  priority?: number;
5
5
  joinsAdjacentSourceTokens?: boolean;
6
+ /** Preserve authored wording as this detected language's translation. */
7
+ preserveSourceI18n?: boolean;
6
8
  }
7
9
  export declare function registerMedicationLocaleDetector(detector: MedicationLocaleDetector): void;
8
10
  export declare function shouldJoinAdjacentSourceTokens(left: string, right: string): boolean;
9
11
  export declare function inferMedicationLocale(text: string, fallback?: string): string;
10
- /** Registered source languages keep their authored wording; English uses the
11
- * lexical definition's wording rather than overriding it with a surface form. */
12
+ /** Registered source providers retain authored wording. Undetected default
13
+ * terminology keeps its existing lexical display. */
12
14
  export declare function withMedicationSourceI18n(sourceText: string, i18n: Record<string, string> | undefined): Record<string, string> | undefined;
@@ -0,0 +1,14 @@
1
+ import type { CourseLanguage } from "../../localization";
2
+ import { type SigLongContext, type SigDoseScope } from "../../i18n";
3
+ import { CanonicalDoseExpr, CanonicalSigClause } from "../../types";
4
+ import { type TimingSummaryOptions } from "../../timing-summary";
5
+ export declare const DAY_NAMES: Record<string, string>;
6
+ /** A typed scalar/range, or an already complete native rich amount, can be
7
+ * labelled without selecting it as the administration's prescribed dose. */
8
+ export declare function formatDoseEnglish(dose: CanonicalDoseExpr | string, style: "short" | "long", scope?: SigDoseScope): string | undefined;
9
+ export declare function joinWithAnd(parts: string[]): string;
10
+ export declare function formatShort(clause: CanonicalSigClause, words: CourseLanguage, resolvedMethod?: SigLongContext["resolvedMethod"], locale?: string, administrationTimingNote?: string): string;
11
+ export declare function formatLong(clause: CanonicalSigClause, options: TimingSummaryOptions | undefined, words: CourseLanguage, resolvedMethod?: SigLongContext["resolvedMethod"], authoredPrimary?: string, deferredDirections?: {
12
+ text?: string;
13
+ current?: string;
14
+ }, requestedLocale?: string, administrationTimingNote?: string): string;
@@ -13,3 +13,8 @@ export declare const ENGLISH_CLAUSE_TIMING: {
13
13
  };
14
14
  /** English route labels retain their existing lexical specificity in every locale. */
15
15
  export declare function routeCodeFromDisplayText(text: string | undefined, includeOtic: boolean): RouteCode | undefined;
16
+ /** Retain authored route detail while leaving recognized route grammar in its owner. */
17
+ export declare function retainedRouteDisplayText(text: string | undefined, code?: RouteCode): {
18
+ text: string;
19
+ kind: "technique" | "qualified" | "authored";
20
+ } | undefined;