ezmedicationinput 0.3.0-beta.1 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +155 -10
- package/dist/adapters/canonical-course.d.ts +7 -4
- package/dist/adapters/r5-course.d.ts +11 -2
- package/dist/advice-locale-adapter.d.ts +24 -0
- package/dist/advice.d.ts +39 -3
- package/dist/body-site-grammar.d.ts +21 -2
- package/dist/body-site-lookup.d.ts +6 -1
- package/dist/body-site-spatial.d.ts +7 -1
- package/dist/body-site-target.d.ts +35 -3
- package/dist/canonical/compile.d.ts +22 -3
- package/dist/canonical/course.d.ts +43 -7
- package/dist/canonical/dosage-agreement.d.ts +84 -0
- package/dist/canonical/format-course.d.ts +4 -2
- package/dist/clause-tail-grammar.d.ts +2 -0
- package/dist/combine-multilingual-dosages.d.ts +32 -0
- package/dist/date-interpretation.d.ts +36 -2
- package/dist/dosage-course.d.ts +26 -17
- package/dist/event-timing-expression.d.ts +26 -1
- package/dist/execution/engine.d.ts +2 -1
- package/dist/fhir-quantity-operator.d.ts +37 -1
- package/dist/fhir-translations.d.ts +14 -1
- package/dist/fhir.d.ts +25 -5
- package/dist/format.d.ts +23 -24
- package/dist/hpsg/constructions.d.ts +27 -5
- package/dist/hpsg/lexical-classes.d.ts +94 -33
- package/dist/hpsg/method-lexicon.d.ts +3 -0
- package/dist/hpsg/procedural-context.d.ts +51 -3
- package/dist/hpsg/projection.d.ts +7 -3
- package/dist/hpsg/quantity-lexicon.d.ts +51 -0
- package/dist/hpsg/rule-context.d.ts +101 -33
- package/dist/hpsg/rules/clinical-quantity-rules.d.ts +1 -1
- package/dist/hpsg/rules/condition-rules.d.ts +13 -2
- package/dist/hpsg/rules/core-rules.d.ts +5 -2
- package/dist/hpsg/rules/prn-rules.d.ts +10 -1
- package/dist/hpsg/rules/site-rules.d.ts +10 -1
- package/dist/hpsg/rules/timing-rules.d.ts +108 -24
- package/dist/hpsg/segmenter.d.ts +2 -2
- package/dist/hpsg/signature.d.ts +50 -5
- package/dist/hpsg/timing-lexicon.d.ts +18 -2
- package/dist/i18n.d.ts +8 -7
- package/dist/index.cjs +84275 -66589
- package/dist/index.d.ts +13 -3
- package/dist/index.js +84263 -66588
- package/dist/instruction-action-locale-adapter.d.ts +69 -5
- package/dist/instruction-action-parser.d.ts +48 -0
- package/dist/instruction-action-terminology.d.ts +22 -1
- package/dist/instruction-concept-terminology.d.ts +14 -1
- package/dist/instruction-graph-fhir.d.ts +4 -2
- package/dist/instruction-graph-ownership.d.ts +96 -0
- package/dist/instruction-graph.d.ts +19 -42
- package/dist/lexer/lex.d.ts +5 -1
- package/dist/lexer/locale.d.ts +14 -0
- package/dist/lexer/locales/en.d.ts +11 -0
- package/dist/lexer/surface.d.ts +3 -1
- package/dist/lexer/token-types.d.ts +6 -0
- package/dist/locale-detection.d.ts +4 -2
- package/dist/locales/clause/en.d.ts +14 -0
- package/dist/locales/course/en.d.ts +5 -0
- package/dist/localization.d.ts +6 -0
- package/dist/localized-timing.d.ts +1 -1
- package/dist/maps.d.ts +38 -12
- package/dist/medication-condition.d.ts +105 -11
- package/dist/parser-state.d.ts +10 -0
- package/dist/parser.d.ts +5 -3
- package/dist/prn.d.ts +15 -2
- package/dist/regimen/coordination-scope.d.ts +13 -1
- package/dist/regimen/grammar.d.ts +7 -1
- package/dist/regimen/parallel-course.d.ts +6 -2
- package/dist/regimen/planner.d.ts +2 -3
- package/dist/regimen/regimen.d.ts +2 -0
- package/dist/schedule.d.ts +5 -2
- package/dist/snomed.d.ts +3 -0
- package/dist/suggest-locale-adapter.d.ts +15 -0
- package/dist/symptom-terminology.d.ts +5 -1
- package/dist/timing-summary.d.ts +43 -10
- package/dist/types.d.ts +213 -16
- package/dist/unit-lexicon.d.ts +2 -6
- package/dist/utils/units.d.ts +3 -0
- package/package.json +1 -1
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
import type { CanonicalSigClause, ParseOptions } from "../types";
|
|
6
6
|
import type { CanonicalAdministration, CanonicalMeasure, CanonicalRange, CanonicalCourse, CanonicalBoundary } from "./course";
|
|
7
7
|
import type { CanonicalParallelRegimen, RegimenPosition } from "../regimen/parallel-course";
|
|
8
|
+
/** Preserve a typed occurrence maximum without inventing an executable period. */
|
|
9
|
+
export declare function unresolvedMaximumLimits(clause: CanonicalSigClause): {
|
|
10
|
+
scope: "period" | "administration";
|
|
11
|
+
count: number;
|
|
12
|
+
text?: string;
|
|
13
|
+
}[] | undefined;
|
|
8
14
|
/** A single authored time denominator is shared by native and FHIR rate projection. */
|
|
9
15
|
export declare function clinicalQuantityTimeDenominator(quantity: NonNullable<CanonicalSigClause["clinicalQuantity"]>): import("../hpsg/signature").HpsgDimensionalQuantityTerm | undefined;
|
|
10
16
|
/** Choose the native rate shape once, preserving an authored numeric time
|
|
@@ -12,10 +18,16 @@ export declare function clinicalQuantityTimeDenominator(quantity: NonNullable<Ca
|
|
|
12
18
|
export declare function rateFromClinicalQuantity(quantity: NonNullable<CanonicalSigClause["clinicalQuantity"]>): {
|
|
13
19
|
rateRange: {
|
|
14
20
|
low: {
|
|
21
|
+
comparator?: "<" | "<=" | ">=" | ">" | "ad" | "~" | undefined;
|
|
22
|
+
system?: string | undefined;
|
|
23
|
+
code?: string | undefined;
|
|
15
24
|
value: number;
|
|
16
25
|
unit: string;
|
|
17
26
|
} | undefined;
|
|
18
27
|
high: {
|
|
28
|
+
comparator?: "<" | "<=" | ">=" | ">" | "ad" | "~" | undefined;
|
|
29
|
+
system?: string | undefined;
|
|
30
|
+
code?: string | undefined;
|
|
19
31
|
value: number;
|
|
20
32
|
unit: string;
|
|
21
33
|
} | undefined;
|
|
@@ -26,10 +38,15 @@ export declare function rateFromClinicalQuantity(quantity: NonNullable<Canonical
|
|
|
26
38
|
rateRatio: {
|
|
27
39
|
numerator: {
|
|
28
40
|
comparator?: "<" | "<=" | ">=" | ">" | "ad" | "~" | undefined;
|
|
41
|
+
system?: string | undefined;
|
|
42
|
+
code?: string | undefined;
|
|
29
43
|
value: number;
|
|
30
44
|
unit: string;
|
|
31
45
|
};
|
|
32
46
|
denominator: {
|
|
47
|
+
comparator?: "<" | "<=" | ">=" | ">" | "ad" | "~" | undefined;
|
|
48
|
+
system?: string | undefined;
|
|
49
|
+
code?: string | undefined;
|
|
33
50
|
value: number;
|
|
34
51
|
unit: string;
|
|
35
52
|
};
|
|
@@ -39,13 +56,15 @@ export declare function rateFromClinicalQuantity(quantity: NonNullable<Canonical
|
|
|
39
56
|
} | {
|
|
40
57
|
rate: {
|
|
41
58
|
comparator?: "<" | "<=" | ">=" | ">" | "ad" | "~" | undefined;
|
|
59
|
+
system?: string | undefined;
|
|
60
|
+
code?: string | undefined;
|
|
42
61
|
value: number;
|
|
43
62
|
unit: string;
|
|
44
63
|
};
|
|
45
64
|
rateRange?: undefined;
|
|
46
65
|
rateRatio?: undefined;
|
|
47
66
|
};
|
|
48
|
-
export declare function administrationFromClause(clause: CanonicalSigClause, text?: string, stageOrdinal?: number): CanonicalAdministration;
|
|
67
|
+
export declare function administrationFromClause(clause: CanonicalSigClause, text?: string, stageOrdinal?: number, phaseStart?: CanonicalBoundary, nativeDefaultText?: boolean): CanonicalAdministration;
|
|
49
68
|
/** Calendar tracks use explicit dates; not offsets from treatment start. */
|
|
50
69
|
export declare function precedingCalendarDay(value: string): string | undefined;
|
|
51
70
|
/** Dates without times are inclusive local calendar days, never UTC timestamps. */
|
|
@@ -56,13 +75,13 @@ export declare function clinicalBoundary(position: RegimenPosition | {
|
|
|
56
75
|
}): CanonicalBoundary;
|
|
57
76
|
export declare function courseFromParallel(regimen: Extract<CanonicalParallelRegimen, {
|
|
58
77
|
kind: "resolved";
|
|
59
|
-
}>, clauseTexts: readonly (string | undefined)[], instruction: string): CanonicalCourse;
|
|
78
|
+
}>, clauseTexts: readonly (string | undefined)[], instruction: string, nativeDefaultText?: boolean): CanonicalCourse;
|
|
60
79
|
/** Preserve independent member origins when global stage cuts are unresolved.
|
|
61
80
|
* Each member retains its own course length; an uncertain transition never
|
|
62
81
|
* supplies the origin or end of another track. */
|
|
63
82
|
export declare function courseFromPartialParallel(regimen: Extract<CanonicalParallelRegimen, {
|
|
64
83
|
kind: "unresolved";
|
|
65
|
-
}>, clauseTexts: readonly (string | undefined)[], instruction: string): CanonicalCourse;
|
|
84
|
+
}>, clauseTexts: readonly (string | undefined)[], instruction: string, nativeDefaultText?: boolean): CanonicalCourse;
|
|
66
85
|
/** The grammar's compact dose range has one shared unit and no endpoint
|
|
67
86
|
* operators. Rich native ranges must retain each independently authored
|
|
68
87
|
* endpoint instead of compressing them into a misleading scalar-unit view. */
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* adapters serialize those fields and preserve unrelated source metadata.
|
|
13
13
|
*/
|
|
14
14
|
import { convertQuantityValue } from "../utils/units";
|
|
15
|
-
import type { BodySiteSpatialRelation, CanonicalSigClause, CanonicalScheduleExpr, CanonicalActivityTimingExpr, CanonicalCycleDayConstraint, CanonicalOccurrenceCapExpr, CanonicalEventWindowExpr, MedicationCondition, NextDueDoseOptions, TotalUnitsOptions } from "../types";
|
|
15
|
+
import type { BodySiteSpatialRelation, CanonicalClinicalAdjuncts, CanonicalSigClause, CanonicalScheduleExpr, CanonicalActivityTimingExpr, CanonicalCycleDayConstraint, CanonicalOccurrenceCapExpr, CanonicalEventWindowExpr, MedicationCondition, NextDueDoseOptions, TotalUnitsOptions } from "../types";
|
|
16
16
|
export { FhirPeriodUnit as DurationUnit, EventTiming as TimingEvent } from "../types";
|
|
17
17
|
import type { FhirPeriodUnit as DurationUnit, EventTiming as TimingEvent, FhirDayOfWeek as Weekday } from "../types";
|
|
18
18
|
/** Shared clinical measurements are not a wire-format Quantity. Additional
|
|
@@ -58,7 +58,8 @@ export declare function hasAmountRole(role: CanonicalConcept | undefined): boole
|
|
|
58
58
|
* represent several differently qualified or expression-based limits without
|
|
59
59
|
* demoting the extras into an active compatibility extension. */
|
|
60
60
|
export interface CanonicalDoseLimit {
|
|
61
|
-
scope
|
|
61
|
+
/** Absent only for a supplied annotation-only wire scope; it is not an executable ceiling. */
|
|
62
|
+
scope?: "dosage" | "period" | "administration" | "lifetime";
|
|
62
63
|
amount?: CanonicalMeasure;
|
|
63
64
|
count?: number;
|
|
64
65
|
expression?: CanonicalExpression;
|
|
@@ -92,8 +93,14 @@ export interface CanonicalAmount {
|
|
|
92
93
|
export interface CanonicalRecurrence {
|
|
93
94
|
count?: number;
|
|
94
95
|
countMax?: number;
|
|
96
|
+
/** A supplied count annotation without either bound is not an open recurrence. */
|
|
97
|
+
countUnresolved?: boolean;
|
|
95
98
|
sharedCount?: CanonicalScheduleExpr["sharedCount"];
|
|
96
99
|
frequency?: number;
|
|
100
|
+
/** A supplied frequency annotation without a numeric bound is not an omitted frequency. */
|
|
101
|
+
frequencyUnresolved?: true;
|
|
102
|
+
/** All divided administrations occur on the first day of each whole civil-day interval. */
|
|
103
|
+
frequencyWithinDay?: true;
|
|
97
104
|
frequencyMax?: number;
|
|
98
105
|
period?: number;
|
|
99
106
|
periodMax?: number;
|
|
@@ -185,6 +192,10 @@ export interface CanonicalAdministration {
|
|
|
185
192
|
kind: "administration";
|
|
186
193
|
schedule?: CanonicalTiming;
|
|
187
194
|
amounts?: CanonicalAmount[];
|
|
195
|
+
/** Independently authored vehicle volume, separate from active dose and rate. */
|
|
196
|
+
carrierVolume?: CanonicalMeasure;
|
|
197
|
+
/** Descriptive, uncoded material belonging to the explicit carrier volume. */
|
|
198
|
+
carrierMaterial?: string;
|
|
188
199
|
stageOrdinal?: number;
|
|
189
200
|
/** Typed parser member identity, independent of external dose sequence. */
|
|
190
201
|
sourceMember?: number;
|
|
@@ -195,6 +206,10 @@ export interface CanonicalAdministration {
|
|
|
195
206
|
onsetReference?: "previous-phase-next-day" | "previous-phase-end" | "treatment-day-start";
|
|
196
207
|
asNeeded?: boolean;
|
|
197
208
|
targetCount?: number;
|
|
209
|
+
/** Counted amounts may be totals or amounts for each anatomical target.
|
|
210
|
+
* Native omission retains the established discrete per-target convention;
|
|
211
|
+
* independent wire imports explicitly own their total quantity. */
|
|
212
|
+
doseAllocation?: "total" | "per-target";
|
|
198
213
|
target?: CanonicalConcept;
|
|
199
214
|
siteReference?: CanonicalReference;
|
|
200
215
|
siteSpatialRelation?: BodySiteSpatialRelation;
|
|
@@ -204,6 +219,10 @@ export interface CanonicalAdministration {
|
|
|
204
219
|
patientInstruction?: string;
|
|
205
220
|
additionalInstructions?: CanonicalConcept[];
|
|
206
221
|
predicate?: MedicationCondition;
|
|
222
|
+
/** Selected-site conditions cannot allocate an undivided authored amount. */
|
|
223
|
+
conditionAllocationUnresolved?: boolean;
|
|
224
|
+
/** Selective allowance retained separately from a whole-administration predicate. */
|
|
225
|
+
conditionTarget?: CanonicalClinicalAdjuncts["conditionTarget"];
|
|
207
226
|
calendarPredicate?: MedicationCondition;
|
|
208
227
|
excludedDates?: string[];
|
|
209
228
|
excludedWeekdays?: Weekday[];
|
|
@@ -255,9 +274,22 @@ export interface CanonicalStage {
|
|
|
255
274
|
safety?: CanonicalSafety;
|
|
256
275
|
provenance?: Record<string, unknown>;
|
|
257
276
|
}
|
|
277
|
+
/** A shared count belongs to the course cycle unless an explicit stage
|
|
278
|
+
* repetition opens a new local allowance. Rendering and execution agree. */
|
|
279
|
+
export declare function stageRepeatsSharedAllowance(stage: Pick<CanonicalStage, "count">): boolean;
|
|
280
|
+
/** Repetition owned by one independent track, using its existing member identities. */
|
|
281
|
+
export interface CanonicalTrackCycle {
|
|
282
|
+
members: number[];
|
|
283
|
+
interval: CanonicalMeasure;
|
|
284
|
+
/** Known total complete track cycles, including the first. */
|
|
285
|
+
count?: number;
|
|
286
|
+
/** An authored finite count has primitive metadata but no known scalar. */
|
|
287
|
+
countUnresolved?: true;
|
|
288
|
+
}
|
|
258
289
|
export interface CanonicalCourse {
|
|
259
290
|
kind: "course";
|
|
260
291
|
stages: CanonicalStage[];
|
|
292
|
+
trackCycles?: CanonicalTrackCycle[];
|
|
261
293
|
instruction?: string;
|
|
262
294
|
cycleInterval?: CanonicalMeasure;
|
|
263
295
|
/** Total complete-course cycles, including the first; independent of each stage's local count. */
|
|
@@ -294,6 +326,10 @@ export declare const administrationCalendarCondition: (a: CanonicalAdministratio
|
|
|
294
326
|
export declare const administrationExcludedDates: (a: CanonicalAdministration) => string[];
|
|
295
327
|
export declare const administrationExcludedWeekdays: (a: CanonicalAdministration) => Weekday[];
|
|
296
328
|
export declare const administrationChoice: (a: CanonicalAdministration) => CanonicalChoice | undefined;
|
|
329
|
+
/** Reuse ordinary course owners for independently repeating tracks. No grouping
|
|
330
|
+
* is needed for ordinary courses; administrations retain their source identities
|
|
331
|
+
* and same-track phase dependencies. */
|
|
332
|
+
export declare function independentTrackCourses(course: CanonicalCourse, firstStageIndices?: number[]): CanonicalCourse[] | undefined;
|
|
297
333
|
export declare const courseContextIssue: (c: CanonicalCourse) => "conflicting-course-phase" | "missing-course-context" | undefined;
|
|
298
334
|
export declare const recurrenceOffset: (r: CanonicalRecurrence | undefined) => number | undefined;
|
|
299
335
|
export declare const recurrenceActivities: (r: CanonicalRecurrence | undefined) => CanonicalActivityTimingExpr[] | undefined;
|
|
@@ -314,13 +350,13 @@ export declare const recurrenceEventWindow: (r: CanonicalRecurrence | undefined)
|
|
|
314
350
|
/** Absolute-event ownership stays nominal; both execution fences follow
|
|
315
351
|
* the event's elapsed displacement. Relative recurrence keeps its own origin. */
|
|
316
352
|
export declare function absoluteEventCycleDisplacement(administration: CanonicalAdministration): number | undefined;
|
|
317
|
-
export declare function administrationHasDatedStart(a: CanonicalAdministration, resolvedStart?: Date | null): boolean;
|
|
318
|
-
/** Clock and
|
|
353
|
+
export declare function administrationHasDatedStart(a: CanonicalAdministration, resolvedStart?: Date | null, selectedEvent?: boolean): boolean;
|
|
354
|
+
/** Clock, weekday and month-day selection defer a calendar cut to execution.
|
|
319
355
|
* A clinical guard or PRN use does not move an authored clock to midnight;
|
|
320
356
|
* clockless clinical conditions retain their existing admission. */
|
|
321
|
-
export declare function administrationHasDatedSelectedStart(a: CanonicalAdministration, resolvedStart?: Date | null): boolean;
|
|
322
|
-
/** The earliest successor date owns any calendar-only cutoff. Selected clocks
|
|
323
|
-
* or
|
|
357
|
+
export declare function administrationHasDatedSelectedStart(a: CanonicalAdministration, resolvedStart?: Date | null, selectedEvent?: boolean): boolean;
|
|
358
|
+
/** The earliest successor date owns any calendar-only cutoff. Selected clocks,
|
|
359
|
+
* calendar days or elapsed displacement leave the exact cut to execution; an unselected date-only member
|
|
324
360
|
* on the same day opens first, at midnight. */
|
|
325
361
|
export declare function earliestCalendarOpening(administrations: readonly CanonicalAdministration[]): {
|
|
326
362
|
start: string;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { FhirDosage, FhirR6DosageInstructionInput, ParseBatchResult, ParseResult } from "../types";
|
|
2
|
+
import type { FhirCoding } from "../types";
|
|
3
|
+
import type { CanonicalAdministration, CanonicalBoundary, CanonicalConcept, CanonicalCourse, CanonicalMeasure, CanonicalStage } from "./course";
|
|
4
|
+
export interface DosageDifference {
|
|
5
|
+
path: string;
|
|
6
|
+
primary: unknown;
|
|
7
|
+
other: unknown;
|
|
8
|
+
reason: "different-meaning" | "unpaired-text" | "ambiguous-alignment" | "uncompared-modifier" | "unknown-unit" | "missing-unit" | "unknown-value" | "unknown-content" | "unresolved-context" | "input";
|
|
9
|
+
}
|
|
10
|
+
/** Clinical compares dosage meaning; structural compares the supplied data shape. */
|
|
11
|
+
export type DosageComparisonMode = "clinical" | "structural" | "permissive" | "custom";
|
|
12
|
+
export type DosageComparisonInput = CanonicalCourse | CanonicalAdministration | readonly CanonicalAdministration[] | FhirDosage | readonly FhirDosage[] | FhirR6DosageInstructionInput | ParseResult | ParseBatchResult;
|
|
13
|
+
export interface DosageComparisonPolicy {
|
|
14
|
+
/** Registered compatible dimensions only; never infer strength or substitute a product. */
|
|
15
|
+
units: "registered" | "exact";
|
|
16
|
+
missingUnits: "indeterminate" | "exact";
|
|
17
|
+
unknownUnits: "indeterminate" | "exact";
|
|
18
|
+
/** Retained unmodeled content; "exact" explicitly selects saved-data equality. */
|
|
19
|
+
unknownContent: "indeterminate" | "exact" | "ignore";
|
|
20
|
+
/** Clinical order treats event sets and independently identified parallel members as unordered. Phases remain ordered. */
|
|
21
|
+
ordering: "clinical" | "preserve" | "multiset";
|
|
22
|
+
narrative: "clinical" | "preserve" | "ignore";
|
|
23
|
+
generatedIds: "ignore" | "preserve";
|
|
24
|
+
/** Structural modes only; clinical import already normalizes absent optional collections. */
|
|
25
|
+
emptyValues: "absent" | "preserve";
|
|
26
|
+
}
|
|
27
|
+
export interface DosageComparisonOptions {
|
|
28
|
+
mode?: DosageComparisonMode;
|
|
29
|
+
/** Custom starts with Clinical defaults. Explicit overrides also apply to a named mode. */
|
|
30
|
+
policy?: Partial<DosageComparisonPolicy>;
|
|
31
|
+
primaryLocale?: string;
|
|
32
|
+
otherLocale?: string;
|
|
33
|
+
/** Clinician-established associations, using the same canonical paths as multilingual composition. */
|
|
34
|
+
pairedText?: readonly string[];
|
|
35
|
+
/** A pure caller-context resolver. Equal keys must identify the same anchor, before its retained displacement. */
|
|
36
|
+
resolveAnchor?: (boundary: CanonicalBoundary, side: "primary" | "other") => string | undefined;
|
|
37
|
+
}
|
|
38
|
+
export interface DosageComparisonResult {
|
|
39
|
+
status: "equivalent" | "different" | "indeterminate";
|
|
40
|
+
differences: DosageDifference[];
|
|
41
|
+
}
|
|
42
|
+
interface ComparisonState {
|
|
43
|
+
policy: DosageComparisonPolicy;
|
|
44
|
+
options: DosageComparisonOptions;
|
|
45
|
+
diagnostics?: DosageDifference[];
|
|
46
|
+
uncertainty: boolean;
|
|
47
|
+
usesPaths: boolean;
|
|
48
|
+
}
|
|
49
|
+
declare function sameDuration(left: CanonicalMeasure | undefined, right: CanonicalMeasure | undefined, state?: ComparisonState, path?: string): boolean;
|
|
50
|
+
export interface WordingAgreement {
|
|
51
|
+
primaryLocale: string;
|
|
52
|
+
otherLocale: string;
|
|
53
|
+
pairedText: ReadonlySet<string>;
|
|
54
|
+
comparison?: ComparisonState;
|
|
55
|
+
}
|
|
56
|
+
export declare function comparableAdviceIndices(a: CanonicalAdministration): number[];
|
|
57
|
+
/** A broad finding code does not account for an independently authored qualifier. */
|
|
58
|
+
export declare function prnUsesStockWording(row: CanonicalConcept, registered?: FhirCoding | undefined): boolean;
|
|
59
|
+
export declare function adviceUsesStockWording(row: CanonicalConcept): boolean;
|
|
60
|
+
export declare function administrationDifference(left: CanonicalAdministration, right: CanonicalAdministration, path: string, wording: WordingAgreement): DosageDifference | undefined;
|
|
61
|
+
export declare function stageDifference(left: CanonicalStage, right: CanonicalStage, path: string, state?: ComparisonState): DosageDifference | undefined;
|
|
62
|
+
export declare function courseDifference(left: CanonicalCourse, right: CanonicalCourse, state?: ComparisonState): DosageDifference | undefined;
|
|
63
|
+
export declare function memberSiteIdentity(a: CanonicalAdministration): string | undefined;
|
|
64
|
+
/** Independent members can also be fixed to different authored clocks or calendar anchors. */
|
|
65
|
+
export declare function memberTimingIdentity(a: CanonicalAdministration): string | undefined;
|
|
66
|
+
export { sameDuration };
|
|
67
|
+
export interface DosageMemberPair {
|
|
68
|
+
left: CanonicalAdministration;
|
|
69
|
+
right: CanonicalAdministration;
|
|
70
|
+
path: string;
|
|
71
|
+
}
|
|
72
|
+
/** Read-only clinical agreement shared by comparison and multilingual composition. */
|
|
73
|
+
export declare function agreeCanonicalCourses(left: CanonicalCourse, right: CanonicalCourse, wording: WordingAgreement): {
|
|
74
|
+
pairs: DosageMemberPair[];
|
|
75
|
+
difference?: DosageDifference;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Compare supported dosage data without parsing prose or requiring executable schedules.
|
|
79
|
+
* Clinical is conservative; indeterminate never becomes true through the boolean helper.
|
|
80
|
+
* Structural and Permissive compare the supplied wire/native representation, retaining row order.
|
|
81
|
+
*/
|
|
82
|
+
export declare function compareDosages(primary: DosageComparisonInput, other: DosageComparisonInput, options?: DosageComparisonOptions): DosageComparisonResult;
|
|
83
|
+
/** The same status kernel with diagnostics disabled; indeterminate is always false. */
|
|
84
|
+
export declare function areDosagesEquivalent(primary: DosageComparisonInput, other: DosageComparisonInput, options?: DosageComparisonOptions): boolean;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* and the existing grammar renderer, never FHIR rows or persistence markers.
|
|
3
3
|
* Display stays separate from executable interpretation: unknown expressions
|
|
4
4
|
* and boundaries remain visible without inventing values or event dates. */
|
|
5
|
-
import type { FormatBatchOptions, FormatOptions, MedicationCondition, FhirDayOfWeek, CanonicalSigClause } from "../types";
|
|
5
|
+
import type { FormatBatchOptions, FormatOptions, MedicationCondition, FhirDayOfWeek, CanonicalSigClause, CanonicalScheduleExpr } from "../types";
|
|
6
6
|
import type { CanonicalCourse, CanonicalAdministration, CanonicalRange, CanonicalExpression, CanonicalSafety } from "./course";
|
|
7
7
|
import { type SigLocalization, type CourseLanguage } from "../i18n";
|
|
8
8
|
/** Resolved once per invocation; recursive clinical composition reuses it. */
|
|
@@ -24,12 +24,14 @@ export declare function unevaluatedExpressionText(expression: CanonicalExpressio
|
|
|
24
24
|
export declare function rateRangePreview(range: CanonicalRange): string | undefined;
|
|
25
25
|
export declare function prefersSourceInstruction(course: CanonicalCourse): boolean;
|
|
26
26
|
/** Unconditional membership owns a shared allowance across every selectable path. */
|
|
27
|
-
export declare function formatCourseChoices<T>(members: readonly T[], render: (member: T, sharedCountAlreadyDisplayed?: boolean) => string, choiceOf: (member: T) => CanonicalAdministration["choice"], words: CourseLanguage, separator?: string, courseLabels?: ReadonlyMap<string, ReadonlyMap<string, string>>,
|
|
27
|
+
export declare function formatCourseChoices<T>(members: readonly T[], render: (member: T, sharedCountAlreadyDisplayed?: boolean) => string, choiceOf: (member: T) => CanonicalAdministration["choice"], words: CourseLanguage, separator?: string, courseLabels?: ReadonlyMap<string, ReadonlyMap<string, string>>, sharedCountOf?: (member: T) => CanonicalScheduleExpr["sharedCount"], memberFormatOverride?: boolean, localization?: SigLocalization): string;
|
|
28
28
|
/** Transient renderer result for callers retaining independently authored text. */
|
|
29
29
|
interface AuthoredDirectionsState {
|
|
30
30
|
text: string;
|
|
31
31
|
rendered: boolean;
|
|
32
32
|
headerRendered?: boolean;
|
|
33
|
+
/** Locale-selected authored wording, supplied by the public interchange boundary. */
|
|
34
|
+
displayText?: string;
|
|
33
35
|
}
|
|
34
36
|
export declare function formatCanonicalAdministration(a: CanonicalAdministration, style?: "short" | "long", options?: FormatOptions, compiled?: ReadonlyMap<CanonicalAdministration, CanonicalSigClause>, authored?: AuthoredDirectionsState, stageSafety?: CanonicalSafety): string;
|
|
35
37
|
export declare function formatCanonicalCourse(oneOrCourse: CanonicalCourse, style?: "short" | "long", options?: FormatBatchOptions, compiled?: ReadonlyMap<CanonicalAdministration, CanonicalSigClause>, authored?: AuthoredDirectionsState): string;
|
|
@@ -6,6 +6,8 @@ export interface TailTokenSegment {
|
|
|
6
6
|
tokens: Token[];
|
|
7
7
|
leadingSeparatorTokens: Token[];
|
|
8
8
|
range: TextRange;
|
|
9
|
+
/** Original coordinates belong to this text; display text may normalize whitespace. */
|
|
10
|
+
sourceText: string;
|
|
9
11
|
text: string;
|
|
10
12
|
}
|
|
11
13
|
export interface ParsedInstructionTokenSegment {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { DosageDifference } from "./canonical/dosage-agreement";
|
|
2
|
+
import type { FhirDosage, FhirR6DosageInstruction, FhirR6DosageInstructionInput, ParseBatchResult } from "./types";
|
|
3
|
+
export type MultilingualDosageInput = FhirDosage | readonly FhirDosage[] | FhirR6DosageInstructionInput | ParseBatchResult;
|
|
4
|
+
export interface CombineMultilingualDosagesOptions {
|
|
5
|
+
/** Locale key whose authored clinical quantities and wording are retained as the originals. Defaults to the first key. */
|
|
6
|
+
primaryLocale?: string;
|
|
7
|
+
/** Zero-based canonical paths of clinician-paired free text, e.g. "stages[0].administrations[0].additionalInstructions[0]". */
|
|
8
|
+
pairedText?: readonly string[];
|
|
9
|
+
}
|
|
10
|
+
export interface MultilingualDosageConflict {
|
|
11
|
+
primaryLocale: string;
|
|
12
|
+
locale: string;
|
|
13
|
+
path: string;
|
|
14
|
+
primary: unknown;
|
|
15
|
+
other: unknown;
|
|
16
|
+
reason: DosageDifference["reason"] | "input" | "different-translation" | "uncompared-modifier";
|
|
17
|
+
}
|
|
18
|
+
export type CombineMultilingualDosagesResult = {
|
|
19
|
+
ok: true;
|
|
20
|
+
primaryLocale: string;
|
|
21
|
+
fhir: FhirDosage[];
|
|
22
|
+
fhirNext: FhirR6DosageInstruction;
|
|
23
|
+
} | {
|
|
24
|
+
ok: false;
|
|
25
|
+
conflicts: MultilingualDosageConflict[];
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Compose independently supplied versions of one dosage course. Locale keys
|
|
29
|
+
* associate the authored SIGs. Use pairedText to also associate independently
|
|
30
|
+
* supplied opaque advice or PRN wording at explicitly aligned native positions.
|
|
31
|
+
*/
|
|
32
|
+
export declare function combineMultilingualDosages(inputs: Readonly<Record<string, MultilingualDosageInput>>, options?: CombineMultilingualDosagesOptions): CombineMultilingualDosagesResult;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TEMPORAL_DATE_RELATION_SOURCES } from "./hpsg/lexical-classes";
|
|
1
2
|
import { CanonicalCalendarEventExpr, MedicationDateResolver, ParseOptions } from "./types";
|
|
2
3
|
export type MedicationDateRelation = "event" | "start-inclusive" | "start-exclusive" | "end-inclusive" | "end-exclusive";
|
|
3
4
|
export interface MedicationDateListMatch {
|
|
@@ -10,13 +11,46 @@ export interface MedicationDateListMatch {
|
|
|
10
11
|
events: CanonicalCalendarEventExpr[];
|
|
11
12
|
unresolved: boolean;
|
|
12
13
|
}
|
|
14
|
+
export interface MedicationDateLexicon {
|
|
15
|
+
months?: ReadonlyArray<{
|
|
16
|
+
month: number;
|
|
17
|
+
forms: readonly string[];
|
|
18
|
+
}>;
|
|
19
|
+
listSeparator?: string;
|
|
20
|
+
eventLead?: string;
|
|
21
|
+
endInclusiveExtra?: string;
|
|
22
|
+
monthBoundary?: string;
|
|
23
|
+
relations?: Partial<typeof TEMPORAL_DATE_RELATION_SOURCES>;
|
|
24
|
+
}
|
|
25
|
+
export interface MedicationDateLexicalFeatures {
|
|
26
|
+
namedMonths: ReadonlyMap<string, number>;
|
|
27
|
+
monthToken: RegExp;
|
|
28
|
+
textualDmy: RegExp;
|
|
29
|
+
textualMdy: RegExp;
|
|
30
|
+
components: RegExp;
|
|
31
|
+
requiredLead: string;
|
|
32
|
+
list: string;
|
|
33
|
+
yearfulList: string;
|
|
34
|
+
listScans: readonly [RegExp, RegExp];
|
|
35
|
+
licensedListScan: RegExp;
|
|
36
|
+
leadPrefix: RegExp;
|
|
37
|
+
leadListAnchored: RegExp;
|
|
38
|
+
listAnchored: RegExp;
|
|
39
|
+
yearfulListAnchored: RegExp;
|
|
40
|
+
leads: ReadonlyArray<{
|
|
41
|
+
group: string;
|
|
42
|
+
relation: MedicationDateRelation;
|
|
43
|
+
}>;
|
|
44
|
+
}
|
|
45
|
+
/** Compile the existing date grammar's lexical slots once per registered pack. */
|
|
46
|
+
export declare function compileMedicationDateLexicon(configured: MedicationDateLexicon): MedicationDateLexicalFeatures;
|
|
13
47
|
/** Register or replace a calendar resolver used by medication date interpretation. */
|
|
14
48
|
export declare function registerMedicationDateResolver(resolver: MedicationDateResolver): void;
|
|
15
49
|
/** Return the currently registered calendar resolver ids. */
|
|
16
50
|
export declare function listMedicationDateResolvers(): string[];
|
|
17
51
|
/** Scan structurally date-shaped numeric date lists, whether resolved or ambiguous. */
|
|
18
|
-
export declare function findMedicationDateListSpans(input: string, options?: ParseOptions): MedicationDateListMatch[];
|
|
52
|
+
export declare function findMedicationDateListSpans(input: string, options?: ParseOptions, licensedDateContext?: boolean): MedicationDateListMatch[];
|
|
19
53
|
/** Resolve a date list beginning exactly at the supplied source offset. */
|
|
20
|
-
export declare function parseMedicationDateListAt(input: string, start: number, options?: ParseOptions): MedicationDateListMatch | undefined;
|
|
54
|
+
export declare function parseMedicationDateListAt(input: string, start: number, options?: ParseOptions, licensedDateContext?: boolean): MedicationDateListMatch | undefined;
|
|
21
55
|
/** True when a source range overlaps a recognized date-shaped list span. */
|
|
22
56
|
export declare function sourceRangeOverlapsMedicationDate(input: string, start: number, end: number, options?: ParseOptions): boolean;
|
package/dist/dosage-course.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { CanonicalTrackCycle } from "./canonical/course";
|
|
2
|
+
export { retainField, readRetainedField } from "./fhir-quantity-operator";
|
|
1
3
|
import { FhirDayOfWeek, FhirDosage, FhirExtension, FhirR6Extension, FhirQuantity, FhirR6Dosage, FhirR6DosageCondition, FhirR6DosageInstruction, FhirR6DosageStep, FhirR6DosageInstructionInput, FhirR6DosageSafety, FhirR6TimingRepeat, MedicationCondition, EzDosage, EzCourseMetadata, EzCourseStep } from "./types";
|
|
2
4
|
/** R5 and R6 tim-8 requires the lower-count Element beside countMax, not a numeric
|
|
3
5
|
* minimum. Preserve authored companions; an absent minimum remains unknown. */
|
|
@@ -12,7 +14,7 @@ export declare const DOSAGE_CONDITION_R5_URL = "urn:ezmedicationinput:StructureD
|
|
|
12
14
|
* a different context and nested child contract, so it cannot be reused. */
|
|
13
15
|
export declare const DOSAGE_CONDITION_R6_LOGIC_URL = "urn:ezmedicationinput:StructureDefinition:medication-r6-condition-logic";
|
|
14
16
|
export declare const DOSAGE_EXCLUDED_DATES_R5_URL = "urn:ezmedicationinput:StructureDefinition:medication-excluded-calendar-dates";
|
|
15
|
-
export
|
|
17
|
+
export { DOSAGE_DETAILS_R5_URL } from "./fhir-quantity-operator";
|
|
16
18
|
/** Keeps an expression-only R5 backbone element valid without inventing a dose. */
|
|
17
19
|
export declare const R5_EXPRESSION_SLOT_SOURCE_URL = "urn:ezmedicationinput:StructureDefinition:r5-expression-slot-source";
|
|
18
20
|
/** Non-modifier metadata: preserves the author's entire literal instruction
|
|
@@ -47,6 +49,19 @@ export declare function setCourseCycleCount(owner: {
|
|
|
47
49
|
export declare function setCourseCycleCount(owner: {
|
|
48
50
|
modifierExtension?: FhirR6Extension[];
|
|
49
51
|
}, count: number | undefined): FhirR6Extension[] | undefined;
|
|
52
|
+
/** An independent track repeats only its named source members. Ignoring this
|
|
53
|
+
* modifier would change which administrations recur; it is not a root repeatCycle. */
|
|
54
|
+
export declare const COURSE_TRACK_CYCLE_EXTENSION_URL = "urn:ezmedicationinput:StructureDefinition:medication-track-cycle";
|
|
55
|
+
export declare function getCourseTrackCycles(owner: {
|
|
56
|
+
modifierExtension?: readonly FhirR6Extension[];
|
|
57
|
+
}): CanonicalTrackCycle[] | undefined;
|
|
58
|
+
/** Both external course writers use the same scoped modifier contract. */
|
|
59
|
+
export declare function setCourseTrackCycles(owner: {
|
|
60
|
+
modifierExtension?: FhirExtension[];
|
|
61
|
+
}, cycles: readonly CanonicalTrackCycle[] | undefined): void;
|
|
62
|
+
export declare function setCourseTrackCycles(owner: {
|
|
63
|
+
modifierExtension?: FhirR6Extension[];
|
|
64
|
+
}, cycles: readonly CanonicalTrackCycle[] | undefined): void;
|
|
50
65
|
type ModifierWrapperOwner = {
|
|
51
66
|
extension?: FhirR6Extension[];
|
|
52
67
|
modifierExtension?: FhirR6Extension[];
|
|
@@ -189,7 +204,13 @@ export declare function getDosageExcludedDates(dosage: FhirDosage | EzDosage | F
|
|
|
189
204
|
export declare function setDosageExcludedDates(dosage: FhirDosage, dates: string[]): void;
|
|
190
205
|
export declare function getDosageExcludedWeekdays(dosage: FhirDosage | FhirR6Dosage): FhirDayOfWeek[];
|
|
191
206
|
export declare function setDosageExcludedWeekdays(dosage: FhirDosage, days: FhirDayOfWeek[]): void;
|
|
192
|
-
|
|
207
|
+
/** Project a complete predicate; existing locale/source context selects only
|
|
208
|
+
* its generated wording, never the encoded clinical meaning or authored text. */
|
|
209
|
+
export declare function conditionToR6(condition: MedicationCondition, context?: {
|
|
210
|
+
locale?: string;
|
|
211
|
+
text?: string;
|
|
212
|
+
extension?: readonly (FhirExtension | FhirR6Extension)[];
|
|
213
|
+
}): FhirR6DosageCondition;
|
|
193
214
|
declare function toR6Safety(dosage: FhirDosage, includePartialPeriods?: boolean): FhirR6DosageSafety | undefined;
|
|
194
215
|
/**
|
|
195
216
|
* Apply edits made through R5 maximum-dose fields without discarding safety
|
|
@@ -386,10 +407,9 @@ export declare function attachCourseDetailsExtensions(dosages: (FhirDosage | EzD
|
|
|
386
407
|
* supplies only final retained fields which cannot live in an R5 Dosage row.
|
|
387
408
|
* The old extension names remain stable so existing persisted edits reopen. */
|
|
388
409
|
export declare function attachR5RetainedRow(row: FhirDosage | EzDosage, retained: CompactCourseRow): void;
|
|
389
|
-
/**
|
|
390
|
-
*
|
|
391
|
-
|
|
392
|
-
export declare function attachQualifiedR5AmountDetails(row: FhirDosage): void;
|
|
410
|
+
/** Typed quantity qualifiers and unevaluated safety use the same retained-row
|
|
411
|
+
* modifier and edit baseline as the direct native R5 writer. */
|
|
412
|
+
export declare function attachQualifiedR5Details(row: FhirDosage, safety?: FhirR6DosageSafety): void;
|
|
393
413
|
/** A course with no administration has a source carrier, not a fabricated
|
|
394
414
|
* dosage. Encode the header and empty-stage metadata directly into its R5
|
|
395
415
|
* extension; do not allocate an intermediate external course. */
|
|
@@ -435,17 +455,6 @@ export declare function executablePhaseMetadata(step: NonNullable<CompactCourseR
|
|
|
435
455
|
export declare function getCourseContextIssue(course: FhirR6DosageInstruction): "missing-course-context" | "conflicting-course-phase" | undefined;
|
|
436
456
|
export declare function encodeR6SourceMetadata(url: string, value: object, kind: "drafts" | "safety" | "step"): FhirExtension;
|
|
437
457
|
export declare function decodeR6SourceMetadata(marker: FhirR6Extension, kind: "drafts" | "safety" | "step"): Record<string, unknown> | undefined;
|
|
438
|
-
/** Preserve an unfamiliar field as explicit typed extension content, never an
|
|
439
|
-
* opaque JSON string. Known FHIR fields use the named datatype schemas above;
|
|
440
|
-
* this escape hatch only retains future/unrecognized native fields verbatim.
|
|
441
|
-
* @param url The enclosing field name.
|
|
442
|
-
* @param value The actual source value; no clinical interpretation is inferred.
|
|
443
|
-
*/
|
|
444
|
-
export declare function retainField(url: string, value: unknown): FhirExtension;
|
|
445
|
-
/** Read retained fields without evaluating them or reparsing serialized text.
|
|
446
|
-
* @param node One preserved field extension.
|
|
447
|
-
*/
|
|
448
|
-
export declare function readRetainedField(node: FhirR6Extension): unknown;
|
|
449
458
|
/** Recover a course from a structured extension, leaving malformed originals
|
|
450
459
|
* with the caller for preservation. No string payload is interpreted here.
|
|
451
460
|
* @param node The dosageDetails extension child.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type LexToken } from "./lexer/token-types";
|
|
2
|
+
import { EventTiming, type ParseOptions } from "./types";
|
|
2
3
|
export interface EventTimingExpression {
|
|
3
4
|
timing: EventTiming;
|
|
4
5
|
length: number;
|
|
@@ -6,3 +7,27 @@ export interface EventTimingExpression {
|
|
|
6
7
|
export declare const MAX_EVENT_TIMING_EXPRESSION_PARTS: number;
|
|
7
8
|
/** Resolve the most specific canonical event expression at `start`. */
|
|
8
9
|
export declare function resolveEventTimingExpression(parts: readonly string[], start?: number, endExclusive?: number): EventTimingExpression | undefined;
|
|
10
|
+
/** A dose head owns its complete registered event modifiers. Return the
|
|
11
|
+
* selected nominal end so an adjacent calendar daughter can keep its own role.
|
|
12
|
+
* Withholding valence can also select the whole-medication noun without an event. */
|
|
13
|
+
export declare function medicationDoseSlotNominalEnd(words: readonly string[], options?: ParseOptions, requireEvent?: boolean): number | undefined;
|
|
14
|
+
/** Complete source coverage prevents an unrelated food or opaque noun from
|
|
15
|
+
* borrowing a contained event as proof of a medication target. */
|
|
16
|
+
export declare function isMedicationDoseSlotNominal(words: readonly string[], options?: ParseOptions): boolean;
|
|
17
|
+
export declare function eventTimingExpressionAt(tokens: readonly LexToken[], start: number, consumed?: ReadonlySet<number>): EventTimingExpression | undefined;
|
|
18
|
+
/** The complete registered nominal has the same owner at a relation lead and
|
|
19
|
+
* at a contained event token. Caller meanings retain their exact precedence. */
|
|
20
|
+
export declare function qualifiedMealStateNominalEnd(tokens: readonly LexToken[], start: number, options?: ParseOptions, input?: string): number | undefined;
|
|
21
|
+
/** Declared PRN leads are independent clauses. A bare FOR reason lead is
|
|
22
|
+
* ambiguous inside an unknown nominal and needs its ordinary PRN owner. */
|
|
23
|
+
export declare function isExplicitPrnClauseLead(tokens: readonly LexToken[], index: number, consumed?: ReadonlySet<number>): boolean;
|
|
24
|
+
/** Registered independent clauses end an accompaniment nominal. Reuse this
|
|
25
|
+
* boundary in the nominal reader and the free-advice body owner. */
|
|
26
|
+
export declare function isAccompanimentClauseBoundary(tokens: readonly LexToken[], index: number, consumed?: ReadonlySet<number>): boolean;
|
|
27
|
+
/** A negative accompaniment owns its event noun as advice, not a positive
|
|
28
|
+
* administration anchor. The chart and instruction boundary reader share this
|
|
29
|
+
* constituent ownership so list punctuation cannot split off an event daughter. */
|
|
30
|
+
export declare function isNegatedEventComplement(tokens: readonly LexToken[], index: number, consumed?: ReadonlySet<number>, options?: ParseOptions, input?: string): boolean;
|
|
31
|
+
/** Punctuation inside the same negative event list is a nominal boundary,
|
|
32
|
+
* not a new instruction. Every extraction path uses this selected scope. */
|
|
33
|
+
export declare function isNegatedEventListSeparator(tokens: readonly LexToken[], index: number, consumed?: ReadonlySet<number>, options?: ParseOptions, input?: string): boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CanonicalScheduleInput, CanonicalSupplyOptions } from "../canonical/course";
|
|
2
|
-
import type { NextDueDoseOptions, TotalUnitsResult } from "../types";
|
|
2
|
+
import type { DueDose, NextDueDoseOptions, TotalUnitsResult } from "../types";
|
|
3
3
|
export declare function nextDueDoses(dosage: CanonicalScheduleInput, options: NextDueDoseOptions): string[];
|
|
4
|
+
export declare function nextDueDosesDetailed(dosage: CanonicalScheduleInput, options: NextDueDoseOptions): DueDose[];
|
|
4
5
|
/** Supply math is deterministic only when the administered amount is known.
|
|
5
6
|
* Clinical conditions/PRN are represented as a maximum permitted supply,
|
|
6
7
|
* not as a claim that every available dose will actually be administered. */
|
|
@@ -15,7 +15,17 @@
|
|
|
15
15
|
* Keep this identifier in the leaf codec so annotation conversion does not
|
|
16
16
|
* initialize the course importer or clinical grammar. */
|
|
17
17
|
export declare const DOSAGE_RECONCILIATION_SOURCE_URL = "urn:ezmedicationinput:StructureDefinition:medication-course-reconciliation-source";
|
|
18
|
-
|
|
18
|
+
/** The same local R6-field carrier is valid on Dosage and nested Timing. */
|
|
19
|
+
export declare const DOSAGE_DETAILS_R5_URL = "urn:ezmedicationinput:StructureDefinition:medication-r6-course-details";
|
|
20
|
+
export declare const TIMING_OFFSETS_BRIDGE_SHAPE: {
|
|
21
|
+
readonly startOffset: {
|
|
22
|
+
readonly value: "valueQuantity";
|
|
23
|
+
};
|
|
24
|
+
readonly endOffset: {
|
|
25
|
+
readonly value: "valueQuantity";
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
import type { FhirExtension, FhirQuantity, FhirR6Quantity, FhirSimpleQuantity, FhirR6SimpleQuantity, FhirR6Timing, FhirR6TimingRepeat, FhirR6Coding, FhirR6CodeableConcept, FhirR6Expression, FhirR6Extension, FhirPrimitiveElement, FhirR6PrimitiveElement } from "./types";
|
|
19
29
|
export declare const EMA_QUANTITY_COMPARATOR_EXTENSION_URL = "http://ema.europa.eu/fhir/extension/comparator";
|
|
20
30
|
export declare const EMA_QUANTITY_OPERATOR_SYSTEM = "http://spor.ema.europa.eu/v1/lists/100000000008";
|
|
21
31
|
export declare const FHIR_QUANTITY_COMPARATOR_SYSTEM = "http://hl7.org/fhir/quantity-comparator";
|
|
@@ -29,8 +39,34 @@ export declare function getQuantityComparator(quantity: Pick<FhirR6Quantity, "co
|
|
|
29
39
|
/** Translations describe a particular code, not an operator slot. Preserve
|
|
30
40
|
* superseded labels under their original Coding, outside the active operator. */
|
|
31
41
|
export declare const QUANTITY_OPERATOR_SOURCE_URL = "urn:ezmedicationinput:StructureDefinition:quantity-operator-source";
|
|
42
|
+
/** Preserve an unfamiliar field as explicit typed extension content, never an
|
|
43
|
+
* opaque JSON string. Known FHIR fields use their declared datatype schemas;
|
|
44
|
+
* this escape hatch only retains future/unrecognized native fields verbatim.
|
|
45
|
+
* @param url The enclosing field name.
|
|
46
|
+
* @param value The actual source value; no clinical interpretation is inferred.
|
|
47
|
+
*/
|
|
48
|
+
export declare function retainField(url: string, value: unknown): FhirExtension;
|
|
49
|
+
/** Restore one retained name/value pair as a literal enumerable field. */
|
|
50
|
+
export declare function restoreRetainedField(result: Record<string, unknown>, child: FhirR6Extension): void;
|
|
51
|
+
/** Read retained fields without evaluating them or reparsing serialized text.
|
|
52
|
+
* @param node One preserved field extension.
|
|
53
|
+
*/
|
|
54
|
+
export declare function readRetainedField(node: FhirR6Extension): unknown;
|
|
55
|
+
export declare function quantityAnnotationExtensions(source: FhirR6Extension[], target: "r5"): FhirExtension[];
|
|
32
56
|
export declare function quantityAnnotationExtensions(source: FhirR6Extension[], target: "r5" | "r6"): FhirR6Extension[];
|
|
57
|
+
/** Read the two declared carrier values without requiring a wire cadence.
|
|
58
|
+
* Native import consumes these facts even when R6 core promotion is ineligible. */
|
|
59
|
+
export declare function readRetainedTimingOffsets(timing: FhirR6Timing): Pick<FhirR6TimingRepeat, "startOffset" | "endOffset"> | undefined;
|
|
60
|
+
/** The supported R6 Timing contract permits offsets on a repeated cadence. */
|
|
61
|
+
export declare function canUseCoreTimingOffsets(repeat: Pick<FhirR6TimingRepeat, "frequency" | "period"> | undefined): boolean;
|
|
62
|
+
export declare function withRetainedTimingOffsets(modifiers: FhirR6Extension[] | undefined, repeat: Pick<FhirR6TimingRepeat, "startOffset" | "endOffset">): FhirR6Extension[];
|
|
63
|
+
/** Follow declared Timing annotation carriers, without interpreting its schedule
|
|
64
|
+
* or walking opaque application payloads. Unchanged branches retain identity. */
|
|
65
|
+
export declare function quantityTimingForWire(timing: FhirR6Timing | undefined, target: "r5" | "r6"): FhirR6Timing | undefined;
|
|
66
|
+
export declare function quantityExpressionForWire(expression: FhirR6Expression, target: "r5" | "r6"): FhirR6Expression;
|
|
67
|
+
export declare function quantityConceptForWire(concept: FhirR6CodeableConcept | undefined, target: "r5" | "r6"): FhirR6CodeableConcept | undefined;
|
|
33
68
|
export declare function quantityCodingForWire(coding: FhirR6Coding | undefined, target: "r5" | "r6"): FhirR6Coding | undefined;
|
|
69
|
+
export declare function quantityPrimitiveForWire(primitive: FhirR6PrimitiveElement | undefined, target: "r5" | "r6"): FhirR6PrimitiveElement | undefined;
|
|
34
70
|
/** The known Quantity choice is projected; all unrelated opaque annotations
|
|
35
71
|
* retain their original datatype and fields at this version boundary. */
|
|
36
72
|
export declare function quantityPrimitiveForR5(primitive: FhirR6PrimitiveElement | undefined): FhirPrimitiveElement | undefined;
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import { FhirExtension, FhirPrimitiveElement, FhirR6PrimitiveElement, FhirR6Extension } from "./types";
|
|
2
2
|
export declare const FHIR_TRANSLATION_EXTENSION_URL = "http://hl7.org/fhir/StructureDefinition/translation";
|
|
3
|
+
export declare const FHIR_LANGUAGE_EXTENSION_URL = "http://hl7.org/fhir/StructureDefinition/language";
|
|
3
4
|
export declare function cloneI18nRecord(i18n: Record<string, string> | undefined): Record<string, string> | undefined;
|
|
4
5
|
export declare function mergeI18nRecords(...records: Array<Record<string, string> | undefined>): Record<string, string> | undefined;
|
|
5
6
|
export declare function cloneExtensions(extensions: FhirR6Extension[] | undefined): FhirExtension[] | undefined;
|
|
6
7
|
export declare function clonePrimitiveElement(element: FhirR6PrimitiveElement | undefined): FhirPrimitiveElement | undefined;
|
|
8
|
+
/** Write or clear one exact locale on the companion of a FHIR string or markdown primitive. */
|
|
9
|
+
export declare function withPrimitiveTranslation(element: FhirPrimitiveElement | undefined, locale: string, content: string | undefined, type?: "string" | "markdown"): FhirPrimitiveElement | undefined;
|
|
10
|
+
export declare function withPrimitiveTranslation(element: FhirR6PrimitiveElement | undefined, locale: string, content: string | undefined, type?: "string" | "markdown"): FhirR6PrimitiveElement | undefined;
|
|
11
|
+
/** The explicit human language of the primitive's original value. */
|
|
12
|
+
export declare function getPrimitiveLanguage(element: FhirR6PrimitiveElement | undefined): string | undefined;
|
|
13
|
+
/** Annotate the original string or markdown value while retaining its translations. */
|
|
14
|
+
export declare function withPrimitiveLanguage(element: FhirPrimitiveElement | undefined, locale: string): FhirPrimitiveElement;
|
|
15
|
+
export declare function withPrimitiveLanguage(element: FhirR6PrimitiveElement | undefined, locale: string): FhirR6PrimitiveElement;
|
|
7
16
|
export declare function buildTranslationPrimitiveElement(translations: Record<string, string> | undefined, base?: FhirPrimitiveElement): FhirPrimitiveElement | undefined;
|
|
8
17
|
export declare function mergeTranslationPrimitiveElement(base: FhirPrimitiveElement | undefined, translations: Record<string, string> | undefined): FhirPrimitiveElement | undefined;
|
|
18
|
+
export declare function getTranslationParts(extension: FhirR6Extension): {
|
|
19
|
+
locale?: string;
|
|
20
|
+
content?: string;
|
|
21
|
+
};
|
|
9
22
|
export declare function getPrimitiveTranslation(element: FhirR6PrimitiveElement | undefined, locale: string | undefined): string | undefined;
|
|
10
|
-
export declare function getPrimitiveTranslations(element: FhirR6PrimitiveElement | undefined): Record<string, string> | undefined;
|
|
23
|
+
export declare function getPrimitiveTranslations(element: FhirR6PrimitiveElement | undefined, fallback?: Record<string, string>): Record<string, string> | undefined;
|