ezmedicationinput 0.2.0 → 0.3.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.
Files changed (86) hide show
  1. package/README.md +216 -18
  2. package/dist/adapters/canonical-course.d.ts +131 -0
  3. package/dist/adapters/r5-course.d.ts +27 -0
  4. package/dist/advice-locale-adapter.d.ts +24 -0
  5. package/dist/advice.d.ts +73 -6
  6. package/dist/body-site-grammar.d.ts +21 -2
  7. package/dist/body-site-lookup.d.ts +8 -0
  8. package/dist/body-site-spatial.d.ts +12 -2
  9. package/dist/body-site-target.d.ts +38 -3
  10. package/dist/canonical/compile.d.ts +98 -0
  11. package/dist/canonical/course.d.ts +388 -0
  12. package/dist/canonical/format-course.d.ts +38 -0
  13. package/dist/clause-tail-grammar.d.ts +2 -0
  14. package/dist/date-interpretation.d.ts +36 -2
  15. package/dist/dosage-course.d.ts +304 -30
  16. package/dist/event-timing-expression.d.ts +26 -1
  17. package/dist/execution/calendar.d.ts +107 -0
  18. package/dist/execution/engine.d.ts +11 -0
  19. package/dist/fhir-quantity-operator.d.ts +89 -0
  20. package/dist/fhir-translations.d.ts +5 -6
  21. package/dist/fhir.d.ts +119 -14
  22. package/dist/format.d.ts +106 -5
  23. package/dist/hpsg/constructions.d.ts +35 -8
  24. package/dist/hpsg/defaults.d.ts +2 -0
  25. package/dist/hpsg/lexical-classes.d.ts +196 -24
  26. package/dist/hpsg/method-lexicon.d.ts +3 -0
  27. package/dist/hpsg/procedural-context.d.ts +48 -5
  28. package/dist/hpsg/projection.d.ts +32 -1
  29. package/dist/hpsg/quantity-lexicon.d.ts +51 -0
  30. package/dist/hpsg/rule-context.d.ts +172 -7
  31. package/dist/hpsg/rules/clinical-quantity-rules.d.ts +16 -7
  32. package/dist/hpsg/rules/condition-rules.d.ts +13 -3
  33. package/dist/hpsg/rules/core-rules.d.ts +8 -2
  34. package/dist/hpsg/rules/instruction-rules.d.ts +2 -0
  35. package/dist/hpsg/rules/prn-rules.d.ts +12 -1
  36. package/dist/hpsg/rules/site-rules.d.ts +10 -1
  37. package/dist/hpsg/rules/timing-rules.d.ts +116 -22
  38. package/dist/hpsg/segmenter.d.ts +2 -2
  39. package/dist/hpsg/signature.d.ts +54 -7
  40. package/dist/hpsg/timing-lexicon.d.ts +18 -2
  41. package/dist/hpsg/unification.d.ts +3 -1
  42. package/dist/i18n.d.ts +37 -1
  43. package/dist/index.cjs +83231 -52284
  44. package/dist/index.d.ts +26 -9
  45. package/dist/index.js +83222 -52284
  46. package/dist/instruction-action-locale-adapter.d.ts +92 -5
  47. package/dist/instruction-action-parser.d.ts +43 -0
  48. package/dist/instruction-action-terminology.d.ts +44 -3
  49. package/dist/instruction-concept-terminology.d.ts +20 -1
  50. package/dist/instruction-graph-fhir.d.ts +10 -2
  51. package/dist/instruction-graph-ownership.d.ts +96 -0
  52. package/dist/instruction-graph.d.ts +68 -49
  53. package/dist/ir.d.ts +1 -1
  54. package/dist/lexer/lex.d.ts +5 -1
  55. package/dist/lexer/locale.d.ts +14 -0
  56. package/dist/lexer/locales/en.d.ts +11 -0
  57. package/dist/lexer/surface-segmenter.d.ts +1 -1
  58. package/dist/lexer/surface.d.ts +4 -1
  59. package/dist/lexer/token-types.d.ts +6 -0
  60. package/dist/locale-detection.d.ts +5 -0
  61. package/dist/locales/clause/en.d.ts +14 -0
  62. package/dist/locales/course/en.d.ts +20 -0
  63. package/dist/locales/course/th.d.ts +12 -0
  64. package/dist/localization.d.ts +76 -0
  65. package/dist/localized-timing.d.ts +1 -1
  66. package/dist/maps.d.ts +44 -10
  67. package/dist/medication-condition.d.ts +72 -11
  68. package/dist/parser-state.d.ts +12 -2
  69. package/dist/parser.d.ts +5 -3
  70. package/dist/prn.d.ts +13 -2
  71. package/dist/regimen/coordination-scope.d.ts +13 -1
  72. package/dist/regimen/grammar.d.ts +18 -1
  73. package/dist/regimen/parallel-course.d.ts +13 -42
  74. package/dist/regimen/planner.d.ts +2 -3
  75. package/dist/regimen/regimen.d.ts +8 -2
  76. package/dist/relation-terminology.d.ts +1 -0
  77. package/dist/schedule.d.ts +14 -10
  78. package/dist/snomed.d.ts +3 -0
  79. package/dist/suggest-locale-adapter.d.ts +15 -0
  80. package/dist/symptom-terminology.d.ts +5 -1
  81. package/dist/timing-summary.d.ts +114 -1
  82. package/dist/types.d.ts +627 -61
  83. package/dist/unit-lexicon.d.ts +4 -1
  84. package/dist/utils/text.d.ts +3 -0
  85. package/dist/utils/units.d.ts +22 -0
  86. package/package.json +1 -1
package/dist/types.d.ts CHANGED
@@ -1,45 +1,146 @@
1
1
  import type { SigTranslationConfig } from "./i18n";
2
2
  export interface FhirCoding {
3
+ id?: string;
3
4
  system?: string;
5
+ _system?: FhirPrimitiveElement;
4
6
  /** Terminology edition used to define this code. */
5
7
  version?: string;
8
+ _version?: FhirPrimitiveElement;
6
9
  code?: string;
10
+ _code?: FhirPrimitiveElement;
7
11
  display?: string;
12
+ userSelected?: boolean;
13
+ _userSelected?: FhirPrimitiveElement;
8
14
  extension?: FhirExtension[];
9
15
  _display?: FhirPrimitiveElement;
10
16
  i18n?: Record<string, string>;
11
17
  }
18
+ export interface FhirR6Coding extends Omit<FhirCoding, "extension" | "_system" | "_version" | "_code" | "_display" | "_userSelected">, FhirR6Element {
19
+ _system?: FhirR6PrimitiveElement;
20
+ _version?: FhirR6PrimitiveElement;
21
+ _code?: FhirR6PrimitiveElement;
22
+ _display?: FhirR6PrimitiveElement;
23
+ _userSelected?: FhirR6PrimitiveElement;
24
+ }
12
25
  export interface FhirCodeableConcept {
26
+ id?: string;
13
27
  coding?: FhirCoding[];
14
28
  text?: string;
15
29
  extension?: FhirExtension[];
16
30
  _text?: FhirPrimitiveElement;
17
31
  }
