ezmedicationinput 0.1.67 → 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.
- package/README.md +222 -28
- package/dist/adapters/canonical-course.d.ts +128 -0
- package/dist/adapters/r5-course.d.ts +24 -0
- package/dist/advice.d.ts +52 -1
- package/dist/body-site-grammar.d.ts +34 -1
- package/dist/body-site-lookup.d.ts +3 -0
- package/dist/body-site-spatial.d.ts +6 -2
- package/dist/body-site-target.d.ts +9 -3
- package/dist/canonical/compile.d.ts +79 -0
- package/dist/canonical/course.d.ts +352 -0
- package/dist/canonical/format-course.d.ts +36 -0
- package/dist/date-interpretation.d.ts +2 -0
- package/dist/dosage-course.d.ts +453 -0
- package/dist/execution/calendar.d.ts +107 -0
- package/dist/execution/engine.d.ts +11 -0
- package/dist/fhir-quantity-operator.d.ts +53 -0
- package/dist/fhir-translations.d.ts +5 -6
- package/dist/fhir.d.ts +233 -13
- package/dist/format.d.ts +113 -3
- package/dist/hpsg/constructions.d.ts +113 -0
- package/dist/hpsg/defaults.d.ts +2 -0
- package/dist/hpsg/lexical-classes.d.ts +282 -2
- package/dist/hpsg/procedural-context.d.ts +18 -4
- package/dist/hpsg/projection.d.ts +38 -3
- package/dist/hpsg/rule-context.d.ts +117 -7
- package/dist/hpsg/rules/clinical-quantity-rules.d.ts +18 -0
- package/dist/hpsg/rules/condition-rules.d.ts +14 -0
- package/dist/hpsg/rules/core-rules.d.ts +32 -0
- package/dist/hpsg/rules/instruction-rules.d.ts +11 -1
- package/dist/hpsg/rules/prn-rules.d.ts +3 -1
- package/dist/hpsg/rules/timing-rules.d.ts +138 -8
- package/dist/hpsg/signature.d.ts +353 -5
- package/dist/hpsg/type-system.d.ts +16 -1
- package/dist/hpsg/unification.d.ts +4 -1
- package/dist/i18n.d.ts +39 -1
- package/dist/index.cjs +65539 -30893
- package/dist/index.d.ts +35 -7
- package/dist/index.js +65505 -30892
- package/dist/instruction-action-locale-adapter.d.ts +32 -3
- package/dist/instruction-action-terminology.d.ts +38 -3
- package/dist/instruction-concept-terminology.d.ts +8 -1
- package/dist/instruction-graph-fhir.d.ts +9 -3
- package/dist/instruction-graph.d.ts +85 -7
- package/dist/ir.d.ts +13 -2
- package/dist/lexer/surface-segmenter.d.ts +1 -1
- package/dist/lexer/surface.d.ts +1 -0
- package/dist/locale-detection.d.ts +3 -0
- package/dist/locales/course/en.d.ts +15 -0
- package/dist/locales/course/th.d.ts +12 -0
- package/dist/localization.d.ts +73 -0
- package/dist/maps.d.ts +24 -1
- package/dist/medication-condition.d.ts +42 -0
- package/dist/parser-state.d.ts +6 -2
- package/dist/parser.d.ts +5 -2
- package/dist/regimen/coordination-scope.d.ts +53 -0
- package/dist/regimen/grammar.d.ts +79 -0
- package/dist/regimen/parallel-course.d.ts +52 -0
- package/dist/regimen/planner.d.ts +19 -0
- package/dist/regimen/regimen.d.ts +70 -0
- package/dist/relation-terminology.d.ts +1 -0
- package/dist/schedule.d.ts +12 -5
- package/dist/stable-structure.d.ts +23 -1
- package/dist/timing-summary.d.ts +82 -1
- package/dist/types.d.ts +899 -40
- package/dist/unit-lexicon.d.ts +7 -0
- package/dist/utils/strength.d.ts +16 -0
- package/dist/utils/text.d.ts +3 -0
- package/dist/utils/units.d.ts +19 -0
- package/package.json +3 -2
package/dist/types.d.ts
CHANGED
|
@@ -1,29 +1,99 @@
|
|
|
1
1
|
import type { SigTranslationConfig } from "./i18n";
|
|
2
2
|
export interface FhirCoding {
|
|
3
|
+
id?: string;
|
|
3
4
|
system?: string;
|
|
5
|
+
_system?: FhirPrimitiveElement;
|
|
6
|
+
/** Terminology edition used to define this code. */
|
|
7
|
+
version?: string;
|
|
8
|
+
_version?: FhirPrimitiveElement;
|
|
4
9
|
code?: string;
|
|
10
|
+
_code?: FhirPrimitiveElement;
|
|
5
11
|
display?: string;
|
|
12
|
+
userSelected?: boolean;
|
|
13
|
+
_userSelected?: FhirPrimitiveElement;
|
|
6
14
|
extension?: FhirExtension[];
|
|
7
15
|
_display?: FhirPrimitiveElement;
|
|
8
16
|
i18n?: Record<string, string>;
|
|
9
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
|
+
}
|
|
10
25
|
export interface FhirCodeableConcept {
|
|
26
|
+
id?: string;
|
|
11
27
|
coding?: FhirCoding[];
|
|
12
28
|
text?: string;
|
|
13
29
|
extension?: FhirExtension[];
|
|
14
30
|
_text?: FhirPrimitiveElement;
|
|
15
31
|
}
|
|
32
|
+
export interface FhirR6CodeableConcept extends Omit<FhirCodeableConcept, "extension" | "coding" | "_text">, FhirR6Element {
|
|
33
|
+
coding?: FhirR6Coding[];
|
|
34
|
+
_text?: FhirR6PrimitiveElement;
|
|
35
|
+
}
|
|
16
36
|
export interface FhirExtension {
|
|
37
|
+
id?: string;
|
|
17
38
|
url: string;
|
|
18
39
|
extension?: FhirExtension[];
|
|
19
40
|
valueCode?: string;
|
|
41
|
+
_valueCode?: FhirPrimitiveElement;
|
|
20
42
|
valueString?: string;
|
|
43
|
+
_valueString?: FhirPrimitiveElement;
|
|
44
|
+
valueMarkdown?: string;
|
|
45
|
+
_valueMarkdown?: FhirPrimitiveElement;
|
|
46
|
+
valueDate?: string;
|
|
21
47
|
valueBoolean?: boolean;
|
|
48
|
+
_valueBoolean?: FhirPrimitiveElement;
|
|
22
49
|
valueInteger?: number;
|
|
50
|
+
_valueInteger?: FhirPrimitiveElement;
|
|
23
51
|
valueDecimal?: number;
|
|
52
|
+
_valueDecimal?: FhirPrimitiveElement;
|
|
24
53
|
valueQuantity?: FhirQuantity;
|
|
25
54
|
valueCoding?: FhirCoding;
|
|
26
55
|
valueCodeableConcept?: FhirCodeableConcept;
|
|
56
|
+
valueUri?: string;
|
|
57
|
+
valueCanonical?: string;
|
|
58
|
+
valueDateTime?: string;
|
|
59
|
+
valueTime?: string;
|
|
60
|
+
_valueTime?: FhirPrimitiveElement;
|
|
61
|
+
valuePositiveInt?: number;
|
|
62
|
+
valueUnsignedInt?: number;
|
|
63
|
+
valueRange?: FhirRange;
|
|
64
|
+
valueRatio?: FhirRatio;
|
|
65
|
+
valuePeriod?: FhirPeriod;
|
|
66
|
+
valueExpression?: FhirExpression;
|
|
67
|
+
valueReference?: NonNullable<FhirCodeableReference["reference"]>;
|
|
68
|
+
valueCodeableReference?: FhirCodeableReference;
|
|
69
|
+
valueTiming?: FhirTiming;
|
|
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[];
|
|
27
97
|
}
|
|
28
98
|
export interface FhirElement {
|
|
29
99
|
id?: string;
|
|
@@ -32,14 +102,23 @@ export interface FhirElement {
|
|
|
32
102
|
export interface FhirBackboneElement extends FhirElement {
|
|
33
103
|
modifierExtension?: FhirExtension[];
|
|
34
104
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
export
|
|
105
|
+
/** FHIR primitive metadata can carry both Element.id and extensions. */
|
|
106
|
+
export type FhirPrimitiveElement = FhirElement;
|
|
107
|
+
/** R6 primitive companions carry the same R6 Extension choices as their owner. */
|
|
108
|
+
export type FhirR6PrimitiveElement = FhirR6Element;
|
|
109
|
+
export interface FhirQuantity extends FhirElement {
|
|
39
110
|
value?: number;
|
|
111
|
+
/** FHIR R5 Quantity comparator. 'ad' was added in R5. */
|
|
112
|
+
comparator?: "<" | "<=" | ">=" | ">" | "ad";
|
|
113
|
+
_comparator?: FhirPrimitiveElement;
|
|
40
114
|
unit?: string;
|
|
41
115
|
system?: string;
|
|
42
116
|
code?: string;
|
|
117
|
+
/** Primitive Element metadata is valid on every FHIR Quantity specialization. */
|
|
118
|
+
_value?: FhirPrimitiveElement;
|
|
119
|
+
_unit?: FhirPrimitiveElement;
|
|
120
|
+
_system?: FhirPrimitiveElement;
|
|
121
|
+
_code?: FhirPrimitiveElement;
|
|
43
122
|
}
|
|
44
123
|
export type DoseUnitKind = "metric" | "biologic_unit" | "counted_presentation" | "device_actuation" | "infusion_rate" | "product_specific_amount" | "length_of_product" | "body_area_proxy" | "qualitative_amount";
|
|
45
124
|
export type DoseUnitApproximationConfidence = "exact" | "approximate" | "product_specific";
|
|
@@ -73,13 +152,40 @@ export interface EstimatedQuantity extends FhirQuantity {
|
|
|
73
152
|
basis?: string;
|
|
74
153
|
source?: string;
|
|
75
154
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
155
|
+
/** FHIR SimpleQuantity: Quantity with the comparator constrained to absent. */
|
|
156
|
+
export type FhirSimpleQuantity = Omit<FhirQuantity, "comparator" | "_comparator"> & {
|
|
157
|
+
comparator?: never;
|
|
158
|
+
_comparator?: never;
|
|
159
|
+
};
|
|
160
|
+
/** FHIR R6 also supports the approximate (~) comparator in general Quantity. */
|
|
161
|
+
export type FhirR6Quantity = Omit<FhirQuantity, "extension" | "comparator" | "_comparator" | "_value" | "_unit" | "_system" | "_code"> & FhirR6Element & {
|
|
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;
|
|
172
|
+
};
|
|
173
|
+
export interface FhirRange extends FhirElement {
|
|
174
|
+
low?: FhirSimpleQuantity;
|
|
175
|
+
high?: FhirSimpleQuantity;
|
|
176
|
+
}
|
|
177
|
+
export interface FhirR6Range extends FhirR6Element {
|
|
178
|
+
low?: FhirR6SimpleQuantity;
|
|
179
|
+
high?: FhirR6SimpleQuantity;
|
|
180
|
+
}
|
|
181
|
+
export interface FhirRatio extends FhirElement {
|
|
81
182
|
numerator?: FhirQuantity;
|
|
82
|
-
denominator?:
|
|
183
|
+
denominator?: FhirSimpleQuantity;
|
|
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;
|
|
83
189
|
}
|
|
84
190
|
/**
|
|
85
191
|
* Follows https://build.fhir.org/valueset-event-timing.html
|
|
@@ -301,57 +407,446 @@ export declare enum FhirDayOfWeek {
|
|
|
301
407
|
Saturday = "sat",
|
|
302
408
|
Sunday = "sun"
|
|
303
409
|
}
|
|
304
|
-
export interface FhirPeriod {
|
|
410
|
+
export interface FhirPeriod extends FhirElement {
|
|
305
411
|
start?: string;
|
|
412
|
+
_start?: FhirPrimitiveElement;
|
|
306
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;
|
|
307
420
|
}
|
|
308
421
|
export interface FhirTimingRepeat extends FhirElement {
|
|
309
422
|
count?: number;
|
|
423
|
+
/** Primitive metadata may represent an unspecified lower count without inventing a value. */
|
|
424
|
+
_count?: FhirPrimitiveElement;
|
|
310
425
|
countMax?: number;
|
|
426
|
+
_countMax?: FhirPrimitiveElement;
|
|
311
427
|
boundsDuration?: FhirQuantity;
|
|
312
428
|
boundsPeriod?: FhirPeriod;
|
|
313
429
|
boundsRange?: FhirRange;
|
|
314
430
|
frequency?: number;
|
|
431
|
+
_frequency?: FhirPrimitiveElement;
|
|
315
432
|
frequencyMax?: number;
|
|
433
|
+
_frequencyMax?: FhirPrimitiveElement;
|
|
316
434
|
/** Duration of each administration occurrence. */
|
|
317
435
|
duration?: number;
|
|
436
|
+
/** Primitive annotation for a stated or unspecified lower duration. */
|
|
437
|
+
_duration?: FhirPrimitiveElement;
|
|
318
438
|
durationMax?: number;
|
|
439
|
+
_durationMax?: FhirPrimitiveElement;
|
|
319
440
|
durationUnit?: FhirPeriodUnit;
|
|
441
|
+
_durationUnit?: FhirPrimitiveElement;
|
|
320
442
|
period?: number;
|
|
443
|
+
/** Primitive annotation for a stated or unspecified lower period. */
|
|
444
|
+
_period?: FhirPrimitiveElement;
|
|
321
445
|
periodMax?: number;
|
|
446
|
+
_periodMax?: FhirPrimitiveElement;
|
|
322
447
|
periodUnit?: FhirPeriodUnit;
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
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>;
|
|
326
458
|
/** Exact event offset in minutes. */
|
|
327
459
|
offset?: number;
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
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>;
|
|
333
495
|
repeat?: FhirTimingRepeat;
|
|
334
496
|
code?: FhirCodeableConcept;
|
|
335
497
|
}
|
|
498
|
+
/** FHIR Expression: enough structure to preserve external R6 dose/rate expressions. */
|
|
499
|
+
export interface FhirExpression extends FhirElement {
|
|
500
|
+
description?: string;
|
|
501
|
+
_description?: FhirPrimitiveElement;
|
|
502
|
+
name?: string;
|
|
503
|
+
_name?: FhirPrimitiveElement;
|
|
504
|
+
/** FHIR R5/R6 Expression.language is optional (0..1). */
|
|
505
|
+
language?: string;
|
|
506
|
+
_language?: FhirPrimitiveElement;
|
|
507
|
+
expression?: string;
|
|
508
|
+
_expression?: FhirPrimitiveElement;
|
|
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;
|
|
518
|
+
}
|
|
336
519
|
export interface FhirDoseAndRate extends FhirBackboneElement {
|
|
337
520
|
type?: FhirCodeableConcept;
|
|
338
521
|
doseRange?: FhirRange;
|
|
339
|
-
doseQuantity?:
|
|
522
|
+
doseQuantity?: FhirSimpleQuantity;
|
|
340
523
|
rateRatio?: FhirRatio;
|
|
341
524
|
rateRange?: FhirRange;
|
|
342
|
-
rateQuantity?:
|
|
525
|
+
rateQuantity?: FhirSimpleQuantity;
|
|
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
|
+
};
|
|
541
|
+
/** R6 additions to the R5 DoseAndRate child object. */
|
|
542
|
+
export interface EzDoseAndRate extends FhirDoseAndRate {
|
|
543
|
+
doseExpression?: FhirExpression;
|
|
544
|
+
rateExpression?: FhirExpression;
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* The meaning of a condition is independent of its wording.
|
|
548
|
+
* all/any/not are explicit: FHIR R6 condition[] alone is OR, not AND.
|
|
549
|
+
* Free-text predicates remain representable but need a caller evaluator.
|
|
550
|
+
*/
|
|
551
|
+
export type MedicationCondition = {
|
|
552
|
+
kind: "measurement";
|
|
553
|
+
name: string;
|
|
554
|
+
operation: "gt" | "ge" | "lt" | "le" | "eq" | "ne";
|
|
555
|
+
value: number;
|
|
556
|
+
unit?: string;
|
|
557
|
+
text: string;
|
|
558
|
+
} | {
|
|
559
|
+
kind: "state";
|
|
560
|
+
name: string;
|
|
561
|
+
text: string;
|
|
562
|
+
expected: boolean;
|
|
563
|
+
} | {
|
|
564
|
+
kind: "text";
|
|
565
|
+
text: string;
|
|
566
|
+
} | {
|
|
567
|
+
kind: "not";
|
|
568
|
+
condition: MedicationCondition;
|
|
569
|
+
} | {
|
|
570
|
+
kind: "all" | "any";
|
|
571
|
+
conditions: MedicationCondition[];
|
|
572
|
+
};
|
|
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;
|
|
579
|
+
valueBoolean?: boolean;
|
|
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;
|
|
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;
|
|
662
|
+
text?: string;
|
|
663
|
+
_text?: FhirR6PrimitiveElement;
|
|
664
|
+
} & DosageConditionValue;
|
|
665
|
+
/** FHIR R6 DosageSafety.doseLimit.value[x] is a required choice. */
|
|
666
|
+
export type FhirR6DoseLimit = FhirR6Element & {
|
|
667
|
+
scope: "dosage" | "period" | "administration" | "lifetime";
|
|
668
|
+
_scope?: FhirR6PrimitiveElement;
|
|
669
|
+
period?: FhirR6Quantity;
|
|
670
|
+
text?: string;
|
|
671
|
+
_text?: FhirR6PrimitiveElement;
|
|
672
|
+
} & ({
|
|
673
|
+
valueQuantity: FhirR6Quantity;
|
|
674
|
+
valueInteger?: never;
|
|
675
|
+
_valueInteger?: never;
|
|
676
|
+
valueExpression?: never;
|
|
677
|
+
} | {
|
|
678
|
+
valueInteger: number;
|
|
679
|
+
_valueInteger?: FhirR6PrimitiveElement;
|
|
680
|
+
valueQuantity?: never;
|
|
681
|
+
valueExpression?: never;
|
|
682
|
+
} | {
|
|
683
|
+
_valueInteger: FhirR6PrimitiveElement;
|
|
684
|
+
valueInteger?: never;
|
|
685
|
+
valueQuantity?: never;
|
|
686
|
+
valueExpression?: never;
|
|
687
|
+
} | {
|
|
688
|
+
valueExpression: FhirR6Expression;
|
|
689
|
+
valueQuantity?: never;
|
|
690
|
+
valueInteger?: never;
|
|
691
|
+
_valueInteger?: never;
|
|
692
|
+
});
|
|
693
|
+
export interface FhirR6DosageSafety extends FhirR6BackboneElement {
|
|
694
|
+
doseLimit?: FhirR6DoseLimit[];
|
|
695
|
+
ifExceeded?: string;
|
|
696
|
+
_ifExceeded?: FhirR6PrimitiveElement;
|
|
697
|
+
}
|
|
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;
|
|
716
|
+
};
|
|
717
|
+
display?: string;
|
|
718
|
+
_display?: FhirPrimitiveElement;
|
|
343
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;
|
|
743
|
+
}
|
|
744
|
+
/** FHIR R6 draft Dosage: no R5 sequence/legacy maxima/PRN alias. */
|
|
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;
|
|
752
|
+
condition?: FhirR6DosageCondition[];
|
|
753
|
+
site?: FhirR6CodeableReference;
|
|
754
|
+
route?: FhirR6CodeableConcept;
|
|
755
|
+
method?: FhirR6CodeableConcept;
|
|
756
|
+
additionalInstruction?: FhirR6CodeableConcept[];
|
|
757
|
+
asNeededFor?: FhirR6CodeableConcept[];
|
|
758
|
+
doseAndRate?: FhirR6DoseAndRate[];
|
|
759
|
+
safety?: FhirR6DosageSafety;
|
|
760
|
+
}
|
|
761
|
+
export interface FhirR6RelativeTime extends FhirR6BackboneElement {
|
|
762
|
+
contextReference?: FhirR6Reference;
|
|
763
|
+
contextDefinition?: string;
|
|
764
|
+
_contextDefinition?: FhirR6PrimitiveElement;
|
|
765
|
+
contextPath?: string;
|
|
766
|
+
_contextPath?: FhirR6PrimitiveElement;
|
|
767
|
+
contextCode?: FhirR6CodeableConcept;
|
|
768
|
+
offsetDuration?: FhirR6Quantity;
|
|
769
|
+
offsetRange?: FhirR6Range;
|
|
770
|
+
text?: string;
|
|
771
|
+
_text?: FhirR6PrimitiveElement;
|
|
772
|
+
}
|
|
773
|
+
export interface FhirR6DosageStep extends FhirR6Element {
|
|
774
|
+
start?: FhirR6RelativeTime;
|
|
775
|
+
end?: FhirR6RelativeTime;
|
|
776
|
+
count?: number;
|
|
777
|
+
_count?: FhirR6PrimitiveElement;
|
|
778
|
+
component: FhirR6Dosage[];
|
|
779
|
+
safety?: FhirR6DosageSafety;
|
|
780
|
+
}
|
|
781
|
+
/** Official FHIR R6 Snapshot 1 DosageInstruction course container. */
|
|
782
|
+
export interface FhirR6DosageInstruction extends FhirR6BackboneElement {
|
|
783
|
+
renderedInstruction?: string;
|
|
784
|
+
_renderedInstruction?: FhirR6PrimitiveElement;
|
|
785
|
+
repeatCycle?: FhirR6Quantity;
|
|
786
|
+
step?: FhirR6DosageStep[];
|
|
787
|
+
safety?: FhirR6DosageSafety;
|
|
788
|
+
}
|
|
789
|
+
/** Current R6 inputs and outputs share the optional 0..* wire shape. */
|
|
790
|
+
export type FhirR6DosageInstructionInput = FhirR6DosageInstruction;
|
|
344
791
|
export interface FhirDosage extends FhirBackboneElement {
|
|
792
|
+
/** FHIR R5 ordering: equal sequences are concurrent, increasing sequences are sequential. */
|
|
793
|
+
sequence?: number;
|
|
794
|
+
_sequence?: FhirPrimitiveElement;
|
|
345
795
|
text?: string;
|
|
796
|
+
/** Primitive metadata belongs to the authored narrative, not a new dose. */
|
|
797
|
+
_text?: FhirPrimitiveElement;
|
|
346
798
|
patientInstruction?: string;
|
|
799
|
+
_patientInstruction?: FhirPrimitiveElement;
|
|
347
800
|
timing?: FhirTiming;
|
|
348
801
|
route?: FhirCodeableConcept;
|
|
349
802
|
site?: FhirCodeableConcept;
|
|
350
803
|
method?: FhirCodeableConcept;
|
|
351
804
|
additionalInstruction?: FhirCodeableConcept[];
|
|
352
|
-
|
|
805
|
+
/** FHIR R5 spelling. */
|
|
806
|
+
asNeeded?: boolean;
|
|
807
|
+
_asNeeded?: FhirPrimitiveElement;
|
|
353
808
|
asNeededFor?: FhirCodeableConcept[];
|
|
354
809
|
doseAndRate?: FhirDoseAndRate[];
|
|
810
|
+
maxDosePerPeriod?: FhirRatio[];
|
|
811
|
+
maxDosePerAdministration?: FhirSimpleQuantity;
|
|
812
|
+
maxDosePerLifetime?: FhirSimpleQuantity;
|
|
813
|
+
}
|
|
814
|
+
/**
|
|
815
|
+
* EZMED's primary dose object. Retains the useful FHIR R5 Dosage shape and
|
|
816
|
+
* lifts a small number of actual R6 features into optional typed fields.
|
|
817
|
+
* This is NOT strict FHIR R5 JSON: call toFhirR5Dosages() for wire export.
|
|
818
|
+
*/
|
|
819
|
+
export interface EzDosage extends Omit<FhirDosage, "doseAndRate"> {
|
|
820
|
+
doseAndRate?: EzDoseAndRate[];
|
|
821
|
+
/** FHIR R6 Dosage.condition, including compound conditions when needed. */
|
|
822
|
+
condition?: FhirR6DosageCondition[];
|
|
823
|
+
/** FHIR R6 Dosage.safety, alongside the R5 maximum fields. */
|
|
824
|
+
safety?: FhirR6DosageSafety;
|
|
825
|
+
/** FHIR R6 Dosage.site.reference, while site remains R5 CodeableConcept. */
|
|
826
|
+
siteReference?: FhirCodeableReference["reference"];
|
|
827
|
+
/** EZMED-specific dates omitted from a repeating schedule; not an HL7 core field. */
|
|
828
|
+
excludedDates?: string[];
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* Small amount of course-level metadata that does not logically belong to an
|
|
832
|
+
* individual dosage. Each step row addresses the usual R5 Dosage.sequence.
|
|
833
|
+
* Step metadata is retained for editable R5 rows; R6 step is an Element.
|
|
834
|
+
*/
|
|
835
|
+
export interface EzCourseStep extends FhirR6BackboneElement {
|
|
836
|
+
/** R5 global sequence corresponding to this R6 step. */
|
|
837
|
+
sequence: number;
|
|
838
|
+
start?: FhirR6RelativeTime;
|
|
839
|
+
end?: FhirR6RelativeTime;
|
|
840
|
+
count?: number;
|
|
841
|
+
_count?: FhirR6PrimitiveElement;
|
|
842
|
+
safety?: FhirR6DosageSafety;
|
|
843
|
+
}
|
|
844
|
+
export interface EzCourseMetadata extends FhirR6BackboneElement {
|
|
845
|
+
renderedInstruction?: string;
|
|
846
|
+
_renderedInstruction?: FhirR6PrimitiveElement;
|
|
847
|
+
repeatCycle?: FhirR6Quantity;
|
|
848
|
+
safety?: FhirR6DosageSafety;
|
|
849
|
+
step?: EzCourseStep[];
|
|
355
850
|
}
|
|
356
851
|
export type RouteCode = SNOMEDCTRouteCodes;
|
|
357
852
|
export declare const RouteCode: typeof SNOMEDCTRouteCodes;
|
|
@@ -366,7 +861,8 @@ export interface MedicationContext {
|
|
|
366
861
|
/** "Simple" strength string; might be the only way strength is provided
|
|
367
862
|
* for discrete units this is the amount of medication for unit e.g. "500 mg" (1 tablet), or for mixed tablets might be like "400 mg + 80 mg"
|
|
368
863
|
* for things like creams or fluids or syrupsit might be "2%", 5 g/100g, 100mg/ 100 g, 262 mg/15 mL, 200 mg/2 mL, 1 mg/dL, or "400 mg/5mL + 80 mg/5mL"
|
|
369
|
-
*
|
|
864
|
+
* For combination products, individual ingredient strengths must remain
|
|
865
|
+
* separate; never sum the parts into one strengthQuantity/strengthRatio.
|
|
370
866
|
*/
|
|
371
867
|
strength?: string;
|
|
372
868
|
strengthQuantity?: FhirQuantity;
|
|
@@ -430,13 +926,39 @@ export interface BodySiteSpatialRelation {
|
|
|
430
926
|
relationCoding?: FhirCoding;
|
|
431
927
|
targetText?: string;
|
|
432
928
|
targetCoding?: BodySiteCode;
|
|
929
|
+
/** Complete supplied concept when one selected Coding cannot carry all its data. */
|
|
930
|
+
targetConcept?: FhirR6CodeableConcept;
|
|
433
931
|
sourceText?: string;
|
|
434
932
|
}
|
|
933
|
+
export type BodySiteRestrictionPredicateForm = "state" | "existential" | "raw";
|
|
934
|
+
/**
|
|
935
|
+
* A source-backed predicate that narrows an administration site. It is not a
|
|
936
|
+
* diagnosis or a regimen-wide execution condition.
|
|
937
|
+
*/
|
|
938
|
+
export interface BodySiteRestrictionPredicate {
|
|
939
|
+
text: string;
|
|
940
|
+
lemma?: string;
|
|
941
|
+
form: BodySiteRestrictionPredicateForm;
|
|
942
|
+
/** Predicate payload after a declarative introducer such as "there is". */
|
|
943
|
+
focusText?: string;
|
|
944
|
+
range?: TextRange;
|
|
945
|
+
}
|
|
946
|
+
/** A restrictive relative clause attached locally to a body-site sign. */
|
|
947
|
+
export interface BodySiteRestriction {
|
|
948
|
+
relation: "where";
|
|
949
|
+
sourceText: string;
|
|
950
|
+
range?: TextRange;
|
|
951
|
+
markerRange?: TextRange;
|
|
952
|
+
predicate: BodySiteRestrictionPredicate;
|
|
953
|
+
}
|
|
435
954
|
export interface BodySiteDefinition {
|
|
436
955
|
coding?: BodySiteCode;
|
|
437
956
|
text?: string;
|
|
438
957
|
spatialRelation?: BodySiteSpatialRelation;
|
|
439
958
|
routeHint?: RouteCode;
|
|
959
|
+
/** Only applies when a typed locative places medication INSIDE this site;
|
|
960
|
+
* external skin administration retains the product/administration route. */
|
|
961
|
+
internalRouteHint?: RouteCode;
|
|
440
962
|
administrationTargetCount?: number;
|
|
441
963
|
/** Optional surface used when the dose applies independently to each target. */
|
|
442
964
|
perTargetText?: string;
|
|
@@ -523,24 +1045,64 @@ export declare enum AdviceArgumentRole {
|
|
|
523
1045
|
Time = "time",
|
|
524
1046
|
Free = "free"
|
|
525
1047
|
}
|
|
1048
|
+
/** A constituent of a compound meaning, not an alternative coding of that whole meaning. */
|
|
1049
|
+
export interface InstructionConceptComponent {
|
|
1050
|
+
role: "head" | "qualifier" | "amount";
|
|
1051
|
+
text: string;
|
|
1052
|
+
coding?: FhirCoding;
|
|
1053
|
+
/** Retained wire annotations are source data, never constituent meaning. */
|
|
1054
|
+
sourceId?: string;
|
|
1055
|
+
sourceExtensions?: FhirExtension[];
|
|
1056
|
+
}
|
|
1057
|
+
/** A standard-coded constituent of an instruction predicate, not an equivalent
|
|
1058
|
+
* code for the whole imperative or an unvalidated SNOMED expression. */
|
|
1059
|
+
export interface InstructionActionSemanticComponent {
|
|
1060
|
+
role: "activity" | "technique" | "target-state" | "target-site" | "target-object" | "operation" | "orientation" | "mechanism" | "situation";
|
|
1061
|
+
coding: FhirCoding;
|
|
1062
|
+
/** Retained wire annotations are source data, never constituent meaning. */
|
|
1063
|
+
sourceId?: string;
|
|
1064
|
+
sourceExtensions?: FhirExtension[];
|
|
1065
|
+
}
|
|
526
1066
|
export interface AdviceArgument {
|
|
527
1067
|
role: AdviceArgumentRole;
|
|
528
1068
|
text: string;
|
|
1069
|
+
/** Independent typed relation from this action to its argument.
|
|
1070
|
+
* Permits material WITH and event BEFORE to coexist on one action. */
|
|
1071
|
+
relation?: AdviceRelation;
|
|
1072
|
+
/** Original relation Coding annotations; the current typed relation owns meaning. */
|
|
1073
|
+
sourceRelationCoding?: FhirCoding;
|
|
529
1074
|
normalized?: string;
|
|
530
1075
|
conceptId?: string;
|
|
531
1076
|
coding?: FhirCoding;
|
|
532
1077
|
codings?: FhirCoding[];
|
|
1078
|
+
/** Resolved anatomical multiplicity of this Site argument. */
|
|
1079
|
+
administrationTargetCount?: number;
|
|
1080
|
+
components?: InstructionConceptComponent[];
|
|
533
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[];
|
|
534
1086
|
quantity?: {
|
|
535
1087
|
value?: number;
|
|
536
1088
|
range?: CanonicalDoseRange;
|
|
537
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">>>;
|
|
538
1098
|
};
|
|
539
1099
|
span?: TextRange;
|
|
540
1100
|
}
|
|
541
1101
|
export interface AdviceFrame {
|
|
542
1102
|
force: AdviceForce;
|
|
543
1103
|
polarity?: AdvicePolarity;
|
|
1104
|
+
/** Shared directive scope may differ from this action's own source wording. */
|
|
1105
|
+
polaritySource?: "shared";
|
|
544
1106
|
modality?: AdviceModality;
|
|
545
1107
|
predicate: {
|
|
546
1108
|
lemma: string;
|
|
@@ -552,8 +1114,12 @@ export interface AdviceFrame {
|
|
|
552
1114
|
realizerConfig?: MedicationInstructionActionRealizerConfig;
|
|
553
1115
|
/** Internal/custom action coding followed by any trustworthy external mappings. */
|
|
554
1116
|
codings?: FhirCoding[];
|
|
1117
|
+
/** Independently coded constituents, not alternative predicate Codings. */
|
|
1118
|
+
semanticComponents?: InstructionActionSemanticComponent[];
|
|
555
1119
|
};
|
|
556
1120
|
relation?: AdviceRelation;
|
|
1121
|
+
/** Original relation Coding annotations; the current typed relation owns meaning. */
|
|
1122
|
+
sourceRelationCoding?: FhirCoding;
|
|
557
1123
|
args: AdviceArgument[];
|
|
558
1124
|
span: TextRange;
|
|
559
1125
|
sourceText: string;
|
|
@@ -561,6 +1127,10 @@ export interface AdviceFrame {
|
|
|
561
1127
|
origin?: "grammar" | "semantic-resolver";
|
|
562
1128
|
confidence?: number;
|
|
563
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[];
|
|
564
1134
|
}
|
|
565
1135
|
export interface TextRange {
|
|
566
1136
|
/** Inclusive start index of the matched substring within the original input. */
|
|
@@ -706,7 +1276,15 @@ export interface MedicationInstructionActionContextualCodingRule {
|
|
|
706
1276
|
};
|
|
707
1277
|
coding: FhirCoding;
|
|
708
1278
|
}
|
|
1279
|
+
/** Bind independently coded parts to a typed semantic argument rather than
|
|
1280
|
+
* to an ambiguous bare verb. Reuses existing contextual coding match semantics. */
|
|
1281
|
+
export interface MedicationInstructionActionContextualSemanticComponentRule {
|
|
1282
|
+
whenArgument: MedicationInstructionActionContextualCodingRule["whenArgument"];
|
|
1283
|
+
component: InstructionActionSemanticComponent;
|
|
1284
|
+
}
|
|
709
1285
|
export interface MedicationInstructionActionLocaleRealizerConfig {
|
|
1286
|
+
/** Finite affirmative wording when no modal supplies the base verb form. */
|
|
1287
|
+
finiteUnmodalLabel?: string;
|
|
710
1288
|
fallbackObject?: string;
|
|
711
1289
|
suppressActivityConcepts?: string[];
|
|
712
1290
|
suppressSiteConcepts?: string[];
|
|
@@ -734,6 +1312,8 @@ export interface MedicationInstructionActionDefinition {
|
|
|
734
1312
|
roundtripI18n?: Record<string, string>;
|
|
735
1313
|
/** Surface forms that should resolve to this action. */
|
|
736
1314
|
aliases?: string[];
|
|
1315
|
+
/** Ambiguous aliases licensed only at a directive boundary or after an explicit directive. */
|
|
1316
|
+
directiveOnlyAliases?: string[];
|
|
737
1317
|
/** Surface forms licensed only when immediately sequence-scoped (e.g. `then off`). */
|
|
738
1318
|
sequenceAliases?: string[];
|
|
739
1319
|
/** Locale-specific parser lexemes. Display translation belongs in `i18n`; parsing aliases are explicit. */
|
|
@@ -745,17 +1325,30 @@ export interface MedicationInstructionActionDefinition {
|
|
|
745
1325
|
}>;
|
|
746
1326
|
/** Whether this is a procedural action rather than ordinary administration advice. */
|
|
747
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;
|
|
748
1332
|
/** Declarative argument grammar family used by the instruction graph. */
|
|
749
1333
|
argumentParser?: MedicationInstructionActionArgumentParser;
|
|
750
1334
|
/** Declarative realization family used by English/Thai graph generation. */
|
|
751
1335
|
realizer?: MedicationInstructionActionRealizer;
|
|
752
1336
|
argumentParserConfig?: {
|
|
1337
|
+
/** Polarity that licenses this lexical frame as a directive rather than an event predicate. */
|
|
1338
|
+
requiredDirectivePolarity?: AdvicePolarity;
|
|
1339
|
+
/** Semantic effect of an affirmative conditional action on its medication-dose complement.
|
|
1340
|
+
* The selected-dose form requires an explicit medication object or a typed dose-slot target;
|
|
1341
|
+
* it never treats a bare avoidance verb, food object, or negation as withholding. */
|
|
1342
|
+
medicationConditionEffect?: "withhold" | "withhold-selected-dose";
|
|
753
1343
|
primaryConcepts?: string[];
|
|
754
1344
|
secondaryConcepts?: string[];
|
|
755
1345
|
implicitMatchedConcept?: string;
|
|
756
1346
|
implicitMatchedRole?: AdviceArgumentRole;
|
|
757
1347
|
};
|
|
758
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[];
|
|
759
1352
|
continuationLicenses?: Array<{
|
|
760
1353
|
candidateAction: string;
|
|
761
1354
|
previousConcepts?: string[];
|
|
@@ -779,6 +1372,8 @@ export interface MedicationInstructionActionDefinition {
|
|
|
779
1372
|
applicationVerb?: boolean;
|
|
780
1373
|
/** Extra exact codings licensed by a typed semantic argument. */
|
|
781
1374
|
contextualCodings?: MedicationInstructionActionContextualCodingRule[];
|
|
1375
|
+
/** Add accurate standard-coded constituents only in the matched argument context. */
|
|
1376
|
+
contextualSemanticComponents?: MedicationInstructionActionContextualSemanticComponentRule[];
|
|
782
1377
|
/** A method-capable procedural action that may serve as the primary administration head. */
|
|
783
1378
|
primaryAdministrationHead?: boolean;
|
|
784
1379
|
/** Semantically light verb that yields to an immediately following stronger administration head. */
|
|
@@ -792,6 +1387,8 @@ export interface MedicationInstructionActionDefinition {
|
|
|
792
1387
|
coding?: FhirCoding;
|
|
793
1388
|
/** Exact external terminology mappings; never fuzzy/approximate mappings. */
|
|
794
1389
|
externalCodings?: FhirCoding[];
|
|
1390
|
+
/** Standard-coded parts of the instruction; preserve its local action coding. */
|
|
1391
|
+
semanticComponents?: InstructionActionSemanticComponent[];
|
|
795
1392
|
}
|
|
796
1393
|
export interface MedicationInstructionActionInput extends Partial<MedicationInstructionActionDefinition> {
|
|
797
1394
|
semanticClass?: string;
|
|
@@ -799,6 +1396,14 @@ export interface MedicationInstructionActionInput extends Partial<MedicationInst
|
|
|
799
1396
|
export interface MedicationInstructionConceptDefinition {
|
|
800
1397
|
code: string;
|
|
801
1398
|
role: AdviceArgumentRole;
|
|
1399
|
+
/** A registered compound noun may entail a second independently typed
|
|
1400
|
+
* argument, e.g. a temporal material "before first use" also supplies
|
|
1401
|
+
* its explicit first-use event. Not a free-form text rewrite. */
|
|
1402
|
+
impliedArgument?: {
|
|
1403
|
+
role: AdviceArgumentRole;
|
|
1404
|
+
conceptId: string;
|
|
1405
|
+
relation: AdviceRelation;
|
|
1406
|
+
};
|
|
802
1407
|
display: string;
|
|
803
1408
|
i18n?: Record<string, string>;
|
|
804
1409
|
aliases?: string[];
|
|
@@ -806,6 +1411,8 @@ export interface MedicationInstructionConceptDefinition {
|
|
|
806
1411
|
localeAliases?: Record<string, string[]>;
|
|
807
1412
|
coding?: FhirCoding;
|
|
808
1413
|
externalCodings?: FhirCoding[];
|
|
1414
|
+
/** Separately coded head and modifiers when there is no equivalent code for the whole phrase. */
|
|
1415
|
+
components?: InstructionConceptComponent[];
|
|
809
1416
|
}
|
|
810
1417
|
export interface MedicationInstructionConceptInput extends Partial<MedicationInstructionConceptDefinition> {
|
|
811
1418
|
role?: AdviceArgumentRole;
|
|
@@ -918,8 +1525,9 @@ export interface ParseOptions extends FormatOptions {
|
|
|
918
1525
|
*/
|
|
919
1526
|
instructionConceptMap?: Record<string, MedicationInstructionConceptInput>;
|
|
920
1527
|
/**
|
|
921
|
-
* Optional learned/remote semantic proposal providers.
|
|
922
|
-
* parseSigAsync()
|
|
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.
|
|
923
1531
|
* Proposals are validated against registered action/concept/site/unit vocabularies
|
|
924
1532
|
* before they can enter the canonical graph.
|
|
925
1533
|
*/
|
|
@@ -1034,9 +1642,24 @@ export interface CanonicalDoseRange {
|
|
|
1034
1642
|
high?: number;
|
|
1035
1643
|
}
|
|
1036
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;
|
|
1037
1655
|
value?: number;
|
|
1038
1656
|
range?: CanonicalDoseRange;
|
|
1039
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"];
|
|
1040
1663
|
evidence?: CanonicalEvidence[];
|
|
1041
1664
|
}
|
|
1042
1665
|
export interface CanonicalRouteExpr {
|
|
@@ -1050,14 +1673,28 @@ export interface CanonicalSiteExpr {
|
|
|
1050
1673
|
i18n?: Record<string, string>;
|
|
1051
1674
|
coding?: BodySiteCode;
|
|
1052
1675
|
spatialRelation?: BodySiteSpatialRelation;
|
|
1676
|
+
restrictions?: BodySiteRestriction[];
|
|
1053
1677
|
administrationTargetCount?: number;
|
|
1054
1678
|
source?: "abbreviation" | "text" | "selection" | "resolver";
|
|
1055
1679
|
inferred?: boolean;
|
|
1056
1680
|
evidence?: CanonicalEvidence[];
|
|
1681
|
+
range?: TextRange;
|
|
1682
|
+
}
|
|
1683
|
+
export type AdministrationTargetCoordinationKind = "conjunction" | "disjunction" | "mixed";
|
|
1684
|
+
/**
|
|
1685
|
+
* A grammatical coordination of administration sites. Each target is an
|
|
1686
|
+
* independently typed site atom; the relation is retained before the singular
|
|
1687
|
+
* FHIR Dosage.site projection chooses whether conjunction fan-out is needed.
|
|
1688
|
+
*/
|
|
1689
|
+
export interface CanonicalAdministrationTargetGroup {
|
|
1690
|
+
coordination: AdministrationTargetCoordinationKind;
|
|
1691
|
+
sourceText: string;
|
|
1692
|
+
range?: TextRange;
|
|
1693
|
+
targets: CanonicalSiteExpr[];
|
|
1057
1694
|
}
|
|
1058
1695
|
export interface CanonicalMethodExpr {
|
|
1059
1696
|
text?: string;
|
|
1060
|
-
_text?:
|
|
1697
|
+
_text?: FhirR6PrimitiveElement;
|
|
1061
1698
|
coding?: FhirCoding;
|
|
1062
1699
|
evidence?: CanonicalEvidence[];
|
|
1063
1700
|
}
|
|
@@ -1066,6 +1703,16 @@ export interface CanonicalOccurrenceCapExpr {
|
|
|
1066
1703
|
period: number;
|
|
1067
1704
|
periodUnit: FhirPeriodUnit;
|
|
1068
1705
|
}
|
|
1706
|
+
/** Explicit maximum medication quantity within a recurring period. */
|
|
1707
|
+
export interface CanonicalDosePeriodMaximumExpr {
|
|
1708
|
+
amount: number;
|
|
1709
|
+
unit: string;
|
|
1710
|
+
/** Exact authored Quantity operator, including EMA-coded approximate R5 limits. */
|
|
1711
|
+
amountComparator?: FhirR6Quantity["comparator"];
|
|
1712
|
+
period: number;
|
|
1713
|
+
periodUnit: FhirPeriodUnit;
|
|
1714
|
+
periodComparator?: FhirR6Quantity["comparator"];
|
|
1715
|
+
}
|
|
1069
1716
|
export interface CanonicalActivityTimingExpr {
|
|
1070
1717
|
relation: "before" | "after";
|
|
1071
1718
|
activity: {
|
|
@@ -1080,6 +1727,14 @@ export interface CanonicalActivityTimingExpr {
|
|
|
1080
1727
|
/** Maximum offset from the activity in minutes. */
|
|
1081
1728
|
offsetMax?: number;
|
|
1082
1729
|
}
|
|
1730
|
+
/** Caller-resolved daily administration window. Unlike a WHEN anchor, this
|
|
1731
|
+
* bounds recurring opportunities rather than defining one administration.
|
|
1732
|
+
* Both endpoints are clinical EventTiming codes, never inferred clock times.
|
|
1733
|
+
*/
|
|
1734
|
+
export interface CanonicalEventWindowExpr {
|
|
1735
|
+
start: EventTiming;
|
|
1736
|
+
end: EventTiming;
|
|
1737
|
+
}
|
|
1083
1738
|
export interface CanonicalCalendarEventExpr {
|
|
1084
1739
|
/** Gregorian ISO calendar date used for date-only FHIR Timing.event values and display. */
|
|
1085
1740
|
isoDate: string;
|
|
@@ -1096,13 +1751,72 @@ export interface CanonicalCalendarEventExpr {
|
|
|
1096
1751
|
/** True when a two-digit source year was expanded using the reference date. */
|
|
1097
1752
|
inferredYear?: boolean;
|
|
1098
1753
|
}
|
|
1754
|
+
/** A recognized cycle-day restriction whose calendar eligibility is unresolved.
|
|
1755
|
+
* Independent dose/route/clock fields remain useful for clinician editing.
|
|
1756
|
+
*/
|
|
1757
|
+
export interface CanonicalCycleDayConstraint {
|
|
1758
|
+
days: number[];
|
|
1759
|
+
periodDays?: number;
|
|
1760
|
+
cycles?: number;
|
|
1761
|
+
anchor?: string;
|
|
1762
|
+
reason: string;
|
|
1763
|
+
sourceText: string;
|
|
1764
|
+
}
|
|
1099
1765
|
export interface CanonicalScheduleExpr {
|
|
1766
|
+
/** Required cycle-day eligibility; do not execute the independent cadence until resolved. */
|
|
1767
|
+
cycleDayConstraint?: CanonicalCycleDayConstraint;
|
|
1768
|
+
/** Typed whole-course interval for a recurring active/rest construction. */
|
|
1769
|
+
repeatCycle?: FhirQuantity;
|
|
1770
|
+
/** Explicit finite number of whole-course repetitions; absent means unbounded. */
|
|
1771
|
+
repeatCount?: number;
|
|
1772
|
+
/** Explicit local-clock interval window; not a list of endpoint doses. */
|
|
1773
|
+
clockWindow?: {
|
|
1774
|
+
start: string;
|
|
1775
|
+
end: string;
|
|
1776
|
+
endInclusive: boolean;
|
|
1777
|
+
};
|
|
1778
|
+
/** Weekday occurrence in each month; -1 denotes the last occurrence. */
|
|
1779
|
+
weekdayOrdinal?: -1 | 1 | 2 | 3 | 4 | 5;
|
|
1780
|
+
/** Source-anaphoric timing (e.g. "at the same times") awaiting a licensed
|
|
1781
|
+
* previous regimen daughter. Resolved within HPSG/regimen, never by FHIR. */
|
|
1782
|
+
timingReference?: "previous" | "previous-weekday-complement";
|
|
1783
|
+
/** Source-relative phase onset; phaseStartReference selects civil-day
|
|
1784
|
+
* midnight instead of the default clock-preserving treatment start. */
|
|
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";
|
|
1789
|
+
/** Elapsed delay from each opportunity in this explicitly retained base schedule. */
|
|
1790
|
+
administrationOffsetMinutes?: number;
|
|
1100
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;
|
|
1101
1796
|
count?: number;
|
|
1102
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
|
+
};
|
|
1103
1805
|
duration?: number;
|
|
1104
1806
|
durationMax?: number;
|
|
1807
|
+
/** Preserve an authored duration range even when only one endpoint exists. */
|
|
1808
|
+
durationIsRange?: true;
|
|
1105
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"];
|
|
1106
1820
|
/** Earliest calendar date/time on which this schedule becomes active. */
|
|
1107
1821
|
boundsStart?: string;
|
|
1108
1822
|
/** Latest inclusive calendar date/time on which this schedule remains active. */
|
|
@@ -1111,6 +1825,10 @@ export interface CanonicalScheduleExpr {
|
|
|
1111
1825
|
administrationDuration?: number;
|
|
1112
1826
|
administrationDurationMax?: number;
|
|
1113
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;
|
|
1114
1832
|
frequency?: number;
|
|
1115
1833
|
frequencyMax?: number;
|
|
1116
1834
|
period?: number;
|
|
@@ -1123,14 +1841,22 @@ export interface CanonicalScheduleExpr {
|
|
|
1123
1841
|
/** Maximum event offset in minutes when the source says “at most”. */
|
|
1124
1842
|
offsetMax?: number;
|
|
1125
1843
|
dayOfWeek?: FhirDayOfWeek[];
|
|
1844
|
+
/** Source-specified calendar days of each month, not medication dose amounts. */
|
|
1845
|
+
dayOfMonth?: number[];
|
|
1126
1846
|
when?: EventTiming[];
|
|
1127
1847
|
timeOfDay?: string[];
|
|
1848
|
+
/** Typed recurring window, distinct from an instantaneous WHEN event. */
|
|
1849
|
+
eventWindow?: CanonicalEventWindowExpr;
|
|
1128
1850
|
/** Explicit calendar occurrences, projected to FHIR Timing.event. */
|
|
1129
1851
|
calendarEvents?: CanonicalCalendarEventExpr[];
|
|
1130
1852
|
activityTiming?: CanonicalActivityTimingExpr[];
|
|
1131
1853
|
occurrenceCap?: CanonicalOccurrenceCapExpr;
|
|
1854
|
+
/** Quantity cap, distinct from occurrenceCap's maximum administration count. */
|
|
1855
|
+
maxDosePerPeriod?: CanonicalDosePeriodMaximumExpr[];
|
|
1132
1856
|
evidence?: CanonicalEvidence[];
|
|
1133
1857
|
}
|
|
1858
|
+
/** Schedule fields explicitly contributed by typed grammar evidence. */
|
|
1859
|
+
export type CanonicalScheduleSemanticField = Exclude<keyof CanonicalScheduleExpr, "evidence" | "timingTextIsLiteral">;
|
|
1134
1860
|
export interface CanonicalPrnReasonExpr {
|
|
1135
1861
|
text?: string;
|
|
1136
1862
|
i18n?: Record<string, string>;
|
|
@@ -1153,6 +1879,11 @@ export interface CanonicalAdditionalInstructionExpr {
|
|
|
1153
1879
|
evidence?: CanonicalEvidence[];
|
|
1154
1880
|
}
|
|
1155
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;
|
|
1156
1887
|
kind: AdviceRelation;
|
|
1157
1888
|
fromActionIndex?: number;
|
|
1158
1889
|
toActionIndex: number;
|
|
@@ -1160,6 +1891,9 @@ export interface CanonicalInstructionRelation {
|
|
|
1160
1891
|
span?: TextRange;
|
|
1161
1892
|
}
|
|
1162
1893
|
export interface CanonicalInstructionCoverage {
|
|
1894
|
+
/** Opaque FHIR annotations stay with this coverage record. */
|
|
1895
|
+
sourceId?: string;
|
|
1896
|
+
sourceExtensions?: FhirExtension[];
|
|
1163
1897
|
understoodCharacters: number;
|
|
1164
1898
|
opaqueCharacters: number;
|
|
1165
1899
|
ratio: number;
|
|
@@ -1172,35 +1906,130 @@ export interface CanonicalInstructionGraph {
|
|
|
1172
1906
|
relations?: CanonicalInstructionRelation[];
|
|
1173
1907
|
/** Source span of the canonical primary administration head, when known. */
|
|
1174
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
|
+
};
|
|
1175
1922
|
/** Source fragments the parser deliberately did not assign semantics to. */
|
|
1176
1923
|
opaqueSpans?: CanonicalSourceSpan[];
|
|
1177
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[];
|
|
1178
1929
|
/** Exact original source represented by this graph. */
|
|
1179
1930
|
sourceText: string;
|
|
1180
1931
|
/** Source language when it can be determined without guessing. */
|
|
1181
1932
|
sourceLocale?: string;
|
|
1182
1933
|
}
|
|
1183
1934
|
export interface CanonicalSourceSpan extends TextRange {
|
|
1935
|
+
/** Opaque FHIR annotations stay with this source span. */
|
|
1936
|
+
sourceId?: string;
|
|
1937
|
+
sourceExtensions?: FhirExtension[];
|
|
1184
1938
|
text: string;
|
|
1185
1939
|
tokenIndices?: number[];
|
|
1186
1940
|
}
|
|
1941
|
+
/** Lexical grammatical role carried from the originating typed sign.
|
|
1942
|
+
* Production names remain diagnostic labels, never semantic dispatch keys. */
|
|
1943
|
+
export type CanonicalLexicalCategory = "dose" | "method" | "prn" | "connector" | "instruction" | "workflow";
|
|
1187
1944
|
export interface CanonicalEvidence {
|
|
1188
1945
|
rule: string;
|
|
1946
|
+
/** Role of the actual lexical sign, independent of the grammar-rule label. */
|
|
1947
|
+
lexicalCategory?: CanonicalLexicalCategory;
|
|
1189
1948
|
spans: CanonicalSourceSpan[];
|
|
1949
|
+
/** Exact schedule semantics owned by this evidence, independent of rule names. */
|
|
1950
|
+
scheduleFields?: CanonicalScheduleSemanticField[];
|
|
1190
1951
|
score?: number;
|
|
1191
1952
|
note?: string;
|
|
1192
1953
|
}
|
|
1954
|
+
/**
|
|
1955
|
+
* Clinical adjuncts are grammatical facts on a typed administration clause.
|
|
1956
|
+
* Local surface recognizers produce them; HPSG constructions determine their
|
|
1957
|
+
* scope; FHIR only projects the resulting semantics. Raw/source data is kept.
|
|
1958
|
+
*/
|
|
1959
|
+
export interface CanonicalClinicalAdjuncts {
|
|
1960
|
+
/** Finite medication-free interval selected by a typed withholding head. */
|
|
1961
|
+
treatmentPause?: {
|
|
1962
|
+
durationDays: number;
|
|
1963
|
+
range: TextRange;
|
|
1964
|
+
};
|
|
1965
|
+
condition?: MedicationCondition;
|
|
1966
|
+
/** Source-typed calendar membership, distinct from unrelated clinical guards. */
|
|
1967
|
+
calendarDayCondition?: MedicationCondition;
|
|
1968
|
+
/** Typed nominal reference of a conditional administration instruction.
|
|
1969
|
+
* Resolved across related regimen daughters before any FHIR lowering. */
|
|
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;
|
|
1975
|
+
when?: EventTiming[];
|
|
1976
|
+
/** Explicit existing clock slots selected by the nominal dose object. */
|
|
1977
|
+
timeOfDay?: string[];
|
|
1978
|
+
/** Lexical daypart membership over already stated clocks; creates no times. */
|
|
1979
|
+
clockRange?: {
|
|
1980
|
+
startHour: number;
|
|
1981
|
+
endHour: number;
|
|
1982
|
+
};
|
|
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[];
|
|
1989
|
+
};
|
|
1990
|
+
excludedDates?: string[];
|
|
1991
|
+
excludedWeekdays?: FhirDayOfWeek[];
|
|
1992
|
+
/** Local source spans for lint ownership, not inherited donor spans. */
|
|
1993
|
+
localRanges?: TextRange[];
|
|
1994
|
+
evidence?: CanonicalEvidence[];
|
|
1995
|
+
}
|
|
1193
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;
|
|
1194
2005
|
kind: "administration";
|
|
2006
|
+
/** Source-backed phase operation; resolved by the typed regimen graph. */
|
|
2007
|
+
regimenAdjustment?: "replace" | "add" | "replace-target";
|
|
1195
2008
|
rawText: string;
|
|
1196
2009
|
span?: TextRange;
|
|
1197
2010
|
raw: CanonicalSourceSpan;
|
|
1198
2011
|
dose?: CanonicalDoseExpr;
|
|
1199
2012
|
route?: CanonicalRouteExpr;
|
|
1200
2013
|
site?: CanonicalSiteExpr;
|
|
2014
|
+
administrationTargetGroup?: CanonicalAdministrationTargetGroup;
|
|
1201
2015
|
method?: CanonicalMethodExpr;
|
|
2016
|
+
/** Only the executable schedule. Undefined when scheduling is unresolved. */
|
|
1202
2017
|
schedule?: CanonicalScheduleExpr;
|
|
2018
|
+
/**
|
|
2019
|
+
* Recognized but NON-EXECUTABLE schedule features retained for review/UI.
|
|
2020
|
+
* An unresolved medication can still have trustworthy dose, route, site,
|
|
2021
|
+
* clocks and bounds. Never schedule or calculate supply from this field;
|
|
2022
|
+
* execution requires a resolved schedule and the dosage safety checks.
|
|
2023
|
+
*/
|
|
2024
|
+
provisionalSchedule?: CanonicalScheduleExpr;
|
|
1203
2025
|
prn?: CanonicalPrnExpr;
|
|
2026
|
+
clinicalAdjuncts?: CanonicalClinicalAdjuncts;
|
|
2027
|
+
/** Closed HPSG condition ownership, projected into instruction-graph relations. */
|
|
2028
|
+
instructionScopes?: Array<{
|
|
2029
|
+
kind: AdviceRelation;
|
|
2030
|
+
span: TextRange;
|
|
2031
|
+
target: TextRange;
|
|
2032
|
+
}>;
|
|
1204
2033
|
patientInstruction?: string;
|
|
1205
2034
|
instructionGraph?: CanonicalInstructionGraph;
|
|
1206
2035
|
additionalInstructions?: CanonicalAdditionalInstructionExpr[];
|
|
@@ -1220,6 +2049,9 @@ export interface ParseResult {
|
|
|
1220
2049
|
normalized: ParseNormalizedMeta;
|
|
1221
2050
|
canonical: {
|
|
1222
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;
|
|
1223
2055
|
};
|
|
1224
2056
|
siteLookups?: Array<{
|
|
1225
2057
|
request: SiteCodeLookupRequest;
|
|
@@ -1254,6 +2086,8 @@ export interface BodySiteDetail {
|
|
|
1254
2086
|
text?: string;
|
|
1255
2087
|
coding?: BodySiteCode;
|
|
1256
2088
|
spatialRelation?: BodySiteSpatialRelation;
|
|
2089
|
+
/** Typed site-local predicates retained for editable normalized suggestions. */
|
|
2090
|
+
restrictions?: BodySiteRestriction[];
|
|
1257
2091
|
administrationTargetCount?: number;
|
|
1258
2092
|
}
|
|
1259
2093
|
export interface ConceptSiteDetail {
|
|
@@ -1269,21 +2103,15 @@ export interface ParseBatchSegmentMeta {
|
|
|
1269
2103
|
export interface ParseBatchResult {
|
|
1270
2104
|
input: string;
|
|
1271
2105
|
count: number;
|
|
2106
|
+
/** Per-clause parser diagnostics and intermediate R5-compatible dosage shapes. */
|
|
1272
2107
|
items: ParseResult[];
|
|
1273
|
-
/**
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
* Top-level compatibility field mirroring the first parsed item so existing
|
|
1280
|
-
* single-sig integrations can migrate incrementally.
|
|
1281
|
-
*/
|
|
2108
|
+
/** Primary output: COMPLETE flat R5-like dosage array with additive R6 fields. */
|
|
2109
|
+
fhir: EzDosage[];
|
|
2110
|
+
/** Strict R6 snapshot projection of the same prescription. */
|
|
2111
|
+
fhirNext: FhirR6DosageInstruction;
|
|
2112
|
+
/** Optional R6 step/course metadata not owned by a single dose. */
|
|
2113
|
+
course?: EzCourseMetadata;
|
|
1282
2114
|
shortText: string;
|
|
1283
|
-
/**
|
|
1284
|
-
* Top-level compatibility field mirroring the first parsed item so existing
|
|
1285
|
-
* single-sig integrations can migrate incrementally.
|
|
1286
|
-
*/
|
|
1287
2115
|
longText: string;
|
|
1288
2116
|
warnings: string[];
|
|
1289
2117
|
meta: {
|
|
@@ -1292,6 +2120,9 @@ export interface ParseBatchResult {
|
|
|
1292
2120
|
normalized: ParseNormalizedMeta;
|
|
1293
2121
|
canonical: {
|
|
1294
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;
|
|
1295
2126
|
};
|
|
1296
2127
|
siteLookups?: Array<{
|
|
1297
2128
|
request: SiteCodeLookupRequest;
|
|
@@ -1364,8 +2195,20 @@ export interface NextDueDoseConfig {
|
|
|
1364
2195
|
/**
|
|
1365
2196
|
* Options bag for next-due dose generation.
|
|
1366
2197
|
*/
|
|
2198
|
+
export type MedicationConditionEvaluator = (condition: MedicationCondition, at: string) => boolean | undefined;
|
|
1367
2199
|
export interface NextDueDoseOptions {
|
|
1368
2200
|
from: Date | string;
|
|
2201
|
+
/** Explicit course-local selection for exactly-one alternative groups.
|
|
2202
|
+
* Keys are getDosageAlternativeChoice(...).groupId; values are branchId.
|
|
2203
|
+
* Omit only for ordinary courses without mutually exclusive alternatives.
|
|
2204
|
+
* Parsing and editing never require a selection; execution and supply do.
|
|
2205
|
+
*/
|
|
2206
|
+
alternativeChoices?: Readonly<Record<string, string>>;
|
|
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. */
|
|
2211
|
+
evaluateCondition?: MedicationConditionEvaluator;
|
|
1369
2212
|
orderedAt?: Date | string;
|
|
1370
2213
|
limit?: number;
|
|
1371
2214
|
priorCount?: number;
|
|
@@ -1377,17 +2220,33 @@ export interface NextDueDoseOptions {
|
|
|
1377
2220
|
frequencyDefaults?: FrequencyFallbackTimes;
|
|
1378
2221
|
config?: NextDueDoseConfig;
|
|
1379
2222
|
}
|
|
2223
|
+
/** Due times calculated with each ordered medication-instruction phase respected. */
|
|
2224
|
+
export interface RegimenDueTimes {
|
|
2225
|
+
dosageIndex: number;
|
|
2226
|
+
sequence: number;
|
|
2227
|
+
phaseStart: string;
|
|
2228
|
+
timestamps: string[];
|
|
2229
|
+
}
|
|
1380
2230
|
export interface TotalUnitsResult {
|
|
1381
2231
|
totalUnits: number;
|
|
2232
|
+
/** Unit of totalUnits, when known. */
|
|
2233
|
+
unit?: string;
|
|
2234
|
+
/** PRN and unresolved clinical observations yield the maximum planned supply, not actual consumption. */
|
|
2235
|
+
quantityKind?: "scheduled" | "maximum";
|
|
2236
|
+
/** Human-readable basis/assumptions suitable for displaying alongside a calculated quantity. */
|
|
2237
|
+
explanation?: string;
|
|
1382
2238
|
totalContainers?: number;
|
|
1383
2239
|
totalContainerQuantity?: FhirQuantity;
|
|
1384
2240
|
totalApproximateQuantity?: EstimatedQuantity;
|
|
1385
2241
|
totalApproximateIngredientQuantity?: EstimatedQuantity;
|
|
1386
2242
|
}
|
|
1387
2243
|
export interface TotalUnitsOptions extends NextDueDoseOptions {
|
|
1388
|
-
dosage: FhirDosage |
|
|
2244
|
+
dosage: FhirDosage | readonly EzDosage[] | FhirR6DosageInstructionInput | ParseBatchResult;
|
|
2245
|
+
/** Required to resolve per-kg administered doses into an actual quantity. */
|
|
2246
|
+
patientWeightKg?: number;
|
|
1389
2247
|
durationValue: number;
|
|
1390
2248
|
durationUnit: FhirPeriodUnit;
|
|
1391
2249
|
roundToMultiple?: number;
|
|
1392
2250
|
context?: MedicationContext;
|
|
1393
2251
|
}
|
|
2252
|
+
export {};
|