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/lexer/surface.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import { SurfaceToken } from "./token-types";
|
|
1
|
+
import { SurfaceToken, type LexToken } from "./token-types";
|
|
2
|
+
export declare function isSentenceBoundaryChar(input: string, index: number): boolean;
|
|
2
3
|
export declare function scanSurfaceTokens(input: string): SurfaceToken[];
|
|
4
|
+
/** Preserve the complete original source when a registered locale phrase is one lexeme. */
|
|
5
|
+
export declare function mergeLexicalSourceSpan(tokens: readonly LexToken[], start: number, endInclusive: number, input: string, canonical?: string): LexToken;
|
|
@@ -25,9 +25,15 @@ export interface LexToken {
|
|
|
25
25
|
lower: string;
|
|
26
26
|
/** Canonical grammar lexeme when locale-aware normalization has one. */
|
|
27
27
|
canonical?: string;
|
|
28
|
+
/** Canonical meaning of an explicitly registered adjacent dotted spelling. */
|
|
29
|
+
dottedCanonical?: string;
|
|
30
|
+
/** Provider license for compact punctuation between typed event daughters. */
|
|
31
|
+
compactEventCoordination?: true;
|
|
28
32
|
index: number;
|
|
29
33
|
kind: LexKind;
|
|
30
34
|
value?: number;
|
|
35
|
+
/** A numeric slash lexeme can supply the proper fractional part of a mixed amount. */
|
|
36
|
+
fractionNumeral?: true;
|
|
31
37
|
low?: number;
|
|
32
38
|
high?: number;
|
|
33
39
|
sourceStart: number;
|
|
@@ -3,7 +3,12 @@ export interface MedicationLocaleDetector {
|
|
|
3
3
|
test(text: string): boolean;
|
|
4
4
|
priority?: number;
|
|
5
5
|
joinsAdjacentSourceTokens?: boolean;
|
|
6
|
+
/** Preserve authored wording as this detected language's translation. */
|
|
7
|
+
preserveSourceI18n?: boolean;
|
|
6
8
|
}
|
|
7
9
|
export declare function registerMedicationLocaleDetector(detector: MedicationLocaleDetector): void;
|
|
8
10
|
export declare function shouldJoinAdjacentSourceTokens(left: string, right: string): boolean;
|
|
9
11
|
export declare function inferMedicationLocale(text: string, fallback?: string): string;
|
|
12
|
+
/** Registered source providers retain authored wording. Undetected default
|
|
13
|
+
* terminology keeps its existing lexical display. */
|
|
14
|
+
export declare function withMedicationSourceI18n(sourceText: string, i18n: Record<string, string> | undefined): Record<string, string> | undefined;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CourseLanguage } from "../../localization";
|
|
2
|
+
import { type SigLongContext, type SigDoseScope } from "../../i18n";
|
|
3
|
+
import { CanonicalDoseExpr, CanonicalSigClause } from "../../types";
|
|
4
|
+
import { type TimingSummaryOptions } from "../../timing-summary";
|
|
5
|
+
export declare const DAY_NAMES: Record<string, string>;
|
|
6
|
+
/** A typed scalar/range, or an already complete native rich amount, can be
|
|
7
|
+
* labelled without selecting it as the administration's prescribed dose. */
|
|
8
|
+
export declare function formatDoseEnglish(dose: CanonicalDoseExpr | string, style: "short" | "long", scope?: SigDoseScope): string | undefined;
|
|
9
|
+
export declare function joinWithAnd(parts: string[]): string;
|
|
10
|
+
export declare function formatShort(clause: CanonicalSigClause, words: CourseLanguage, resolvedMethod?: SigLongContext["resolvedMethod"], locale?: string, administrationTimingNote?: string): string;
|
|
11
|
+
export declare function formatLong(clause: CanonicalSigClause, options: TimingSummaryOptions | undefined, words: CourseLanguage, resolvedMethod?: SigLongContext["resolvedMethod"], authoredPrimary?: string, deferredDirections?: {
|
|
12
|
+
text?: string;
|
|
13
|
+
current?: string;
|
|
14
|
+
}, requestedLocale?: string, administrationTimingNote?: string): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** English course wording. Clinical scope and date arithmetic are supplied
|
|
2
|
+
* by the canonical formatter; this module owns words and English inflection. */
|
|
3
|
+
import { RouteCode } from "../../types";
|
|
4
|
+
import type { CourseLanguage } from "../../localization";
|
|
5
|
+
export declare const ENGLISH_DAY_NAMES: Record<string, string>;
|
|
6
|
+
export declare const ENGLISH_COURSE: CourseLanguage;
|
|
7
|
+
/** Native clause timing wording; shared formatting supplies resolved clock shifts. */
|
|
8
|
+
export declare const ENGLISH_CLAUSE_TIMING: {
|
|
9
|
+
sharedAdministration: (body: string, total?: string) => string;
|
|
10
|
+
clockWindow: (start: string, end: string, inclusive: boolean) => string;
|
|
11
|
+
offset: (minutes: number) => string;
|
|
12
|
+
dayShift: (days: number) => string;
|
|
13
|
+
};
|
|
14
|
+
/** English route labels retain their existing lexical specificity in every locale. */
|
|
15
|
+
export declare function routeCodeFromDisplayText(text: string | undefined, includeOtic: boolean): RouteCode | undefined;
|
|
16
|
+
/** Retain authored route detail while leaving recognized route grammar in its owner. */
|
|
17
|
+
export declare function retainedRouteDisplayText(text: string | undefined, code?: RouteCode): {
|
|
18
|
+
text: string;
|
|
19
|
+
kind: "technique" | "qualified" | "authored";
|
|
20
|
+
} | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Thai course wording. Keep locale realization separate from shared
|
|
2
|
+
* interval/count/condition semantics; this is a facet of SigLocalization. */
|
|
3
|
+
import type { CourseLanguage } from "../../localization";
|
|
4
|
+
export declare const THAI_DAY_NAMES: Record<string, string>;
|
|
5
|
+
export declare const THAI_COURSE: CourseLanguage;
|
|
6
|
+
/** Native clause timing wording; shared formatting supplies resolved clock shifts. */
|
|
7
|
+
export declare const THAI_CLAUSE_TIMING: {
|
|
8
|
+
sharedAdministration: (body: string, total?: string) => string;
|
|
9
|
+
clockWindow: (start: string, end: string, inclusive: boolean) => string;
|
|
10
|
+
offset: (minutes: number) => string;
|
|
11
|
+
dayShift: (days: number) => string;
|
|
12
|
+
};
|
package/dist/localization.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import type { FhirR6Quantity } from "./types";
|
|
1
2
|
export type I18nRecord = Record<string, string>;
|
|
3
|
+
export declare function cloneLocaleAliases(aliases: Record<string, string[]> | undefined): Record<string, string[]> | undefined;
|
|
4
|
+
export declare function flattenLocaleAliases(aliases: Record<string, string[]> | undefined): string[];
|
|
2
5
|
export declare function normalizeLocaleTag(locale: string | undefined): string | undefined;
|
|
3
6
|
export declare function baseLanguageTag(locale: string | undefined): string | undefined;
|
|
4
7
|
export declare function localeFallbackChain(locale: string | undefined): string[];
|
|
@@ -6,3 +9,76 @@ export declare function localizedValue(i18n: Record<string, string | undefined>
|
|
|
6
9
|
export declare function localizedConfig<T>(configs: Record<string, T> | undefined, locale: string | undefined, fallbackLocale?: string): T | undefined;
|
|
7
10
|
export declare function localeKeys(...records: Array<Record<string, unknown> | undefined>): string[];
|
|
8
11
|
export declare function composeLocalizedRecords(records: Array<I18nRecord | undefined>, compose: (values: string[], locale: string) => string | undefined): I18nRecord | undefined;
|
|
12
|
+
/** Spoken quantity operator shared by medication and action-graph renderers.
|
|
13
|
+
* No qualifier means no prefix; amounts must not become exact when the
|
|
14
|
+
* instruction graph supplies a richer sentence than the ordinary dose body. */
|
|
15
|
+
export declare function quantityComparatorText(comparator: FhirR6Quantity["comparator"], locale: string): string;
|
|
16
|
+
/** Locale-owned realization of already-resolved course semantics.
|
|
17
|
+
* The canonical formatter chooses clinical facts and scope; this contract
|
|
18
|
+
* supplies wording only. A language pack can provide it through the existing
|
|
19
|
+
* SigLocalization registry alongside its clause grammar. No second parser,
|
|
20
|
+
* external serialization, or locale checks belong in the canonical course.
|
|
21
|
+
*/
|
|
22
|
+
export interface CourseLanguage {
|
|
23
|
+
readonly notPrefix: string;
|
|
24
|
+
readonly allSeparator: string;
|
|
25
|
+
readonly anySeparator: string;
|
|
26
|
+
readonly onlyIf: string;
|
|
27
|
+
readonly unless: string;
|
|
28
|
+
readonly exceptDates: string;
|
|
29
|
+
readonly exceptWeekdays: string;
|
|
30
|
+
readonly choicePrefix: string;
|
|
31
|
+
readonly stageSeparator: string;
|
|
32
|
+
readonly doseLabel: string;
|
|
33
|
+
amountRoleLabel(kind: "dose" | "rate" | "rateRange", role: "ordered" | "calculated" | undefined, sourceRole: string): string;
|
|
34
|
+
applicationSites(count: number): string;
|
|
35
|
+
readonly rateLabel: string;
|
|
36
|
+
readonly rateRangeLabel: string;
|
|
37
|
+
readonly carrierVolumeLabel: string;
|
|
38
|
+
readonly unspecified: string;
|
|
39
|
+
withAuthoredDirections(current: string, source: string): string;
|
|
40
|
+
readonly treatmentStart: string;
|
|
41
|
+
readonly cycleStart: string;
|
|
42
|
+
readonly treatmentDayStart: string;
|
|
43
|
+
readonly afterPreviousPhase: string;
|
|
44
|
+
readonly nextDayAfterPreviousPhase: string;
|
|
45
|
+
readonly previousPhaseEnd?: string;
|
|
46
|
+
readonly incompleteInterpretation: string;
|
|
47
|
+
readonly retainedStructure: string;
|
|
48
|
+
readonly maxAdministrationLabel: string;
|
|
49
|
+
readonly maxLifetimeLabel: string;
|
|
50
|
+
readonly maxPeriodLabel: string;
|
|
51
|
+
readonly maxDosageLabel: string;
|
|
52
|
+
readonly courseLimitsLabel: string;
|
|
53
|
+
readonly stageLimitsLabel: string;
|
|
54
|
+
ifLimitExceeded(action: string): string;
|
|
55
|
+
eventWindow(start: string, end: string): string;
|
|
56
|
+
unresolvedCycleTiming(days: string, periodDays?: number, cycles?: number, anchor?: string): string;
|
|
57
|
+
weekdayName(day: string): string;
|
|
58
|
+
measurementName(name: string): string;
|
|
59
|
+
joinList(items: readonly string[]): string;
|
|
60
|
+
timeUnit(unit: string, value: number | undefined): string | undefined;
|
|
61
|
+
expression(kind: "dose" | "rate", detail: string | undefined): string;
|
|
62
|
+
upTo(value: string): string;
|
|
63
|
+
administrations(frequency: string, period?: string): string;
|
|
64
|
+
dosingPeriod(period: string): string;
|
|
65
|
+
periodContext(period: string): string;
|
|
66
|
+
startsWithinPeriod(offset: string, context: string): string;
|
|
67
|
+
endsWithinPeriod(offset: string, context: string): string;
|
|
68
|
+
afterTreatmentStart(offset: string): string;
|
|
69
|
+
relativeEvent(offset: string, event: string | undefined, before: boolean): string;
|
|
70
|
+
/** Compare event-relative time points without narrowing an open-ended range. */
|
|
71
|
+
relativeTimeLimit?(point: string, comparator: "<" | "<=" | ">" | ">="): string;
|
|
72
|
+
calendarWindow(start?: string, end?: string): string;
|
|
73
|
+
calendarEvents(events: readonly string[]): string;
|
|
74
|
+
reviewTiming(source?: string, boundary?: "end"): string;
|
|
75
|
+
dayRange(first: number, last: number): string;
|
|
76
|
+
fromDay(first: number): string;
|
|
77
|
+
throughDay(last: number): string;
|
|
78
|
+
noDoseDays(first: number, last: number): string;
|
|
79
|
+
noDoseWindow(start: string, end: string): string;
|
|
80
|
+
phaseCount(count: number): string;
|
|
81
|
+
unresolvedPhaseCount: string;
|
|
82
|
+
repeatCount(count: number): string;
|
|
83
|
+
repeatCycle(interval: string, exact: boolean, count?: number): string;
|
|
84
|
+
}
|
|
@@ -5,7 +5,7 @@ export interface LocalizedTimingGrammar {
|
|
|
5
5
|
readonly whenText: Partial<Record<EventTiming, string>>;
|
|
6
6
|
joinList(parts: string[]): string;
|
|
7
7
|
summarizeMealTimingGroup(group: MealTimingGroup): string;
|
|
8
|
-
formatEventOffset?(eventText: string, schedule: CanonicalScheduleExpr): string;
|
|
8
|
+
formatEventOffset?(eventText: string, schedule: CanonicalScheduleExpr, event?: EventTiming, mealGroup?: MealTimingGroup): string;
|
|
9
9
|
bedtimeJoinStyle?(dailyCount: number | undefined): BedtimeJoinStyle;
|
|
10
10
|
}
|
|
11
11
|
export declare function filterLocalizedWhenEvents(schedule: CanonicalScheduleExpr | undefined): EventTiming[];
|
package/dist/maps.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BodySiteDefinition, EventTiming, FhirDayOfWeek, FhirPeriodUnit, PrnReasonDefinition, RouteCode, SNOMEDCTRouteCodes } from "./types";
|
|
1
|
+
import { BodySiteDefinition, EventTiming, FhirDayOfWeek, type FhirCoding, type FhirR6Coding, type FhirR6Quantity, FhirPeriodUnit, PrnReasonDefinition, RouteCode, SNOMEDCTRouteCodes } from "./types";
|
|
2
2
|
import { type SymptomDictionaryEntry } from "./symptom-terminology";
|
|
3
3
|
/**
|
|
4
4
|
* SNOMED CT codings aligned with every known RouteCode. Keeping the structure
|
|
@@ -10,11 +10,9 @@ export declare const ROUTE_SNOMED: Record<RouteCode, {
|
|
|
10
10
|
display: string;
|
|
11
11
|
}>;
|
|
12
12
|
export declare const ROUTE_TEXT: Record<RouteCode, string>;
|
|
13
|
-
/**
|
|
14
|
-
* Inverse lookup so that SNOMED codes flowing in from FHIR can be mapped back
|
|
15
|
-
* into our internal RouteCode abstraction during round-tripping.
|
|
16
|
-
*/
|
|
17
13
|
export declare const ROUTE_BY_SNOMED: Record<SNOMEDCTRouteCodes, RouteCode>;
|
|
14
|
+
/** Prefer the first explicitly identified route; keep a systemless legacy fallback. */
|
|
15
|
+
export declare function routeCodeFromCodings(codings: readonly Pick<FhirCoding | FhirR6Coding, "system" | "_system" | "code">[] | undefined): RouteCode | undefined;
|
|
18
16
|
export interface RouteSynonym {
|
|
19
17
|
code: RouteCode;
|
|
20
18
|
text: string;
|
|
@@ -28,21 +26,57 @@ export declare const DEFAULT_ROUTE_SYNONYMS: Record<string, RouteSynonym>;
|
|
|
28
26
|
export declare function normalizeBodySiteKey(value: string): string;
|
|
29
27
|
type BodySiteSnomedSourceEntry = {
|
|
30
28
|
names: string[];
|
|
29
|
+
/** Exact reverse-code wording, independent of accepted forward alias order. */
|
|
30
|
+
preferredForCode?: boolean;
|
|
31
31
|
definition: BodySiteDefinition;
|
|
32
32
|
};
|
|
33
|
+
/** Canonical laterality metadata shared by anatomical lookup and realization. */
|
|
34
|
+
export declare const BODY_SITE_LATERALITIES: readonly [{
|
|
35
|
+
readonly textPrefix: "left";
|
|
36
|
+
readonly englishPrefix: "left";
|
|
37
|
+
readonly localeSuffixes: {
|
|
38
|
+
readonly th: readonly ["ซ้าย"];
|
|
39
|
+
};
|
|
40
|
+
readonly code: "7771000";
|
|
41
|
+
readonly display: "Left";
|
|
42
|
+
}, {
|
|
43
|
+
readonly textPrefix: "right";
|
|
44
|
+
readonly englishPrefix: "right";
|
|
45
|
+
readonly localeSuffixes: {
|
|
46
|
+
readonly th: readonly ["ขวา"];
|
|
47
|
+
};
|
|
48
|
+
readonly code: "24028007";
|
|
49
|
+
readonly display: "Right";
|
|
50
|
+
}, {
|
|
51
|
+
readonly textPrefix: "both";
|
|
52
|
+
readonly englishPrefix: "both";
|
|
53
|
+
readonly localeSuffixes: {
|
|
54
|
+
readonly th: readonly ["ทั้งสองข้าง", "สองข้าง"];
|
|
55
|
+
};
|
|
56
|
+
readonly code: "51440002";
|
|
57
|
+
readonly display: "Right and left";
|
|
58
|
+
}];
|
|
59
|
+
/** Read canonical anatomical laterality from the same vocabulary that creates it. */
|
|
60
|
+
export declare function splitBodySiteLaterality(text: string): {
|
|
61
|
+
baseText: string;
|
|
62
|
+
lateralityCode: string;
|
|
63
|
+
localeSuffixes: Readonly<Record<string, readonly string[]>>;
|
|
64
|
+
} | undefined;
|
|
33
65
|
export declare const DEFAULT_BODY_SITE_SNOMED_SOURCE: BodySiteSnomedSourceEntry[];
|
|
34
66
|
export declare const DEFAULT_BODY_SITE_SNOMED: Record<string, BodySiteDefinition>;
|
|
35
67
|
export declare const DEFAULT_BODY_SITE_HINTS: Set<string>;
|
|
36
68
|
export declare const HOUSEHOLD_VOLUME_UNITS: readonly ["tsp", "tbsp"];
|
|
37
69
|
export declare const DEFAULT_UNIT_SYNONYMS: Record<string, string>;
|
|
70
|
+
/** Remove non-dimensional UCUM annotations for comparison only.
|
|
71
|
+
* Callers retain their own terminology, supported-unit and case rules. */
|
|
72
|
+
export declare function stripUcumAnnotations(code: string, ungroupSingletons?: boolean): string;
|
|
38
73
|
/** Resolve standard codes and plain unit labels to the same calculation unit.
|
|
39
74
|
* @param quantity A dose or limit quantity; its original display remains untouched.
|
|
75
|
+
* @param includeOpaqueCode Retain an unknown code as a display/counting label.
|
|
76
|
+
* Dimensional calculations disable that fallback, while still accepting authored
|
|
77
|
+
* unit labels and explicit UCUM expressions outside the simple-unit lexicon.
|
|
40
78
|
*/
|
|
41
|
-
export declare function getDoseQuantityUnit(quantity:
|
|
42
|
-
system?: string;
|
|
43
|
-
code?: string;
|
|
44
|
-
unit?: string;
|
|
45
|
-
} | undefined): string;
|
|
79
|
+
export declare function getDoseQuantityUnit(quantity: Pick<FhirR6Quantity, "system" | "code" | "unit" | "_system"> | undefined, includeOpaqueCode?: boolean): string;
|
|
46
80
|
/** Resolve a known dosage unit without changing its display or numerical value.
|
|
47
81
|
* @param unit Canonical unit or supported synonym, including dimensional rates.
|
|
48
82
|
*/
|
|
@@ -1,8 +1,74 @@
|
|
|
1
|
-
import { MedicationCondition } from "./types";
|
|
1
|
+
import { MedicationCondition, type FhirDayOfWeek } from "./types";
|
|
2
2
|
import type { HpsgGuardFeature } from "./hpsg/signature";
|
|
3
3
|
export { parseMedicationGuard } from "./hpsg/constructions";
|
|
4
4
|
export type { ParsedMedicationGuard } from "./hpsg/constructions";
|
|
5
|
-
export
|
|
5
|
+
export interface MedicationConditionLexicalFeatures {
|
|
6
|
+
operators: ReadonlyArray<{
|
|
7
|
+
operation: "ge" | "le" | "gt" | "lt";
|
|
8
|
+
pattern: RegExp;
|
|
9
|
+
}>;
|
|
10
|
+
stateLeads: readonly RegExp[];
|
|
11
|
+
/** A predicate-initial qualifier that selects a registered nonfinite activity. */
|
|
12
|
+
activityConcernLead?: RegExp;
|
|
13
|
+
/** A predicate-final qualifier that selects an administration activity. */
|
|
14
|
+
activityConcernTail?: RegExp;
|
|
15
|
+
connectors: RegExp;
|
|
16
|
+
/** Complete comparison lexemes whose internal connectors are not Boolean operators. */
|
|
17
|
+
comparisonOperator?: RegExp;
|
|
18
|
+
measurementNameAliases?: Readonly<Record<string, string>>;
|
|
19
|
+
boundaries: {
|
|
20
|
+
frontedLead: RegExp;
|
|
21
|
+
alternative: RegExp;
|
|
22
|
+
noDoseConsequent: RegExp;
|
|
23
|
+
};
|
|
24
|
+
measurementCopula: RegExp;
|
|
25
|
+
stateNoise: RegExp;
|
|
26
|
+
approvalPredicate: RegExp;
|
|
27
|
+
negationPrefix: RegExp;
|
|
28
|
+
unlessLead: RegExp;
|
|
29
|
+
disjunction: RegExp;
|
|
30
|
+
tokenCue: RegExp;
|
|
31
|
+
sourceCue: RegExp;
|
|
32
|
+
calendar: {
|
|
33
|
+
cycle: {
|
|
34
|
+
cue: RegExp;
|
|
35
|
+
frame: string;
|
|
36
|
+
startLead: RegExp;
|
|
37
|
+
repeatCount: RegExp;
|
|
38
|
+
};
|
|
39
|
+
cue: RegExp;
|
|
40
|
+
/** Registration-derived views for whole-source search and token-origin admission. */
|
|
41
|
+
sourceCue?: RegExp;
|
|
42
|
+
startCue?: RegExp;
|
|
43
|
+
weekdays: ReadonlyArray<{
|
|
44
|
+
day: FhirDayOfWeek;
|
|
45
|
+
patterns: RegExp[];
|
|
46
|
+
}>;
|
|
47
|
+
groups: ReadonlyArray<{
|
|
48
|
+
pattern: RegExp;
|
|
49
|
+
days: FhirDayOfWeek[];
|
|
50
|
+
}>;
|
|
51
|
+
connectors: RegExp;
|
|
52
|
+
universalQuantifiers: ReadonlySet<string>;
|
|
53
|
+
dayHeads: ReadonlySet<string>;
|
|
54
|
+
};
|
|
55
|
+
guardLead: RegExp;
|
|
56
|
+
numericGuard: RegExp;
|
|
57
|
+
contextDayGuard: RegExp;
|
|
58
|
+
contextDayNominal: RegExp;
|
|
59
|
+
measurement: RegExp;
|
|
60
|
+
headlessMeasurement: RegExp;
|
|
61
|
+
measurementChange: RegExp;
|
|
62
|
+
observationWindow: RegExp;
|
|
63
|
+
circumstantialGuard: RegExp;
|
|
64
|
+
/** Optional token admission for circumstantial leads, separate from ordinary guard markers. */
|
|
65
|
+
circumstantialCue?: RegExp;
|
|
66
|
+
bareLead: RegExp;
|
|
67
|
+
}
|
|
68
|
+
/** Existing advice providers supply lexical features; HPSG still owns the tree. */
|
|
69
|
+
export declare function medicationConditionLexicalFeatures(locale?: string): MedicationConditionLexicalFeatures;
|
|
70
|
+
/** Remove registered state leads without interpreting the remaining predicate. */
|
|
71
|
+
export declare function normalizeMedicationConditionStateText(value: string, lexicon: MedicationConditionLexicalFeatures): string;
|
|
6
72
|
export interface MedicationGuardLeadLexeme {
|
|
7
73
|
start: number;
|
|
8
74
|
end: number;
|
|
@@ -11,28 +77,23 @@ export interface MedicationGuardLeadLexeme {
|
|
|
11
77
|
}
|
|
12
78
|
/** Recognize a conditional marker's spelling, leaving its predicate licensing
|
|
13
79
|
* and scope to the HPSG guard-head construction. */
|
|
14
|
-
export declare function medicationGuardLeadLexeme(source: string, licensedConsequent?: boolean): MedicationGuardLeadLexeme | undefined;
|
|
80
|
+
export declare function medicationGuardLeadLexeme(source: string, licensedConsequent?: boolean, lexicon?: MedicationConditionLexicalFeatures): MedicationGuardLeadLexeme | undefined;
|
|
15
81
|
/** Lexical boundary spellings shared with the typed guard phrase. No result
|
|
16
82
|
* from these recognizers is itself a medication condition or administration. */
|
|
17
|
-
export declare const MEDICATION_GUARD_BOUNDARIES: {
|
|
18
|
-
alternative: RegExp;
|
|
19
|
-
noDoseConsequent: RegExp;
|
|
20
|
-
administrationHead: RegExp;
|
|
21
|
-
};
|
|
22
83
|
/** Recognize one predicate atom. Incomplete comparisons remain unsatisfied
|
|
23
84
|
* head requirements, not measurements with a guessed variable name. */
|
|
24
|
-
export declare function medicationConditionAtomLexeme(input: string): HpsgGuardFeature;
|
|
85
|
+
export declare function medicationConditionAtomLexeme(input: string, lexicon?: MedicationConditionLexicalFeatures): HpsgGuardFeature;
|
|
25
86
|
/** Recognize a predicate negator, not the beginning of a comparison idiom.
|
|
26
87
|
* @param source One predicate atom before Boolean coordination.
|
|
27
88
|
*/
|
|
28
|
-
export declare function conditionNegationPrefixLength(source: string): number | undefined;
|
|
89
|
+
export declare function conditionNegationPrefixLength(source: string, lexicon?: MedicationConditionLexicalFeatures): number | undefined;
|
|
29
90
|
export interface ConditionSourceLexeme {
|
|
30
91
|
start: number;
|
|
31
92
|
end: number;
|
|
32
93
|
operator?: "all" | "any";
|
|
33
94
|
}
|
|
34
95
|
/** Lexicalize Boolean connective surfaces without assigning a tree or scope. */
|
|
35
|
-
export declare function conditionSourceLexemes(source: string, start: number, end: number): ConditionSourceLexeme[];
|
|
96
|
+
export declare function conditionSourceLexemes(source: string, start: number, end: number, lexicon?: MedicationConditionLexicalFeatures): ConditionSourceLexeme[];
|
|
36
97
|
/** Punctuation boundary excluding decimal points inside lexical quantities. */
|
|
37
98
|
export declare function medicationGuardClauseBoundary(text: string): number;
|
|
38
99
|
/**
|
package/dist/parser-state.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AnnotatedLexToken } from "./lexer/meaning";
|
|
2
|
-
import {
|
|
2
|
+
import type { CanonicalBoundary } from "./canonical/course";
|
|
3
|
+
import { CanonicalAdditionalInstructionExpr, CanonicalAdministrationTargetGroup, BodySiteSpatialRelation, CanonicalDoseRange, CanonicalPrnReasonExpr, CanonicalSigClause, EventTiming, FhirCoding, FhirDayOfWeek, FhirPrimitiveElement, FhirR6PrimitiveElement, FhirPeriodUnit, PrnReasonLookupRequest, PrnReasonSuggestion, RouteCode, SiteCodeLookupRequest, SiteCodeSuggestion } from "./types";
|
|
3
4
|
export interface SiteLookupDetail {
|
|
4
5
|
request: SiteCodeLookupRequest;
|
|
5
6
|
suggestions: SiteCodeSuggestion[];
|
|
@@ -27,6 +28,13 @@ export declare class ParserState {
|
|
|
27
28
|
prnReasonLookups: PrnReasonLookupDetail[];
|
|
28
29
|
methodVerb?: string;
|
|
29
30
|
productFormKey?: string;
|
|
31
|
+
/** Internal selected interval; phase composition uses its authored civil unit. */
|
|
32
|
+
relativeAdministrationInterval?: {
|
|
33
|
+
value: number;
|
|
34
|
+
unit: FhirPeriodUnit;
|
|
35
|
+
};
|
|
36
|
+
/** Selected civil onset, lowered into the existing native boundary owner. */
|
|
37
|
+
relativePhaseStart?: CanonicalBoundary;
|
|
30
38
|
clauses: CanonicalSigClause[];
|
|
31
39
|
private clause;
|
|
32
40
|
constructor(input: string, tokens: Token[], customSiteHints?: Set<string>);
|
|
@@ -43,7 +51,7 @@ export declare class ParserState {
|
|
|
43
51
|
set routeText(value: string | undefined);
|
|
44
52
|
get methodText(): string | undefined;
|
|
45
53
|
set methodText(value: string | undefined);
|
|
46
|
-
get methodTextElement():
|
|
54
|
+
get methodTextElement(): FhirR6PrimitiveElement | undefined;
|
|
47
55
|
set methodTextElement(value: FhirPrimitiveElement | undefined);
|
|
48
56
|
get methodCoding(): LocalizedCoding | undefined;
|
|
49
57
|
set methodCoding(value: LocalizedCoding | undefined);
|
|
@@ -83,6 +91,8 @@ export declare class ParserState {
|
|
|
83
91
|
set occurrenceCap(value: import("./types").CanonicalOccurrenceCapExpr | undefined);
|
|
84
92
|
get maxDosePerPeriod(): import("./types").CanonicalDosePeriodMaximumExpr[] | undefined;
|
|
85
93
|
set maxDosePerPeriod(value: import("./types").CanonicalDosePeriodMaximumExpr[] | undefined);
|
|
94
|
+
get maxDosePerAdministration(): Pick<import("./types").CanonicalDosePeriodMaximumExpr, "unit" | "amount" | "amountComparator">[] | undefined;
|
|
95
|
+
set maxDosePerAdministration(value: Pick<import("./types").CanonicalDosePeriodMaximumExpr, "unit" | "amount" | "amountComparator">[] | undefined);
|
|
86
96
|
get timingCode(): string | undefined;
|
|
87
97
|
set timingCode(value: string | undefined);
|
|
88
98
|
get asNeeded(): boolean | undefined;
|
package/dist/parser.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import type { InstructionActionProgram } from "./instruction-action-parser";
|
|
2
|
+
import type { LexToken } from "./lexer/token-types";
|
|
1
3
|
import { ParserState, Token } from "./parser-state";
|
|
2
4
|
export { applyPrnReasonCoding, applyPrnReasonCodingAsync } from "./prn-reason-coding";
|
|
3
5
|
export { applySiteCoding, applySiteCodingAsync } from "./site-coding";
|
|
4
6
|
import { BodySiteDefinition, ParseOptions, TextRange } from "./types";
|
|
5
|
-
export declare function tokenize(input: string): Token[];
|
|
7
|
+
export declare function tokenize(input: string, options?: ParseOptions): Token[];
|
|
6
8
|
export declare function buildCustomSiteHints(map: Record<string, BodySiteDefinition> | undefined): Set<string> | undefined;
|
|
7
|
-
export declare function findUnparsedTokenGroups(state: ParserState): Array<{
|
|
9
|
+
export declare function findUnparsedTokenGroups(state: ParserState, includeOpaque?: boolean): Array<{
|
|
8
10
|
tokens: Token[];
|
|
9
11
|
range?: TextRange;
|
|
10
12
|
}>;
|
|
11
13
|
/** Raw typed analysis for grammar/treebank tests; no canonical or FHIR projection. */
|
|
12
14
|
export declare function parseClauseSign(input: string, options?: ParseOptions): import("./hpsg/signature").HpsgSign | undefined;
|
|
13
|
-
export declare function parseClauseState(input: string, options?: ParseOptions, customSiteHints?: Set<string> | undefined): ParserState;
|
|
15
|
+
export declare function parseClauseState(input: string, options?: ParseOptions, customSiteHints?: Set<string> | undefined, plannedProgram?: InstructionActionProgram, rawTokens?: LexToken[]): ParserState;
|
package/dist/prn.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
import { CanonicalPrnReasonExpr } from "./types";
|
|
1
|
+
import { CanonicalPrnReasonExpr, type BodySiteSpatialRelation, type SymptomDefinition } from "./types";
|
|
2
|
+
import { type ResolvedBodySitePhrase } from "./body-site-grammar";
|
|
2
3
|
export declare function getCanonicalPrnReasonText(reason: CanonicalPrnReasonExpr | undefined): string | undefined;
|
|
3
4
|
export declare function joinCanonicalPrnReasonTexts(reasons: CanonicalPrnReasonExpr[] | undefined, conjunction?: string): string | undefined;
|
|
4
5
|
export declare function getPreferredCanonicalPrnReasonText(reason: CanonicalPrnReasonExpr | undefined, reasons: CanonicalPrnReasonExpr[] | undefined, conjunction?: string): string | undefined;
|
|
5
|
-
export declare function
|
|
6
|
+
export declare function getPrnReasonTextFallbackI18n(reason: CanonicalPrnReasonExpr): Record<string, string> | undefined;
|
|
7
|
+
export declare function getLocalizedCanonicalPrnReasonText(reason: CanonicalPrnReasonExpr | undefined, reasons: CanonicalPrnReasonExpr[] | undefined, locale: string, conjunction?: string, realizeReason?: (reason: CanonicalPrnReasonExpr, localizedText: string | undefined) => string | undefined): string | undefined;
|
|
8
|
+
export interface LocatedPrnWording {
|
|
9
|
+
symptom?: SymptomDefinition;
|
|
10
|
+
site: ResolvedBodySitePhrase;
|
|
11
|
+
spatialRelation?: BodySiteSpatialRelation;
|
|
12
|
+
coversSpatialRelation: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** Check complete constituent wording against typed finding facts. Unknown
|
|
15
|
+
* heads remain authored text; a Coding alone never proves that text's meaning. */
|
|
16
|
+
export declare function resolveLocatedPrnWording(reason: CanonicalPrnReasonExpr, text: string | undefined): LocatedPrnWording | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ParserState } from '../parser-state';
|
|
2
|
-
import type { CanonicalScheduleSemanticField } from '../types';
|
|
2
|
+
import type { CanonicalScheduleSemanticField, CanonicalSigClause } from '../types';
|
|
3
3
|
import type { HpsgSigSegment } from '../hpsg/segmenter';
|
|
4
4
|
import type { BoundaryPlan } from '../hpsg/signature';
|
|
5
5
|
export interface CoordinatedClauseState {
|
|
@@ -12,8 +12,20 @@ export interface CoordinationScopeApplication {
|
|
|
12
12
|
from: number;
|
|
13
13
|
to: number;
|
|
14
14
|
fields: string[];
|
|
15
|
+
/** Original BoundaryPlan members selected by the fronted-condition owner. */
|
|
16
|
+
frontedCondition?: {
|
|
17
|
+
origin: number;
|
|
18
|
+
member: number;
|
|
19
|
+
};
|
|
15
20
|
}
|
|
16
21
|
type ScheduleSemanticField = CanonicalScheduleSemanticField;
|
|
22
|
+
/**
|
|
23
|
+
* A positive CONTINUE-TREATMENT action with a typed Duration valence states
|
|
24
|
+
* the course bound of its administration clause. Materialize that typed
|
|
25
|
+
* contribution before coordination selection so the ordinary course-bound
|
|
26
|
+
* construction can distribute it; no instruction wording is reparsed here.
|
|
27
|
+
*/
|
|
28
|
+
export declare function materializeTypedContinueCourseDuration(clause: CanonicalSigClause): void;
|
|
17
29
|
export interface TimingAnchorCompositionApplication {
|
|
18
30
|
rule: 'hpsg.cx.regimen.coordinated-timing-anchors' | 'hpsg.cx.regimen.interval-origin';
|
|
19
31
|
recipient: number;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { type CanonicalSigClause } from "../types";
|
|
1
|
+
import { type AdviceFrame, type CanonicalSigClause } from "../types";
|
|
2
2
|
import type { BoundaryDecision, BoundarySite, CoordinationConnectorKind, CoordinationScopeFacts, Proposal, ProbeSummary, RegimenSemanticConstruction, RegimenSemanticSelection, TrailingInstructionScopeFacts } from '../hpsg/signature';
|
|
3
3
|
/** A recognized modifier of an administration remains meaningful even when
|
|
4
4
|
* it cannot be assigned a clock time (for example an accompanying snack).
|
|
5
5
|
* @param clause Source-typed clause whose explicit dose is being segmented.
|
|
6
6
|
*/
|
|
7
7
|
export declare function hasAdministrationAdjunct(clause: CanonicalSigClause): boolean;
|
|
8
|
+
/** A selected civil interval locates an independently continuing phase. */
|
|
9
|
+
export declare function hasContinuingRelativePhase(clause: CanonicalSigClause, interval: ProbeSummary["relativeAdministrationInterval"]): boolean;
|
|
8
10
|
/** Typed boundary facts are a separate signature from the production clause grammar. */
|
|
9
11
|
export interface BoundaryFacts {
|
|
10
12
|
site: BoundarySite;
|
|
@@ -15,6 +17,7 @@ export interface BoundaryFacts {
|
|
|
15
17
|
explicitRightUnit: boolean;
|
|
16
18
|
rightHasProcedure: boolean;
|
|
17
19
|
rightAfterFirstAdministration: boolean;
|
|
20
|
+
rightRepeatsAdministration: boolean;
|
|
18
21
|
leftDateSpan: boolean;
|
|
19
22
|
rightDateSpan: boolean;
|
|
20
23
|
leftTargetCue: boolean;
|
|
@@ -41,6 +44,17 @@ interface SemanticConstraint {
|
|
|
41
44
|
interface SemanticConstruction extends RegimenSemanticConstruction {
|
|
42
45
|
constraints: readonly SemanticConstraint[];
|
|
43
46
|
}
|
|
47
|
+
/** A source-unowned single count is an execution default, not a written
|
|
48
|
+
* schedule or phase bound. Both boundary planning and cadence inheritance use
|
|
49
|
+
* this same distinction before a later adjunct completes the administration. */
|
|
50
|
+
export declare function hasImplicitSingleCount(clause: CanonicalSigClause): boolean;
|
|
51
|
+
/** A postposed onset completes a dose whose only timing is local runtime
|
|
52
|
+
* or delay. Independent recurrence, anchored positions and authored bounds
|
|
53
|
+
* remain capable of establishing a separate treatment phase. */
|
|
54
|
+
export declare function canReceivePostposedOnset(probe: ProbeSummary): boolean;
|
|
55
|
+
/** A single clock without independent recurrence or phase boundaries can
|
|
56
|
+
* locate the initial administration in an explicitly ordered clock sequence. */
|
|
57
|
+
export declare function singleClockWithoutRecurrence(schedule: CanonicalSigClause['schedule']): string | undefined;
|
|
44
58
|
/**
|
|
45
59
|
* Distributive cadence is licensed only for a coordinated dose continuation.
|
|
46
60
|
* The right daughter is the scoped cadence donor; an independently headed,
|
|
@@ -54,6 +68,9 @@ export declare function grammaticalCoordinationScopes(facts: CoordinationScopeFa
|
|
|
54
68
|
* whether that local adjunct scopes over a related compatible administration.
|
|
55
69
|
*/
|
|
56
70
|
export declare function grammaticalTrailingInstructionScope(facts: TrailingInstructionScopeFacts): RegimenSemanticSelection | undefined;
|
|
71
|
+
/** Select the local terminal action after the medication, regardless of its
|
|
72
|
+
* action-specific meaning. A local non-wait remains a terminal barrier. */
|
|
73
|
+
export declare function localTerminalPostAdministrationAction(clause: CanonicalSigClause): AdviceFrame | undefined;
|
|
57
74
|
/** Exact elapsed interval on a terminal wait action, already composed by HPSG. */
|
|
58
75
|
export declare function terminalAdministrationDelay(clause: CanonicalSigClause): number | undefined;
|
|
59
76
|
/** Rules inspect features only. Surface/locale recognition belongs to lexical and span producers. */
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type CanonicalBoundary, type CanonicalChoice, type RegimenPosition } from '../canonical/course';
|
|
2
2
|
import type { HpsgSigSegment } from '../hpsg/segmenter';
|
|
3
3
|
import type { BoundaryPlan } from '../hpsg/signature';
|
|
4
4
|
import { type RegimenGraph } from './regimen';
|
|
5
|
-
import type { CanonicalSigClause
|
|
6
|
-
|
|
7
|
-
export interface RegimenPosition {
|
|
8
|
-
unit: 'd' | 'mo';
|
|
9
|
-
value: number;
|
|
10
|
-
}
|
|
5
|
+
import type { CanonicalSigClause } from '../types';
|
|
6
|
+
export type { RegimenPosition } from '../canonical/course';
|
|
11
7
|
export interface CanonicalParallelComponent {
|
|
12
8
|
member: number;
|
|
13
9
|
clause: CanonicalSigClause;
|
|
@@ -16,15 +12,23 @@ export interface CanonicalParallelComponent {
|
|
|
16
12
|
boundsEndBasis?: 'next-phase-start' | 'anchored-duration';
|
|
17
13
|
/** Original track-phase origin retained when copied across global steps. */
|
|
18
14
|
phaseOrigin?: RegimenPosition;
|
|
15
|
+
/** Selected member boundary retained before global cuts can be ordered. */
|
|
16
|
+
phaseStart?: CanonicalBoundary;
|
|
19
17
|
}
|
|
20
18
|
export interface CanonicalParallelPhase {
|
|
21
19
|
kind: 'relative' | 'calendar';
|
|
22
20
|
members: CanonicalParallelComponent[];
|
|
23
21
|
start?: RegimenPosition;
|
|
22
|
+
/** Origin of the known relative start; absent retains elapsed semantics. */
|
|
23
|
+
startReference?: "treatment-day-start";
|
|
24
24
|
end?: RegimenPosition;
|
|
25
|
+
/** A known same-track successor caps this phase without replacing its own end. */
|
|
26
|
+
phaseEnd?: CanonicalBoundary;
|
|
25
27
|
}
|
|
26
28
|
export interface CanonicalParallelTrack {
|
|
27
29
|
phases: CanonicalParallelPhase[];
|
|
30
|
+
repeatCycle?: NonNullable<CanonicalSigClause["schedule"]>["repeatCycle"];
|
|
31
|
+
repeatCount?: number;
|
|
28
32
|
}
|
|
29
33
|
export interface CanonicalParallelStage {
|
|
30
34
|
sequence: number;
|
|
@@ -37,49 +41,16 @@ export type CanonicalParallelRegimen = {
|
|
|
37
41
|
} | {
|
|
38
42
|
kind: 'unresolved';
|
|
39
43
|
reason: string;
|
|
44
|
+
tracks?: CanonicalParallelTrack[];
|
|
40
45
|
} | {
|
|
41
46
|
kind: 'resolved';
|
|
42
47
|
tracks: CanonicalParallelTrack[];
|
|
43
48
|
stages: CanonicalParallelStage[];
|
|
44
49
|
};
|
|
45
|
-
type ParallelProjection = {
|
|
46
|
-
kind: 'not-parallel';
|
|
47
|
-
} | {
|
|
48
|
-
kind: 'unresolved';
|
|
49
|
-
reason: string;
|
|
50
|
-
} | {
|
|
51
|
-
kind: 'resolved';
|
|
52
|
-
dosages: EzDosage[];
|
|
53
|
-
course: EzCourseMetadata;
|
|
54
|
-
details: FhirR6DosageDetails;
|
|
55
|
-
};
|
|
56
50
|
/**
|
|
57
51
|
* Build independent track windows and canonical global stages from typed HPSG
|
|
58
52
|
* clauses and licensed regimen relations. No FHIR object or source text is
|
|
59
53
|
* inspected. Unsupported relationships remain editable through ordinary
|
|
60
54
|
* per-clause results while this richer course projection stays unresolved.
|
|
61
55
|
*/
|
|
62
|
-
export declare function buildCanonicalParallelRegimen(clauses: readonly CanonicalSigClause[], segments: readonly HpsgSigSegment[], plan: BoundaryPlan, graph: RegimenGraph): CanonicalParallelRegimen;
|
|
63
|
-
export declare const TREATMENT_START_SYSTEM = "http://hl7.org/fhir/evidence-variable-event";
|
|
64
|
-
/** Shared pure lowering of an already-typed treatment-relative position. */
|
|
65
|
-
export declare function relativeTime(position: RegimenPosition | {
|
|
66
|
-
unit: "s" | "min" | "h" | "wk" | "a";
|
|
67
|
-
value: number;
|
|
68
|
-
}): {
|
|
69
|
-
contextCode: {
|
|
70
|
-
coding: {
|
|
71
|
-
system: string;
|
|
72
|
-
code: string;
|
|
73
|
-
display: string;
|
|
74
|
-
}[];
|
|
75
|
-
};
|
|
76
|
-
offsetDuration: {
|
|
77
|
-
value: number;
|
|
78
|
-
unit: "s" | "min" | "h" | "d" | "wk" | "mo" | "a";
|
|
79
|
-
system: string;
|
|
80
|
-
code: "s" | "min" | "h" | "d" | "wk" | "mo" | "a";
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
/** Pure one-way serialization of an already composed canonical course. */
|
|
84
|
-
export declare function projectParallelRegimen(regimen: CanonicalParallelRegimen, clauseTexts: readonly (string | undefined)[], renderedInstruction: string, options?: FhirProjectionOptions): ParallelProjection;
|
|
85
|
-
export {};
|
|
56
|
+
export declare function buildCanonicalParallelRegimen(clauses: readonly CanonicalSigClause[], segments: readonly HpsgSigSegment[], plan: BoundaryPlan, graph: RegimenGraph, choices?: readonly (CanonicalChoice | undefined)[], memberStarts?: readonly (CanonicalBoundary | undefined)[]): CanonicalParallelRegimen;
|
|
@@ -2,9 +2,8 @@ import { type ParseOptions } from '../types';
|
|
|
2
2
|
import type { ParserState } from '../parser-state';
|
|
3
3
|
import type { HpsgSigSegment } from '../hpsg/segmenter';
|
|
4
4
|
import type { BoundaryPlan, PlannerOptions } from '../hpsg/signature';
|
|
5
|
-
/** Reuse exact completed HPSG
|
|
6
|
-
*
|
|
7
|
-
* parse, so it does not invalidate an exact segment result. */
|
|
5
|
+
/** Reuse an exact completed HPSG probe or its already selected lexical evidence.
|
|
6
|
+
* The production consumer applies carry-forward after taking the state. */
|
|
8
7
|
export declare function takeBoundaryParsedState(plan: BoundaryPlan, start: number, end: number, text: string): ParserState | undefined;
|
|
9
8
|
/** Production boundary grammar: lexical candidates are arbitrated using typed
|
|
10
9
|
* constituent ownership before final clause parsing.
|