18
- export interface FhirExtension {
32
+ export interface FhirR6CodeableConcept extends Omit<FhirCodeableConcept, "extension" | "coding" | "_text">, FhirR6Element {
33
+ coding?: FhirR6Coding[];
34
+ _text?: FhirR6PrimitiveElement;
35
+ }
36
+ /** Valid wire choices outside medication semantics are retained as opaque data.
37
+ * Declared interpreted choices below keep their destination-specific types. */
38
+ type FhirOpaqueExtensionValues = Partial<Record<"valueBase64Binary" | "valueId" | "valueInteger64" | "valueOid" | "valueUuid" | "valueAddress" | "valueAnnotation" | "valueAttachment" | "valueHumanName" | "valueMoney" | "valueRatioRange" | "valueSampledData" | "valueSignature" | "valueContactDetail" | "valueDataRequirement" | "valueParameterDefinition" | "valueRelatedArtifact" | "valueTriggerDefinition" | "valueUsageContext" | "valueAvailability" | "valueExtendedContactDetail" | "valueDosage" | "valueMeta", unknown>>;
39
+ export interface FhirExtension extends FhirOpaqueExtensionValues {
19
40
  id?: string;
20
41
  url: string;
21
42
  extension?: FhirExtension[];
22
43
  valueCode?: string;
44
+ _valueCode?: FhirPrimitiveElement;
23
45
  valueString?: string;
46
+ _valueString?: FhirPrimitiveElement;
47
+ valueMarkdown?: string;
48
+ _valueMarkdown?: FhirPrimitiveElement;
24
49
  valueDate?: string;
50
+ _valueDate?: FhirPrimitiveElement;
25
51
  valueBoolean?: boolean;
52
+ _valueBoolean?: FhirPrimitiveElement;
26
53
  valueInteger?: number;
54
+ _valueInteger?: FhirPrimitiveElement;
27
55
  valueDecimal?: number;
56
+ _valueDecimal?: FhirPrimitiveElement;
28
57
  valueQuantity?: FhirQuantity;
58
+ valueAge?: FhirQuantity;
59
+ valueCount?: FhirQuantity;
60
+ valueDistance?: FhirQuantity;
61
+ valueDuration?: FhirQuantity;
29
62
  valueCoding?: FhirCoding;
30
63
  valueCodeableConcept?: FhirCodeableConcept;
31
64
  valueUri?: string;
65
+ _valueUri?: FhirPrimitiveElement;
66
+ valueUrl?: string;
67
+ _valueUrl?: FhirPrimitiveElement;
32
68
  valueCanonical?: string;
69
+ _valueCanonical?: FhirPrimitiveElement;
33
70
  valueDateTime?: string;
71
+ _valueDateTime?: FhirPrimitiveElement;
72
+ valueInstant?: string;
73
+ _valueInstant?: FhirPrimitiveElement;
34
74
  valueTime?: string;
75
+ _valueTime?: FhirPrimitiveElement;
35
76
  valuePositiveInt?: number;
77
+ _valuePositiveInt?: FhirPrimitiveElement;
36
78
  valueUnsignedInt?: number;
79
+ _valueUnsignedInt?: FhirPrimitiveElement;
80
+ _valueBase64Binary?: FhirPrimitiveElement;
81
+ _valueId?: FhirPrimitiveElement;
82
+ _valueInteger64?: FhirPrimitiveElement;
83
+ _valueOid?: FhirPrimitiveElement;
84
+ _valueUuid?: FhirPrimitiveElement;
37
85
  valueRange?: FhirRange;
38
86
  valueRatio?: FhirRatio;
87
+ valuePeriod?: FhirPeriod;
39
88
  valueExpression?: FhirExpression;
40
89
  valueReference?: NonNullable<FhirCodeableReference["reference"]>;
41
90
  valueCodeableReference?: FhirCodeableReference;
42
91
  valueTiming?: FhirTiming;
92
+ valueIdentifier?: FhirReference["identifier"];
93
+ /** Retained ContactPoint content is opaque to medication semantics. */
94
+ valueContactPoint?: Record<string, unknown>;
95
+ }
96
+ /** R6 Extension values retain their native datatype contracts. */
97
+ export interface FhirR6Extension extends Omit<FhirExtension, "extension" | "valueQuantity" | "valueAge" | "valueCount" | "valueDistance" | "valueDuration" | "valueRatio" | "valueTiming" | "valueReference" | "valueCodeableReference" | "valueCoding" | "valueCodeableConcept" | "valueRange" | "valueExpression" | "valuePeriod" | "valueIdentifier" | "_valueCode" | "_valueString" | "_valueMarkdown" | "_valueDecimal" | "_valueDate" | "_valueTime" | "_valueInteger" | "_valueBoolean" | "_valueUri" | "_valueUrl" | "_valueCanonical" | "_valueDateTime" | "_valueInstant" | "_valuePositiveInt" | "_valueUnsignedInt" | "_valueBase64Binary" | "_valueId" | "_valueInteger64" | "_valueOid" | "_valueUuid"> {
98
+ _valueBoolean?: FhirR6PrimitiveElement;
99
+ _valueCode?: FhirR6PrimitiveElement;
100
+ _valueString?: FhirR6PrimitiveElement;
101
+ _valueMarkdown?: FhirR6PrimitiveElement;
102
+ _valueDecimal?: FhirR6PrimitiveElement;
103
+ _valueDate?: FhirR6PrimitiveElement;
104
+ _valueTime?: FhirR6PrimitiveElement;
105
+ _valueInteger?: FhirR6PrimitiveElement;
106
+ _valueUri?: FhirR6PrimitiveElement;
107
+ _valueUrl?: FhirR6PrimitiveElement;
108
+ _valueCanonical?: FhirR6PrimitiveElement;
109
+ _valueDateTime?: FhirR6PrimitiveElement;
110
+ _valueInstant?: FhirR6PrimitiveElement;
111
+ _valuePositiveInt?: FhirR6PrimitiveElement;
112
+ _valueUnsignedInt?: FhirR6PrimitiveElement;
113
+ _valueBase64Binary?: FhirR6PrimitiveElement;
114
+ _valueId?: FhirR6PrimitiveElement;
115
+ _valueInteger64?: FhirR6PrimitiveElement;
116
+ _valueOid?: FhirR6PrimitiveElement;
117
+ _valueUuid?: FhirR6PrimitiveElement;
118
+ extension?: FhirR6Extension[];
119
+ valueQuantity?: FhirR6Quantity;
120
+ valueAge?: FhirR6Quantity;
121
+ valueCount?: FhirR6Quantity;
122
+ valueDistance?: FhirR6Quantity;
123
+ valueDuration?: FhirR6Quantity;
124
+ valueCoding?: FhirR6Coding;
125
+ valueCodeableConcept?: FhirR6CodeableConcept;
126
+ valueRange?: FhirR6Range;
127
+ valueExpression?: FhirR6Expression;
128
+ valueRatio?: FhirR6Ratio;
129
+ valuePeriod?: FhirR6Period;
130
+ valueTiming?: FhirR6Timing;
131
+ valueReference?: FhirR6Reference;
132
+ valueIdentifier?: FhirR6Reference["identifier"];
133
+ valueCodeableReference?: FhirR6CodeableReference;
134
+ /** R6-only content retained without interpreting virtual service metadata. */
135
+ valueVirtualServiceDetail?: unknown;
136
+ /** Retained ContactPoint content is opaque to medication semantics. */
137
+ valueContactPoint?: Record<string, unknown>;
138
+ }
139
+ export interface FhirR6Element extends Omit<FhirElement, "extension"> {
140
+ extension?: FhirR6Extension[];
141
+ }
142
+ export interface FhirR6BackboneElement extends FhirR6Element {
143
+ modifierExtension?: FhirR6Extension[];
43
144
  }
44
145
  export interface FhirElement {
45
146
  id?: string;
@@ -50,10 +151,13 @@ export interface FhirBackboneElement extends FhirElement {
50
151
  }
51
152
  /** FHIR primitive metadata can carry both Element.id and extensions. */
52
153
  export type FhirPrimitiveElement = FhirElement;
154
+ /** R6 primitive companions carry the same R6 Extension choices as their owner. */
155
+ export type FhirR6PrimitiveElement = FhirR6Element;
53
156
  export interface FhirQuantity extends FhirElement {
54
157
  value?: number;
55
158
  /** FHIR R5 Quantity comparator. 'ad' was added in R5. */
56
159
  comparator?: "<" | "<=" | ">=" | ">" | "ad";
160
+ _comparator?: FhirPrimitiveElement;
57
161
  unit?: string;
58
162
  system?: string;
59
163
  code?: string;
@@ -96,21 +200,40 @@ export interface EstimatedQuantity extends FhirQuantity {
96
200
  source?: string;
97
201
  }
98
202
  /** FHIR SimpleQuantity: Quantity with the comparator constrained to absent. */
99
- export type FhirSimpleQuantity = Omit<FhirQuantity, "comparator"> & {
203
+ export type FhirSimpleQuantity = Omit<FhirQuantity, "comparator" | "_comparator"> & {
100
204
  comparator?: never;
205
+ _comparator?: never;
101
206
  };
102
207
  /** FHIR R6 also supports the approximate (~) comparator in general Quantity. */
103
- export type FhirR6Quantity = Omit<FhirQuantity, "comparator"> & {
208
+ export type FhirR6Quantity = Omit<FhirQuantity, "extension" | "comparator" | "_comparator" | "_value" | "_unit" | "_system" | "_code"> & FhirR6Element & {
104
209
  comparator?: FhirQuantity["comparator"] | "~";
210
+ _comparator?: FhirR6PrimitiveElement;
211
+ _value?: FhirR6PrimitiveElement;
212
+ _unit?: FhirR6PrimitiveElement;
213
+ _system?: FhirR6PrimitiveElement;
214
+ _code?: FhirR6PrimitiveElement;
215
+ };
216
+ export type FhirR6SimpleQuantity = Omit<FhirR6Quantity, "comparator" | "_comparator"> & {
217
+ comparator?: never;
218
+ _comparator?: never;
105
219
  };
106
220
  export interface FhirRange extends FhirElement {
107
221
  low?: FhirSimpleQuantity;
108
222
  high?: FhirSimpleQuantity;
109
223
  }
224
+ export interface FhirR6Range extends FhirR6Element {
225
+ low?: FhirR6SimpleQuantity;
226
+ high?: FhirR6SimpleQuantity;
227
+ }
110
228
  export interface FhirRatio extends FhirElement {
111
229
  numerator?: FhirQuantity;
112
230
  denominator?: FhirSimpleQuantity;
113
231
  }
232
+ /** R6 Ratio uses native R6 annotations; only its numerator permits a comparator. */
233
+ export interface FhirR6Ratio extends FhirR6Element {
234
+ numerator?: FhirR6Quantity;
235
+ denominator?: FhirR6SimpleQuantity;
236
+ }
114
237
  /**
115
238
  * Follows https://build.fhir.org/valueset-event-timing.html
116
239
  * Real-world event relating to the schedule.
@@ -331,46 +454,117 @@ export declare enum FhirDayOfWeek {
331
454
  Saturday = "sat",
332
455
  Sunday = "sun"
333
456
  }
334
- export interface FhirPeriod {
457
+ export interface FhirPeriod extends FhirElement {
335
458
  start?: string;
459
+ _start?: FhirPrimitiveElement;
336
460
  end?: string;
461
+ _end?: FhirPrimitiveElement;
462
+ }
463
+ /** Native R6 Period metadata uses native R6 Extension values. */
464
+ export interface FhirR6Period extends Omit<FhirPeriod, "extension" | "_start" | "_end">, FhirR6Element {
465
+ _start?: FhirR6PrimitiveElement;
466
+ _end?: FhirR6PrimitiveElement;
337
467
  }
338
468
  export interface FhirTimingRepeat extends FhirElement {
339
469
  count?: number;
470
+ /** Primitive metadata may represent an unspecified lower count without inventing a value. */
471
+ _count?: FhirPrimitiveElement;
340
472
  countMax?: number;
473
+ _countMax?: FhirPrimitiveElement;
341
474
  boundsDuration?: FhirQuantity;
342
475
  boundsPeriod?: FhirPeriod;
343
476
  boundsRange?: FhirRange;
344
477
  frequency?: number;
478
+ _frequency?: FhirPrimitiveElement;
345
479
  frequencyMax?: number;
480
+ _frequencyMax?: FhirPrimitiveElement;
346
481
  /** Duration of each administration occurrence. */
347
482
  duration?: number;
483
+ /** Primitive annotation for a stated or unspecified lower duration. */
484
+ _duration?: FhirPrimitiveElement;
348
485
  durationMax?: number;
486
+ _durationMax?: FhirPrimitiveElement;
349
487
  durationUnit?: FhirPeriodUnit;
488
+ _durationUnit?: FhirPrimitiveElement;
350
489
  period?: number;
490
+ /** Primitive annotation for a stated or unspecified lower period. */
491
+ _period?: FhirPrimitiveElement;
351
492
  periodMax?: number;
493
+ _periodMax?: FhirPrimitiveElement;
352
494
  periodUnit?: FhirPeriodUnit;
353
- dayOfWeek?: FhirDayOfWeek[];
354
- timeOfDay?: string[];
355
- when?: EventTiming[];
495
+ _periodUnit?: FhirPrimitiveElement;
496
+ dayOfWeek?: Array<`${FhirDayOfWeek}` | null>;
497
+ /** Primitive metadata corresponding positionally to dayOfWeek. */
498
+ _dayOfWeek?: Array<FhirPrimitiveElement | null>;
499
+ timeOfDay?: Array<string | null>;
500
+ /** Primitive metadata corresponding positionally to timeOfDay. */
501
+ _timeOfDay?: Array<FhirPrimitiveElement | null>;
502
+ when?: Array<`${EventTiming}` | null>;
503
+ /** Primitive metadata corresponding positionally to when. */
504
+ _when?: Array<FhirPrimitiveElement | null>;
356
505
  /** Exact event offset in minutes. */
357
506
  offset?: number;
358
- }
359
- export interface FhirTiming extends FhirElement {
360
- event?: string[];
361
- /** Primitive metadata corresponding positionally to event. */
362
- _event?: FhirPrimitiveElement[];
507
+ _offset?: FhirPrimitiveElement;
508
+ }
509
+ /** R6 Snapshot 1 adds period-local interlacing windows to Timing.repeat.
510
+ * These are not R5 Timing fields and must remain confined to the R6 wire type. */
511
+ export interface FhirR6TimingRepeat extends Omit<FhirTimingRepeat, "boundsDuration" | "boundsRange" | "boundsPeriod" | "extension" | "durationUnit" | "periodUnit" | "_count" | "_countMax" | "_frequency" | "_frequencyMax" | "_duration" | "_durationMax" | "_durationUnit" | "_period" | "_periodMax" | "_periodUnit" | "_dayOfWeek" | "_timeOfDay" | "_when" | "_offset">, FhirR6Element {
512
+ /** Bounded wire codes accept JSON literals as well as the exported enum. */
513
+ durationUnit?: `${FhirPeriodUnit}`;
514
+ periodUnit?: `${FhirPeriodUnit}`;
515
+ _count?: FhirR6PrimitiveElement;
516
+ _countMax?: FhirR6PrimitiveElement;
517
+ _durationMax?: FhirR6PrimitiveElement;
518
+ _durationUnit?: FhirR6PrimitiveElement;
519
+ _periodMax?: FhirR6PrimitiveElement;
520
+ _periodUnit?: FhirR6PrimitiveElement;
521
+ _offset?: FhirR6PrimitiveElement;
522
+ _frequency?: FhirR6PrimitiveElement;
523
+ _frequencyMax?: FhirR6PrimitiveElement;
524
+ _duration?: FhirR6PrimitiveElement;
525
+ _period?: FhirR6PrimitiveElement;
526
+ _dayOfWeek?: Array<FhirR6PrimitiveElement | null>;
527
+ _timeOfDay?: Array<FhirR6PrimitiveElement | null>;
528
+ _when?: Array<FhirR6PrimitiveElement | null>;
529
+ /** R6 Quantity permits the native approximate "~" comparator. */
530
+ boundsDuration?: FhirR6Quantity;
531
+ boundsRange?: FhirR6Range;
532
+ boundsPeriod?: FhirR6Period;
533
+ startOffset?: FhirR6SimpleQuantity;
534
+ endOffset?: FhirR6SimpleQuantity;
535
+ }
536
+ export interface FhirR6Timing extends Omit<FhirTiming, "repeat" | "code" | "extension" | "modifierExtension" | "_event">, FhirR6BackboneElement {
537
+ _event?: Array<FhirR6PrimitiveElement | null>;
538
+ repeat?: FhirR6TimingRepeat;
539
+ code?: FhirR6CodeableConcept;
540
+ }
541
+ export interface FhirTiming extends FhirBackboneElement {
542
+ event?: Array<string | null>;
543
+ /** Primitive metadata corresponding positionally to event, including value-only slots. */
544
+ _event?: Array<FhirPrimitiveElement | null>;
363
545
  repeat?: FhirTimingRepeat;
364
546
  code?: FhirCodeableConcept;
365
547
  }
366
548
  /** FHIR Expression: enough structure to preserve external R6 dose/rate expressions. */
367
549
  export interface FhirExpression extends FhirElement {
368
550
  description?: string;
551
+ _description?: FhirPrimitiveElement;
369
552
  name?: string;
553
+ _name?: FhirPrimitiveElement;
370
554
  /** FHIR R5/R6 Expression.language is optional (0..1). */
371
555
  language?: string;
556
+ _language?: FhirPrimitiveElement;
372
557
  expression?: string;
558
+ _expression?: FhirPrimitiveElement;
373
559
  reference?: string;
560
+ _reference?: FhirPrimitiveElement;
561
+ }
562
+ export interface FhirR6Expression extends Omit<FhirExpression, "extension" | "_description" | "_name" | "_language" | "_expression" | "_reference">, FhirR6Element {
563
+ _description?: FhirR6PrimitiveElement;
564
+ _name?: FhirR6PrimitiveElement;
565
+ _language?: FhirR6PrimitiveElement;
566
+ _expression?: FhirR6PrimitiveElement;
567
+ _reference?: FhirR6PrimitiveElement;
374
568
  }
375
569
  export interface FhirDoseAndRate extends FhirBackboneElement {
376
570
  type?: FhirCodeableConcept;
@@ -380,6 +574,20 @@ export interface FhirDoseAndRate extends FhirBackboneElement {
380
574
  rateRange?: FhirRange;
381
575
  rateQuantity?: FhirSimpleQuantity;
382
576
  }
577
+ /** Current R6 Dosage.doseAndRate is an Element, unlike R5/R6 Dosage
578
+ * itself (a BackboneType). No modifierExtension is valid on this child. */
579
+ export type FhirR6DoseAndRate = Omit<EzDoseAndRate, "extension" | "modifierExtension" | "type" | "doseQuantity" | "doseRange" | "doseExpression" | "rateQuantity" | "rateRange" | "rateRatio" | "rateExpression"> & FhirR6Element & {
580
+ type?: FhirR6CodeableConcept;
581
+ doseRange?: FhirR6Range;
582
+ doseExpression?: FhirR6Expression;
583
+ rateRange?: FhirR6Range;
584
+ rateExpression?: FhirR6Expression;
585
+ /** Both R5 and R6 scalar dose/rate choices constrain Quantity to
586
+ * SimpleQuantity. Qualifiers use the shared quantity-operator extension. */
587
+ doseQuantity?: FhirR6SimpleQuantity;
588
+ rateQuantity?: FhirR6SimpleQuantity;
589
+ rateRatio?: FhirR6Ratio;
590
+ };
383
591
  /** R6 additions to the R5 DoseAndRate child object. */
384
592
  export interface EzDoseAndRate extends FhirDoseAndRate {
385
593
  doseExpression?: FhirExpression;
@@ -412,84 +620,238 @@ export type MedicationCondition = {
412
620
  kind: "all" | "any";
413
621
  conditions: MedicationCondition[];
414
622
  };
415
- /** FHIR R6 draft DosageCondition compatible subset. */
416
- export interface FhirR6DosageCondition extends FhirBackboneElement {
417
- code: FhirCodeableConcept;
418
- details?: FhirCodeableConcept;
419
- operation?: "eq" | "ne" | "in" | "nin" | "gt" | "lt" | "ge" | "le" | "sa" | "eb" | "ap";
623
+ /** The pinned R6 DosageCondition value[x] choices are accepted at the wire
624
+ * boundary. Uninterpreted complex values are retained as source data; accepting
625
+ * a choice here does not make it executable as a medication predicate. */
626
+ interface FhirR6DosageConditionValues {
627
+ valueBase64Binary?: string;
628
+ _valueBase64Binary?: FhirR6PrimitiveElement;
420
629
  valueBoolean?: boolean;
421
- valueQuantity?: FhirR6Quantity;
630
+ _valueBoolean?: FhirR6PrimitiveElement;
631
+ valueCanonical?: string;
632
+ _valueCanonical?: FhirR6PrimitiveElement;
633
+ valueCode?: string;
634
+ _valueCode?: FhirR6PrimitiveElement;
635
+ valueDate?: string;
636
+ _valueDate?: FhirR6PrimitiveElement;
637
+ valueDateTime?: string;
638
+ _valueDateTime?: FhirR6PrimitiveElement;
639
+ valueDecimal?: number;
640
+ _valueDecimal?: FhirR6PrimitiveElement;
641
+ valueId?: string;
642
+ _valueId?: FhirR6PrimitiveElement;
643
+ valueInstant?: string;
644
+ _valueInstant?: FhirR6PrimitiveElement;
645
+ valueInteger?: number;
646
+ _valueInteger?: FhirR6PrimitiveElement;
647
+ valueInteger64?: string;
648
+ _valueInteger64?: FhirR6PrimitiveElement;
649
+ valueMarkdown?: string;
650
+ _valueMarkdown?: FhirR6PrimitiveElement;
651
+ valueOid?: string;
652
+ _valueOid?: FhirR6PrimitiveElement;
653
+ valuePositiveInt?: number;
654
+ _valuePositiveInt?: FhirR6PrimitiveElement;
422
655
  valueString?: string;
656
+ _valueString?: FhirR6PrimitiveElement;
657
+ valueTime?: string;
658
+ _valueTime?: FhirR6PrimitiveElement;
659
+ valueUnsignedInt?: number;
660
+ _valueUnsignedInt?: FhirR6PrimitiveElement;
661
+ valueUri?: string;
662
+ _valueUri?: FhirR6PrimitiveElement;
663
+ valueUrl?: string;
664
+ _valueUrl?: FhirR6PrimitiveElement;
665
+ valueUuid?: string;
666
+ _valueUuid?: FhirR6PrimitiveElement;
667
+ valueAddress?: Record<string, unknown>;
668
+ valueAge?: FhirR6Quantity;
669
+ valueAnnotation?: Record<string, unknown>;
670
+ valueAttachment?: Record<string, unknown>;
671
+ valueCodeableConcept?: FhirR6CodeableConcept;
672
+ valueCodeableReference?: FhirR6CodeableReference;
673
+ valueCoding?: FhirR6Coding;
674
+ valueContactPoint?: Record<string, unknown>;
675
+ valueCount?: FhirR6Quantity;
676
+ valueDistance?: FhirR6Quantity;
677
+ valueDuration?: FhirR6Quantity;
678
+ valueHumanName?: Record<string, unknown>;
679
+ valueIdentifier?: NonNullable<FhirR6Reference["identifier"]>;
680
+ valueMoney?: Record<string, unknown>;
681
+ valuePeriod?: FhirR6Period;
682
+ valueQuantity?: FhirR6Quantity;
683
+ valueRange?: FhirR6Range;
684
+ valueRatio?: FhirR6Ratio;
685
+ valueRatioRange?: Record<string, unknown>;
686
+ valueReference?: FhirR6Reference;
687
+ valueSampledData?: Record<string, unknown>;
688
+ valueSignature?: Record<string, unknown>;
689
+ valueTiming?: FhirR6Timing;
690
+ valueContactDetail?: Record<string, unknown>;
691
+ valueDataRequirement?: Record<string, unknown>;
692
+ valueExpression?: FhirR6Expression;
693
+ valueParameterDefinition?: Record<string, unknown>;
694
+ valueRelatedArtifact?: Record<string, unknown>;
695
+ valueTriggerDefinition?: Record<string, unknown>;
696
+ valueUsageContext?: object;
697
+ valueAvailability?: Record<string, unknown>;
698
+ valueExtendedContactDetail?: Record<string, unknown>;
699
+ valueVirtualServiceDetail?: Record<string, unknown>;
700
+ valueDosage?: FhirR6Dosage;
701
+ valueMeta?: Record<string, unknown>;
702
+ }
703
+ type DosageConditionValueField = Exclude<keyof FhirR6DosageConditionValues, `_${string}`>;
704
+ type DosageConditionValue = {
705
+ [K in DosageConditionValueField]: Pick<FhirR6DosageConditionValues, K | Extract<keyof FhirR6DosageConditionValues, `_${K}`>> & Partial<Record<Exclude<keyof FhirR6DosageConditionValues, K | `_${K}`>, never>>;
706
+ }[DosageConditionValueField];
707
+ export type FhirR6DosageCondition = FhirR6BackboneElement & {
708
+ code: FhirR6CodeableConcept;
709
+ details?: FhirR6CodeableConcept;
710
+ operation?: "eq" | "ne" | "in" | "nin" | "gt" | "lt" | "ge" | "le" | "sa" | "eb" | "ap";
711
+ _operation?: FhirR6PrimitiveElement;
423
712
  text?: string;
424
- }
713
+ _text?: FhirR6PrimitiveElement;
714
+ } & DosageConditionValue;
425
715
  /** FHIR R6 DosageSafety.doseLimit.value[x] is a required choice. */
426
- export type FhirR6DoseLimit = FhirBackboneElement & {
427
- scope: "dosage" | "period" | "administration" | "lifetime";
428
- period?: FhirQuantity;
716
+ export type FhirR6DoseLimit = FhirR6Element & {
717
+ period?: FhirR6Quantity;
429
718
  text?: string;
719
+ _text?: FhirR6PrimitiveElement;
430
720
  } & ({
721
+ scope: "dosage" | "period" | "administration" | "lifetime";
722
+ _scope?: FhirR6PrimitiveElement;
723
+ } | {
724
+ scope?: never;
725
+ _scope: FhirR6PrimitiveElement;
726
+ }) & ({
431
727
  valueQuantity: FhirR6Quantity;
432
728
  valueInteger?: never;
729
+ _valueInteger?: never;
433
730
  valueExpression?: never;
434
731
  } | {
435
732
  valueInteger: number;
733
+ _valueInteger?: FhirR6PrimitiveElement;
734
+ valueQuantity?: never;
735
+ valueExpression?: never;
736
+ } | {
737
+ _valueInteger: FhirR6PrimitiveElement;
738
+ valueInteger?: never;
436
739
  valueQuantity?: never;
437
740
  valueExpression?: never;
438
741
  } | {
439
- valueExpression: FhirExpression;
742
+ valueExpression: FhirR6Expression;
440
743
  valueQuantity?: never;
441
744
  valueInteger?: never;
745
+ _valueInteger?: never;
442
746
  });
443
- export interface FhirR6DosageSafety extends FhirBackboneElement {
747
+ export interface FhirR6DosageSafety extends FhirR6BackboneElement {
444
748
  doseLimit?: FhirR6DoseLimit[];
445
749
  ifExceeded?: string;
750
+ _ifExceeded?: FhirR6PrimitiveElement;
446
751
  }
447
- /** FHIR R6 CodeableReference allows either a concept or resource reference. */
448
- export interface FhirCodeableReference {
449
- concept?: FhirCodeableConcept;
450
- reference?: {
451
- reference?: string;
452
- type?: string;
453
- display?: string;
752
+ /** R6 Reference carries standard Reference.identifier and Element metadata. */
753
+ export interface FhirReference extends FhirElement {
754
+ reference?: string;
755
+ _reference?: FhirPrimitiveElement;
756
+ type?: string;
757
+ _type?: FhirPrimitiveElement;
758
+ identifier?: {
759
+ id?: string;
760
+ extension?: FhirExtension[];
761
+ use?: string;
762
+ _use?: FhirPrimitiveElement;
763
+ type?: FhirCodeableConcept;
764
+ system?: string;
765
+ _system?: FhirPrimitiveElement;
766
+ value?: string;
767
+ _value?: FhirPrimitiveElement;
768
+ period?: FhirPeriod;
769
+ assigner?: FhirReference;
770
+ };
771
+ display?: string;
772
+ _display?: FhirPrimitiveElement;
773
+ }
774
+ /** Native R6 Reference annotations use native R6 Extension values. */
775
+ export interface FhirR6Reference extends Omit<FhirReference, "extension" | "identifier" | "_reference" | "_type" | "_display">, FhirR6Element {
776
+ _reference?: FhirR6PrimitiveElement;
777
+ _type?: FhirR6PrimitiveElement;
778
+ _display?: FhirR6PrimitiveElement;
779
+ identifier?: Omit<NonNullable<FhirReference["identifier"]>, "extension" | "type" | "assigner" | "period" | "_use" | "_system" | "_value"> & FhirR6Element & {
780
+ type?: FhirR6CodeableConcept;
781
+ _use?: FhirR6PrimitiveElement;
782
+ _system?: FhirR6PrimitiveElement;
783
+ _value?: FhirR6PrimitiveElement;
784
+ period?: FhirR6Period;
785
+ assigner?: FhirR6Reference;
454
786
  };
455
787
  }
788
+ /** CodeableReference fields with R5-compatible Element metadata. */
789
+ export interface FhirCodeableReference extends FhirElement {
790
+ concept?: FhirCodeableConcept;
791
+ reference?: FhirReference;
792
+ }
793
+ /** Current R6 Element annotations may carry native R6 Quantity choices. */
794
+ export interface FhirR6CodeableReference extends Omit<FhirCodeableReference, "extension" | "concept" | "reference">, FhirR6Element {
795
+ concept?: FhirR6CodeableConcept;
796
+ reference?: FhirR6Reference;
797
+ }
456
798
  /** FHIR R6 draft Dosage: no R5 sequence/legacy maxima/PRN alias. */
457
- export interface FhirR6Dosage extends Omit<FhirDosage, "sequence" | "site" | "maxDosePerPeriod" | "maxDosePerAdministration" | "maxDosePerLifetime" | "doseAndRate"> {
799
+ export interface FhirR6Dosage extends Omit<FhirDosage, "sequence" | "_sequence" | "site" | "maxDosePerPeriod" | "maxDosePerAdministration" | "maxDosePerLifetime" | "doseAndRate" | "timing" | "extension" | "modifierExtension" | "_text" | "_asNeeded" | "route" | "method" | "additionalInstruction" | "asNeededFor" | "_patientInstruction"> {
800
+ _text?: FhirR6PrimitiveElement;
801
+ _patientInstruction?: FhirR6PrimitiveElement;
802
+ _asNeeded?: FhirR6PrimitiveElement;
803
+ extension?: FhirR6Extension[];
804
+ modifierExtension?: FhirR6Extension[];
805
+ timing?: FhirR6Timing;
458
806
  condition?: FhirR6DosageCondition[];
459
- site?: FhirCodeableReference;
460
- doseAndRate?: EzDoseAndRate[];
807
+ site?: FhirR6CodeableReference;
808
+ route?: FhirR6CodeableConcept;
809
+ method?: FhirR6CodeableConcept;
810
+ additionalInstruction?: FhirR6CodeableConcept[];
811
+ asNeededFor?: FhirR6CodeableConcept[];
812
+ doseAndRate?: FhirR6DoseAndRate[];
461
813
  safety?: FhirR6DosageSafety;
462
814
  }
463
- export interface FhirR6RelativeTime extends FhirBackboneElement {
464
- contextReference?: {
465
- reference?: string;
466
- };
815
+ export interface FhirR6RelativeTime extends FhirR6BackboneElement {
816
+ contextReference?: FhirR6Reference;
467
817
  contextDefinition?: string;
818
+ _contextDefinition?: FhirR6PrimitiveElement;
468
819
  contextPath?: string;
469
- contextCode?: FhirCodeableConcept;
470
- offsetDuration?: FhirQuantity;
471
- offsetRange?: FhirRange;
820
+ _contextPath?: FhirR6PrimitiveElement;
821
+ contextCode?: FhirR6CodeableConcept;
822
+ offsetDuration?: FhirR6Quantity;
823
+ offsetRange?: FhirR6Range;
472
824
  text?: string;
825
+ _text?: FhirR6PrimitiveElement;
473
826
  }
474
- export interface FhirR6DosageStep extends FhirBackboneElement {
827
+ export interface FhirR6DosageStep extends FhirR6Element {
475
828
  start?: FhirR6RelativeTime;
476
829
  end?: FhirR6RelativeTime;
477
830
  count?: number;
831
+ _count?: FhirR6PrimitiveElement;
478
832
  component: FhirR6Dosage[];
479
833
  safety?: FhirR6DosageSafety;
480
834
  }
481
- /** R6's step/component course representation. */
482
- export interface FhirR6DosageDetails extends FhirBackboneElement {
835
+ /** Official FHIR R6 Snapshot 1 DosageInstruction course container. */
836
+ export interface FhirR6DosageInstruction extends FhirR6BackboneElement {
483
837
  renderedInstruction?: string;
484
- repeatCycle?: FhirQuantity;
485
- step: FhirR6DosageStep[];
838
+ _renderedInstruction?: FhirR6PrimitiveElement;
839
+ /** FHIR Duration: numeric values use UCUM time coding. */
840
+ repeatCycle?: FhirR6Quantity;
841
+ step?: FhirR6DosageStep[];
486
842
  safety?: FhirR6DosageSafety;
487
843
  }
844
+ /** Current R6 inputs and outputs share the optional 0..* wire shape. */
845
+ export type FhirR6DosageInstructionInput = FhirR6DosageInstruction;
488
846
  export interface FhirDosage extends FhirBackboneElement {
489
847
  /** FHIR R5 ordering: equal sequences are concurrent, increasing sequences are sequential. */
490
848
  sequence?: number;
849
+ _sequence?: FhirPrimitiveElement;
491
850
  text?: string;
851
+ /** Primitive metadata belongs to the authored narrative, not a new dose. */
852
+ _text?: FhirPrimitiveElement;
492
853
  patientInstruction?: string;
854
+ _patientInstruction?: FhirPrimitiveElement;
493
855
  timing?: FhirTiming;
494
856
  route?: FhirCodeableConcept;
495
857
  site?: FhirCodeableConcept;
@@ -497,6 +859,7 @@ export interface FhirDosage extends FhirBackboneElement {
497
859
  additionalInstruction?: FhirCodeableConcept[];
498
860
  /** FHIR R5 spelling. */
499
861
  asNeeded?: boolean;
862
+ _asNeeded?: FhirPrimitiveElement;
500
863
  asNeededFor?: FhirCodeableConcept[];
501
864
  doseAndRate?: FhirDoseAndRate[];
502
865
  maxDosePerPeriod?: FhirRatio[];
@@ -515,26 +878,28 @@ export interface EzDosage extends Omit<FhirDosage, "doseAndRate"> {
515
878
  /** FHIR R6 Dosage.safety, alongside the R5 maximum fields. */
516
879
  safety?: FhirR6DosageSafety;
517
880
  /** FHIR R6 Dosage.site.reference, while site remains R5 CodeableConcept. */
518
- siteReference?: FhirCodeableReference["reference"];
881
+ siteReference?: FhirR6Reference;
519
882
  /** EZMED-specific dates omitted from a repeating schedule; not an HL7 core field. */
520
883
  excludedDates?: string[];
521
884
  }
522
885
  /**
523
886
  * Small amount of course-level metadata that does not logically belong to an
524
887
  * individual dosage. Each step row addresses the usual R5 Dosage.sequence.
525
- * The fields under step come directly from FHIR R6 DosageDetails.step.
888
+ * Step metadata is retained for editable R5 rows; R6 step is an Element.
526
889
  */
527
- export interface EzCourseStep extends FhirBackboneElement {
890
+ export interface EzCourseStep extends FhirR6BackboneElement {
528
891
  /** R5 global sequence corresponding to this R6 step. */
529
892
  sequence: number;
530
893
  start?: FhirR6RelativeTime;
531
894
  end?: FhirR6RelativeTime;
532
895
  count?: number;
896
+ _count?: FhirR6PrimitiveElement;
533
897
  safety?: FhirR6DosageSafety;
534
898
  }
535
- export interface EzCourseMetadata extends FhirBackboneElement {
899
+ export interface EzCourseMetadata extends FhirR6BackboneElement {
536
900
  renderedInstruction?: string;
537
- repeatCycle?: FhirQuantity;
901
+ _renderedInstruction?: FhirR6PrimitiveElement;
902
+ repeatCycle?: FhirR6Quantity;
538
903
  safety?: FhirR6DosageSafety;
539
904
  step?: EzCourseStep[];
540
905
  }
@@ -614,9 +979,21 @@ export interface BodySiteCode {
614
979
  export interface BodySiteSpatialRelation {
615
980
  relationText: string;
616
981
  relationCoding?: FhirCoding;
982
+ /** Annotations on the supplied relation Extension, separate from its Coding. */
983
+ relationSource?: FhirR6Extension;
617
984
  targetText?: string;
618
985
  targetCoding?: BodySiteCode;
986
+ /** Complete supplied concept when one selected Coding cannot carry all its data. */
987
+ targetConcept?: FhirR6CodeableConcept;
988
+ /** Annotations on the supplied target Extension, separate from its concept. */
989
+ targetSource?: FhirR6Extension;
619
990
  sourceText?: string;
991
+ /** Supplied annotated string carriers, kept separate from selected display text. */
992
+ relationTextSource?: FhirR6Extension;
993
+ targetTextSource?: FhirR6Extension;
994
+ sourceTextSource?: FhirR6Extension;
995
+ /** Original wrapper annotations and unrecognized children remain opaque. */
996
+ retainedExtension?: FhirR6Extension;
620
997
  }
621
998
  export type BodySiteRestrictionPredicateForm = "state" | "existential" | "raw";
622
999
  /**
@@ -640,6 +1017,11 @@ export interface BodySiteRestriction {
640
1017
  predicate: BodySiteRestrictionPredicate;
641
1018
  }
642
1019
  export interface BodySiteDefinition {
1020
+ /** A named treatment locus may supply the omitted recipient of an immediately
1021
+ * following application after local cleansing; ordinary anatomy alone may not. */
1022
+ treatmentLocus?: true;
1023
+ /** A complete unqualified nominal refers to the administration's selected site. */
1024
+ administrationSiteReference?: true;
643
1025
  coding?: BodySiteCode;
644
1026
  text?: string;
645
1027
  spatialRelation?: BodySiteSpatialRelation;
@@ -706,6 +1088,7 @@ export declare enum AdviceRelation {
706
1088
  Between = "between",
707
1089
  Then = "then",
708
1090
  Until = "until",
1091
+ Within = "within",
709
1092
  For = "for",
710
1093
  In = "in",
711
1094
  Into = "into",
@@ -738,12 +1121,18 @@ export interface InstructionConceptComponent {
738
1121
  role: "head" | "qualifier" | "amount";
739
1122
  text: string;
740
1123
  coding?: FhirCoding;
1124
+ /** Retained wire annotations are source data, never constituent meaning. */
1125
+ sourceId?: string;
1126
+ sourceExtensions?: FhirExtension[];
741
1127
  }
742
1128
  /** A standard-coded constituent of an instruction predicate, not an equivalent
743
1129
  * code for the whole imperative or an unvalidated SNOMED expression. */
744
1130
  export interface InstructionActionSemanticComponent {
745
1131
  role: "activity" | "technique" | "target-state" | "target-site" | "target-object" | "operation" | "orientation" | "mechanism" | "situation";
746
1132
  coding: FhirCoding;
1133
+ /** Retained wire annotations are source data, never constituent meaning. */
1134
+ sourceId?: string;
1135
+ sourceExtensions?: FhirExtension[];
747
1136
  }
748
1137
  export interface AdviceArgument {
749
1138
  role: AdviceArgumentRole;
@@ -751,16 +1140,32 @@ export interface AdviceArgument {
751
1140
  /** Independent typed relation from this action to its argument.
752
1141
  * Permits material WITH and event BEFORE to coexist on one action. */
753
1142
  relation?: AdviceRelation;
1143
+ /** Original relation Coding annotations; the current typed relation owns meaning. */
1144
+ sourceRelationCoding?: FhirCoding;
754
1145
  normalized?: string;
755
1146
  conceptId?: string;
756
1147
  coding?: FhirCoding;
757
1148
  codings?: FhirCoding[];
1149
+ /** Resolved anatomical multiplicity of this Site argument. */
1150
+ administrationTargetCount?: number;
758
1151
  components?: InstructionConceptComponent[];
759
1152
  i18n?: Record<string, string>;
1153
+ /** Original FHIR Element identity of the argument wrapper. */
1154
+ sourceId?: string;
1155
+ /** Imported field annotations and unknown argument children, retained as FHIR data. */
1156
+ sourceExtensions?: FhirExtension[];
760
1157
  quantity?: {
761
1158
  value?: number;
762
1159
  range?: CanonicalDoseRange;
763
1160
  unit?: string;
1161
+ /** Authored qualifier follows this amount through graph matching and FHIR. */
1162
+ comparator?: FhirR6Quantity["comparator"];
1163
+ /** Active primitive metadata follows the current operator through FHIR. */
1164
+ comparatorElement?: FhirR6PrimitiveElement;
1165
+ /** Original wire operator annotations; the current comparator owns meaning. */
1166
+ comparatorExtensions?: FhirR6Extension[];
1167
+ /** Primitive child annotations; current typed values own quantity meaning. */
1168
+ fieldMetadata?: Partial<Record<"value" | "low" | "high" | "unit", Omit<FhirExtension, "url" | "valueDecimal" | "valueString">>>;
764
1169
  };
765
1170
  span?: TextRange;
766
1171
  }
@@ -784,6 +1189,8 @@ export interface AdviceFrame {
784
1189
  semanticComponents?: InstructionActionSemanticComponent[];
785
1190
  };
786
1191
  relation?: AdviceRelation;
1192
+ /** Original relation Coding annotations; the current typed relation owns meaning. */
1193
+ sourceRelationCoding?: FhirCoding;
787
1194
  args: AdviceArgument[];
788
1195
  span: TextRange;
789
1196
  sourceText: string;
@@ -791,6 +1198,10 @@ export interface AdviceFrame {
791
1198
  origin?: "grammar" | "semantic-resolver";
792
1199
  confidence?: number;
793
1200
  coding?: FhirCoding;
1201
+ /** Original FHIR Element identity of the action wrapper. */
1202
+ sourceId?: string;
1203
+ /** Imported action child annotations and unrecognized children, retained as non-executable FHIR data. */
1204
+ sourceExtensions?: FhirExtension[];
794
1205
  }
795
1206
  export interface TextRange {
796
1207
  /** Inclusive start index of the matched substring within the original input. */
@@ -799,6 +1210,8 @@ export interface TextRange {
799
1210
  end: number;
800
1211
  }
801
1212
  export interface SiteCodeLookupRequest {
1213
+ /** Grammar-owned modifiers outside the anatomical lookup head. */
1214
+ nominalModifiers?: readonly string[];
802
1215
  /** Original site text preserved for debugging or auditing. */
803
1216
  originalText: string;
804
1217
  /**
@@ -943,6 +1356,8 @@ export interface MedicationInstructionActionContextualSemanticComponentRule {
943
1356
  component: InstructionActionSemanticComponent;
944
1357
  }
945
1358
  export interface MedicationInstructionActionLocaleRealizerConfig {
1359
+ /** Finite affirmative wording when no modal supplies the base verb form. */
1360
+ finiteUnmodalLabel?: string;
946
1361
  fallbackObject?: string;
947
1362
  suppressActivityConcepts?: string[];
948
1363
  suppressSiteConcepts?: string[];
@@ -970,6 +1385,10 @@ export interface MedicationInstructionActionDefinition {
970
1385
  roundtripI18n?: Record<string, string>;
971
1386
  /** Surface forms that should resolve to this action. */
972
1387
  aliases?: string[];
1388
+ /** Already registered action forms licensed as a subordinate Activity after coordination. */
1389
+ activityAliases?: string[];
1390
+ /** Activity forms that also license finite directives when a local complement completes them. */
1391
+ dualUseActivityAliases?: string[];
973
1392
  /** Ambiguous aliases licensed only at a directive boundary or after an explicit directive. */
974
1393
  directiveOnlyAliases?: string[];
975
1394
  /** Surface forms licensed only when immediately sequence-scoped (e.g. `then off`). */
@@ -983,6 +1402,10 @@ export interface MedicationInstructionActionDefinition {
983
1402
  }>;
984
1403
  /** Whether this is a procedural action rather than ordinary administration advice. */
985
1404
  procedural?: boolean;
1405
+ /** Licenses an informational or warning clause without declaring a procedure. */
1406
+ adviceClauseHead?: boolean;
1407
+ /** Force of an unqualified action; explicit directive grammar takes precedence. */
1408
+ defaultForce?: AdviceForce;
986
1409
  /** Declarative argument grammar family used by the instruction graph. */
987
1410
  argumentParser?: MedicationInstructionActionArgumentParser;
988
1411
  /** Declarative realization family used by English/Thai graph generation. */
@@ -998,8 +1421,13 @@ export interface MedicationInstructionActionDefinition {
998
1421
  secondaryConcepts?: string[];
999
1422
  implicitMatchedConcept?: string;
1000
1423
  implicitMatchedRole?: AdviceArgumentRole;
1424
+ /** The registered predicate already includes its own nominal complement. */
1425
+ implicitComplement?: boolean;
1001
1426
  };
1002
1427
  realizerConfig?: MedicationInstructionActionRealizerConfig;
1428
+ /** Typed manner concepts tied to this administration method. An edited
1429
+ * method drops these from its display copy while keeping source evidence. */
1430
+ methodBoundMannerConcepts?: string[];
1003
1431
  continuationLicenses?: Array<{
1004
1432
  candidateAction: string;
1005
1433
  previousConcepts?: string[];
@@ -1009,6 +1437,8 @@ export interface MedicationInstructionActionDefinition {
1009
1437
  continuationAfterRelations?: string[];
1010
1438
  /** Surface introducers that make a parsed duration describe each administration occurrence. */
1011
1439
  administrationDurationIntroducers?: string[];
1440
+ /** Optional canonical-unit restrictions on an already licensed occurrence-duration introducer. */
1441
+ administrationDurationUnitsByIntroducer?: Record<string, FhirPeriodUnit[]>;
1012
1442
  /** Preferred relation semantic classes used to resolve lexically ambiguous relation surfaces. */
1013
1443
  preferredRelationSemanticClasses?: string[];
1014
1444
  /** Exact coding for FHIR Dosage.method when this action can head administration. */
@@ -1047,6 +1477,8 @@ export interface MedicationInstructionActionInput extends Partial<MedicationInst
1047
1477
  export interface MedicationInstructionConceptDefinition {
1048
1478
  code: string;
1049
1479
  role: AdviceArgumentRole;
1480
+ /** A complete unqualified nominal refers to the administration's selected site. */
1481
+ administrationSiteReference?: true;
1050
1482
  /** A registered compound noun may entail a second independently typed
1051
1483
  * argument, e.g. a temporal material "before first use" also supplies
1052
1484
  * its explicit first-use event. Not a free-form text rewrite. */
@@ -1058,6 +1490,8 @@ export interface MedicationInstructionConceptDefinition {
1058
1490
  display: string;
1059
1491
  i18n?: Record<string, string>;
1060
1492
  aliases?: string[];
1493
+ /** Existing activity aliases that can head an independent command after coordination. */
1494
+ verbalAliases?: string[];
1061
1495
  /** Locale-specific parser lexemes; display translations are not implicitly grammar-active. */
1062
1496
  localeAliases?: Record<string, string[]>;
1063
1497
  coding?: FhirCoding;
@@ -1176,8 +1610,9 @@ export interface ParseOptions extends FormatOptions {
1176
1610
  */
1177
1611
  instructionConceptMap?: Record<string, MedicationInstructionConceptInput>;
1178
1612
  /**
1179
- * Optional learned/remote semantic proposal providers. They are used only by
1180
- * parseSigAsync(), and only against spans the deterministic parser left opaque.
1613
+ * Optional learned/remote semantic proposal providers. parseSig() accepts
1614
+ * synchronous providers; parseSigAsync() also accepts asynchronous providers.
1615
+ * Both apply proposals only to spans the deterministic parser left opaque.
1181
1616
  * Proposals are validated against registered action/concept/site/unit vocabularies
1182
1617
  * before they can enter the canonical graph.
1183
1618
  */
@@ -1292,9 +1727,26 @@ export interface CanonicalDoseRange {
1292
1727
  high?: number;
1293
1728
  }
1294
1729
  export interface CanonicalDoseExpr {
1730
+ /** Counted dose allocation, distinct from the number of anatomical targets. */
1731
+ allocation?: "total" | "per-target";
1732
+ /** Explicitly assumed one discrete dose from caller policy, not source
1733
+ * evidence. Roundtrip source wording can remain unchanged for this case. */
1734
+ defaulted?: boolean;
1735
+ /** Unit at the time the one-dose default was inferred. An edited unit
1736
+ * must not inherit permission to replay amountless source wording. */
1737
+ defaultedUnit?: string;
1738
+ /** The imported R5 row still matches its persisted clinical fingerprint.
1739
+ * Only source-preserving realization consults this fact; canonical
1740
+ * execution ignores it. No source wording is reparsed to infer a dose. */
1741
+ sourceDoseVerified?: boolean;
1295
1742
  value?: number;
1296
1743
  range?: CanonicalDoseRange;
1297
1744
  unit?: string;
1745
+ /** Resolved Quantity unit identity for clinical scope in the compact display
1746
+ * view. The authored unit label and complete native quantity stay unchanged. */
1747
+ unitIdentity?: string;
1748
+ /** Exact authored comparator; scalar doseQuantity uses the EMA extension in both R5 and R6. */
1749
+ comparator?: FhirR6Quantity["comparator"];
1298
1750
  evidence?: CanonicalEvidence[];
1299
1751
  }
1300
1752
  export interface CanonicalRouteExpr {
@@ -1329,7 +1781,7 @@ export interface CanonicalAdministrationTargetGroup {
1329
1781
  }
1330
1782
  export interface CanonicalMethodExpr {
1331
1783
  text?: string;
1332
- _text?: FhirPrimitiveElement;
1784
+ _text?: FhirR6PrimitiveElement;
1333
1785
  coding?: FhirCoding;
1334
1786
  evidence?: CanonicalEvidence[];
1335
1787
  }
@@ -1342,8 +1794,11 @@ export interface CanonicalOccurrenceCapExpr {
1342
1794
  export interface CanonicalDosePeriodMaximumExpr {
1343
1795
  amount: number;
1344
1796
  unit: string;
1797
+ /** Exact authored Quantity operator, including EMA-coded approximate R5 limits. */
1798
+ amountComparator?: FhirR6Quantity["comparator"];
1345
1799
  period: number;
1346
1800
  periodUnit: FhirPeriodUnit;
1801
+ periodComparator?: FhirR6Quantity["comparator"];
1347
1802
  }
1348
1803
  export interface CanonicalActivityTimingExpr {
1349
1804
  relation: "before" | "after";
@@ -1412,16 +1867,45 @@ export interface CanonicalScheduleExpr {
1412
1867
  /** Source-anaphoric timing (e.g. "at the same times") awaiting a licensed
1413
1868
  * previous regimen daughter. Resolved within HPSG/regimen, never by FHIR. */
1414
1869
  timingReference?: "previous" | "previous-weekday-complement";
1415
- /** Source-relative phase onset, in elapsed days from treatment start. */
1870
+ /** Source-relative phase onset; phaseStartReference selects civil-day
1871
+ * midnight instead of the default clock-preserving treatment start. */
1416
1872
  treatmentStartOffsetDays?: number;
1873
+ /** Local-day origin or preceding-phase completion, never a guessed
1874
+ * count-to-treatment-day conversion. */
1875
+ phaseStartReference?: "previous-phase-next-day" | "previous-phase-end" | "treatment-day-start";
1417
1876
  /** Elapsed delay from each opportunity in this explicitly retained base schedule. */
1418
1877
  administrationOffsetMinutes?: number;
1419
1878
  timingCode?: string;
1879
+ /** Independent authored Timing.code.text, separate from the cadence code. */
1880
+ timingText?: string;
1881
+ /** Label selected from an explicit nonstandard Coding, never a cadence abbreviation. */
1882
+ timingTextIsLiteral?: true;
1420
1883
  count?: number;
1421
1884
  countMax?: number;
1885
+ /** Explicit shared administration allowance; a finite total is optional.
1886
+ * Independently authored members retain their own cap policies. */
1887
+ sharedCount?: {
1888
+ groupId: string;
1889
+ count?: number;
1890
+ countMax?: number;
1891
+ /** Clock partitions of one authored administration retain its complete cap policy. */
1892
+ sameAdministration?: true;
1893
+ };
1422
1894
  duration?: number;
1423
1895
  durationMax?: number;
1896
+ /** Preserve an authored duration range even when only one endpoint exists. */
1897
+ durationIsRange?: true;
1424
1898
  durationUnit?: FhirPeriodUnit;
1899
+ /** Unit of the upper duration endpoint when distinct from durationUnit. */
1900
+ durationMaxUnit?: FhirPeriodUnit;
1901
+ /** Authored unit labels are independent of the normalized temporal codes. */
1902
+ durationUnitLabel?: string;
1903
+ durationMaxUnitLabel?: string;
1904
+ /** Typed qualifiers for the beginning/end of the prescribed duration.
1905
+ * They are independent for FHIR boundsRange, and R5 approximation uses
1906
+ * EMA Quantity Operator instead of an unsupported native "~". */
1907
+ durationComparator?: FhirR6Quantity["comparator"];
1908
+ durationMaxComparator?: FhirR6Quantity["comparator"];
1425
1909
  /** Earliest calendar date/time on which this schedule becomes active. */
1426
1910
  boundsStart?: string;
1427
1911
  /** Latest inclusive calendar date/time on which this schedule remains active. */
@@ -1430,7 +1914,13 @@ export interface CanonicalScheduleExpr {
1430
1914
  administrationDuration?: number;
1431
1915
  administrationDurationMax?: number;
1432
1916
  administrationDurationUnit?: FhirPeriodUnit;
1917
+ /** Qualifier on each administration duration, distinct from course length. */
1918
+ administrationDurationComparator?: FhirR6Quantity["comparator"];
1919
+ /** Independently authored occurrence endpoints, distinct from scalar duration. */
1920
+ administrationDurationRange?: import("./canonical/course").CanonicalRange;
1433
1921
  frequency?: number;
1922
+ /** All divided administrations occur on the first day of each whole civil-day interval. */
1923
+ frequencyWithinDay?: true;
1434
1924
  frequencyMax?: number;
1435
1925
  period?: number;
1436
1926
  periodMax?: number;
@@ -1454,10 +1944,12 @@ export interface CanonicalScheduleExpr {
1454
1944
  occurrenceCap?: CanonicalOccurrenceCapExpr;
1455
1945
  /** Quantity cap, distinct from occurrenceCap's maximum administration count. */
1456
1946
  maxDosePerPeriod?: CanonicalDosePeriodMaximumExpr[];
1947
+ /** Quantity ceiling for each administration, independent of a time period. */
1948
+ maxDosePerAdministration?: Pick<CanonicalDosePeriodMaximumExpr, "amount" | "unit" | "amountComparator">[];
1457
1949
  evidence?: CanonicalEvidence[];
1458
1950
  }
1459
1951
  /** Schedule fields explicitly contributed by typed grammar evidence. */
1460
- export type CanonicalScheduleSemanticField = Exclude<keyof CanonicalScheduleExpr, "evidence">;
1952
+ export type CanonicalScheduleSemanticField = Exclude<keyof CanonicalScheduleExpr, "evidence" | "timingTextIsLiteral" | "openEndedStart">;
1461
1953
  export interface CanonicalPrnReasonExpr {
1462
1954
  text?: string;
1463
1955
  i18n?: Record<string, string>;
@@ -1473,6 +1965,11 @@ export interface CanonicalPrnExpr {
1473
1965
  evidence?: CanonicalEvidence[];
1474
1966
  }
1475
1967
  export interface CanonicalAdditionalInstructionExpr {
1968
+ /** Recognized occurrence maximum whose authored window has no numeric execution policy. */
1969
+ unresolvedMaximum?: {
1970
+ count: number;
1971
+ scope: "period" | "administration";
1972
+ };
1476
1973
  text?: string;
1477
1974
  i18n?: Record<string, string>;
1478
1975
  coding?: FhirCoding;
@@ -1480,6 +1977,11 @@ export interface CanonicalAdditionalInstructionExpr {
1480
1977
  evidence?: CanonicalEvidence[];
1481
1978
  }
1482
1979
  export interface CanonicalInstructionRelation {
1980
+ /** Retained wire annotations are source data, never relationship semantics. */
1981
+ sourceId?: string;
1982
+ sourceExtensions?: FhirExtension[];
1983
+ /** Retained Coding annotations; the current typed kind owns meaning. */
1984
+ sourceKindCoding?: FhirCoding;
1483
1985
  kind: AdviceRelation;
1484
1986
  fromActionIndex?: number;
1485
1987
  toActionIndex: number;
@@ -1487,6 +1989,9 @@ export interface CanonicalInstructionRelation {
1487
1989
  span?: TextRange;
1488
1990
  }
1489
1991
  export interface CanonicalInstructionCoverage {
1992
+ /** Opaque FHIR annotations stay with this coverage record. */
1993
+ sourceId?: string;
1994
+ sourceExtensions?: FhirExtension[];
1490
1995
  understoodCharacters: number;
1491
1996
  opaqueCharacters: number;
1492
1997
  ratio: number;
@@ -1499,15 +2004,41 @@ export interface CanonicalInstructionGraph {
1499
2004
  relations?: CanonicalInstructionRelation[];
1500
2005
  /** Source span of the canonical primary administration head, when known. */
1501
2006
  primaryAdministrationSpan?: TextRange;
2007
+ /** Selected typed source owners, independent of later clinical edits.
2008
+ * Presence is authoritative: an omitted member has no retained graph owner.
2009
+ * Older graphs without this record retain their conservative span fallback. */
2010
+ primaryOwnership?: {
2011
+ administrationActionIndex?: number;
2012
+ dose?: {
2013
+ actionIndex: number;
2014
+ argumentIndex: number;
2015
+ };
2016
+ /** Opaque annotations retained independently of the active source binding. */
2017
+ sourceId?: string;
2018
+ sourceExtensions?: FhirExtension[];
2019
+ };
2020
+ /** Structural source daughters selected by HPSG. Retained independently of
2021
+ * locale wording so fresh wire consumers do not reinterpret patient text. */
2022
+ connectorSpans?: CanonicalSourceSpan[];
1502
2023
  /** Source fragments the parser deliberately did not assign semantics to. */
1503
2024
  opaqueSpans?: CanonicalSourceSpan[];
1504
2025
  coverage?: CanonicalInstructionCoverage;
2026
+ /** Original FHIR Element identity of the graph wrapper. */
2027
+ sourceId?: string;
2028
+ /** Unrecognized graph children retained at their original FHIR owner. */
2029
+ sourceExtensions?: FhirExtension[];
2030
+ /** Whole-source replay was rejected because this graph includes another
2031
+ * administration's source. Its actions and original text remain retained. */
2032
+ sourceProjectionVerified?: false;
1505
2033
  /** Exact original source represented by this graph. */
1506
2034
  sourceText: string;
1507
2035
  /** Source language when it can be determined without guessing. */
1508
2036
  sourceLocale?: string;
1509
2037
  }
1510
2038
  export interface CanonicalSourceSpan extends TextRange {
2039
+ /** Opaque FHIR annotations stay with this source span. */
2040
+ sourceId?: string;
2041
+ sourceExtensions?: FhirExtension[];
1511
2042
  text: string;
1512
2043
  tokenIndices?: number[];
1513
2044
  }
@@ -1518,6 +2049,9 @@ export interface CanonicalEvidence {
1518
2049
  rule: string;
1519
2050
  /** Role of the actual lexical sign, independent of the grammar-rule label. */
1520
2051
  lexicalCategory?: CanonicalLexicalCategory;
2052
+ /** Clinical role supplied by the typed sign. For conditions, the first span
2053
+ * owns the antecedent; later spans may retain ancillary no-dose branches. */
2054
+ clinicalKind?: "condition" | "calendar-exclusion" | "treatment-pause" | "unresolved";
1521
2055
  spans: CanonicalSourceSpan[];
1522
2056
  /** Exact schedule semantics owned by this evidence, independent of rule names. */
1523
2057
  scheduleFields?: CanonicalScheduleSemanticField[];
@@ -1541,15 +2075,29 @@ export interface CanonicalClinicalAdjuncts {
1541
2075
  /** Typed nominal reference of a conditional administration instruction.
1542
2076
  * Resolved across related regimen daughters before any FHIR lowering. */
1543
2077
  conditionTarget?: {
2078
+ /** A selective condition has no authored share of a common metric total. */
2079
+ allocationUnresolved?: true;
2080
+ /** A recognized guard retained on an unresolved nominal reference, never
2081
+ * executed against an unrelated administration. */
2082
+ condition?: MedicationCondition;
2083
+ /** Quantified prohibition binds only to the same existing administration dose. */
2084
+ dose?: CanonicalDoseExpr;
2085
+ /** A named administration site narrows this target independently of its dose. */
2086
+ site?: CanonicalSiteExpr;
1544
2087
  when?: EventTiming[];
1545
2088
  /** Explicit existing clock slots selected by the nominal dose object. */
1546
2089
  timeOfDay?: string[];
1547
2090
  /** Lexical daypart membership over already stated clocks; creates no times. */
1548
- clockRange?: {
2091
+ clockRanges?: {
1549
2092
  startHour: number;
1550
2093
  endHour: number;
1551
- };
2094
+ }[];
1552
2095
  quantifier?: "all" | "both";
2096
+ /** Coordinated targets retain each independently qualified dose and slot. */
2097
+ members?: NonNullable<CanonicalClinicalAdjuncts["conditionTarget"]>[];
2098
+ /** Calendar restrictions owned by this target, pending regimen binding. */
2099
+ excludedDates?: string[];
2100
+ excludedWeekdays?: FhirDayOfWeek[];
1553
2101
  };
1554
2102
  excludedDates?: string[];
1555
2103
  excludedWeekdays?: FhirDayOfWeek[];
@@ -1558,6 +2106,14 @@ export interface CanonicalClinicalAdjuncts {
1558
2106
  evidence?: CanonicalEvidence[];
1559
2107
  }
1560
2108
  export interface CanonicalSigClause {
2109
+ /** Current dose/timing proof for replaying retained source, including dose-less clauses. */
2110
+ sourceProjectionVerified?: boolean;
2111
+ /** Retained wire-source evidence that this primary's structured schedule owned clocks. */
2112
+ sourceHasStructuredClocks?: boolean;
2113
+ /** Retained wire-source evidence that this primary's structured schedule owned event anchors. */
2114
+ sourceHasStructuredEvents?: boolean;
2115
+ /** Original structured primary site ownership; graph-only sites remain independent facts. */
2116
+ sourceHasStructuredSite?: boolean;
1561
2117
  kind: "administration";
1562
2118
  /** Source-backed phase operation; resolved by the typed regimen graph. */
1563
2119
  regimenAdjustment?: "replace" | "add" | "replace-target";
@@ -1605,6 +2161,9 @@ export interface ParseResult {
1605
2161
  normalized: ParseNormalizedMeta;
1606
2162
  canonical: {
1607
2163
  clauses: CanonicalSigClause[];
2164
+ /** Native clinical meaning, independent of either public FHIR projection. */
2165
+ administration?: import("./canonical/course").CanonicalAdministration;
2166
+ course?: import("./canonical/course").CanonicalCourse;
1608
2167
  };
1609
2168
  siteLookups?: Array<{
1610
2169
  request: SiteCodeLookupRequest;
@@ -1661,7 +2220,7 @@ export interface ParseBatchResult {
1661
2220
  /** Primary output: COMPLETE flat R5-like dosage array with additive R6 fields. */
1662
2221
  fhir: EzDosage[];
1663
2222
  /** Strict R6 snapshot projection of the same prescription. */
1664
- fhirNext: FhirR6DosageDetails;
2223
+ fhirNext: FhirR6DosageInstruction;
1665
2224
  /** Optional R6 step/course metadata not owned by a single dose. */
1666
2225
  course?: EzCourseMetadata;
1667
2226
  shortText: string;
@@ -1673,6 +2232,9 @@ export interface ParseBatchResult {
1673
2232
  normalized: ParseNormalizedMeta;
1674
2233
  canonical: {
1675
2234
  clauses: CanonicalSigClause[];
2235
+ /** Native clinical meaning, independent of either public FHIR projection. */
2236
+ administration?: import("./canonical/course").CanonicalAdministration;
2237
+ course?: import("./canonical/course").CanonicalCourse;
1676
2238
  };
1677
2239
  siteLookups?: Array<{
1678
2240
  request: SiteCodeLookupRequest;
@@ -1754,7 +2316,10 @@ export interface NextDueDoseOptions {
1754
2316
  * Parsing and editing never require a selection; execution and supply do.
1755
2317
  */
1756
2318
  alternativeChoices?: Readonly<Record<string, string>>;
1757
- /** Evaluate structured conditional instructions at each candidate occurrence. Required for conditional scheduling. */
2319
+ /** Evaluate structured conditions at each candidate occurrence. Omission
2320
+ * returns candidate opportunities assuming the conditions hold; these are
2321
+ * not patient-specific confirmed administrations. A supplied evaluator must
2322
+ * return true to admit an occurrence; false/undefined withhold it. */
1758
2323
  evaluateCondition?: MedicationConditionEvaluator;
1759
2324
  orderedAt?: Date | string;
1760
2325
  limit?: number;
@@ -1788,7 +2353,7 @@ export interface TotalUnitsResult {
1788
2353
  totalApproximateIngredientQuantity?: EstimatedQuantity;
1789
2354
  }
1790
2355
  export interface TotalUnitsOptions extends NextDueDoseOptions {
1791
- dosage: FhirDosage | readonly EzDosage[] | FhirR6DosageDetails | ParseBatchResult;
2356
+ dosage: FhirDosage | readonly EzDosage[] | FhirR6DosageInstructionInput | ParseBatchResult;
1792
2357
  /** Required to resolve per-kg administered doses into an actual quantity. */
1793
2358
  patientWeightKg?: number;
1794
2359
  durationValue: number;
@@ -1796,3 +2361,4 @@ export interface TotalUnitsOptions extends NextDueDoseOptions {
1796
2361
  roundToMultiple?: number;
1797
2362
  context?: MedicationContext;
1798
2363
  }
2364
+ export {};