ezmedicationinput 0.2.0 → 0.3.0-beta.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 (61) hide show
  1. package/README.md +201 -10
  2. package/dist/adapters/canonical-course.d.ts +128 -0
  3. package/dist/adapters/r5-course.d.ts +24 -0
  4. package/dist/advice.d.ts +36 -5
  5. package/dist/body-site-lookup.d.ts +3 -0
  6. package/dist/body-site-spatial.d.ts +6 -2
  7. package/dist/body-site-target.d.ts +9 -3
  8. package/dist/canonical/compile.d.ts +79 -0
  9. package/dist/canonical/course.d.ts +352 -0
  10. package/dist/canonical/format-course.d.ts +36 -0
  11. package/dist/dosage-course.d.ts +294 -29
  12. package/dist/execution/calendar.d.ts +107 -0
  13. package/dist/execution/engine.d.ts +11 -0
  14. package/dist/fhir-quantity-operator.d.ts +53 -0
  15. package/dist/fhir-translations.d.ts +5 -6
  16. package/dist/fhir.d.ts +99 -14
  17. package/dist/format.d.ts +105 -3
  18. package/dist/hpsg/constructions.d.ts +11 -3
  19. package/dist/hpsg/defaults.d.ts +2 -0
  20. package/dist/hpsg/lexical-classes.d.ts +115 -4
  21. package/dist/hpsg/procedural-context.d.ts +3 -3
  22. package/dist/hpsg/projection.d.ts +28 -1
  23. package/dist/hpsg/rule-context.d.ts +104 -7
  24. package/dist/hpsg/rules/clinical-quantity-rules.d.ts +16 -7
  25. package/dist/hpsg/rules/condition-rules.d.ts +0 -1
  26. package/dist/hpsg/rules/core-rules.d.ts +3 -0
  27. package/dist/hpsg/rules/instruction-rules.d.ts +2 -0
  28. package/dist/hpsg/rules/prn-rules.d.ts +3 -1
  29. package/dist/hpsg/rules/timing-rules.d.ts +17 -1
  30. package/dist/hpsg/signature.d.ts +13 -3
  31. package/dist/hpsg/unification.d.ts +3 -1
  32. package/dist/i18n.d.ts +37 -1
  33. package/dist/index.cjs +63500 -46393
  34. package/dist/index.d.ts +21 -9
  35. package/dist/index.js +63491 -46393
  36. package/dist/instruction-action-locale-adapter.d.ts +31 -3
  37. package/dist/instruction-action-terminology.d.ts +23 -3
  38. package/dist/instruction-concept-terminology.d.ts +7 -0
  39. package/dist/instruction-graph-fhir.d.ts +8 -2
  40. package/dist/instruction-graph.d.ts +80 -38
  41. package/dist/ir.d.ts +1 -1
  42. package/dist/lexer/surface-segmenter.d.ts +1 -1
  43. package/dist/lexer/surface.d.ts +1 -0
  44. package/dist/locale-detection.d.ts +3 -0
  45. package/dist/locales/course/en.d.ts +15 -0
  46. package/dist/locales/course/th.d.ts +12 -0
  47. package/dist/localization.d.ts +73 -0
  48. package/dist/maps.d.ts +10 -2
  49. package/dist/medication-condition.d.ts +1 -1
  50. package/dist/parser-state.d.ts +2 -2
  51. package/dist/regimen/grammar.d.ts +11 -0
  52. package/dist/regimen/parallel-course.d.ts +8 -41
  53. package/dist/regimen/regimen.d.ts +6 -2
  54. package/dist/relation-terminology.d.ts +1 -0
  55. package/dist/schedule.d.ts +14 -10
  56. package/dist/timing-summary.d.ts +82 -1
  57. package/dist/types.d.ts +510 -56
  58. package/dist/unit-lexicon.d.ts +7 -0
  59. package/dist/utils/text.d.ts +3 -0
  60. package/dist/utils/units.d.ts +19 -0
  61. package/package.json +1 -1
package/dist/types.d.ts CHANGED
@@ -1,30 +1,55 @@
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
  }
