ezmedicationinput 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +216 -18
- package/dist/adapters/canonical-course.d.ts +131 -0
- package/dist/adapters/r5-course.d.ts +27 -0
- package/dist/advice-locale-adapter.d.ts +24 -0
- package/dist/advice.d.ts +73 -6
- package/dist/body-site-grammar.d.ts +21 -2
- package/dist/body-site-lookup.d.ts +8 -0
- package/dist/body-site-spatial.d.ts +12 -2
- package/dist/body-site-target.d.ts +38 -3
- package/dist/canonical/compile.d.ts +98 -0
- package/dist/canonical/course.d.ts +388 -0
- package/dist/canonical/format-course.d.ts +38 -0
- package/dist/clause-tail-grammar.d.ts +2 -0
- package/dist/date-interpretation.d.ts +36 -2
- package/dist/dosage-course.d.ts +304 -30
- package/dist/event-timing-expression.d.ts +26 -1
- package/dist/execution/calendar.d.ts +107 -0
- package/dist/execution/engine.d.ts +11 -0
- package/dist/fhir-quantity-operator.d.ts +89 -0
- package/dist/fhir-translations.d.ts +5 -6
- package/dist/fhir.d.ts +119 -14
- package/dist/format.d.ts +106 -5
- package/dist/hpsg/constructions.d.ts +35 -8
- package/dist/hpsg/defaults.d.ts +2 -0
- package/dist/hpsg/lexical-classes.d.ts +196 -24
- package/dist/hpsg/method-lexicon.d.ts +3 -0
- package/dist/hpsg/procedural-context.d.ts +48 -5
- package/dist/hpsg/projection.d.ts +32 -1
- package/dist/hpsg/quantity-lexicon.d.ts +51 -0
- package/dist/hpsg/rule-context.d.ts +172 -7
- package/dist/hpsg/rules/clinical-quantity-rules.d.ts +16 -7
- package/dist/hpsg/rules/condition-rules.d.ts +13 -3
- package/dist/hpsg/rules/core-rules.d.ts +8 -2
- package/dist/hpsg/rules/instruction-rules.d.ts +2 -0
- package/dist/hpsg/rules/prn-rules.d.ts +12 -1
- package/dist/hpsg/rules/site-rules.d.ts +10 -1
- package/dist/hpsg/rules/timing-rules.d.ts +116 -22
- package/dist/hpsg/segmenter.d.ts +2 -2
- package/dist/hpsg/signature.d.ts +54 -7
- package/dist/hpsg/timing-lexicon.d.ts +18 -2
- package/dist/hpsg/unification.d.ts +3 -1
- package/dist/i18n.d.ts +37 -1
- package/dist/index.cjs +83231 -52284
- package/dist/index.d.ts +26 -9
- package/dist/index.js +83222 -52284
- package/dist/instruction-action-locale-adapter.d.ts +92 -5
- package/dist/instruction-action-parser.d.ts +43 -0
- package/dist/instruction-action-terminology.d.ts +44 -3
- package/dist/instruction-concept-terminology.d.ts +20 -1
- package/dist/instruction-graph-fhir.d.ts +10 -2
- package/dist/instruction-graph-ownership.d.ts +96 -0
- package/dist/instruction-graph.d.ts +68 -49
- package/dist/ir.d.ts +1 -1
- 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-segmenter.d.ts +1 -1
- package/dist/lexer/surface.d.ts +4 -1
- package/dist/lexer/token-types.d.ts +6 -0
- package/dist/locale-detection.d.ts +5 -0
- package/dist/locales/clause/en.d.ts +14 -0
- package/dist/locales/course/en.d.ts +20 -0
- package/dist/locales/course/th.d.ts +12 -0
- package/dist/localization.d.ts +76 -0
- package/dist/localized-timing.d.ts +1 -1
- package/dist/maps.d.ts +44 -10
- package/dist/medication-condition.d.ts +72 -11
- package/dist/parser-state.d.ts +12 -2
- package/dist/parser.d.ts +5 -3
- package/dist/prn.d.ts +13 -2
- package/dist/regimen/coordination-scope.d.ts +13 -1
- package/dist/regimen/grammar.d.ts +18 -1
- package/dist/regimen/parallel-course.d.ts +13 -42
- package/dist/regimen/planner.d.ts +2 -3
- package/dist/regimen/regimen.d.ts +8 -2
- package/dist/relation-terminology.d.ts +1 -0
- package/dist/schedule.d.ts +14 -10
- 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 +114 -1
- package/dist/types.d.ts +627 -61
- package/dist/unit-lexicon.d.ts +4 -1
- package/dist/utils/text.d.ts +3 -0
- package/dist/utils/units.d.ts +22 -0
- package/package.json +1 -1
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/** Civil-clock primitives shared by clinical occurrence and supply execution.
|
|
2
|
+
* Calendar stepping preserves the prescribed wall clock across DST and month
|
|
3
|
+
* boundaries. No medication, FHIR, parser, or persistence type lives here. */
|
|
4
|
+
export declare const SECONDS_PER_MINUTE = 60;
|
|
5
|
+
/** Caches expensive Intl.DateTimeFormat objects per time zone. */
|
|
6
|
+
export declare const dateTimeFormatCache: Map<string, Intl.DateTimeFormat>;
|
|
7
|
+
/** Separate cache for weekday formatting to avoid rebuilding formatters. */
|
|
8
|
+
export declare const weekdayFormatCache: Map<string, Intl.DateTimeFormat>;
|
|
9
|
+
export interface TimeParts {
|
|
10
|
+
year: number;
|
|
11
|
+
month: number;
|
|
12
|
+
day: number;
|
|
13
|
+
hour: number;
|
|
14
|
+
minute: number;
|
|
15
|
+
second: number;
|
|
16
|
+
}
|
|
17
|
+
export interface DateTimeFormatPart {
|
|
18
|
+
type: string;
|
|
19
|
+
value: string;
|
|
20
|
+
}
|
|
21
|
+
export interface IntlDateTimeFormatOptionsExtended extends Intl.DateTimeFormatOptions {
|
|
22
|
+
calendar?: string;
|
|
23
|
+
numberingSystem?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface DateTimeFormatWithParts {
|
|
26
|
+
formatToParts?: (date?: number | Date) => DateTimeFormatPart[];
|
|
27
|
+
}
|
|
28
|
+
/** Simple zero-padding helper for numeric components. */
|
|
29
|
+
export declare function pad(value: number, length?: number): string;
|
|
30
|
+
export declare function formatToParts(formatter: Intl.DateTimeFormat, date: Date): DateTimeFormatPart[];
|
|
31
|
+
/**
|
|
32
|
+
* Normalizes HH:mm or HH:mm:ss clocks into a consistent HH:mm:ss string.
|
|
33
|
+
*/
|
|
34
|
+
export declare function normalizeClock(clock: string): string;
|
|
35
|
+
/** Retrieves (and caches) an Intl formatter for calendar components. */
|
|
36
|
+
export declare function getDateTimeFormat(timeZone: string): Intl.DateTimeFormat;
|
|
37
|
+
/** Retrieves (and caches) a formatter for weekday lookups. */
|
|
38
|
+
export declare function getWeekdayFormat(timeZone: string): Intl.DateTimeFormat;
|
|
39
|
+
/**
|
|
40
|
+
* Extracts calendar components for a Date interpreted within the supplied time
|
|
41
|
+
* zone.
|
|
42
|
+
*/
|
|
43
|
+
export declare function getTimeParts(date: Date, timeZone: string): TimeParts;
|
|
44
|
+
/** Calculates the time-zone offset in minutes for a given instant. */
|
|
45
|
+
export declare function getOffset(date: Date, timeZone: string): number;
|
|
46
|
+
/** Locate the offset transition within one civil day. Calendar arithmetic
|
|
47
|
+
* can then split at the real discontinuity instead of assuming local wall
|
|
48
|
+
* clocks are monotone across a DST fold. Ordinary days need two lookups. */
|
|
49
|
+
export declare function calendarOffsetTransition(start: Date, end: Date, timeZone: string): number | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Renders an ISO-8601 string that reflects the provided time zone instead of
|
|
52
|
+
* defaulting to UTC.
|
|
53
|
+
*/
|
|
54
|
+
export declare function formatZonedIso(date: Date, timeZone: string): string;
|
|
55
|
+
/**
|
|
56
|
+
* Builds a Date representing a local wall-clock time in the target time zone.
|
|
57
|
+
*/
|
|
58
|
+
export declare function makeZonedDate(timeZone: string, year: number, month: number, day: number, hour: number, minute: number, second: number): Date | null;
|
|
59
|
+
/** Calendar boundaries use the iCalendar DATE-TIME convention for a
|
|
60
|
+
* nonexistent wall clock: apply the pre-gap offset and advance through the
|
|
61
|
+
* gap. Do not use this for prescribed dose events; a missing explicit
|
|
62
|
+
* timeOfDay still has no exact administration instant. */
|
|
63
|
+
export declare function calendarBoundaryDate(timeZone: string, year: number, month: number, day: number, hour: number, minute: number, second: number): Date | null;
|
|
64
|
+
export interface ClockParts {
|
|
65
|
+
hour: number;
|
|
66
|
+
minute: number;
|
|
67
|
+
second: number;
|
|
68
|
+
milliseconds: number;
|
|
69
|
+
}
|
|
70
|
+
/** Decode a clock once for reuse by the existing civil-date constructor. */
|
|
71
|
+
export declare function parseClockParts(clock: string): ClockParts;
|
|
72
|
+
/** Convenience wrapper around makeZonedDate for day-level math. */
|
|
73
|
+
export declare function makeZonedDateFromDay(base: Date, timeZone: string, clock: string | ClockParts): Date | null;
|
|
74
|
+
/** Returns a Date pinned to the start of the local day. */
|
|
75
|
+
export declare function startOfLocalDay(date: Date, timeZone: string): Date;
|
|
76
|
+
/** Adds a number of calendar days while remaining aligned to the time zone. */
|
|
77
|
+
export declare function addLocalDays(date: Date, days: number, timeZone: string): Date;
|
|
78
|
+
/** Advance a *calendar* dose cycle by local days while keeping its
|
|
79
|
+
* prescribed wall clock. Unlike an elapsed q24h interval, a course cycle
|
|
80
|
+
* cannot lose an hour at daylight-saving transitions. */
|
|
81
|
+
export declare function addCalendarDaysAtClock(instant: Date, days: number, timeZone: string, clock: Pick<TimeParts, "hour" | "minute" | "second">): Date | null;
|
|
82
|
+
/** A calendar cycle keeps its original wall clock even after one boundary
|
|
83
|
+
* falls into a DST gap. The next boundary resumes the prescribed hour. */
|
|
84
|
+
export declare function calendarDayStepper(anchor: Date, days: number, timeZone: string, originalClock?: Pick<TimeParts, "hour" | "minute" | "second">): (instant: Date) => Date | null;
|
|
85
|
+
/** Computes the local weekday token (mon..sun). */
|
|
86
|
+
export declare function getLocalWeekday(date: Date, timeZone: string): string;
|
|
87
|
+
export declare function getLocalDayNumber(date: Date, timeZone: string): number;
|
|
88
|
+
export declare function getLocalMonthIndex(date: Date, timeZone: string): number;
|
|
89
|
+
/** Parses arbitrary string/Date inputs into a valid Date instance. */
|
|
90
|
+
export declare function coerceDate(value: Date | string, label: string): Date;
|
|
91
|
+
/**
|
|
92
|
+
* Adds calendar months while respecting varying month lengths and DST.
|
|
93
|
+
*
|
|
94
|
+
* @param date Starting instant.
|
|
95
|
+
* @param months Number of calendar months to add.
|
|
96
|
+
* @param timeZone IANA timezone used for wall-clock preservation.
|
|
97
|
+
* @returns Shifted date preserving local clock and clamped day-of-month.
|
|
98
|
+
*/
|
|
99
|
+
export declare function addCalendarMonths(date: Date, months: number, timeZone: string, originalClock?: Pick<TimeParts, "hour" | "minute" | "second">): Date;
|
|
100
|
+
/**
|
|
101
|
+
* Formats a date into a local `HH:MM:SS` clock for the supplied timezone.
|
|
102
|
+
*
|
|
103
|
+
* @param date Source instant.
|
|
104
|
+
* @param timeZone IANA timezone to interpret the instant.
|
|
105
|
+
* @returns Local wall-clock time in `HH:MM:SS` format.
|
|
106
|
+
*/
|
|
107
|
+
export declare function toLocalClock(date: Date, timeZone: string): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CanonicalScheduleInput, CanonicalSupplyOptions } from "../canonical/course";
|
|
2
|
+
import type { NextDueDoseOptions, TotalUnitsResult } from "../types";
|
|
3
|
+
export declare function nextDueDoses(dosage: CanonicalScheduleInput, options: NextDueDoseOptions): string[];
|
|
4
|
+
/** Supply math is deterministic only when the administered amount is known.
|
|
5
|
+
* Clinical conditions/PRN are represented as a maximum permitted supply,
|
|
6
|
+
* not as a claim that every available dose will actually be administered. */
|
|
7
|
+
export declare class MedicationQuantityCalculationError extends Error {
|
|
8
|
+
readonly code: string;
|
|
9
|
+
constructor(code: string, message: string);
|
|
10
|
+
}
|
|
11
|
+
export declare function calculateTotalUnits(options: CanonicalSupplyOptions): TotalUnitsResult;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/** Established EMA SPOR Quantity Operator representation for R5 quantities.
|
|
2
|
+
*
|
|
3
|
+
* R5 Dosage.doseAndRate.doseQuantity / rateQuantity use SimpleQuantity,
|
|
4
|
+
* which has no comparator field. EMA's published comparator extension is
|
|
5
|
+
* applicable to Element and preserves the qualifier without erasing the
|
|
6
|
+
* numeric dose. General Quantity supports native comparators; SimpleQuantity
|
|
7
|
+
* remains comparator-free in both R5 and R6.
|
|
8
|
+
*
|
|
9
|
+
* Sources:
|
|
10
|
+
* EMA http://ema.europa.eu/fhir/extension/comparator
|
|
11
|
+
* EMA http://spor.ema.europa.eu/v1/lists/100000000008
|
|
12
|
+
* HL7 http://hl7.org/fhir/quantity-comparator
|
|
13
|
+
*/
|
|
14
|
+
/** Inactive retained wire data is shared by the version-boundary codecs.
|
|
15
|
+
* Keep this identifier in the leaf codec so annotation conversion does not
|
|
16
|
+
* initialize the course importer or clinical grammar. */
|
|
17
|
+
export declare const DOSAGE_RECONCILIATION_SOURCE_URL = "urn:ezmedicationinput:StructureDefinition:medication-course-reconciliation-source";
|
|
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";
|
|
29
|
+
export declare const EMA_QUANTITY_COMPARATOR_EXTENSION_URL = "http://ema.europa.eu/fhir/extension/comparator";
|
|
30
|
+
export declare const EMA_QUANTITY_OPERATOR_SYSTEM = "http://spor.ema.europa.eu/v1/lists/100000000008";
|
|
31
|
+
export declare const FHIR_QUANTITY_COMPARATOR_SYSTEM = "http://hl7.org/fhir/quantity-comparator";
|
|
32
|
+
/** Read the published EMA Coding without treating "average", "equivalent"
|
|
33
|
+
* or "range" as invented HL7 comparator semantics. */
|
|
34
|
+
export declare function getEmaQuantityComparator(quantity: Pick<FhirR6Quantity, "extension"> | undefined): FhirR6Quantity["comparator"];
|
|
35
|
+
/** Read the active qualifier. A clinician-edited native Quantity comparator
|
|
36
|
+
* wins over retained EMA metadata; SimpleQuantity falls back to EMA Coding.
|
|
37
|
+
* Use this for meaning/display, not the extension-only inspection API. */
|
|
38
|
+
export declare function getQuantityComparator(quantity: Pick<FhirR6Quantity, "comparator" | "extension"> | undefined): FhirR6Quantity["comparator"];
|
|
39
|
+
/** Translations describe a particular code, not an operator slot. Preserve
|
|
40
|
+
* superseded labels under their original Coding, outside the active operator. */
|
|
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[];
|
|
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;
|
|
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;
|
|
70
|
+
/** The known Quantity choice is projected; all unrelated opaque annotations
|
|
71
|
+
* retain their original datatype and fields at this version boundary. */
|
|
72
|
+
export declare function quantityPrimitiveForR5(primitive: FhirR6PrimitiveElement | undefined): FhirPrimitiveElement | undefined;
|
|
73
|
+
export declare function simpleQuantityForR5(quantity: FhirR6Quantity | undefined): FhirSimpleQuantity | undefined;
|
|
74
|
+
/** R6 SimpleQuantity keeps native primitive annotations while using the same
|
|
75
|
+
* comparator-free scalar representation as R5. */
|
|
76
|
+
export declare function simpleQuantityForR6(quantity: FhirR6Quantity | undefined): FhirR6SimpleQuantity | undefined;
|
|
77
|
+
/** A general R5 Quantity supports older native comparators. Its only
|
|
78
|
+
* missing R6 comparator is "~"; use the EMA extension for that case. */
|
|
79
|
+
export declare function quantityForR5(quantity: FhirR6Quantity | undefined): FhirQuantity | undefined;
|
|
80
|
+
/** A native Quantity operator has one active owner. Retain authored EMA
|
|
81
|
+
* annotations as inert source when writing that owner, so a subsequent edit
|
|
82
|
+
* of the external native comparator cannot revive a hidden duplicate. EMA-only
|
|
83
|
+
* input still owns its qualifier, and SimpleQuantity still writes active EMA. */
|
|
84
|
+
export declare function quantityForR6(quantity: FhirR6Quantity | undefined): FhirR6Quantity | undefined;
|
|
85
|
+
/** Read the current quantity operator at either FHIR boundary. The same EMA
|
|
86
|
+
* coding owns a SimpleQuantity in R5 and R6; native comparators take priority.
|
|
87
|
+
* Authored annotations and superseded labels remain recoverable source. */
|
|
88
|
+
export declare function quantityFromWire(quantity: FhirQuantity | FhirR6Quantity | FhirSimpleQuantity | undefined): FhirR6Quantity | undefined;
|
|
89
|
+
export { quantityFromWire as quantityFromR5 };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { FhirExtension, FhirPrimitiveElement } from "./types";
|
|
1
|
+
import { FhirExtension, FhirPrimitiveElement, FhirR6PrimitiveElement, FhirR6Extension } from "./types";
|
|
2
2
|
export declare const FHIR_TRANSLATION_EXTENSION_URL = "http://hl7.org/fhir/StructureDefinition/translation";
|
|
3
3
|
export declare function cloneI18nRecord(i18n: Record<string, string> | undefined): Record<string, string> | undefined;
|
|
4
4
|
export declare function mergeI18nRecords(...records: Array<Record<string, string> | undefined>): Record<string, string> | undefined;
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function clonePrimitiveElement(element: FhirPrimitiveElement | undefined): FhirPrimitiveElement | undefined;
|
|
5
|
+
export declare function cloneExtensions(extensions: FhirR6Extension[] | undefined): FhirExtension[] | undefined;
|
|
6
|
+
export declare function clonePrimitiveElement(element: FhirR6PrimitiveElement | undefined): FhirPrimitiveElement | undefined;
|
|
8
7
|
export declare function buildTranslationPrimitiveElement(translations: Record<string, string> | undefined, base?: FhirPrimitiveElement): FhirPrimitiveElement | undefined;
|
|
9
8
|
export declare function mergeTranslationPrimitiveElement(base: FhirPrimitiveElement | undefined, translations: Record<string, string> | undefined): FhirPrimitiveElement | undefined;
|
|
10
|
-
export declare function getPrimitiveTranslation(element:
|
|
11
|
-
export declare function getPrimitiveTranslations(element:
|
|
9
|
+
export declare function getPrimitiveTranslation(element: FhirR6PrimitiveElement | undefined, locale: string | undefined): string | undefined;
|
|
10
|
+
export declare function getPrimitiveTranslations(element: FhirR6PrimitiveElement | undefined, fallback?: Record<string, string>): Record<string, string> | undefined;
|
package/dist/fhir.d.ts
CHANGED
|
@@ -1,22 +1,59 @@
|
|
|
1
|
+
import type { ParseOptions } from "./types";
|
|
2
|
+
import type { HpsgClinicalQuantityFeature } from "./hpsg/signature";
|
|
1
3
|
import { ParserState } from "./parser-state";
|
|
2
|
-
import { CanonicalActivityTimingExpr, CanonicalCycleDayConstraint, CanonicalOccurrenceCapExpr, CanonicalSigClause, EventTiming, FhirDosage, FhirExtension, FhirTimingRepeat } from "./types";
|
|
4
|
+
import { CanonicalAdditionalInstructionExpr, CanonicalClinicalAdjuncts, CanonicalInstructionGraph, CanonicalActivityTimingExpr, CanonicalCycleDayConstraint, CanonicalOccurrenceCapExpr, CanonicalDoseRange, CanonicalDoseExpr, CanonicalSigClause, CanonicalScheduleExpr, EventTiming, FhirCodeableConcept, FhirR6CodeableConcept, FhirDosage, FhirExtension, FhirR6Extension, FhirR6Dosage, FhirR6Quantity, FhirRange, FhirR6Range, FhirTiming, FhirTimingRepeat, FhirR6TimingRepeat } from "./types";
|
|
3
5
|
/** Known modifier: an independent cadence is restricted by unresolved cycle days. */
|
|
4
6
|
export declare const CYCLE_DAY_ELIGIBILITY_EXTENSION_URL = "urn:ezmedicationinput:StructureDefinition:medication-cycle-day-eligibility";
|
|
5
7
|
/** Read the recognized cycle constraint without interpreting narrative text.
|
|
6
8
|
* @param dosage Editable R5/R6-compatible dosage with a retained known modifier.
|
|
7
9
|
*/
|
|
8
|
-
export declare function getCycleDayConstraint(dosage: FhirDosage): CanonicalCycleDayConstraint | undefined;
|
|
10
|
+
export declare function getCycleDayConstraint(dosage: FhirDosage | FhirR6Dosage): CanonicalCycleDayConstraint | undefined;
|
|
11
|
+
/** Preserve the source-decided cycle restriction as a genuine dosage modifier.
|
|
12
|
+
* @param constraint Recognized cycle ordinals and the unresolved calendar dependency.
|
|
13
|
+
*/
|
|
14
|
+
export declare function cycleDayConstraintExtension(constraint: CanonicalCycleDayConstraint, previous?: FhirExtension): FhirExtension;
|
|
9
15
|
export declare const TIMING_FREQUENCY_MIN_EXTENSION_URL = "urn:ezmedicationinput:StructureDefinition:medication-timing-frequency-min";
|
|
16
|
+
/** Divided administrations share the active treatment day of a civil-day interval. */
|
|
17
|
+
export declare const TIMING_FREQUENCY_WITHIN_DAY_EXTENSION_URL = "urn:ezmedicationinput:StructureDefinition:medication-timing-frequency-within-day";
|
|
18
|
+
/** Qualified per-administration duration, independent of a scalar rate denominator. */
|
|
19
|
+
export declare const TIMING_ADMINISTRATION_DURATION_EXTENSION_URL = "urn:ezmedicationinput:StructureDefinition:timing-administration-duration";
|
|
20
|
+
/** Decode one classified marker without flattening independent endpoints. */
|
|
21
|
+
export declare function parseTimingAdministrationDuration(extension: FhirR6Extension | undefined, current?: Pick<FhirR6TimingRepeat, "duration" | "durationMax" | "durationUnit">): (Partial<NonNullable<HpsgClinicalQuantityFeature["administrationDuration"]>> & {
|
|
22
|
+
range?: import("./canonical/course").CanonicalRange;
|
|
23
|
+
}) | undefined;
|
|
10
24
|
/** Modifier: each retained base-schedule opportunity occurs this many minutes later. */
|
|
11
25
|
export declare const ADMINISTRATION_OFFSET_EXTENSION_URL = "urn:ezmedicationinput:StructureDefinition:medication-administration-offset";
|
|
12
|
-
|
|
26
|
+
/** Modifier: a selective condition cannot allocate the authored shared amount. */
|
|
27
|
+
export declare const CONDITION_ALLOCATION_UNRESOLVED_EXTENSION_URL = "urn:ezmedicationinput:StructureDefinition:medication-condition-allocation-unresolved";
|
|
28
|
+
/** Keep the selective site's allowance in its own modifier, never on the whole dose. */
|
|
29
|
+
export declare function buildConditionAllocationUnresolvedExtension(target?: CanonicalClinicalAdjuncts["conditionTarget"]): FhirExtension;
|
|
30
|
+
export declare function conditionAllocationTargetFromExtension(marker: FhirR6Extension): CanonicalClinicalAdjuncts["conditionTarget"];
|
|
31
|
+
export declare function getAdministrationOffsetMinutes(dosage: FhirDosage | FhirR6Dosage): number | undefined;
|
|
13
32
|
/** Modifier retaining a course duration alongside its absolute calendar bounds. */
|
|
14
33
|
export declare const ANCHORED_COURSE_DURATION_EXTENSION_URL = "urn:ezmedicationinput:StructureDefinition:medication-anchored-course-duration";
|
|
15
34
|
/** Read the authored temporal quantity without reconstructing it from dates or text.
|
|
16
35
|
* @param dosage R5/R6-compatible dosage containing the known duration modifier.
|
|
17
36
|
* @returns The retained duration quantity or range, when supplied.
|
|
18
37
|
*/
|
|
19
|
-
export declare function getAnchoredCourseDuration(dosage: Pick<
|
|
38
|
+
export declare function getAnchoredCourseDuration(dosage: Pick<FhirR6Dosage, "modifierExtension"> & {
|
|
39
|
+
timing?: {
|
|
40
|
+
repeat?: {
|
|
41
|
+
boundsRange?: FhirR6Range;
|
|
42
|
+
boundsDuration?: FhirR6Quantity;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
}): Pick<FhirR6Extension, "valueQuantity" | "valueRange"> | undefined;
|
|
46
|
+
/** Core Range endpoints share one unit identity. The known duration modifier
|
|
47
|
+
* keeps both authored endpoints as active quantities when the wire range needs
|
|
48
|
+
* a common label or cannot express mixed elapsed/calendar units. */
|
|
49
|
+
export declare function projectCourseDurationRange(range: FhirRange): {
|
|
50
|
+
range: FhirRange;
|
|
51
|
+
source?: FhirExtension;
|
|
52
|
+
};
|
|
53
|
+
export declare function projectCourseDurationRange(range: FhirR6Range): {
|
|
54
|
+
range: FhirR6Range;
|
|
55
|
+
source?: FhirR6Extension;
|
|
56
|
+
};
|
|
20
57
|
export declare const TIMING_OFFSET_MIN_EXTENSION_URL = "urn:ezmedicationinput:StructureDefinition:medication-timing-offset-min";
|
|
21
58
|
export declare const TIMING_OFFSET_MAX_EXTENSION_URL = "urn:ezmedicationinput:StructureDefinition:medication-timing-offset-max";
|
|
22
59
|
export declare const TIMING_OFFSET_EXACT_EXTENSION_URL = "urn:ezmedicationinput:StructureDefinition:medication-timing-offset-exact";
|
|
@@ -24,12 +61,25 @@ export declare const TIMING_ACTIVITY_WINDOW_EXTENSION_URL = "urn:ezmedicationinp
|
|
|
24
61
|
/** Recurring administration opportunity window; distinct from a punctual
|
|
25
62
|
* FHIR Timing.repeat.when WAKE or HS administration. */
|
|
26
63
|
export declare const TIMING_EVENT_WINDOW_EXTENSION_URL = "urn:ezmedicationinput:StructureDefinition:medication-timing-event-window";
|
|
64
|
+
/** Independent clocks combined with event anchors share one recurrence/count.
|
|
65
|
+
* R5 and the current R6 pin forbid both core fields in that recurrence (tim-10). */
|
|
66
|
+
export declare const TIMING_ADDITIONAL_CLOCK_EXTENSION_URL = "urn:ezmedicationinput:StructureDefinition:medication-timing-additional-clock";
|
|
67
|
+
/** Wire primitive arrays contain metadata-only null positions. The clinical
|
|
68
|
+
* event list keeps values only, while the owning Timing retains wire positions. */
|
|
69
|
+
export declare function getTimingEvents(timing: Pick<FhirTiming, "event"> | undefined): string[] | undefined;
|
|
70
|
+
/** Core clock values take priority over the bridge. Null primitive positions
|
|
71
|
+
* carry metadata only; an explicitly empty clock array remains an empty field. */
|
|
72
|
+
export declare function getTimingClocks(repeat: Pick<FhirR6TimingRepeat, "timeOfDay" | "extension"> | undefined): string[] | undefined;
|
|
73
|
+
/** Independent event and clock opportunities share one wire recurrence.
|
|
74
|
+
* The original wire repeat distinguishes a bridge read from a current core edit;
|
|
75
|
+
* no administration/count/cap is split, and retired carriers cannot revive. */
|
|
76
|
+
export declare function projectTimingClocks<T extends Pick<FhirR6TimingRepeat, "timeOfDay" | "_timeOfDay" | "when" | "_when" | "extension">>(repeat: T, wireSource?: Pick<FhirTimingRepeat, "timeOfDay">, target?: "r5" | "r6"): T;
|
|
27
77
|
export declare const TIMING_CLOCK_WINDOW_EXTENSION_URL = "urn:ezmedicationinput:StructureDefinition:medication-timing-clock-window";
|
|
28
78
|
/** Read a local-clock recurrence window from structural timing metadata.
|
|
29
79
|
* @param repeat FHIR Timing.repeat containing a typed window extension.
|
|
30
80
|
* @returns Source clock endpoints and explicit endpoint inclusivity.
|
|
31
81
|
*/
|
|
32
|
-
export declare function getTimingClockWindow(repeat:
|
|
82
|
+
export declare function getTimingClockWindow(repeat: FhirR6TimingRepeat | undefined): {
|
|
33
83
|
start: string;
|
|
34
84
|
end: string;
|
|
35
85
|
endInclusive: boolean;
|
|
@@ -38,25 +88,34 @@ export declare function getTimingClockWindow(repeat: FhirTimingRepeat | undefine
|
|
|
38
88
|
export declare const TIMING_DAY_OF_MONTH_EXTENSION_URL = "http://hl7.org/fhir/StructureDefinition/timing-dayOfMonth";
|
|
39
89
|
/** Retrieve bounded executable month-day selection without interpreting prose.
|
|
40
90
|
* Unknown and malformed extensions remain in the original FHIR object.
|
|
41
|
-
* @param repeat Original FHIR R5 Timing.repeat with optional standard extensions.
|
|
91
|
+
* @param repeat Original FHIR R5/R6 Timing.repeat with optional standard extensions.
|
|
42
92
|
* @returns Sorted unique calendar days, or undefined when none are recognized.
|
|
43
93
|
*/
|
|
44
|
-
export declare function getTimingMonthDays(repeat:
|
|
94
|
+
export declare function getTimingMonthDays(repeat: FhirR6TimingRepeat | undefined): number[] | undefined;
|
|
45
95
|
export declare const TIMING_WEEKDAY_ORDINAL_EXTENSION_URL = "urn:ezmedicationinput:StructureDefinition:medication-timing-weekday-ordinal";
|
|
46
96
|
/** Read the explicitly encoded ordinal, independent of prose and scheduling anchors.
|
|
47
97
|
* @param repeat Typed FHIR timing repeat containing an optional ordinal extension.
|
|
48
98
|
* @returns The source weekday occurrence, including -1 for last, when valid.
|
|
49
99
|
*/
|
|
50
|
-
export declare function getTimingWeekdayOrdinal(repeat:
|
|
100
|
+
export declare function getTimingWeekdayOrdinal(repeat: FhirR6TimingRepeat | undefined): -1 | 1 | 2 | 3 | 4 | 5 | undefined;
|
|
51
101
|
/** Read an explicitly encoded daily event window without examining SIG text. */
|
|
52
|
-
export declare function getTimingEventWindow(repeat:
|
|
102
|
+
export declare function getTimingEventWindow(repeat: FhirR6TimingRepeat | undefined): {
|
|
53
103
|
start: EventTiming;
|
|
54
104
|
end: EventTiming;
|
|
55
105
|
} | undefined;
|
|
56
106
|
export declare const TIMING_OCCURRENCE_CAP_EXTENSION_URL = "urn:ezmedicationinput:StructureDefinition:medication-timing-occurrence-cap";
|
|
107
|
+
/** Internal current recurrence fact; deliberately absent from public index exports. */
|
|
108
|
+
export declare const TIMING_SHARED_COUNT_EXTENSION_URL = "urn:ezmedicationinput:StructureDefinition:medication-timing-shared-count";
|
|
57
109
|
export declare const TIMING_EVENT_CALENDAR_SOURCE_EXTENSION_URL = "urn:ezmedicationinput:StructureDefinition:medication-timing-event-calendar-source";
|
|
58
110
|
export declare const PRN_TRIGGER_PHASE_EXTENSION_URL = "urn:ezmedicationinput:StructureDefinition:medication-prn-trigger-phase";
|
|
111
|
+
/** Explicit counted per-target allocation; anatomical cardinality alone is not this fact. */
|
|
112
|
+
export declare const DOSAGE_DOSE_ALLOCATION_EXTENSION_URL = "urn:ezmedicationinput:StructureDefinition:medication-dose-allocation";
|
|
113
|
+
export declare function getDosageDoseAllocation(dosage: {
|
|
114
|
+
modifierExtension?: FhirR6Extension[];
|
|
115
|
+
}): CanonicalDoseExpr["allocation"];
|
|
59
116
|
export declare const BODY_SITE_RESTRICTION_EXTENSION_URL = "urn:ezmedicationinput:StructureDefinition:medication-body-site-restriction";
|
|
117
|
+
/** An explicitly authored vehicle volume, independent of active dose or rate. */
|
|
118
|
+
export declare const INFUSION_CARRIER_VOLUME_EXTENSION_URL = "urn:ezmedicationinput:StructureDefinition:medication-infusion-carrier-volume";
|
|
60
119
|
export declare const INFUSION_CARRIER_MATERIAL_EXTENSION_URL = "urn:ezmedicationinput:StructureDefinition:medication-infusion-carrier-material";
|
|
61
120
|
/** Draft FHIR R5 extension definition, produced from the same typed child
|
|
62
121
|
* contract as the live encoder. Carrier material is a descriptive vehicle
|
|
@@ -137,12 +196,28 @@ export declare function buildInfusionCarrierMaterialStructureDefinition(): {
|
|
|
137
196
|
})[];
|
|
138
197
|
};
|
|
139
198
|
};
|
|
140
|
-
|
|
141
|
-
|
|
199
|
+
/** Preserve a clinically named vehicle without claiming it has a verified
|
|
200
|
+
* terminology identity. This describes the volume-owned material and never
|
|
201
|
+
* changes dose/rate scheduling or converts a vehicle into the active drug.
|
|
202
|
+
*/
|
|
203
|
+
export declare function infusionCarrierMaterialExtension(material: NonNullable<HpsgClinicalQuantityFeature["carrierMaterial"]>): FhirExtension;
|
|
204
|
+
/** Typed FHIR extraction: retain only supplied extension children, never
|
|
205
|
+
* guess a vehicle from original SIG text or volume/mass alone.
|
|
206
|
+
*/
|
|
207
|
+
export declare function infusionCarrierMaterialFromFhir(dosage: FhirDosage): HpsgClinicalQuantityFeature["carrierMaterial"];
|
|
208
|
+
/** Reconstitute dimensional R5 meaning only where the role and amount were
|
|
209
|
+
* explicitly supplied. Other external rateRatio dosages remain untouched.
|
|
210
|
+
*/
|
|
211
|
+
export declare function clinicalCarrierQuantityFromFhir(dosage: FhirDosage): HpsgClinicalQuantityFeature | undefined;
|
|
212
|
+
export declare function parsePrnTriggerPhase(concept: FhirR6CodeableConcept | undefined): "onset" | undefined;
|
|
213
|
+
export declare function getExactTimingOffsetMinutes(repeat: FhirR6TimingRepeat | undefined): number | undefined;
|
|
214
|
+
/** Read the explicit shared allowance, never derive membership from source or phase IDs. */
|
|
215
|
+
export declare function getTimingSharedCount(repeat: FhirR6TimingRepeat | undefined): CanonicalScheduleExpr["sharedCount"];
|
|
216
|
+
export declare function getTimingOccurrenceCap(repeat: FhirR6TimingRepeat | undefined): CanonicalOccurrenceCapExpr | undefined;
|
|
142
217
|
/** Read typed activity-event relations from Timing extensions without parsing
|
|
143
218
|
* narrative instructions or inferring an activity's calendar instant.
|
|
144
219
|
*/
|
|
145
|
-
export declare function parseActivityTimingExtensions(repeat:
|
|
220
|
+
export declare function parseActivityTimingExtensions(repeat: FhirR6TimingRepeat | undefined): CanonicalActivityTimingExpr[] | undefined;
|
|
146
221
|
export interface FhirProjectionOptions {
|
|
147
222
|
/** Typed regimen-graph sequence; serialized without inferring phase meaning. */
|
|
148
223
|
sequence?: number;
|
|
@@ -158,7 +233,37 @@ export interface FhirProjectionOptions {
|
|
|
158
233
|
*/
|
|
159
234
|
includeTranslationExtensions?: boolean;
|
|
160
235
|
}
|
|
236
|
+
export declare function createEmptyCanonicalClause(rawText: string): CanonicalSigClause;
|
|
237
|
+
export declare function extractCanonicalDoseRange(range: FhirRange): {
|
|
238
|
+
range?: CanonicalDoseRange;
|
|
239
|
+
unit?: string;
|
|
240
|
+
warning?: string;
|
|
241
|
+
};
|
|
242
|
+
/** Shared FHIR terminology/source serializer for BOTH output versions.
|
|
243
|
+
* This serializes coded context only; no course, dose or scheduling semantics
|
|
244
|
+
* are read back from this interchange object. R5/R6 adapters own their own
|
|
245
|
+
* quantity and timing choices around the same exact clinical code payload. */
|
|
246
|
+
export declare function serializeCanonicalContext(clause: CanonicalSigClause, options?: FhirProjectionOptions): Pick<FhirDosage, "extension" | "route" | "site" | "method" | "additionalInstruction" | "asNeeded" | "asNeededFor" | "patientInstruction">;
|
|
247
|
+
/** Core Timing offsets require a nonnegative integer and a supplied when
|
|
248
|
+
* element without a neutral meal code. An extension-only primitive is still
|
|
249
|
+
* a supplied element; its annotation does not invent an event identity. */
|
|
250
|
+
export declare function canUseCoreTimingOffset(when: readonly (string | null)[] | undefined, offset: number | undefined, suppliedWhenElement?: boolean): boolean;
|
|
251
|
+
/** Shared wire Timing/source metadata serializer. This projects the already
|
|
252
|
+
* scoped canonical schedule; it never parses or interprets external dosage.
|
|
253
|
+
* R5 and current-R6 adapters independently choose their Quantity encodings. */
|
|
254
|
+
export declare function serializeCanonicalSchedule(schedule: CanonicalSigClause["schedule"], options?: FhirProjectionOptions, clinicalQuantity?: HpsgClinicalQuantityFeature, asNeeded?: boolean): Pick<FhirDosage, "timing" | "modifierExtension">;
|
|
255
|
+
/** Project only independent typed warnings; related actions keep their graph scope.
|
|
256
|
+
* Existing standard entries are never rewritten or removed. Generated wording
|
|
257
|
+
* comes from the selected action/arguments, not the graph's authored source.
|
|
258
|
+
*/
|
|
259
|
+
export declare function independentGraphWarningAdvice(graph: CanonicalInstructionGraph | undefined, typed: readonly CanonicalAdditionalInstructionExpr[] | undefined): FhirCodeableConcept[] | undefined;
|
|
161
260
|
export declare function canonicalToFhir(clause: CanonicalSigClause, textOverride?: string, options?: FhirProjectionOptions): FhirDosage;
|
|
162
261
|
export declare function toFhir(state: ParserState): FhirDosage;
|
|
163
|
-
|
|
164
|
-
|
|
262
|
+
/** Decode common coded source annotations for either FHIR version.
|
|
263
|
+
* No dose, rate, Timing, course, or compatibility marker is interpreted here.
|
|
264
|
+
* Native-course import supplies an R6 CodeableReference's concept explicitly. */
|
|
265
|
+
export declare function deserializeCanonicalContext(dosage: Pick<FhirR6Dosage, "text" | "route" | "method" | "asNeeded" | "asNeededFor" | "additionalInstruction" | "patientInstruction" | "extension"> & {
|
|
266
|
+
site?: FhirR6CodeableConcept;
|
|
267
|
+
}, options?: ParseOptions): CanonicalSigClause;
|
|
268
|
+
export declare function canonicalFromFhir(dosage: FhirDosage, options?: ParseOptions): CanonicalSigClause;
|
|
269
|
+
export declare function parserStateFromFhir(dosage: FhirDosage, options?: ParseOptions): ParserState;
|
package/dist/format.d.ts
CHANGED
|
@@ -1,14 +1,115 @@
|
|
|
1
|
+
import type { CourseLanguage } from "./localization";
|
|
1
2
|
import { ParserState } from "./parser-state";
|
|
2
|
-
import type
|
|
3
|
-
import {
|
|
3
|
+
import { resolveNativeClauseRendering, type SigLocalization, type SigLongContext } from "./i18n";
|
|
4
|
+
import { type InstructionGraphPrimaryCondition } from "./instruction-graph";
|
|
5
|
+
import { type AdviceFrame, type CanonicalAdditionalInstructionExpr, CanonicalScheduleExpr, CanonicalSigClause, EventTiming, FhirPeriodUnit, type MedicationCondition, type FhirDayOfWeek } from "./types";
|
|
4
6
|
import { type TimingSummaryOptions } from "./timing-summary";
|
|
5
|
-
export declare
|
|
7
|
+
export declare function scheduleOf(clause: CanonicalSigClause): CanonicalScheduleExpr;
|
|
8
|
+
/** A method can name a registered manner rather than an action head. */
|
|
9
|
+
export declare function registeredMethodManner(method: CanonicalSigClause["method"], resolvedMethod?: SigLongContext["resolvedMethod"]): import("./types").AdditionalInstructionDefinition | undefined;
|
|
10
|
+
export declare function alternateDayEvent(schedule: CanonicalScheduleExpr | undefined): EventTiming | undefined;
|
|
6
11
|
/** Daily recurrence applies to every explicit clock, not one occurrence in total.
|
|
7
12
|
* Presentation may say "daily at ..." without rewriting the stored frequency.
|
|
8
13
|
* Explicit ranges and counts other than one retain their authored summary.
|
|
9
14
|
* @param schedule Typed timing to realize; source text is never inspected.
|
|
10
15
|
*/
|
|
11
16
|
export declare function hasDailyRecurrenceAcrossClocks(schedule: CanonicalScheduleExpr | undefined): boolean;
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
type FrequencyDisplayMode = "daily" | "daily-count" | "daily-range" | "daily-maximum" | "period" | "period-maximum" | "alternate-days" | "treatment-day-count" | "calendar-count" | "calendar-range" | "calendar-maximum" | "code" | "code-period" | "count" | "count-bounds";
|
|
18
|
+
interface FrequencyDisplay {
|
|
19
|
+
mode: FrequencyDisplayMode;
|
|
20
|
+
countPrefix: "none" | "count" | "range" | "maximum";
|
|
21
|
+
frequency?: number;
|
|
22
|
+
frequencyMax?: number;
|
|
23
|
+
period?: number;
|
|
24
|
+
periodMax?: number;
|
|
25
|
+
periodUnit?: FhirPeriodUnit;
|
|
26
|
+
rangeEnd?: number;
|
|
27
|
+
timingCode?: string;
|
|
28
|
+
codePeriod?: {
|
|
29
|
+
period: number;
|
|
30
|
+
periodUnit: FhirPeriodUnit;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** Select the independent cadence label; a selected event owns its own identity. */
|
|
34
|
+
export declare function timingPreviewCadenceCode(code: string, schedule: CanonicalScheduleExpr): string | undefined;
|
|
35
|
+
/** Select clinical display meaning once; each locale retains its wording. */
|
|
36
|
+
export declare function frequencyDisplay(schedule: CanonicalScheduleExpr | undefined, uppercaseTimingCode?: boolean): FrequencyDisplay | undefined;
|
|
37
|
+
export declare function standaloneOccurrenceCount(schedule: CanonicalScheduleExpr | undefined): number | undefined;
|
|
38
|
+
export { doseUnitUsesTargetScope } from "./body-site-target";
|
|
39
|
+
/** Whether the recurrence supports describing selected days as occurring each month. */
|
|
40
|
+
export declare function dayOfMonthUsesSingleMonth(schedule: CanonicalScheduleExpr | undefined): boolean;
|
|
41
|
+
export declare function formatDurationShort(schedule: CanonicalScheduleExpr): string | undefined;
|
|
42
|
+
export interface DurationWording {
|
|
43
|
+
readonly locale: string;
|
|
44
|
+
readonly coursePrefix: string;
|
|
45
|
+
readonly administrationPrefix: string;
|
|
46
|
+
readonly administrationShortPrefix: string;
|
|
47
|
+
readonly range: string;
|
|
48
|
+
readonly upper: string;
|
|
49
|
+
readonly lower: string;
|
|
50
|
+
administrationUnit(unit: FhirPeriodUnit, value: number | undefined, maximum: number | undefined, short: boolean, words: CourseLanguage): string;
|
|
51
|
+
}
|
|
52
|
+
export declare function describeDuration(schedule: CanonicalScheduleExpr | undefined, words: CourseLanguage, text: DurationWording): string | undefined;
|
|
53
|
+
export declare function describeAdministrationDuration(schedule: CanonicalScheduleExpr | undefined, short: boolean, words: CourseLanguage, text: DurationWording, prefix?: string): string | undefined;
|
|
54
|
+
type TimingPreviewRecurrence = Pick<CanonicalScheduleExpr, "frequency" | "frequencyMax" | "period" | "periodMax" | "periodUnit"> & {
|
|
55
|
+
when?: readonly (string | null)[];
|
|
56
|
+
timeOfDay?: readonly (string | null)[];
|
|
57
|
+
};
|
|
58
|
+
/** Preserve free labels and independently selected cadence beside a range. */
|
|
59
|
+
export declare function independentTimingText(code: string | undefined, recurrence?: TimingPreviewRecurrence): string | undefined;
|
|
60
|
+
export declare function timingCodeMatchesRecurrence(schedule: TimingPreviewRecurrence & Pick<CanonicalScheduleExpr, "timingCode">, code?: string | undefined): boolean;
|
|
61
|
+
/** A code-only event supplies display meaning without changing authored timing. */
|
|
62
|
+
export declare function timingEventPreviewSchedule(schedule: CanonicalScheduleExpr | undefined): CanonicalScheduleExpr | undefined;
|
|
63
|
+
export interface LongAdministrationTimingParts {
|
|
64
|
+
frequency?: string;
|
|
65
|
+
event?: string;
|
|
66
|
+
eventWindow?: string;
|
|
67
|
+
clockWindow?: string;
|
|
68
|
+
activities: string[];
|
|
69
|
+
calendarEvents?: string;
|
|
70
|
+
dayOfWeek?: string;
|
|
71
|
+
dayOfMonth?: string;
|
|
72
|
+
calendarBounds?: string;
|
|
73
|
+
count?: string;
|
|
74
|
+
administrationDuration?: string;
|
|
75
|
+
duration?: string;
|
|
76
|
+
occurrenceCap?: string;
|
|
77
|
+
administrationNote?: string;
|
|
78
|
+
}
|
|
79
|
+
interface RichAdministrationParts {
|
|
80
|
+
route?: string;
|
|
81
|
+
frequencyWithoutEvent?: string;
|
|
82
|
+
independentTiming?: string;
|
|
83
|
+
clock?: string;
|
|
84
|
+
asNeeded?: string;
|
|
85
|
+
site?: string;
|
|
86
|
+
coversSingleEvent: boolean;
|
|
87
|
+
}
|
|
88
|
+
/** Locale realizers supply words; their clinical timing order is shared. */
|
|
89
|
+
export declare function describeClockWindow(schedule: CanonicalScheduleExpr | undefined, timing: ReturnType<typeof resolveNativeClauseRendering>["timing"]): string | undefined;
|
|
90
|
+
export declare function appendLongAdministrationTiming(parts: string[], timing: LongAdministrationTimingParts, richTiming?: RichAdministrationParts): void;
|
|
91
|
+
export declare function richGraphAdministrationTail(clause: CanonicalSigClause, action: AdviceFrame, timing: LongAdministrationTimingParts, parts: RichAdministrationParts): string[];
|
|
92
|
+
export declare function instructionGraphMatchesDose(clause: CanonicalSigClause): boolean;
|
|
93
|
+
export declare function instructionGraphActionHasSequenceSuccessor(clause: CanonicalSigClause, action: AdviceFrame | undefined): boolean;
|
|
94
|
+
export declare function hasExplicitAdministrationMethod(clause: CanonicalSigClause): boolean;
|
|
95
|
+
export declare function instructionGraphCanStandAlone(clause: CanonicalSigClause, timingText: string | undefined, graphRepresentsDose: boolean, richPrimaryAction: AdviceFrame | undefined, graphText: string | undefined, primaryConditions: InstructionGraphPrimaryCondition[] | undefined): boolean;
|
|
96
|
+
/** Calendar qualifiers use locale-owned labels and stay on their medication
|
|
97
|
+
* primary before independent instructions are composed. */
|
|
98
|
+
export declare function appendClinicalCalendarText(text: string, dates: readonly string[] | undefined, weekdays: readonly FhirDayOfWeek[] | undefined, words: CourseLanguage): string;
|
|
99
|
+
/** A source-only primary and its recognized cadence describe one medication.
|
|
100
|
+
* Qualify that complete primary before independent advice is composed. */
|
|
101
|
+
export declare function composeNativePrimaryDirections(rendered: string, authored: string | undefined, condition: MedicationCondition | undefined, words: CourseLanguage, deferredDirections?: {
|
|
102
|
+
text?: string;
|
|
103
|
+
current?: string;
|
|
104
|
+
}, clause?: CanonicalSigClause): string;
|
|
105
|
+
export declare function isEmptyStomachInstruction(instruction: CanonicalAdditionalInstructionExpr): boolean;
|
|
106
|
+
/** One locale-owned allowance label for a selected shared administration group. */
|
|
107
|
+
export declare function formatSharedAdministration(body: string, shared: Pick<NonNullable<CanonicalScheduleExpr["sharedCount"]>, "count" | "countMax">, localization?: SigLocalization): string;
|
|
108
|
+
export declare function formatNativeCanonicalClause(clause: CanonicalSigClause, style: "short" | "long", localization?: SigLocalization, options?: TimingSummaryOptions, authoredPrimary?: string, deferredDirections?: {
|
|
109
|
+
text?: string;
|
|
110
|
+
current?: string;
|
|
111
|
+
}, sharedCountAlreadyDisplayed?: boolean, administrationTimingNote?: string): string;
|
|
112
|
+
export declare function formatCanonicalClause(clause: CanonicalSigClause, style: "short" | "long", localization?: SigLocalization, options?: TimingSummaryOptions, nativeDefault?: (target: "short" | "long") => string): string;
|
|
14
113
|
export declare function formatInternal(internal: ParserState, style: "short" | "long", localization?: SigLocalization, options?: TimingSummaryOptions): string;
|
|
114
|
+
export declare function stripTrailingZero(value: number): string;
|
|
115
|
+
export { DAY_NAMES, formatDoseEnglish, joinWithAnd } from "./locales/clause/en";
|