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
package/dist/hpsg/signature.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { HpsgSigSegment } from "./segmenter";
|
|
2
|
-
import type { CanonicalSigClause, ParseOptions } from "../types";
|
|
2
|
+
import type { CanonicalEvidence, CanonicalSigClause, CanonicalScheduleExpr, ParseOptions } from "../types";
|
|
3
3
|
import type { MedicationDateListMatch } from "../date-interpretation";
|
|
4
4
|
import { AdviceFrame, AdviceRelation, CanonicalDoseRange, CanonicalClinicalAdjuncts, CanonicalAdditionalInstructionExpr, CanonicalActivityTimingExpr, CanonicalCalendarEventExpr, CanonicalCycleDayConstraint, CanonicalDosePeriodMaximumExpr, CanonicalOccurrenceCapExpr, AdministrationTargetCoordinationKind, CanonicalScheduleSemanticField, CanonicalLexicalCategory, BodySiteRestriction, BodySiteRestrictionPredicate, BodySiteSpatialRelation, EventTiming, FhirCoding, FhirDayOfWeek, FhirPeriodUnit, FhirPrimitiveElement, FhirQuantity, MedicationCondition, RouteCode, PrnReasonLookupRequest, SiteCodeLookupRequest, TextRange } from "../types";
|
|
5
|
-
import { Token } from "../parser-state";
|
|
5
|
+
import { Token, type ParserState } from "../parser-state";
|
|
6
6
|
import type { HpsgFeatureNode } from "./type-system";
|
|
7
7
|
export type HpsgType = "sign" | "word-sign" | "phrase-sign" | "headed-phrase" | "head-complement-phrase" | "head-adjunct-phrase" | "head-marker-phrase" | "procedure-sequence-phrase" | "conditional-instruction-phrase" | "coordination-phrase" | "site-coordination-phrase" | "clause-sign" | "administration-clause" | "method-sign" | "route-sign" | "site-sign" | "site-relative-marker-sign" | "site-predicate-sign" | "site-relative-clause" | "restricted-site-phrase" | "recurring-course-phrase" | "dose-sign" | "schedule-sign" | "prn-sign" | "instruction-sign" | "conditional-sign" | "clinical-adjunct-sign" | "guard-predicate-sign" | "guard-operator-sign" | "guard-marker-sign" | "guard-predicate-phrase" | "guard-coordination-tail" | "guard-negation-phrase" | "medication-guard-phrase" | "adjustment-sign" | "connector-sign";
|
|
8
8
|
export interface HpsgEvidence {
|
|
@@ -11,7 +11,7 @@ export interface HpsgEvidence {
|
|
|
11
11
|
lexicalCategory?: CanonicalLexicalCategory;
|
|
12
12
|
tokenIndices: number[];
|
|
13
13
|
/** Lexical evidence that a schedule field is an inferred, construction-local default. */
|
|
14
|
-
scheduleDefault?: "daily-frequency";
|
|
14
|
+
scheduleDefault?: "daily-frequency" | "weekday-recurrence";
|
|
15
15
|
/** Exact typed schedule fields contributed by this lexical evidence. */
|
|
16
16
|
scheduleFields?: CanonicalScheduleSemanticField[];
|
|
17
17
|
}
|
|
@@ -92,6 +92,8 @@ export interface HpsgConditionFeature {
|
|
|
92
92
|
sourceEnd: number;
|
|
93
93
|
targetStart: number;
|
|
94
94
|
targetEnd: number;
|
|
95
|
+
/** Independently selected targets of one coordinated withholding program. */
|
|
96
|
+
targetRanges?: TextRange[];
|
|
95
97
|
safety: boolean;
|
|
96
98
|
frames: AdviceFrame[];
|
|
97
99
|
}
|
|
@@ -141,7 +143,8 @@ export interface HpsgClinicalAdjunctFeature {
|
|
|
141
143
|
/** Lexical provenance and typed clinical role are distinct. */
|
|
142
144
|
evidence: Array<{
|
|
143
145
|
rule: string;
|
|
144
|
-
kind: "
|
|
146
|
+
kind: NonNullable<CanonicalEvidence["clinicalKind"]>;
|
|
147
|
+
/** First range owns the selected clinical extent; subsequent ranges retain ancillary source. */
|
|
145
148
|
ranges: TextRange[];
|
|
146
149
|
}>;
|
|
147
150
|
}
|
|
@@ -158,6 +161,7 @@ export interface HpsgDoseFeature {
|
|
|
158
161
|
value?: number;
|
|
159
162
|
range?: CanonicalDoseRange;
|
|
160
163
|
unit?: string;
|
|
164
|
+
comparator?: FhirQuantity["comparator"] | "~";
|
|
161
165
|
/**
|
|
162
166
|
* Dimensionally typed clinical quantity contributed by the grammar. This
|
|
163
167
|
* remains distinct from `value`/`unit`: an infusion rate must never be
|
|
@@ -166,12 +170,16 @@ export interface HpsgDoseFeature {
|
|
|
166
170
|
clinicalQuantity?: HpsgClinicalQuantityFeature;
|
|
167
171
|
/** Number of administrations dividing a stated period-total quantity. */
|
|
168
172
|
divisionCount?: number;
|
|
173
|
+
/** Authored complement retained when no compatible period total selects its count. */
|
|
174
|
+
divisionInstruction?: HpsgInstructionFeature;
|
|
169
175
|
}
|
|
170
176
|
export type HpsgClinicalQuantityDimension = "mass" | "volume" | "biologic-activity" | "administration-unit" | "patient-mass" | "time";
|
|
171
177
|
/** Authored quantity label plus any FHIR unit coding that cannot be regenerated from it. */
|
|
172
178
|
export interface HpsgCodedQuantityTerm {
|
|
173
179
|
value: number;
|
|
174
180
|
unit: string;
|
|
181
|
+
/** Qualifier on this amount only; active drug and carrier can differ. */
|
|
182
|
+
comparator?: FhirQuantity["comparator"] | "~";
|
|
175
183
|
system?: string;
|
|
176
184
|
code?: string;
|
|
177
185
|
}
|
|
@@ -181,23 +189,29 @@ export interface HpsgDimensionalQuantityTerm extends HpsgCodedQuantityTerm {
|
|
|
181
189
|
export interface HpsgClinicalQuantityFeature {
|
|
182
190
|
representation: "dose" | "rate-quantity" | "dose-with-rate-ratio";
|
|
183
191
|
status: "resolved" | "incomplete" | "unsupported";
|
|
184
|
-
numerator: HpsgDimensionalQuantityTerm
|
|
192
|
+
numerator: HpsgDimensionalQuantityTerm | (Omit<HpsgDimensionalQuantityTerm, "value"> & {
|
|
193
|
+
range: CanonicalDoseRange;
|
|
194
|
+
});
|
|
185
195
|
denominators: HpsgDimensionalQuantityTerm[];
|
|
186
196
|
/** Per-administration value after an explicit daily total is divided. */
|
|
187
197
|
projectedDose?: HpsgCodedQuantityTerm;
|
|
188
198
|
/** Carrier amount used for an administration rate when it differs from the active drug dose. */
|
|
189
199
|
rateNumerator?: HpsgCodedQuantityTerm;
|
|
200
|
+
/** Authored vehicle volume when no point runtime denominator is supplied. */
|
|
201
|
+
carrierVolume?: HpsgCodedQuantityTerm;
|
|
190
202
|
/** Source-backed vehicle NP scoped to the carrier volume, not the active drug.
|
|
191
203
|
* It is descriptive and uncoded unless terminology separately confirms it. */
|
|
192
204
|
carrierMaterial?: {
|
|
193
205
|
text: string;
|
|
194
206
|
range?: TextRange;
|
|
195
207
|
};
|
|
208
|
+
/** Positive license for explicit period-total division; the legacy name is not limited to days. */
|
|
196
209
|
dailyTotal?: boolean;
|
|
197
210
|
dividedDoseCount?: number;
|
|
198
211
|
administrationDuration?: {
|
|
199
212
|
value: number;
|
|
200
213
|
unit: FhirPeriodUnit;
|
|
214
|
+
comparator?: FhirQuantity["comparator"] | "~";
|
|
201
215
|
};
|
|
202
216
|
requiresPatientWeight?: true;
|
|
203
217
|
reviewReason?: "incomplete-weight-based-dose" | "unsupported-weight-based-rate";
|
|
@@ -212,6 +226,10 @@ declare module "../types" {
|
|
|
212
226
|
interface CanonicalSigClause {
|
|
213
227
|
clinicalQuantity?: HpsgClinicalQuantityFeature;
|
|
214
228
|
}
|
|
229
|
+
interface CanonicalScheduleExpr {
|
|
230
|
+
/** Grammar-owned continuing onset, distinct from one dated occurrence. */
|
|
231
|
+
openEndedStart?: true;
|
|
232
|
+
}
|
|
215
233
|
}
|
|
216
234
|
export interface HpsgScheduleFeature {
|
|
217
235
|
cycleDayConstraint?: CanonicalCycleDayConstraint;
|
|
@@ -228,8 +246,10 @@ export interface HpsgScheduleFeature {
|
|
|
228
246
|
/** Weekday occurrence in each month; -1 denotes the last occurrence. */
|
|
229
247
|
weekdayOrdinal?: -1 | 1 | 2 | 3 | 4 | 5;
|
|
230
248
|
timingReference?: "previous" | "previous-weekday-complement";
|
|
231
|
-
/** Source-relative phase onset
|
|
249
|
+
/** Source-relative phase onset; the reference distinguishes civil days. */
|
|
232
250
|
treatmentStartOffsetDays?: number;
|
|
251
|
+
/** Local civil-day origin or completion of the preceding phase. */
|
|
252
|
+
phaseStartReference?: "treatment-day-start" | "previous-phase-next-day" | "previous-phase-end";
|
|
233
253
|
attachmentClass?: "administration" | "procedure";
|
|
234
254
|
/** Exact source owned by this schedule construction, retained for generic attachment arbitration. */
|
|
235
255
|
sourceRanges?: TextRange[];
|
|
@@ -239,11 +259,27 @@ export interface HpsgScheduleFeature {
|
|
|
239
259
|
duration?: number;
|
|
240
260
|
durationMax?: number;
|
|
241
261
|
durationUnit?: FhirPeriodUnit;
|
|
262
|
+
durationMaxUnit?: FhirPeriodUnit;
|
|
263
|
+
/** Runtime selected by an explicit local method, independent of course bounds. */
|
|
264
|
+
administrationDuration?: number;
|
|
265
|
+
administrationDurationMax?: number;
|
|
266
|
+
administrationDurationComparator?: CanonicalScheduleExpr["administrationDurationComparator"];
|
|
267
|
+
administrationDurationRange?: CanonicalScheduleExpr["administrationDurationRange"];
|
|
268
|
+
administrationDurationUnit?: FhirPeriodUnit;
|
|
242
269
|
/** Elapsed delay before one administration, not a course duration. */
|
|
243
270
|
administrationOffsetMinutes?: number;
|
|
271
|
+
/** Selected lexical interval retained until the regimen construction owns its scope. */
|
|
272
|
+
relativeAdministrationInterval?: {
|
|
273
|
+
value: number;
|
|
274
|
+
unit: FhirPeriodUnit;
|
|
275
|
+
};
|
|
244
276
|
boundsStart?: string;
|
|
277
|
+
/** The selected start construction explicitly continues beyond its date. */
|
|
278
|
+
openEndedStart?: true;
|
|
245
279
|
boundsEnd?: string;
|
|
246
280
|
frequency?: number;
|
|
281
|
+
/** All divided administrations occur on the first day of each whole civil-day interval. */
|
|
282
|
+
frequencyWithinDay?: true;
|
|
247
283
|
frequencyMax?: number;
|
|
248
284
|
period?: number;
|
|
249
285
|
periodMax?: number;
|
|
@@ -264,6 +300,7 @@ export interface HpsgScheduleFeature {
|
|
|
264
300
|
};
|
|
265
301
|
occurrenceCap?: CanonicalOccurrenceCapExpr;
|
|
266
302
|
maxDosePerPeriod?: CanonicalDosePeriodMaximumExpr[];
|
|
303
|
+
maxDosePerAdministration?: CanonicalScheduleExpr["maxDosePerAdministration"];
|
|
267
304
|
}
|
|
268
305
|
export interface HpsgSynsem {
|
|
269
306
|
head: {
|
|
@@ -364,6 +401,12 @@ export interface BoundarySite extends Range {
|
|
|
364
401
|
lastTokenIndex: number;
|
|
365
402
|
rightIndex: number;
|
|
366
403
|
kind: BoundaryKind;
|
|
404
|
+
/** Selected lexical relation; surface remains the authored source. */
|
|
405
|
+
connectorKind?: CoordinationConnectorKind;
|
|
406
|
+
/** Typed antecedent complement selected by an explicit alternative marker. */
|
|
407
|
+
complementCondition?: MedicationCondition;
|
|
408
|
+
/** The selected antecedent is invariant within its calendar day. */
|
|
409
|
+
complementDayConstant?: boolean;
|
|
367
410
|
surface: string;
|
|
368
411
|
}
|
|
369
412
|
export interface Evidence {
|
|
@@ -379,7 +422,7 @@ export interface Proposal {
|
|
|
379
422
|
/** Typed boundary license to inherit a following sibling's course duration. */
|
|
380
423
|
inheritFollowingDuration?: boolean;
|
|
381
424
|
/** Typed construction license, never inferred from its display rule id. */
|
|
382
|
-
semanticLicense?: "dose-continuation" | "target-transition" | "delayed-target" | "event-timing-ellipsis" | "interval-origin";
|
|
425
|
+
semanticLicense?: "dose-continuation" | "target-transition" | "delayed-target" | "event-timing-ellipsis" | "additive-timing" | "interval-origin" | "withholding-target";
|
|
383
426
|
evidence: Evidence[];
|
|
384
427
|
}
|
|
385
428
|
export interface BoundaryDecision {
|
|
@@ -412,6 +455,7 @@ export interface ProbeSummary extends Range {
|
|
|
412
455
|
coordination: 'conjunction' | 'disjunction' | 'mixed';
|
|
413
456
|
}>;
|
|
414
457
|
clause: CanonicalSigClause;
|
|
458
|
+
relativeAdministrationInterval?: ParserState["relativeAdministrationInterval"];
|
|
415
459
|
}
|
|
416
460
|
export interface PlannerMetrics {
|
|
417
461
|
lexicalPasses: number;
|
|
@@ -451,6 +495,9 @@ export interface BoundaryRelation {
|
|
|
451
495
|
connectorKind: CoordinationConnectorKind;
|
|
452
496
|
rule: string;
|
|
453
497
|
semanticLicense?: Proposal["semanticLicense"];
|
|
498
|
+
complementCondition?: MedicationCondition;
|
|
499
|
+
/** The selected antecedent is invariant within its calendar day. */
|
|
500
|
+
complementDayConstant?: boolean;
|
|
454
501
|
range: Range;
|
|
455
502
|
}
|
|
456
503
|
/** Typed facts consumed by cross-clause HPSG coordination constructions. */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { type LexToken } from "../lexer/token-types";
|
|
1
2
|
import { ParserState } from "../parser-state";
|
|
2
|
-
import { FhirPeriodUnit } from "../types";
|
|
3
|
+
import { EventTiming, FhirPeriodUnit } from "../types";
|
|
3
4
|
import { HpsgScheduleFeature } from "./signature";
|
|
4
5
|
export declare const EVERY_INTERVAL_TOKENS: Set<string>;
|
|
5
6
|
export declare const COUNT_MARKER_TOKENS: Set<string>;
|
|
@@ -25,8 +26,23 @@ export declare function normalizeMixedPeriodRange(low: number, lowUnit: FhirPeri
|
|
|
25
26
|
} | undefined;
|
|
26
27
|
export declare function periodUnitSuffix(unit: FhirPeriodUnit): string | undefined;
|
|
27
28
|
export declare function applyPeriod(internal: ParserState, period: number, unit: FhirPeriodUnit): void;
|
|
28
|
-
export declare function buildPeriodScheduleFeature(period: number, unit: FhirPeriodUnit): HpsgScheduleFeature;
|
|
29
|
+
export declare function buildPeriodScheduleFeature(period: number, unit: FhirPeriodUnit, when?: EventTiming): HpsgScheduleFeature;
|
|
29
30
|
export declare function mapIntervalUnit(token: string): FhirPeriodUnit.Minute | FhirPeriodUnit.Hour | FhirPeriodUnit.Day | FhirPeriodUnit.Week | FhirPeriodUnit.Month | undefined;
|
|
31
|
+
/** Bounded lexical constituent for a fronted following treatment course.
|
|
32
|
+
* The planner reuses its source extent; duration consumers retain the
|
|
33
|
+
* same selected numeric daughter.
|
|
34
|
+
* @param tokens Source lexical tokens.
|
|
35
|
+
* @param start Candidate duration-lead index.
|
|
36
|
+
*/
|
|
37
|
+
export declare function followingCourseDurationHeaderAt(tokens: readonly LexToken[], start: number): {
|
|
38
|
+
valueIndex: number;
|
|
39
|
+
tokenEnd: number;
|
|
40
|
+
implicitSingle?: boolean;
|
|
41
|
+
range?: {
|
|
42
|
+
low: number;
|
|
43
|
+
high: number;
|
|
44
|
+
};
|
|
45
|
+
} | undefined;
|
|
30
46
|
export declare function mapFrequencyAdverb(token: string): FhirPeriodUnit | undefined;
|
|
31
47
|
export declare function parseNumericRange(token: string): {
|
|
32
48
|
low: number;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { HpsgSign, HpsgSynsem } from "./signature";
|
|
1
|
+
import { HpsgSign, HpsgInstructionFeature, HpsgSynsem } from "./signature";
|
|
2
2
|
import { RouteCode } from "../types";
|
|
3
3
|
export interface HpsgUnificationContext {
|
|
4
4
|
normalizeSiteText(text: string): string;
|
|
5
5
|
isCompatibleRouteRefinement(current: RouteCode | undefined, next: RouteCode): boolean;
|
|
6
6
|
sourceText?(start: number, end: number): string;
|
|
7
7
|
}
|
|
8
|
+
/** Keep separately selected occurrences while retaining unframed instruction deduplication. */
|
|
9
|
+
export declare function sameInstructionSourceOccurrence(left: HpsgInstructionFeature, right: HpsgInstructionFeature): boolean;
|
|
8
10
|
export declare function unifySynsem(left: HpsgSynsem, right: HpsgSynsem, context: HpsgUnificationContext): HpsgSynsem | undefined;
|
|
9
11
|
export declare function combineSigns(left: HpsgSign, right: HpsgSign, context: HpsgUnificationContext, rule: string): HpsgSign | undefined;
|
package/dist/i18n.d.ts
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { formatLong as formatLongEnglish, formatShort as formatShortEnglish } from "./locales/clause/en";
|
|
2
|
+
import type { CourseLanguage } from "./localization";
|
|
3
|
+
import { ENGLISH_CLAUSE_TIMING } from "./locales/course/en";
|
|
4
|
+
export type { CourseLanguage } from "./localization";
|
|
5
|
+
import { BodySiteDefinition, CanonicalDoseExpr, CanonicalSigClause, type MedicationInstructionActionDefinition, type MedicationCondition } from "./types";
|
|
6
|
+
import { type TimingSummaryOptions } from "./timing-summary";
|
|
7
|
+
/** Compose the existing typed guard with its selected administration text. */
|
|
8
|
+
export declare function appendClinicalConditionText(text: string, condition: MedicationCondition, words: CourseLanguage): string;
|
|
2
9
|
export interface SigFormatContext {
|
|
3
10
|
readonly style: "short" | "long";
|
|
4
11
|
readonly clause: CanonicalSigClause;
|
|
5
12
|
readonly defaultText: string;
|
|
13
|
+
readonly course?: CourseLanguage;
|
|
6
14
|
readonly groupMealTimingsByRelation: boolean;
|
|
7
15
|
readonly includeTimesPerDaySummary: boolean;
|
|
8
16
|
readonly realizationMode: "normalized" | "roundtrip";
|
|
9
17
|
readonly sitePlacement: "natural" | "trailing";
|
|
18
|
+
readonly instructionActionMap?: TimingSummaryOptions["instructionActionMap"];
|
|
19
|
+
readonly resolvedMethod?: MedicationInstructionActionDefinition;
|
|
10
20
|
formatDefault(style: "short" | "long"): string;
|
|
11
21
|
}
|
|
12
22
|
export interface SigShortContext extends SigFormatContext {
|
|
@@ -15,18 +25,44 @@ export interface SigShortContext extends SigFormatContext {
|
|
|
15
25
|
export interface SigLongContext extends SigFormatContext {
|
|
16
26
|
readonly style: "long";
|
|
17
27
|
}
|
|
28
|
+
/** Dose amount scope is independent of whether the compact clause has one
|
|
29
|
+
* scalar dose. Native multi/role-bearing amounts retain this target scope. */
|
|
30
|
+
export interface SigDoseScope {
|
|
31
|
+
targetCount: number;
|
|
32
|
+
site?: BodySiteDefinition;
|
|
33
|
+
}
|
|
18
34
|
export interface SigLocalization {
|
|
19
35
|
readonly locale: string;
|
|
36
|
+
/** Optional language-pack facet for whole-course text. Clinical facts stay
|
|
37
|
+
* in canonical code; adding a language never edits the course algorithm. */
|
|
38
|
+
readonly course?: CourseLanguage;
|
|
39
|
+
formatDose?(dose: CanonicalDoseExpr | string, style: "short" | "long", scope?: SigDoseScope): string | undefined;
|
|
20
40
|
formatShort?(context: SigShortContext): string;
|
|
41
|
+
/** Overrides the complete clause; the callback owns its returned wording.
|
|
42
|
+
* Context and default renderings still describe the full clause. */
|
|
21
43
|
formatLong?(context: SigLongContext): string;
|
|
22
44
|
}
|
|
23
45
|
export interface SigLocalizationConfig extends Partial<Omit<SigLocalization, "locale">> {
|
|
24
46
|
locale?: string;
|
|
25
47
|
inherit?: string;
|
|
26
48
|
}
|
|
49
|
+
interface NativeClauseRendering {
|
|
50
|
+
course: CourseLanguage;
|
|
51
|
+
long: typeof formatLongEnglish;
|
|
52
|
+
short: typeof formatShortEnglish;
|
|
53
|
+
timing: typeof ENGLISH_CLAUSE_TIMING;
|
|
54
|
+
dose: NonNullable<SigLocalization["formatDose"]>;
|
|
55
|
+
}
|
|
27
56
|
export declare function registerSigLocalization(localization: SigLocalization): void;
|
|
28
57
|
export declare function getRegisteredSigLocalizations(): SigLocalization[];
|
|
58
|
+
export declare function resolveNativeClauseRendering(localization?: SigLocalization): NativeClauseRendering;
|
|
59
|
+
/** Optional rich-amount formatting uses the same provider-owned stock fallback. */
|
|
60
|
+
export declare function resolveSigDoseFormatter(localization?: SigLocalization): NonNullable<SigLocalization["formatDose"]>;
|
|
29
61
|
export declare function resolveSigLocalization(locale?: string, config?: SigLocalizationConfig): SigLocalization | undefined;
|
|
62
|
+
export declare function hasClauseFormatOverride(localization: SigLocalization | undefined, style: "short" | "long"): boolean;
|
|
63
|
+
/** Resolve the course facet once at a public formatting boundary. Reuse the
|
|
64
|
+
* existing registry and inheritance contract; no new pack registry or parser. */
|
|
65
|
+
export declare function resolveCourseLanguage(locale?: string, config?: SigLocalizationConfig, resolved?: SigLocalization): CourseLanguage;
|
|
30
66
|
export type SigTranslation = SigLocalization;
|
|
31
67
|
export type SigTranslationConfig = SigLocalizationConfig;
|
|
32
68
|
export declare const registerSigTranslation: typeof registerSigLocalization;
|