32
+ export interface FhirR6CodeableConcept extends Omit<FhirCodeableConcept, "extension" | "coding" | "_text">, FhirR6Element {
33
+ coding?: FhirR6Coding[];
34
+ _text?: FhirR6PrimitiveElement;
35
+ }
18
36
  export interface FhirExtension {
19
37
  id?: string;
20
38
  url: string;
21
39
  extension?: FhirExtension[];
22
40
  valueCode?: string;
41
+ _valueCode?: FhirPrimitiveElement;
23
42
  valueString?: string;
43
+ _valueString?: FhirPrimitiveElement;
44
+ valueMarkdown?: string;
45
+ _valueMarkdown?: FhirPrimitiveElement;
24
46
  valueDate?: string;
25
47
  valueBoolean?: boolean;
48
+ _valueBoolean?: FhirPrimitiveElement;
26
49
  valueInteger?: number;
50
+ _valueInteger?: FhirPrimitiveElement;
27
51
  valueDecimal?: number;
52
+ _valueDecimal?: FhirPrimitiveElement;
28
53
  valueQuantity?: FhirQuantity;
29
54
  valueCoding?: FhirCoding;
30
55
  valueCodeableConcept?: FhirCodeableConcept;
@@ -32,15 +57,44 @@ export interface FhirExtension {
32
57
  valueCanonical?: string;
33
58
  valueDateTime?: string;
34
59
  valueTime?: string;
60
+ _valueTime?: FhirPrimitiveElement;
35
61
  valuePositiveInt?: number;
36
62
  valueUnsignedInt?: number;
37
63
  valueRange?: FhirRange;
38
64
  valueRatio?: FhirRatio;
65
+ valuePeriod?: FhirPeriod;
39
66
  valueExpression?: FhirExpression;
40
67
  valueReference?: NonNullable<FhirCodeableReference["reference"]>;
41
68
  valueCodeableReference?: FhirCodeableReference;
42
69
  valueTiming?: FhirTiming;
43
70
  }
71
+ /** R6 Extension values retain their native datatype contracts. */
72
+ export interface FhirR6Extension extends Omit<FhirExtension, "extension" | "valueQuantity" | "valueRatio" | "valueTiming" | "valueReference" | "valueCodeableReference" | "valueCoding" | "valueCodeableConcept" | "valueRange" | "valueExpression" | "valuePeriod" | "_valueCode" | "_valueString" | "_valueMarkdown" | "_valueDecimal" | "_valueTime" | "_valueInteger" | "_valueBoolean"> {
73
+ _valueBoolean?: FhirR6PrimitiveElement;
74
+ _valueCode?: FhirR6PrimitiveElement;
75
+ _valueString?: FhirR6PrimitiveElement;
76
+ _valueMarkdown?: FhirR6PrimitiveElement;
77
+ _valueDecimal?: FhirR6PrimitiveElement;
78
+ _valueTime?: FhirR6PrimitiveElement;
79
+ _valueInteger?: FhirR6PrimitiveElement;
80
+ extension?: FhirR6Extension[];
81
+ valueQuantity?: FhirR6Quantity;
82
+ valueCoding?: FhirR6Coding;
83
+ valueCodeableConcept?: FhirR6CodeableConcept;
84
+ valueRange?: FhirR6Range;
85
+ valueExpression?: FhirR6Expression;
86
+ valueRatio?: FhirR6Ratio;
87
+ valuePeriod?: FhirR6Period;
88
+ valueTiming?: FhirR6Timing;
89
+ valueReference?: FhirR6Reference;
90
+ valueCodeableReference?: FhirR6CodeableReference;
91
+ }
92
+ export interface FhirR6Element extends Omit<FhirElement, "extension"> {
93
+ extension?: FhirR6Extension[];
94
+ }
95
+ export interface FhirR6BackboneElement extends FhirR6Element {
96
+ modifierExtension?: FhirR6Extension[];
97
+ }
44
98
  export interface FhirElement {
45
99
  id?: string;
46
100
  extension?: FhirExtension[];
@@ -50,10 +104,13 @@ export interface FhirBackboneElement extends FhirElement {
50
104
  }
51
105
  /** FHIR primitive metadata can carry both Element.id and extensions. */
52
106
  export type FhirPrimitiveElement = FhirElement;
107
+ /** R6 primitive companions carry the same R6 Extension choices as their owner. */
108
+ export type FhirR6PrimitiveElement = FhirR6Element;
53
109
  export interface FhirQuantity extends FhirElement {
54
110
  value?: number;
55
111
  /** FHIR R5 Quantity comparator. 'ad' was added in R5. */
56
112
  comparator?: "<" | "<=" | ">=" | ">" | "ad";
113
+ _comparator?: FhirPrimitiveElement;
57
114
  unit?: string;
58
115
  system?: string;
59
116
  code?: string;
@@ -96,21 +153,40 @@ export interface EstimatedQuantity extends FhirQuantity {
96
153
  source?: string;
97
154
  }
98
155
  /** FHIR SimpleQuantity: Quantity with the comparator constrained to absent. */
99
- export type FhirSimpleQuantity = Omit<FhirQuantity, "comparator"> & {
156
+ export type FhirSimpleQuantity = Omit<FhirQuantity, "comparator" | "_comparator"> & {
100
157
  comparator?: never;
158
+ _comparator?: never;
101
159
  };
102
160
  /** FHIR R6 also supports the approximate (~) comparator in general Quantity. */
103
- export type FhirR6Quantity = Omit<FhirQuantity, "comparator"> & {
161
+ export type FhirR6Quantity = Omit<FhirQuantity, "extension" | "comparator" | "_comparator" | "_value" | "_unit" | "_system" | "_code"> & FhirR6Element & {
104
162
  comparator?: FhirQuantity["comparator"] | "~";
163
+ _comparator?: FhirR6PrimitiveElement;
164
+ _value?: FhirR6PrimitiveElement;
165
+ _unit?: FhirR6PrimitiveElement;
166
+ _system?: FhirR6PrimitiveElement;
167
+ _code?: FhirR6PrimitiveElement;
168
+ };
169
+ export type FhirR6SimpleQuantity = Omit<FhirR6Quantity, "comparator" | "_comparator"> & {
170
+ comparator?: never;
171
+ _comparator?: never;
105
172
  };
106
173
  export interface FhirRange extends FhirElement {
107
174
  low?: FhirSimpleQuantity;
108
175
  high?: FhirSimpleQuantity;
109
176
  }
177
+ export interface FhirR6Range extends FhirR6Element {
178
+ low?: FhirR6SimpleQuantity;
179
+ high?: FhirR6SimpleQuantity;
180
+ }
110
181
  export interface FhirRatio extends FhirElement {
111
182
  numerator?: FhirQuantity;
112
183
  denominator?: FhirSimpleQuantity;
113
184
  }
185
+ /** R6 Ratio uses native R6 annotations; only its numerator permits a comparator. */
186
+ export interface FhirR6Ratio extends FhirR6Element {
187
+ numerator?: FhirR6Quantity;
188
+ denominator?: FhirR6SimpleQuantity;
189
+ }
114
190
  /**
115
191
  * Follows https://build.fhir.org/valueset-event-timing.html
116
192
  * Real-world event relating to the schedule.
@@ -331,46 +407,114 @@ export declare enum FhirDayOfWeek {
331
407
  Saturday = "sat",
332
408
  Sunday = "sun"
333
409
  }
334
- export interface FhirPeriod {
410
+ export interface FhirPeriod extends FhirElement {
335
411
  start?: string;
412
+ _start?: FhirPrimitiveElement;
336
413
  end?: string;
414
+ _end?: FhirPrimitiveElement;
415
+ }
416
+ /** Native R6 Period metadata uses native R6 Extension values. */
417
+ export interface FhirR6Period extends Omit<FhirPeriod, "extension" | "_start" | "_end">, FhirR6Element {
418
+ _start?: FhirR6PrimitiveElement;
419
+ _end?: FhirR6PrimitiveElement;
337
420
  }
338
421
  export interface FhirTimingRepeat extends FhirElement {
339
422
  count?: number;
423
+ /** Primitive metadata may represent an unspecified lower count without inventing a value. */
424
+ _count?: FhirPrimitiveElement;
340
425
  countMax?: number;
426
+ _countMax?: FhirPrimitiveElement;
341
427
  boundsDuration?: FhirQuantity;
342
428
  boundsPeriod?: FhirPeriod;
343
429
  boundsRange?: FhirRange;
344
430
  frequency?: number;
431
+ _frequency?: FhirPrimitiveElement;
345
432
  frequencyMax?: number;
433
+ _frequencyMax?: FhirPrimitiveElement;
346
434
  /** Duration of each administration occurrence. */
347
435
  duration?: number;
436
+ /** Primitive annotation for a stated or unspecified lower duration. */
437
+ _duration?: FhirPrimitiveElement;
348
438
  durationMax?: number;
439
+ _durationMax?: FhirPrimitiveElement;
349
440
  durationUnit?: FhirPeriodUnit;
441
+ _durationUnit?: FhirPrimitiveElement;
350
442
  period?: number;
443
+ /** Primitive annotation for a stated or unspecified lower period. */
444
+ _period?: FhirPrimitiveElement;
351
445
  periodMax?: number;
446
+ _periodMax?: FhirPrimitiveElement;
352
447
  periodUnit?: FhirPeriodUnit;
353
- dayOfWeek?: FhirDayOfWeek[];
354
- timeOfDay?: string[];
355
- when?: EventTiming[];
448
+ _periodUnit?: FhirPrimitiveElement;
449
+ dayOfWeek?: Array<FhirDayOfWeek | null>;
450
+ /** Primitive metadata corresponding positionally to dayOfWeek. */
451
+ _dayOfWeek?: Array<FhirPrimitiveElement | null>;
452
+ timeOfDay?: Array<string | null>;
453
+ /** Primitive metadata corresponding positionally to timeOfDay. */
454
+ _timeOfDay?: Array<FhirPrimitiveElement | null>;
455
+ when?: Array<EventTiming | null>;
456
+ /** Primitive metadata corresponding positionally to when. */
457
+ _when?: Array<FhirPrimitiveElement | null>;
356
458
  /** Exact event offset in minutes. */
357
459
  offset?: number;
358
- }
359
- export interface FhirTiming extends FhirElement {
360
- event?: string[];
361
- /** Primitive metadata corresponding positionally to event. */
362
- _event?: FhirPrimitiveElement[];
460
+ _offset?: FhirPrimitiveElement;
461
+ }
462
+ /** R6 Snapshot 1 adds period-local interlacing windows to Timing.repeat.
463
+ * These are not R5 Timing fields and must remain confined to the R6 wire type. */
464
+ export interface FhirR6TimingRepeat extends Omit<FhirTimingRepeat, "boundsDuration" | "boundsRange" | "boundsPeriod" | "extension" | "_count" | "_countMax" | "_frequency" | "_frequencyMax" | "_duration" | "_durationMax" | "_durationUnit" | "_period" | "_periodMax" | "_periodUnit" | "_dayOfWeek" | "_timeOfDay" | "_when" | "_offset">, FhirR6Element {
465
+ _count?: FhirR6PrimitiveElement;
466
+ _countMax?: FhirR6PrimitiveElement;
467
+ _durationMax?: FhirR6PrimitiveElement;
468
+ _durationUnit?: FhirR6PrimitiveElement;
469
+ _periodMax?: FhirR6PrimitiveElement;
470
+ _periodUnit?: FhirR6PrimitiveElement;
471
+ _offset?: FhirR6PrimitiveElement;
472
+ _frequency?: FhirR6PrimitiveElement;
473
+ _frequencyMax?: FhirR6PrimitiveElement;
474
+ _duration?: FhirR6PrimitiveElement;
475
+ _period?: FhirR6PrimitiveElement;
476
+ _dayOfWeek?: Array<FhirR6PrimitiveElement | null>;
477
+ _timeOfDay?: Array<FhirR6PrimitiveElement | null>;
478
+ _when?: Array<FhirR6PrimitiveElement | null>;
479
+ /** R6 Quantity permits the native approximate "~" comparator. */
480
+ boundsDuration?: FhirR6Quantity;
481
+ boundsRange?: FhirR6Range;
482
+ boundsPeriod?: FhirR6Period;
483
+ startOffset?: FhirR6SimpleQuantity;
484
+ endOffset?: FhirR6SimpleQuantity;
485
+ }
486
+ export interface FhirR6Timing extends Omit<FhirTiming, "repeat" | "code" | "extension" | "modifierExtension" | "_event">, FhirR6BackboneElement {
487
+ _event?: Array<FhirR6PrimitiveElement | null>;
488
+ repeat?: FhirR6TimingRepeat;
489
+ code?: FhirR6CodeableConcept;
490
+ }
491
+ export interface FhirTiming extends FhirBackboneElement {
492
+ event?: Array<string | null>;
493
+ /** Primitive metadata corresponding positionally to event, including value-only slots. */
494
+ _event?: Array<FhirPrimitiveElement | null>;
363
495
  repeat?: FhirTimingRepeat;
364
496
  code?: FhirCodeableConcept;
365
497
  }
366
498
  /** FHIR Expression: enough structure to preserve external R6 dose/rate expressions. */
367
499
  export interface FhirExpression extends FhirElement {
368
500
  description?: string;
501
+ _description?: FhirPrimitiveElement;
369
502
  name?: string;
503
+ _name?: FhirPrimitiveElement;
370
504
  /** FHIR R5/R6 Expression.language is optional (0..1). */
371
505
  language?: string;
506
+ _language?: FhirPrimitiveElement;
372
507
  expression?: string;
508
+ _expression?: FhirPrimitiveElement;
373
509
  reference?: string;
510
+ _reference?: FhirPrimitiveElement;
511
+ }
512
+ export interface FhirR6Expression extends Omit<FhirExpression, "extension" | "_description" | "_name" | "_language" | "_expression" | "_reference">, FhirR6Element {
513
+ _description?: FhirR6PrimitiveElement;
514
+ _name?: FhirR6PrimitiveElement;
515
+ _language?: FhirR6PrimitiveElement;
516
+ _expression?: FhirR6PrimitiveElement;
517
+ _reference?: FhirR6PrimitiveElement;
374
518
  }
375
519
  export interface FhirDoseAndRate extends FhirBackboneElement {
376
520
  type?: FhirCodeableConcept;
@@ -380,6 +524,20 @@ export interface FhirDoseAndRate extends FhirBackboneElement {
380
524
  rateRange?: FhirRange;
381
525
  rateQuantity?: FhirSimpleQuantity;
382
526
  }
527
+ /** Current R6 Dosage.doseAndRate is an Element, unlike R5/R6 Dosage
528
+ * itself (a BackboneType). No modifierExtension is valid on this child. */
529
+ export type FhirR6DoseAndRate = Omit<EzDoseAndRate, "extension" | "modifierExtension" | "type" | "doseQuantity" | "doseRange" | "doseExpression" | "rateQuantity" | "rateRange" | "rateRatio" | "rateExpression"> & FhirR6Element & {
530
+ type?: FhirR6CodeableConcept;
531
+ doseRange?: FhirR6Range;
532
+ doseExpression?: FhirR6Expression;
533
+ rateRange?: FhirR6Range;
534
+ rateExpression?: FhirR6Expression;
535
+ /** Both R5 and R6 scalar dose/rate choices constrain Quantity to
536
+ * SimpleQuantity. Qualifiers use the shared quantity-operator extension. */
537
+ doseQuantity?: FhirR6SimpleQuantity;
538
+ rateQuantity?: FhirR6SimpleQuantity;
539
+ rateRatio?: FhirR6Ratio;
540
+ };
383
541
  /** R6 additions to the R5 DoseAndRate child object. */
384
542
  export interface EzDoseAndRate extends FhirDoseAndRate {
385
543
  doseExpression?: FhirExpression;
@@ -412,84 +570,233 @@ export type MedicationCondition = {
412
570
  kind: "all" | "any";
413
571
  conditions: MedicationCondition[];
414
572
  };
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";
573
+ /** The pinned R6 DosageCondition value[x] choices are accepted at the wire
574
+ * boundary. Uninterpreted complex values are retained as source data; accepting
575
+ * a choice here does not make it executable as a medication predicate. */
576
+ interface FhirR6DosageConditionValues {
577
+ valueBase64Binary?: string;
578
+ _valueBase64Binary?: FhirR6PrimitiveElement;
420
579
  valueBoolean?: boolean;
421
- valueQuantity?: FhirR6Quantity;
580
+ _valueBoolean?: FhirR6PrimitiveElement;
581
+ valueCanonical?: string;
582
+ _valueCanonical?: FhirR6PrimitiveElement;
583
+ valueCode?: string;
584
+ _valueCode?: FhirR6PrimitiveElement;
585
+ valueDate?: string;
586
+ _valueDate?: FhirR6PrimitiveElement;
587
+ valueDateTime?: string;
588
+ _valueDateTime?: FhirR6PrimitiveElement;
589
+ valueDecimal?: number;
590
+ _valueDecimal?: FhirR6PrimitiveElement;
591
+ valueId?: string;
592
+ _valueId?: FhirR6PrimitiveElement;
593
+ valueInstant?: string;
594
+ _valueInstant?: FhirR6PrimitiveElement;
595
+ valueInteger?: number;
596
+ _valueInteger?: FhirR6PrimitiveElement;
597
+ valueInteger64?: string;
598
+ _valueInteger64?: FhirR6PrimitiveElement;
599
+ valueMarkdown?: string;
600
+ _valueMarkdown?: FhirR6PrimitiveElement;
601
+ valueOid?: string;
602
+ _valueOid?: FhirR6PrimitiveElement;
603
+ valuePositiveInt?: number;
604
+ _valuePositiveInt?: FhirR6PrimitiveElement;
422
605
  valueString?: string;
606
+ _valueString?: FhirR6PrimitiveElement;
607
+ valueTime?: string;
608
+ _valueTime?: FhirR6PrimitiveElement;
609
+ valueUnsignedInt?: number;
610
+ _valueUnsignedInt?: FhirR6PrimitiveElement;
611
+ valueUri?: string;
612
+ _valueUri?: FhirR6PrimitiveElement;
613
+ valueUrl?: string;
614
+ _valueUrl?: FhirR6PrimitiveElement;
615
+ valueUuid?: string;
616
+ _valueUuid?: FhirR6PrimitiveElement;
617
+ valueAddress?: Record<string, unknown>;
618
+ valueAge?: FhirR6Quantity;
619
+ valueAnnotation?: Record<string, unknown>;
620
+ valueAttachment?: Record<string, unknown>;
621
+ valueCodeableConcept?: FhirR6CodeableConcept;
622
+ valueCodeableReference?: FhirR6CodeableReference;
623
+ valueCoding?: FhirR6Coding;
624
+ valueContactPoint?: Record<string, unknown>;
625
+ valueCount?: FhirR6Quantity;
626
+ valueDistance?: FhirR6Quantity;
627
+ valueDuration?: FhirR6Quantity;
628
+ valueHumanName?: Record<string, unknown>;
629
+ valueIdentifier?: NonNullable<FhirR6Reference["identifier"]>;
630
+ valueMoney?: Record<string, unknown>;
631
+ valuePeriod?: FhirR6Period;
632
+ valueQuantity?: FhirR6Quantity;
633
+ valueRange?: FhirR6Range;
634
+ valueRatio?: FhirR6Ratio;
635
+ valueRatioRange?: Record<string, unknown>;
636
+ valueReference?: FhirR6Reference;
637
+ valueSampledData?: Record<string, unknown>;
638
+ valueSignature?: Record<string, unknown>;
639
+ valueTiming?: FhirR6Timing;
640
+ valueContactDetail?: Record<string, unknown>;
641
+ valueDataRequirement?: Record<string, unknown>;
642
+ valueExpression?: FhirR6Expression;
643
+ valueParameterDefinition?: Record<string, unknown>;
644
+ valueRelatedArtifact?: Record<string, unknown>;
645
+ valueTriggerDefinition?: Record<string, unknown>;
646
+ valueUsageContext?: Record<string, unknown>;
647
+ valueAvailability?: Record<string, unknown>;
648
+ valueExtendedContactDetail?: Record<string, unknown>;
649
+ valueVirtualServiceDetail?: Record<string, unknown>;
650
+ valueDosage?: FhirR6Dosage;
651
+ valueMeta?: Record<string, unknown>;
652
+ }
653
+ type DosageConditionValueField = Exclude<keyof FhirR6DosageConditionValues, `_${string}`>;
654
+ type DosageConditionValue = {
655
+ [K in DosageConditionValueField]: Pick<FhirR6DosageConditionValues, K | Extract<keyof FhirR6DosageConditionValues, `_${K}`>> & Partial<Record<Exclude<keyof FhirR6DosageConditionValues, K | `_${K}`>, never>>;
656
+ }[DosageConditionValueField];
657
+ export type FhirR6DosageCondition = FhirR6BackboneElement & {
658
+ code: FhirR6CodeableConcept;
659
+ details?: FhirR6CodeableConcept;
660
+ operation?: "eq" | "ne" | "in" | "nin" | "gt" | "lt" | "ge" | "le" | "sa" | "eb" | "ap";
661
+ _operation?: FhirR6PrimitiveElement;
423
662
  text?: string;
424
- }
663
+ _text?: FhirR6PrimitiveElement;
664
+ } & DosageConditionValue;
425
665
  /** FHIR R6 DosageSafety.doseLimit.value[x] is a required choice. */
426
- export type FhirR6DoseLimit = FhirBackboneElement & {
666
+ export type FhirR6DoseLimit = FhirR6Element & {
427
667
  scope: "dosage" | "period" | "administration" | "lifetime";
428
- period?: FhirQuantity;
668
+ _scope?: FhirR6PrimitiveElement;
669
+ period?: FhirR6Quantity;
429
670
  text?: string;
671
+ _text?: FhirR6PrimitiveElement;
430
672
  } & ({
431
673
  valueQuantity: FhirR6Quantity;
432
674
  valueInteger?: never;
675
+ _valueInteger?: never;
433
676
  valueExpression?: never;
434
677
  } | {
435
678
  valueInteger: number;
679
+ _valueInteger?: FhirR6PrimitiveElement;
436
680
  valueQuantity?: never;
437
681
  valueExpression?: never;
438
682
  } | {
439
- valueExpression: FhirExpression;
683
+ _valueInteger: FhirR6PrimitiveElement;
684
+ valueInteger?: never;
685
+ valueQuantity?: never;
686
+ valueExpression?: never;
687
+ } | {
688
+ valueExpression: FhirR6Expression;
440
689
  valueQuantity?: never;
441
690
  valueInteger?: never;
691
+ _valueInteger?: never;
442
692
  });
443
- export interface FhirR6DosageSafety extends FhirBackboneElement {
693
+ export interface FhirR6DosageSafety extends FhirR6BackboneElement {
444
694
  doseLimit?: FhirR6DoseLimit[];
445
695
  ifExceeded?: string;
696
+ _ifExceeded?: FhirR6PrimitiveElement;
446
697
  }
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;
698
+ /** R6 Reference carries standard Reference.identifier and Element metadata. */
699
+ export interface FhirReference extends FhirElement {
700
+ reference?: string;
701
+ _reference?: FhirPrimitiveElement;
702
+ type?: string;
703
+ _type?: FhirPrimitiveElement;
704
+ identifier?: {
705
+ id?: string;
706
+ extension?: FhirExtension[];
707
+ use?: string;
708
+ _use?: FhirPrimitiveElement;
709
+ type?: FhirCodeableConcept;
710
+ system?: string;
711
+ _system?: FhirPrimitiveElement;
712
+ value?: string;
713
+ _value?: FhirPrimitiveElement;
714
+ period?: FhirPeriod;
715
+ assigner?: FhirReference;
454
716
  };
717
+ display?: string;
718
+ _display?: FhirPrimitiveElement;
719
+ }
720
+ /** Native R6 Reference annotations use native R6 Extension values. */
721
+ export interface FhirR6Reference extends Omit<FhirReference, "extension" | "identifier" | "_reference" | "_type" | "_display">, FhirR6Element {
722
+ _reference?: FhirR6PrimitiveElement;
723
+ _type?: FhirR6PrimitiveElement;
724
+ _display?: FhirR6PrimitiveElement;
725
+ identifier?: Omit<NonNullable<FhirReference["identifier"]>, "extension" | "type" | "assigner" | "period" | "_use" | "_system" | "_value"> & FhirR6Element & {
726
+ type?: FhirR6CodeableConcept;
727
+ _use?: FhirR6PrimitiveElement;
728
+ _system?: FhirR6PrimitiveElement;
729
+ _value?: FhirR6PrimitiveElement;
730
+ period?: FhirR6Period;
731
+ assigner?: FhirR6Reference;
732
+ };
733
+ }
734
+ /** CodeableReference fields with R5-compatible Element metadata. */
735
+ export interface FhirCodeableReference extends FhirElement {
736
+ concept?: FhirCodeableConcept;
737
+ reference?: FhirReference;
738
+ }
739
+ /** Current R6 Element annotations may carry native R6 Quantity choices. */
740
+ export interface FhirR6CodeableReference extends Omit<FhirCodeableReference, "extension" | "concept" | "reference">, FhirR6Element {
741
+ concept?: FhirR6CodeableConcept;
742
+ reference?: FhirR6Reference;
455
743
  }
456
744
  /** FHIR R6 draft Dosage: no R5 sequence/legacy maxima/PRN alias. */
457
- export interface FhirR6Dosage extends Omit<FhirDosage, "sequence" | "site" | "maxDosePerPeriod" | "maxDosePerAdministration" | "maxDosePerLifetime" | "doseAndRate"> {
745
+ export interface FhirR6Dosage extends Omit<FhirDosage, "sequence" | "_sequence" | "site" | "maxDosePerPeriod" | "maxDosePerAdministration" | "maxDosePerLifetime" | "doseAndRate" | "timing" | "extension" | "modifierExtension" | "_text" | "_asNeeded" | "route" | "method" | "additionalInstruction" | "asNeededFor" | "_patientInstruction"> {
746
+ _text?: FhirR6PrimitiveElement;
747
+ _patientInstruction?: FhirR6PrimitiveElement;
748
+ _asNeeded?: FhirR6PrimitiveElement;
749
+ extension?: FhirR6Extension[];
750
+ modifierExtension?: FhirR6Extension[];
751
+ timing?: FhirR6Timing;
458
752
  condition?: FhirR6DosageCondition[];
459
- site?: FhirCodeableReference;
460
- doseAndRate?: EzDoseAndRate[];
753
+ site?: FhirR6CodeableReference;
754
+ route?: FhirR6CodeableConcept;
755
+ method?: FhirR6CodeableConcept;
756
+ additionalInstruction?: FhirR6CodeableConcept[];
757
+ asNeededFor?: FhirR6CodeableConcept[];
758
+ doseAndRate?: FhirR6DoseAndRate[];
461
759
  safety?: FhirR6DosageSafety;
462
760
  }
463
- export interface FhirR6RelativeTime extends FhirBackboneElement {
464
- contextReference?: {
465
- reference?: string;
466
- };
761
+ export interface FhirR6RelativeTime extends FhirR6BackboneElement {
762
+ contextReference?: FhirR6Reference;
467
763
  contextDefinition?: string;
764
+ _contextDefinition?: FhirR6PrimitiveElement;
468
765
  contextPath?: string;
469
- contextCode?: FhirCodeableConcept;
470
- offsetDuration?: FhirQuantity;
471
- offsetRange?: FhirRange;
766
+ _contextPath?: FhirR6PrimitiveElement;
767
+ contextCode?: FhirR6CodeableConcept;
768
+ offsetDuration?: FhirR6Quantity;
769
+ offsetRange?: FhirR6Range;
472
770
  text?: string;
771
+ _text?: FhirR6PrimitiveElement;
473
772
  }
474
- export interface FhirR6DosageStep extends FhirBackboneElement {
773
+ export interface FhirR6DosageStep extends FhirR6Element {
475
774
  start?: FhirR6RelativeTime;
476
775
  end?: FhirR6RelativeTime;
477
776
  count?: number;
777
+ _count?: FhirR6PrimitiveElement;
478
778
  component: FhirR6Dosage[];
479
779
  safety?: FhirR6DosageSafety;
480
780
  }
481
- /** R6's step/component course representation. */
482
- export interface FhirR6DosageDetails extends FhirBackboneElement {
781
+ /** Official FHIR R6 Snapshot 1 DosageInstruction course container. */
782
+ export interface FhirR6DosageInstruction extends FhirR6BackboneElement {
483
783
  renderedInstruction?: string;
484
- repeatCycle?: FhirQuantity;
485
- step: FhirR6DosageStep[];
784
+ _renderedInstruction?: FhirR6PrimitiveElement;
785
+ repeatCycle?: FhirR6Quantity;
786
+ step?: FhirR6DosageStep[];
486
787
  safety?: FhirR6DosageSafety;
487
788
  }
789
+ /** Current R6 inputs and outputs share the optional 0..* wire shape. */
790
+ export type FhirR6DosageInstructionInput = FhirR6DosageInstruction;
488
791
  export interface FhirDosage extends FhirBackboneElement {
489
792
  /** FHIR R5 ordering: equal sequences are concurrent, increasing sequences are sequential. */
490
793
  sequence?: number;
794
+ _sequence?: FhirPrimitiveElement;
491
795
  text?: string;
796
+ /** Primitive metadata belongs to the authored narrative, not a new dose. */
797
+ _text?: FhirPrimitiveElement;
492
798
  patientInstruction?: string;
799
+ _patientInstruction?: FhirPrimitiveElement;
493
800
  timing?: FhirTiming;
494
801
  route?: FhirCodeableConcept;
495
802
  site?: FhirCodeableConcept;
@@ -497,6 +804,7 @@ export interface FhirDosage extends FhirBackboneElement {
497
804
  additionalInstruction?: FhirCodeableConcept[];
498
805
  /** FHIR R5 spelling. */
499
806
  asNeeded?: boolean;
807
+ _asNeeded?: FhirPrimitiveElement;
500
808
  asNeededFor?: FhirCodeableConcept[];
501
809
  doseAndRate?: FhirDoseAndRate[];
502
810
  maxDosePerPeriod?: FhirRatio[];
@@ -522,19 +830,21 @@ export interface EzDosage extends Omit<FhirDosage, "doseAndRate"> {
522
830
  /**
523
831
  * Small amount of course-level metadata that does not logically belong to an
524
832
  * individual dosage. Each step row addresses the usual R5 Dosage.sequence.
525
- * The fields under step come directly from FHIR R6 DosageDetails.step.
833
+ * Step metadata is retained for editable R5 rows; R6 step is an Element.
526
834
  */
527
- export interface EzCourseStep extends FhirBackboneElement {
835
+ export interface EzCourseStep extends FhirR6BackboneElement {
528
836
  /** R5 global sequence corresponding to this R6 step. */
529
837
  sequence: number;
530
838
  start?: FhirR6RelativeTime;
531
839
  end?: FhirR6RelativeTime;
532
840
  count?: number;
841
+ _count?: FhirR6PrimitiveElement;
533
842
  safety?: FhirR6DosageSafety;
534
843
  }
535
- export interface EzCourseMetadata extends FhirBackboneElement {
844
+ export interface EzCourseMetadata extends FhirR6BackboneElement {
536
845
  renderedInstruction?: string;
537
- repeatCycle?: FhirQuantity;
846
+ _renderedInstruction?: FhirR6PrimitiveElement;
847
+ repeatCycle?: FhirR6Quantity;
538
848
  safety?: FhirR6DosageSafety;
539
849
  step?: EzCourseStep[];
540
850
  }
@@ -616,6 +926,8 @@ export interface BodySiteSpatialRelation {
616
926
  relationCoding?: FhirCoding;
617
927
  targetText?: string;
618
928
  targetCoding?: BodySiteCode;
929
+ /** Complete supplied concept when one selected Coding cannot carry all its data. */
930
+ targetConcept?: FhirR6CodeableConcept;
619
931
  sourceText?: string;
620
932
  }
621
933
  export type BodySiteRestrictionPredicateForm = "state" | "existential" | "raw";
@@ -738,12 +1050,18 @@ export interface InstructionConceptComponent {
738
1050
  role: "head" | "qualifier" | "amount";
739
1051
  text: string;
740
1052
  coding?: FhirCoding;
1053
+ /** Retained wire annotations are source data, never constituent meaning. */
1054
+ sourceId?: string;
1055
+ sourceExtensions?: FhirExtension[];
741
1056
  }
742
1057
  /** A standard-coded constituent of an instruction predicate, not an equivalent
743
1058
  * code for the whole imperative or an unvalidated SNOMED expression. */
744
1059
  export interface InstructionActionSemanticComponent {
745
1060
  role: "activity" | "technique" | "target-state" | "target-site" | "target-object" | "operation" | "orientation" | "mechanism" | "situation";
746
1061
  coding: FhirCoding;
1062
+ /** Retained wire annotations are source data, never constituent meaning. */
1063
+ sourceId?: string;
1064
+ sourceExtensions?: FhirExtension[];
747
1065
  }
748
1066
  export interface AdviceArgument {
749
1067
  role: AdviceArgumentRole;
@@ -751,16 +1069,32 @@ export interface AdviceArgument {
751
1069
  /** Independent typed relation from this action to its argument.
752
1070
  * Permits material WITH and event BEFORE to coexist on one action. */
753
1071
  relation?: AdviceRelation;
1072
+ /** Original relation Coding annotations; the current typed relation owns meaning. */
1073
+ sourceRelationCoding?: FhirCoding;
754
1074
  normalized?: string;
755
1075
  conceptId?: string;
756
1076
  coding?: FhirCoding;
757
1077
  codings?: FhirCoding[];
1078
+ /** Resolved anatomical multiplicity of this Site argument. */
1079
+ administrationTargetCount?: number;
758
1080
  components?: InstructionConceptComponent[];
759
1081
  i18n?: Record<string, string>;
1082
+ /** Original FHIR Element identity of the argument wrapper. */
1083
+ sourceId?: string;
1084
+ /** Imported field annotations and unknown argument children, retained as FHIR data. */
1085
+ sourceExtensions?: FhirExtension[];
760
1086
  quantity?: {
761
1087
  value?: number;
762
1088
  range?: CanonicalDoseRange;
763
1089
  unit?: string;
1090
+ /** Authored qualifier follows this amount through graph matching and FHIR. */
1091
+ comparator?: FhirR6Quantity["comparator"];
1092
+ /** Active primitive metadata follows the current operator through FHIR. */
1093
+ comparatorElement?: FhirR6PrimitiveElement;
1094
+ /** Original wire operator annotations; the current comparator owns meaning. */
1095
+ comparatorExtensions?: FhirR6Extension[];
1096
+ /** Primitive child annotations; current typed values own quantity meaning. */
1097
+ fieldMetadata?: Partial<Record<"value" | "low" | "high" | "unit", Omit<FhirExtension, "url" | "valueDecimal" | "valueString">>>;
764
1098
  };
765
1099
  span?: TextRange;
766
1100
  }
@@ -784,6 +1118,8 @@ export interface AdviceFrame {
784
1118
  semanticComponents?: InstructionActionSemanticComponent[];
785
1119
  };
786
1120
  relation?: AdviceRelation;
1121
+ /** Original relation Coding annotations; the current typed relation owns meaning. */
1122
+ sourceRelationCoding?: FhirCoding;
787
1123
  args: AdviceArgument[];
788
1124
  span: TextRange;
789
1125
  sourceText: string;
@@ -791,6 +1127,10 @@ export interface AdviceFrame {
791
1127
  origin?: "grammar" | "semantic-resolver";
792
1128
  confidence?: number;
793
1129
  coding?: FhirCoding;
1130
+ /** Original FHIR Element identity of the action wrapper. */
1131
+ sourceId?: string;
1132
+ /** Imported action child annotations and unrecognized children, retained as non-executable FHIR data. */
1133
+ sourceExtensions?: FhirExtension[];
794
1134
  }
795
1135
  export interface TextRange {
796
1136
  /** Inclusive start index of the matched substring within the original input. */
@@ -943,6 +1283,8 @@ export interface MedicationInstructionActionContextualSemanticComponentRule {
943
1283
  component: InstructionActionSemanticComponent;
944
1284
  }
945
1285
  export interface MedicationInstructionActionLocaleRealizerConfig {
1286
+ /** Finite affirmative wording when no modal supplies the base verb form. */
1287
+ finiteUnmodalLabel?: string;
946
1288
  fallbackObject?: string;
947
1289
  suppressActivityConcepts?: string[];
948
1290
  suppressSiteConcepts?: string[];
@@ -983,6 +1325,10 @@ export interface MedicationInstructionActionDefinition {
983
1325
  }>;
984
1326
  /** Whether this is a procedural action rather than ordinary administration advice. */
985
1327
  procedural?: boolean;
1328
+ /** Licenses an informational or warning clause without declaring a procedure. */
1329
+ adviceClauseHead?: boolean;
1330
+ /** Force of an unqualified action; explicit directive grammar takes precedence. */
1331
+ defaultForce?: AdviceForce;
986
1332
  /** Declarative argument grammar family used by the instruction graph. */
987
1333
  argumentParser?: MedicationInstructionActionArgumentParser;
988
1334
  /** Declarative realization family used by English/Thai graph generation. */
@@ -1000,6 +1346,9 @@ export interface MedicationInstructionActionDefinition {
1000
1346
  implicitMatchedRole?: AdviceArgumentRole;
1001
1347
  };
1002
1348
  realizerConfig?: MedicationInstructionActionRealizerConfig;
1349
+ /** Typed manner concepts tied to this administration method. An edited
1350
+ * method drops these from its display copy while keeping source evidence. */
1351
+ methodBoundMannerConcepts?: string[];
1003
1352
  continuationLicenses?: Array<{
1004
1353
  candidateAction: string;
1005
1354
  previousConcepts?: string[];
@@ -1176,8 +1525,9 @@ export interface ParseOptions extends FormatOptions {
1176
1525
  */
1177
1526
  instructionConceptMap?: Record<string, MedicationInstructionConceptInput>;
1178
1527
  /**
1179
- * Optional learned/remote semantic proposal providers. They are used only by
1180
- * parseSigAsync(), and only against spans the deterministic parser left opaque.
1528
+ * Optional learned/remote semantic proposal providers. parseSig() accepts
1529
+ * synchronous providers; parseSigAsync() also accepts asynchronous providers.
1530
+ * Both apply proposals only to spans the deterministic parser left opaque.
1181
1531
  * Proposals are validated against registered action/concept/site/unit vocabularies
1182
1532
  * before they can enter the canonical graph.
1183
1533
  */
@@ -1292,9 +1642,24 @@ export interface CanonicalDoseRange {
1292
1642
  high?: number;
1293
1643
  }
1294
1644
  export interface CanonicalDoseExpr {
1645
+ /** Explicitly assumed one discrete dose from caller policy, not source
1646
+ * evidence. Roundtrip source wording can remain unchanged for this case. */
1647
+ defaulted?: boolean;
1648
+ /** Unit at the time the one-dose default was inferred. An edited unit
1649
+ * must not inherit permission to replay amountless source wording. */
1650
+ defaultedUnit?: string;
1651
+ /** The imported R5 row still matches its persisted clinical fingerprint.
1652
+ * Only source-preserving realization consults this fact; canonical
1653
+ * execution ignores it. No source wording is reparsed to infer a dose. */
1654
+ sourceDoseVerified?: boolean;
1295
1655
  value?: number;
1296
1656
  range?: CanonicalDoseRange;
1297
1657
  unit?: string;
1658
+ /** Resolved Quantity unit identity for clinical scope in the compact display
1659
+ * view. The authored unit label and complete native quantity stay unchanged. */
1660
+ unitIdentity?: string;
1661
+ /** Exact authored Quantity comparator; R5 uses the EMA extension, R6 native. */
1662
+ comparator?: FhirR6Quantity["comparator"];
1298
1663
  evidence?: CanonicalEvidence[];
1299
1664
  }
1300
1665
  export interface CanonicalRouteExpr {
@@ -1329,7 +1694,7 @@ export interface CanonicalAdministrationTargetGroup {
1329
1694
  }
1330
1695
  export interface CanonicalMethodExpr {
1331
1696
  text?: string;
1332
- _text?: FhirPrimitiveElement;
1697
+ _text?: FhirR6PrimitiveElement;
1333
1698
  coding?: FhirCoding;
1334
1699
  evidence?: CanonicalEvidence[];
1335
1700
  }
@@ -1342,8 +1707,11 @@ export interface CanonicalOccurrenceCapExpr {
1342
1707
  export interface CanonicalDosePeriodMaximumExpr {
1343
1708
  amount: number;
1344
1709
  unit: string;
1710
+ /** Exact authored Quantity operator, including EMA-coded approximate R5 limits. */
1711
+ amountComparator?: FhirR6Quantity["comparator"];
1345
1712
  period: number;
1346
1713
  periodUnit: FhirPeriodUnit;
1714
+ periodComparator?: FhirR6Quantity["comparator"];
1347
1715
  }
1348
1716
  export interface CanonicalActivityTimingExpr {
1349
1717
  relation: "before" | "after";
@@ -1412,16 +1780,43 @@ export interface CanonicalScheduleExpr {
1412
1780
  /** Source-anaphoric timing (e.g. "at the same times") awaiting a licensed
1413
1781
  * previous regimen daughter. Resolved within HPSG/regimen, never by FHIR. */
1414
1782
  timingReference?: "previous" | "previous-weekday-complement";
1415
- /** Source-relative phase onset, in elapsed days from treatment start. */
1783
+ /** Source-relative phase onset; phaseStartReference selects civil-day
1784
+ * midnight instead of the default clock-preserving treatment start. */
1416
1785
  treatmentStartOffsetDays?: number;
1786
+ /** Local-day origin or preceding-phase completion, never a guessed
1787
+ * count-to-treatment-day conversion. */
1788
+ phaseStartReference?: "previous-phase-next-day" | "previous-phase-end" | "treatment-day-start";
1417
1789
  /** Elapsed delay from each opportunity in this explicitly retained base schedule. */
1418
1790
  administrationOffsetMinutes?: number;
1419
1791
  timingCode?: string;
1792
+ /** Independent authored Timing.code.text, separate from the cadence code. */
1793
+ timingText?: string;
1794
+ /** Label selected from an explicit nonstandard Coding, never a cadence abbreviation. */
1795
+ timingTextIsLiteral?: true;
1420
1796
  count?: number;
1421
1797
  countMax?: number;
1798
+ /** Original occurrence allowance shared only by a partition's anchor daughters.
1799
+ * Existing period caps retain this same owner; a finite total is optional. */
1800
+ sharedCount?: {
1801
+ groupId: string;
1802
+ count?: number;
1803
+ countMax?: number;
1804
+ };
1422
1805
  duration?: number;
1423
1806
  durationMax?: number;
1807
+ /** Preserve an authored duration range even when only one endpoint exists. */
1808
+ durationIsRange?: true;
1424
1809
  durationUnit?: FhirPeriodUnit;
1810
+ /** Unit of the upper duration endpoint when distinct from durationUnit. */
1811
+ durationMaxUnit?: FhirPeriodUnit;
1812
+ /** Authored unit labels are independent of the normalized temporal codes. */
1813
+ durationUnitLabel?: string;
1814
+ durationMaxUnitLabel?: string;
1815
+ /** Typed qualifiers for the beginning/end of the prescribed duration.
1816
+ * They are independent for FHIR boundsRange, and R5 approximation uses
1817
+ * EMA Quantity Operator instead of an unsupported native "~". */
1818
+ durationComparator?: FhirR6Quantity["comparator"];
1819
+ durationMaxComparator?: FhirR6Quantity["comparator"];
1425
1820
  /** Earliest calendar date/time on which this schedule becomes active. */
1426
1821
  boundsStart?: string;
1427
1822
  /** Latest inclusive calendar date/time on which this schedule remains active. */
@@ -1430,6 +1825,10 @@ export interface CanonicalScheduleExpr {
1430
1825
  administrationDuration?: number;
1431
1826
  administrationDurationMax?: number;
1432
1827
  administrationDurationUnit?: FhirPeriodUnit;
1828
+ /** Qualifier on each administration duration, distinct from course length. */
1829
+ administrationDurationComparator?: FhirR6Quantity["comparator"];
1830
+ /** Independently authored occurrence endpoints, distinct from scalar duration. */
1831
+ administrationDurationRange?: import("./canonical/course").CanonicalRange;
1433
1832
  frequency?: number;
1434
1833
  frequencyMax?: number;
1435
1834
  period?: number;
@@ -1457,7 +1856,7 @@ export interface CanonicalScheduleExpr {
1457
1856
  evidence?: CanonicalEvidence[];
1458
1857
  }
1459
1858
  /** Schedule fields explicitly contributed by typed grammar evidence. */
1460
- export type CanonicalScheduleSemanticField = Exclude<keyof CanonicalScheduleExpr, "evidence">;
1859
+ export type CanonicalScheduleSemanticField = Exclude<keyof CanonicalScheduleExpr, "evidence" | "timingTextIsLiteral">;
1461
1860
  export interface CanonicalPrnReasonExpr {
1462
1861
  text?: string;
1463
1862
  i18n?: Record<string, string>;
@@ -1480,6 +1879,11 @@ export interface CanonicalAdditionalInstructionExpr {
1480
1879
  evidence?: CanonicalEvidence[];
1481
1880
  }
1482
1881
  export interface CanonicalInstructionRelation {
1882
+ /** Retained wire annotations are source data, never relationship semantics. */
1883
+ sourceId?: string;
1884
+ sourceExtensions?: FhirExtension[];
1885
+ /** Retained Coding annotations; the current typed kind owns meaning. */
1886
+ sourceKindCoding?: FhirCoding;
1483
1887
  kind: AdviceRelation;
1484
1888
  fromActionIndex?: number;
1485
1889
  toActionIndex: number;
@@ -1487,6 +1891,9 @@ export interface CanonicalInstructionRelation {
1487
1891
  span?: TextRange;
1488
1892
  }
1489
1893
  export interface CanonicalInstructionCoverage {
1894
+ /** Opaque FHIR annotations stay with this coverage record. */
1895
+ sourceId?: string;
1896
+ sourceExtensions?: FhirExtension[];
1490
1897
  understoodCharacters: number;
1491
1898
  opaqueCharacters: number;
1492
1899
  ratio: number;
@@ -1499,15 +1906,35 @@ export interface CanonicalInstructionGraph {
1499
1906
  relations?: CanonicalInstructionRelation[];
1500
1907
  /** Source span of the canonical primary administration head, when known. */
1501
1908
  primaryAdministrationSpan?: TextRange;
1909
+ /** Selected typed source owners, independent of later clinical edits.
1910
+ * Presence is authoritative: an omitted member has no retained graph owner.
1911
+ * Older graphs without this record retain their conservative span fallback. */
1912
+ primaryOwnership?: {
1913
+ administrationActionIndex?: number;
1914
+ dose?: {
1915
+ actionIndex: number;
1916
+ argumentIndex: number;
1917
+ };
1918
+ /** Opaque annotations retained independently of the active source binding. */
1919
+ sourceId?: string;
1920
+ sourceExtensions?: FhirExtension[];
1921
+ };
1502
1922
  /** Source fragments the parser deliberately did not assign semantics to. */
1503
1923
  opaqueSpans?: CanonicalSourceSpan[];
1504
1924
  coverage?: CanonicalInstructionCoverage;
1925
+ /** Original FHIR Element identity of the graph wrapper. */
1926
+ sourceId?: string;
1927
+ /** Unrecognized graph children retained at their original FHIR owner. */
1928
+ sourceExtensions?: FhirExtension[];
1505
1929
  /** Exact original source represented by this graph. */
1506
1930
  sourceText: string;
1507
1931
  /** Source language when it can be determined without guessing. */
1508
1932
  sourceLocale?: string;
1509
1933
  }
1510
1934
  export interface CanonicalSourceSpan extends TextRange {
1935
+ /** Opaque FHIR annotations stay with this source span. */
1936
+ sourceId?: string;
1937
+ sourceExtensions?: FhirExtension[];
1511
1938
  text: string;
1512
1939
  tokenIndices?: number[];
1513
1940
  }
@@ -1541,6 +1968,10 @@ export interface CanonicalClinicalAdjuncts {
1541
1968
  /** Typed nominal reference of a conditional administration instruction.
1542
1969
  * Resolved across related regimen daughters before any FHIR lowering. */
1543
1970
  conditionTarget?: {
1971
+ /** Quantified prohibition binds only to the same existing administration dose. */
1972
+ dose?: CanonicalDoseExpr;
1973
+ /** A named administration site narrows this target independently of its dose. */
1974
+ site?: CanonicalSiteExpr;
1544
1975
  when?: EventTiming[];
1545
1976
  /** Explicit existing clock slots selected by the nominal dose object. */
1546
1977
  timeOfDay?: string[];
@@ -1550,6 +1981,11 @@ export interface CanonicalClinicalAdjuncts {
1550
1981
  endHour: number;
1551
1982
  };
1552
1983
  quantifier?: "all" | "both";
1984
+ /** Coordinated targets retain each independently qualified dose and slot. */
1985
+ members?: NonNullable<CanonicalClinicalAdjuncts["conditionTarget"]>[];
1986
+ /** Calendar restrictions owned by this target, pending regimen binding. */
1987
+ excludedDates?: string[];
1988
+ excludedWeekdays?: FhirDayOfWeek[];
1553
1989
  };
1554
1990
  excludedDates?: string[];
1555
1991
  excludedWeekdays?: FhirDayOfWeek[];
@@ -1558,6 +1994,14 @@ export interface CanonicalClinicalAdjuncts {
1558
1994
  evidence?: CanonicalEvidence[];
1559
1995
  }
1560
1996
  export interface CanonicalSigClause {
1997
+ /** Current dose/timing proof for replaying retained source, including dose-less clauses. */
1998
+ sourceProjectionVerified?: boolean;
1999
+ /** Retained wire-source evidence that this primary's structured schedule owned clocks. */
2000
+ sourceHasStructuredClocks?: boolean;
2001
+ /** Retained wire-source evidence that this primary's structured schedule owned event anchors. */
2002
+ sourceHasStructuredEvents?: boolean;
2003
+ /** Original structured primary site ownership; graph-only sites remain independent facts. */
2004
+ sourceHasStructuredSite?: boolean;
1561
2005
  kind: "administration";
1562
2006
  /** Source-backed phase operation; resolved by the typed regimen graph. */
1563
2007
  regimenAdjustment?: "replace" | "add" | "replace-target";
@@ -1605,6 +2049,9 @@ export interface ParseResult {
1605
2049
  normalized: ParseNormalizedMeta;
1606
2050
  canonical: {
1607
2051
  clauses: CanonicalSigClause[];
2052
+ /** Native clinical meaning, independent of either public FHIR projection. */
2053
+ administration?: import("./canonical/course").CanonicalAdministration;
2054
+ course?: import("./canonical/course").CanonicalCourse;
1608
2055
  };
1609
2056
  siteLookups?: Array<{
1610
2057
  request: SiteCodeLookupRequest;
@@ -1661,7 +2108,7 @@ export interface ParseBatchResult {
1661
2108
  /** Primary output: COMPLETE flat R5-like dosage array with additive R6 fields. */
1662
2109
  fhir: EzDosage[];
1663
2110
  /** Strict R6 snapshot projection of the same prescription. */
1664
- fhirNext: FhirR6DosageDetails;
2111
+ fhirNext: FhirR6DosageInstruction;
1665
2112
  /** Optional R6 step/course metadata not owned by a single dose. */
1666
2113
  course?: EzCourseMetadata;
1667
2114
  shortText: string;
@@ -1673,6 +2120,9 @@ export interface ParseBatchResult {
1673
2120
  normalized: ParseNormalizedMeta;
1674
2121
  canonical: {
1675
2122
  clauses: CanonicalSigClause[];
2123
+ /** Native clinical meaning, independent of either public FHIR projection. */
2124
+ administration?: import("./canonical/course").CanonicalAdministration;
2125
+ course?: import("./canonical/course").CanonicalCourse;
1676
2126
  };
1677
2127
  siteLookups?: Array<{
1678
2128
  request: SiteCodeLookupRequest;
@@ -1754,7 +2204,10 @@ export interface NextDueDoseOptions {
1754
2204
  * Parsing and editing never require a selection; execution and supply do.
1755
2205
  */
1756
2206
  alternativeChoices?: Readonly<Record<string, string>>;
1757
- /** Evaluate structured conditional instructions at each candidate occurrence. Required for conditional scheduling. */
2207
+ /** Evaluate structured conditions at each candidate occurrence. Omission
2208
+ * returns candidate opportunities assuming the conditions hold; these are
2209
+ * not patient-specific confirmed administrations. A supplied evaluator must
2210
+ * return true to admit an occurrence; false/undefined withhold it. */
1758
2211
  evaluateCondition?: MedicationConditionEvaluator;
1759
2212
  orderedAt?: Date | string;
1760
2213
  limit?: number;
@@ -1788,7 +2241,7 @@ export interface TotalUnitsResult {
1788
2241
  totalApproximateIngredientQuantity?: EstimatedQuantity;
1789
2242
  }
1790
2243
  export interface TotalUnitsOptions extends NextDueDoseOptions {
1791
- dosage: FhirDosage | readonly EzDosage[] | FhirR6DosageDetails | ParseBatchResult;
2244
+ dosage: FhirDosage | readonly EzDosage[] | FhirR6DosageInstructionInput | ParseBatchResult;
1792
2245
  /** Required to resolve per-kg administered doses into an actual quantity. */
1793
2246
  patientWeightKg?: number;
1794
2247
  durationValue: number;
@@ -1796,3 +2249,4 @@ export interface TotalUnitsOptions extends NextDueDoseOptions {
1796
2249
  roundToMultiple?: number;
1797
2250
  context?: MedicationContext;
1798
2251
  }
2252
+ export {};