ezmedicationinput 0.3.0-beta.1 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +155 -10
- package/dist/adapters/canonical-course.d.ts +7 -4
- package/dist/adapters/r5-course.d.ts +11 -2
- package/dist/advice-locale-adapter.d.ts +24 -0
- package/dist/advice.d.ts +39 -3
- package/dist/body-site-grammar.d.ts +21 -2
- package/dist/body-site-lookup.d.ts +6 -1
- package/dist/body-site-spatial.d.ts +7 -1
- package/dist/body-site-target.d.ts +35 -3
- package/dist/canonical/compile.d.ts +22 -3
- package/dist/canonical/course.d.ts +43 -7
- package/dist/canonical/dosage-agreement.d.ts +84 -0
- package/dist/canonical/format-course.d.ts +4 -2
- package/dist/clause-tail-grammar.d.ts +2 -0
- package/dist/combine-multilingual-dosages.d.ts +32 -0
- package/dist/date-interpretation.d.ts +36 -2
- package/dist/dosage-course.d.ts +26 -17
- package/dist/event-timing-expression.d.ts +26 -1
- package/dist/execution/engine.d.ts +2 -1
- package/dist/fhir-quantity-operator.d.ts +37 -1
- package/dist/fhir-translations.d.ts +14 -1
- package/dist/fhir.d.ts +25 -5
- package/dist/format.d.ts +23 -24
- package/dist/hpsg/constructions.d.ts +27 -5
- package/dist/hpsg/lexical-classes.d.ts +94 -33
- package/dist/hpsg/method-lexicon.d.ts +3 -0
- package/dist/hpsg/procedural-context.d.ts +51 -3
- package/dist/hpsg/projection.d.ts +7 -3
- package/dist/hpsg/quantity-lexicon.d.ts +51 -0
- package/dist/hpsg/rule-context.d.ts +101 -33
- package/dist/hpsg/rules/clinical-quantity-rules.d.ts +1 -1
- package/dist/hpsg/rules/condition-rules.d.ts +13 -2
- package/dist/hpsg/rules/core-rules.d.ts +5 -2
- package/dist/hpsg/rules/prn-rules.d.ts +10 -1
- package/dist/hpsg/rules/site-rules.d.ts +10 -1
- package/dist/hpsg/rules/timing-rules.d.ts +108 -24
- package/dist/hpsg/segmenter.d.ts +2 -2
- package/dist/hpsg/signature.d.ts +50 -5
- package/dist/hpsg/timing-lexicon.d.ts +18 -2
- package/dist/i18n.d.ts +8 -7
- package/dist/index.cjs +84275 -66589
- package/dist/index.d.ts +13 -3
- package/dist/index.js +84263 -66588
- package/dist/instruction-action-locale-adapter.d.ts +69 -5
- package/dist/instruction-action-parser.d.ts +48 -0
- package/dist/instruction-action-terminology.d.ts +22 -1
- package/dist/instruction-concept-terminology.d.ts +14 -1
- package/dist/instruction-graph-fhir.d.ts +4 -2
- package/dist/instruction-graph-ownership.d.ts +96 -0
- package/dist/instruction-graph.d.ts +19 -42
- package/dist/lexer/lex.d.ts +5 -1
- package/dist/lexer/locale.d.ts +14 -0
- package/dist/lexer/locales/en.d.ts +11 -0
- package/dist/lexer/surface.d.ts +3 -1
- package/dist/lexer/token-types.d.ts +6 -0
- package/dist/locale-detection.d.ts +4 -2
- package/dist/locales/clause/en.d.ts +14 -0
- package/dist/locales/course/en.d.ts +5 -0
- package/dist/localization.d.ts +6 -0
- package/dist/localized-timing.d.ts +1 -1
- package/dist/maps.d.ts +38 -12
- package/dist/medication-condition.d.ts +105 -11
- package/dist/parser-state.d.ts +10 -0
- package/dist/parser.d.ts +5 -3
- package/dist/prn.d.ts +15 -2
- package/dist/regimen/coordination-scope.d.ts +13 -1
- package/dist/regimen/grammar.d.ts +7 -1
- package/dist/regimen/parallel-course.d.ts +6 -2
- package/dist/regimen/planner.d.ts +2 -3
- package/dist/regimen/regimen.d.ts +2 -0
- package/dist/schedule.d.ts +5 -2
- package/dist/snomed.d.ts +3 -0
- package/dist/suggest-locale-adapter.d.ts +15 -0
- package/dist/symptom-terminology.d.ts +5 -1
- package/dist/timing-summary.d.ts +43 -10
- package/dist/types.d.ts +213 -16
- package/dist/unit-lexicon.d.ts +2 -6
- package/dist/utils/units.d.ts +3 -0
- package/package.json +1 -1
package/dist/localization.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export interface CourseLanguage {
|
|
|
34
34
|
applicationSites(count: number): string;
|
|
35
35
|
readonly rateLabel: string;
|
|
36
36
|
readonly rateRangeLabel: string;
|
|
37
|
+
readonly carrierVolumeLabel: string;
|
|
37
38
|
readonly unspecified: string;
|
|
38
39
|
withAuthoredDirections(current: string, source: string): string;
|
|
39
40
|
readonly treatmentStart: string;
|
|
@@ -53,8 +54,11 @@ export interface CourseLanguage {
|
|
|
53
54
|
ifLimitExceeded(action: string): string;
|
|
54
55
|
eventWindow(start: string, end: string): string;
|
|
55
56
|
unresolvedCycleTiming(days: string, periodDays?: number, cycles?: number, anchor?: string): string;
|
|
57
|
+
namedCycleTiming?(cycle: string, days: string, startDay?: number, maxTreatmentDays?: number): string;
|
|
58
|
+
cycleDayOneDefinition?(event: string): string;
|
|
56
59
|
weekdayName(day: string): string;
|
|
57
60
|
measurementName(name: string): string;
|
|
61
|
+
conditionFindingName?(fallback: string, translations?: Readonly<Record<string, string>>, label?: string): string;
|
|
58
62
|
joinList(items: readonly string[]): string;
|
|
59
63
|
timeUnit(unit: string, value: number | undefined): string | undefined;
|
|
60
64
|
expression(kind: "dose" | "rate", detail: string | undefined): string;
|
|
@@ -66,6 +70,8 @@ export interface CourseLanguage {
|
|
|
66
70
|
endsWithinPeriod(offset: string, context: string): string;
|
|
67
71
|
afterTreatmentStart(offset: string): string;
|
|
68
72
|
relativeEvent(offset: string, event: string | undefined, before: boolean): string;
|
|
73
|
+
/** Compare event-relative time points without narrowing an open-ended range. */
|
|
74
|
+
relativeTimeLimit?(point: string, comparator: "<" | "<=" | ">" | ">="): string;
|
|
69
75
|
calendarWindow(start?: string, end?: string): string;
|
|
70
76
|
calendarEvents(events: readonly string[]): string;
|
|
71
77
|
reviewTiming(source?: string, boundary?: "end"): string;
|
|
@@ -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, type FhirCoding, 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,13 +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>;
|
|
18
14
|
/** Prefer the first explicitly identified route; keep a systemless legacy fallback. */
|
|
19
|
-
export declare function routeCodeFromCodings(codings: readonly Pick<FhirCoding, "system" | "code">[] | undefined): RouteCode | undefined;
|
|
15
|
+
export declare function routeCodeFromCodings(codings: readonly Pick<FhirCoding | FhirR6Coding, "system" | "_system" | "code">[] | undefined): RouteCode | undefined;
|
|
20
16
|
export interface RouteSynonym {
|
|
21
17
|
code: RouteCode;
|
|
22
18
|
text: string;
|
|
@@ -30,8 +26,42 @@ export declare const DEFAULT_ROUTE_SYNONYMS: Record<string, RouteSynonym>;
|
|
|
30
26
|
export declare function normalizeBodySiteKey(value: string): string;
|
|
31
27
|
type BodySiteSnomedSourceEntry = {
|
|
32
28
|
names: string[];
|
|
29
|
+
/** Exact reverse-code wording, independent of accepted forward alias order. */
|
|
30
|
+
preferredForCode?: boolean;
|
|
33
31
|
definition: BodySiteDefinition;
|
|
34
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;
|
|
35
65
|
export declare const DEFAULT_BODY_SITE_SNOMED_SOURCE: BodySiteSnomedSourceEntry[];
|
|
36
66
|
export declare const DEFAULT_BODY_SITE_SNOMED: Record<string, BodySiteDefinition>;
|
|
37
67
|
export declare const DEFAULT_BODY_SITE_HINTS: Set<string>;
|
|
@@ -39,18 +69,14 @@ export declare const HOUSEHOLD_VOLUME_UNITS: readonly ["tsp", "tbsp"];
|
|
|
39
69
|
export declare const DEFAULT_UNIT_SYNONYMS: Record<string, string>;
|
|
40
70
|
/** Remove non-dimensional UCUM annotations for comparison only.
|
|
41
71
|
* Callers retain their own terminology, supported-unit and case rules. */
|
|
42
|
-
export declare function stripUcumAnnotations(code: string): string;
|
|
72
|
+
export declare function stripUcumAnnotations(code: string, ungroupSingletons?: boolean): string;
|
|
43
73
|
/** Resolve standard codes and plain unit labels to the same calculation unit.
|
|
44
74
|
* @param quantity A dose or limit quantity; its original display remains untouched.
|
|
45
75
|
* @param includeOpaqueCode Retain an unknown code as a display/counting label.
|
|
46
76
|
* Dimensional calculations disable that fallback, while still accepting authored
|
|
47
77
|
* unit labels and explicit UCUM expressions outside the simple-unit lexicon.
|
|
48
78
|
*/
|
|
49
|
-
export declare function getDoseQuantityUnit(quantity:
|
|
50
|
-
system?: string;
|
|
51
|
-
code?: string;
|
|
52
|
-
unit?: string;
|
|
53
|
-
} | undefined, includeOpaqueCode?: boolean): string;
|
|
79
|
+
export declare function getDoseQuantityUnit(quantity: Pick<FhirR6Quantity, "system" | "code" | "unit" | "_system"> | undefined, includeOpaqueCode?: boolean): string;
|
|
54
80
|
/** Resolve a known dosage unit without changing its display or numerical value.
|
|
55
81
|
* @param unit Canonical unit or supported synonym, including dimensional rates.
|
|
56
82
|
*/
|
|
@@ -1,38 +1,132 @@
|
|
|
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 CountedAdviceSituation {
|
|
6
|
+
end: number;
|
|
7
|
+
conceptId: string;
|
|
8
|
+
count: number;
|
|
9
|
+
unit: "tab" | "dose";
|
|
10
|
+
comparator?: ">=";
|
|
11
|
+
consecutive?: true;
|
|
12
|
+
}
|
|
13
|
+
export interface MedicationConditionLexicalFeatures {
|
|
14
|
+
countedAdviceSituation?(source: string): CountedAdviceSituation | undefined;
|
|
15
|
+
operators: ReadonlyArray<{
|
|
16
|
+
operation: "ge" | "le" | "gt" | "lt";
|
|
17
|
+
pattern: RegExp;
|
|
18
|
+
}>;
|
|
19
|
+
stateLeads: readonly RegExp[];
|
|
20
|
+
/** A predicate-initial qualifier that selects a registered nonfinite activity. */
|
|
21
|
+
activityConcernLead?: RegExp;
|
|
22
|
+
/** A predicate-final qualifier that selects an administration activity. */
|
|
23
|
+
activityConcernTail?: RegExp;
|
|
24
|
+
connectors: RegExp;
|
|
25
|
+
/** Complete comparison lexemes whose internal connectors are not Boolean operators. */
|
|
26
|
+
comparisonOperator?: RegExp;
|
|
27
|
+
measurementNameAliases?: Readonly<Record<string, string>>;
|
|
28
|
+
boundaries: {
|
|
29
|
+
frontedLead: RegExp;
|
|
30
|
+
alternative: RegExp;
|
|
31
|
+
noDoseConsequent: RegExp;
|
|
32
|
+
};
|
|
33
|
+
measurementCopula: RegExp;
|
|
34
|
+
stateNoise: RegExp;
|
|
35
|
+
approvalPredicate: RegExp;
|
|
36
|
+
negationPrefix: RegExp;
|
|
37
|
+
unlessLead: RegExp;
|
|
38
|
+
disjunction: RegExp;
|
|
39
|
+
tokenCue: RegExp;
|
|
40
|
+
sourceCue: RegExp;
|
|
41
|
+
calendar: {
|
|
42
|
+
cycle: {
|
|
43
|
+
/** Whole-source admission for day, named-cycle and maximum constituents. */
|
|
44
|
+
cue: RegExp;
|
|
45
|
+
frame: string;
|
|
46
|
+
startLead: RegExp;
|
|
47
|
+
repeatCount: RegExp;
|
|
48
|
+
dayPart?: string;
|
|
49
|
+
identifyNamedCycle?(surface: string): {
|
|
50
|
+
conceptId: string;
|
|
51
|
+
startsOnDay?: boolean;
|
|
52
|
+
} | undefined;
|
|
53
|
+
treatmentMaximum?: {
|
|
54
|
+
cue: RegExp;
|
|
55
|
+
frame: string;
|
|
56
|
+
};
|
|
57
|
+
dayOneDefinitions?: readonly {
|
|
58
|
+
frame: string;
|
|
59
|
+
cycleConceptId: string;
|
|
60
|
+
eventConceptId: string;
|
|
61
|
+
}[];
|
|
62
|
+
};
|
|
63
|
+
cue: RegExp;
|
|
64
|
+
/** Registration-derived views for whole-source search and token-origin admission. */
|
|
65
|
+
sourceCue?: RegExp;
|
|
66
|
+
startCue?: RegExp;
|
|
67
|
+
weekdays: ReadonlyArray<{
|
|
68
|
+
day: FhirDayOfWeek;
|
|
69
|
+
patterns: RegExp[];
|
|
70
|
+
}>;
|
|
71
|
+
groups: ReadonlyArray<{
|
|
72
|
+
pattern: RegExp;
|
|
73
|
+
days: FhirDayOfWeek[];
|
|
74
|
+
}>;
|
|
75
|
+
connectors: RegExp;
|
|
76
|
+
universalQuantifiers: ReadonlySet<string>;
|
|
77
|
+
dayHeads: ReadonlySet<string>;
|
|
78
|
+
};
|
|
79
|
+
guardLead: RegExp;
|
|
80
|
+
intervalEligibilityLead?: RegExp;
|
|
81
|
+
numericGuard: RegExp;
|
|
82
|
+
contextDayGuard: RegExp;
|
|
83
|
+
contextDayNominal: RegExp;
|
|
84
|
+
measurement: RegExp;
|
|
85
|
+
headlessMeasurement: RegExp;
|
|
86
|
+
measurementChange: RegExp;
|
|
87
|
+
observationWindow: RegExp;
|
|
88
|
+
circumstantialGuard: RegExp;
|
|
89
|
+
/** Optional token admission for circumstantial leads, separate from ordinary guard markers. */
|
|
90
|
+
circumstantialCue?: RegExp;
|
|
91
|
+
bareLead: RegExp;
|
|
92
|
+
}
|
|
93
|
+
/** Existing advice providers supply lexical features; HPSG still owns the tree. */
|
|
94
|
+
export declare function medicationConditionLexicalFeatures(locale?: string): MedicationConditionLexicalFeatures;
|
|
95
|
+
/** Remove registered state leads without interpreting the remaining predicate. */
|
|
96
|
+
export declare function normalizeMedicationConditionStateText(value: string, lexicon: MedicationConditionLexicalFeatures): string;
|
|
6
97
|
export interface MedicationGuardLeadLexeme {
|
|
7
98
|
start: number;
|
|
8
99
|
end: number;
|
|
9
100
|
marker: "if" | "only-if" | "unless";
|
|
10
101
|
circumstantial?: true;
|
|
102
|
+
intervalEligibility?: true;
|
|
11
103
|
}
|
|
12
104
|
/** Recognize a conditional marker's spelling, leaving its predicate licensing
|
|
13
105
|
* and scope to the HPSG guard-head construction. */
|
|
14
|
-
export declare function medicationGuardLeadLexeme(source: string, licensedConsequent?: boolean): MedicationGuardLeadLexeme | undefined;
|
|
106
|
+
export declare function medicationGuardLeadLexeme(source: string, licensedConsequent?: boolean, lexicon?: MedicationConditionLexicalFeatures): MedicationGuardLeadLexeme | undefined;
|
|
107
|
+
/** The cycle schedule and adjacent guards use the same provider-owned cap span. */
|
|
108
|
+
export declare function namedCycleTreatmentMaxima(source: string, cycle: MedicationConditionLexicalFeatures["calendar"]["cycle"], start?: number, end?: number): IterableIterator<{
|
|
109
|
+
start: number;
|
|
110
|
+
end: number;
|
|
111
|
+
days: number;
|
|
112
|
+
conceptId: string;
|
|
113
|
+
}>;
|
|
15
114
|
/** Lexical boundary spellings shared with the typed guard phrase. No result
|
|
16
115
|
* from these recognizers is itself a medication condition or administration. */
|
|
17
|
-
export declare const MEDICATION_GUARD_BOUNDARIES: {
|
|
18
|
-
frontedLead: RegExp;
|
|
19
|
-
alternative: RegExp;
|
|
20
|
-
noDoseConsequent: RegExp;
|
|
21
|
-
};
|
|
22
116
|
/** Recognize one predicate atom. Incomplete comparisons remain unsatisfied
|
|
23
117
|
* head requirements, not measurements with a guessed variable name. */
|
|
24
|
-
export declare function medicationConditionAtomLexeme(input: string): HpsgGuardFeature;
|
|
118
|
+
export declare function medicationConditionAtomLexeme(input: string, lexicon?: MedicationConditionLexicalFeatures): HpsgGuardFeature;
|
|
25
119
|
/** Recognize a predicate negator, not the beginning of a comparison idiom.
|
|
26
120
|
* @param source One predicate atom before Boolean coordination.
|
|
27
121
|
*/
|
|
28
|
-
export declare function conditionNegationPrefixLength(source: string): number | undefined;
|
|
122
|
+
export declare function conditionNegationPrefixLength(source: string, lexicon?: MedicationConditionLexicalFeatures): number | undefined;
|
|
29
123
|
export interface ConditionSourceLexeme {
|
|
30
124
|
start: number;
|
|
31
125
|
end: number;
|
|
32
126
|
operator?: "all" | "any";
|
|
33
127
|
}
|
|
34
128
|
/** Lexicalize Boolean connective surfaces without assigning a tree or scope. */
|
|
35
|
-
export declare function conditionSourceLexemes(source: string, start: number, end: number): ConditionSourceLexeme[];
|
|
129
|
+
export declare function conditionSourceLexemes(source: string, start: number, end: number, lexicon?: MedicationConditionLexicalFeatures): ConditionSourceLexeme[];
|
|
36
130
|
/** Punctuation boundary excluding decimal points inside lexical quantities. */
|
|
37
131
|
export declare function medicationGuardClauseBoundary(text: string): number;
|
|
38
132
|
/**
|
package/dist/parser-state.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AnnotatedLexToken } from "./lexer/meaning";
|
|
2
|
+
import type { CanonicalBoundary } from "./canonical/course";
|
|
2
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;
|
|
@@ -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>);
|
|
@@ -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,18 @@
|
|
|
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
|
-
|
|
6
|
+
/** Match the complete registered symptom, allowing only its existing predicative state lead. */
|
|
7
|
+
export declare function resolveWholePrnSymptom(text: string | undefined): SymptomDefinition | undefined;
|
|
8
|
+
export declare function getPrnReasonTextFallbackI18n(reason: CanonicalPrnReasonExpr): Record<string, string> | undefined;
|
|
9
|
+
export declare function getLocalizedCanonicalPrnReasonText(reason: CanonicalPrnReasonExpr | undefined, reasons: CanonicalPrnReasonExpr[] | undefined, locale: string, conjunction?: string, realizeReason?: (reason: CanonicalPrnReasonExpr, localizedText: string | undefined) => string | undefined): string | undefined;
|
|
10
|
+
export interface LocatedPrnWording {
|
|
11
|
+
symptom?: SymptomDefinition;
|
|
12
|
+
site: ResolvedBodySitePhrase;
|
|
13
|
+
spatialRelation?: BodySiteSpatialRelation;
|
|
14
|
+
coversSpatialRelation: boolean;
|
|
15
|
+
}
|
|
16
|
+
/** Check complete constituent wording against typed finding facts. Unknown
|
|
17
|
+
* heads remain authored text; a Coding alone never proves that text's meaning. */
|
|
18
|
+
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;
|
|
@@ -65,6 +68,9 @@ export declare function grammaticalCoordinationScopes(facts: CoordinationScopeFa
|
|
|
65
68
|
* whether that local adjunct scopes over a related compatible administration.
|
|
66
69
|
*/
|
|
67
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;
|
|
68
74
|
/** Exact elapsed interval on a terminal wait action, already composed by HPSG. */
|
|
69
75
|
export declare function terminalAdministrationDelay(clause: CanonicalSigClause): number | undefined;
|
|
70
76
|
/** Rules inspect features only. Surface/locale recognition belongs to lexical and span producers. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CanonicalBoundary, type RegimenPosition } from '../canonical/course';
|
|
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';
|
|
@@ -12,6 +12,8 @@ export interface CanonicalParallelComponent {
|
|
|
12
12
|
boundsEndBasis?: 'next-phase-start' | 'anchored-duration';
|
|
13
13
|
/** Original track-phase origin retained when copied across global steps. */
|
|
14
14
|
phaseOrigin?: RegimenPosition;
|
|
15
|
+
/** Selected member boundary retained before global cuts can be ordered. */
|
|
16
|
+
phaseStart?: CanonicalBoundary;
|
|
15
17
|
}
|
|
16
18
|
export interface CanonicalParallelPhase {
|
|
17
19
|
kind: 'relative' | 'calendar';
|
|
@@ -25,6 +27,8 @@ export interface CanonicalParallelPhase {
|
|
|
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;
|
|
@@ -49,4 +53,4 @@ export type CanonicalParallelRegimen = {
|
|
|
49
53
|
* inspected. Unsupported relationships remain editable through ordinary
|
|
50
54
|
* per-clause results while this richer course projection stays unresolved.
|
|
51
55
|
*/
|
|
52
|
-
export declare function buildCanonicalParallelRegimen(clauses: readonly CanonicalSigClause[], segments: readonly HpsgSigSegment[], plan: BoundaryPlan, graph: RegimenGraph): CanonicalParallelRegimen;
|
|
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.
|
|
@@ -47,6 +47,8 @@ export declare function hasExactScheduleDuration(schedule: CanonicalSigClause["s
|
|
|
47
47
|
* wire layer never has to choose between boundsPeriod and boundsDuration.
|
|
48
48
|
*/
|
|
49
49
|
export declare function anchoredScheduleDurationEnd(schedule: CanonicalSigClause['schedule']): string | undefined;
|
|
50
|
+
/** Inherit a source administration before selective target/clock partitioning. */
|
|
51
|
+
export declare function scopeDelayedTargetAdministrations(states: readonly ParserState[], segments: readonly HpsgSigSegment[], graph: RegimenGraph): void;
|
|
50
52
|
/**
|
|
51
53
|
* License sequential schedule inheritance on the typed regimen graph before
|
|
52
54
|
* canonical clauses are lowered to FHIR. A complete predecessor phase owns
|
package/dist/schedule.d.ts
CHANGED
|
@@ -6,9 +6,12 @@
|
|
|
6
6
|
* implemented in execution/engine, which has no import/export dependency.
|
|
7
7
|
* Canonical callers bypass interchange completely.
|
|
8
8
|
*/
|
|
9
|
-
import type { FhirDosage, FhirR6DosageInstructionInput, ParseBatchResult, NextDueDoseOptions, TotalUnitsOptions, TotalUnitsResult } from "./types";
|
|
9
|
+
import type { FhirDosage, FhirR6DosageInstructionInput, ParseBatchResult, DueDose, NextDueDoseOptions, TotalUnitsOptions, TotalUnitsResult } from "./types";
|
|
10
10
|
import type { CanonicalScheduleInput, CanonicalSupplyOptions } from "./canonical/course";
|
|
11
11
|
import { MedicationQuantityCalculationError } from "./execution/engine";
|
|
12
12
|
export { MedicationQuantityCalculationError };
|
|
13
|
-
|
|
13
|
+
type ScheduleInput = FhirDosage | readonly FhirDosage[] | FhirR6DosageInstructionInput | ParseBatchResult | CanonicalScheduleInput;
|
|
14
|
+
export declare function nextDueDoses(input: ScheduleInput, options: NextDueDoseOptions): string[];
|
|
15
|
+
/** Schedule the same opportunities with the selected administration and known source facts. */
|
|
16
|
+
export declare function nextDueDosesDetailed(input: ScheduleInput, options: NextDueDoseOptions): DueDose[];
|
|
14
17
|
export declare function calculateTotalUnits(options: TotalUnitsOptions | CanonicalSupplyOptions): TotalUnitsResult;
|
package/dist/snomed.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FhirCoding, FhirR6Coding } from "./types";
|
|
1
2
|
export declare const SNOMED_SYSTEM = "http://snomed.info/sct";
|
|
2
3
|
export declare const SNOMED_CT_FINDING_SITE_ATTRIBUTE_CODE = "363698007";
|
|
3
4
|
export declare const SNOMED_CT_FINDING_SITE_ATTRIBUTE_DISPLAY = "Finding site";
|
|
@@ -11,3 +12,5 @@ export declare const SNOMED_CT_RIGHT_QUALIFIER_CODE = "24028007";
|
|
|
11
12
|
export declare const SNOMED_CT_RIGHT_QUALIFIER_DISPLAY = "Right";
|
|
12
13
|
export declare const SNOMED_CT_BILATERAL_QUALIFIER_CODE = "51440002";
|
|
13
14
|
export declare const SNOMED_CT_BILATERAL_QUALIFIER_DISPLAY = "Right and left";
|
|
15
|
+
/** Legacy shorthand defaults to SNOMED; a primitive companion alone does not establish identity. */
|
|
16
|
+
export declare function codingSystemWithSnomedDefault(coding: Pick<FhirCoding | FhirR6Coding, "system" | "_system"> | undefined): string | undefined;
|
|
@@ -7,6 +7,11 @@ export interface SuggestLocaleUnitRoutePair {
|
|
|
7
7
|
export interface SuggestLocaleAdapter {
|
|
8
8
|
locale: string;
|
|
9
9
|
acceptsSurface(surface: string): boolean;
|
|
10
|
+
directTimeSuggestions?(input: string, limit: number): string[] | undefined;
|
|
11
|
+
directRelationSuggestions?(input: string, events: string[], acceptsEvent: (relation: string, event: string) => boolean, limit: number): string[] | undefined;
|
|
12
|
+
actionDisplay?(display: string, custom: boolean): string | undefined;
|
|
13
|
+
allowsAdjacentArgument?(action: string, suffix: string): boolean;
|
|
14
|
+
prnReasonLocale?(input: string): string | undefined;
|
|
10
15
|
unitSuggestionUsesLocaleLexemes: boolean;
|
|
11
16
|
includeEyeAbbreviations: boolean;
|
|
12
17
|
preferRawSiteMapSurfaces: boolean;
|
|
@@ -18,6 +23,9 @@ export interface SuggestLocaleAdapter {
|
|
|
18
23
|
partial: string;
|
|
19
24
|
} | undefined;
|
|
20
25
|
joinBodySite(lead: string, surface: string): string;
|
|
26
|
+
/** Own PRN recognition and vocabulary selection together. The vocabulary
|
|
27
|
+
* callback is lazy; legacy completion hooks remain the fallback. */
|
|
28
|
+
completePrn?(input: string, reasons: (locale?: string) => string[], limit: number): string[] | undefined;
|
|
21
29
|
directPrnCompletion(input: string, reasons: string[], limit: number): string[] | undefined;
|
|
22
30
|
buildUnitCandidate(prefix: string, dose: string, surface: string, route: string): string;
|
|
23
31
|
unitSurface(unit: string, lexeme: SuggestLocaleLexemeResolver): string;
|
|
@@ -29,3 +37,10 @@ export interface SuggestLocaleAdapter {
|
|
|
29
37
|
}
|
|
30
38
|
export declare function registerSuggestLocaleAdapter(adapter: SuggestLocaleAdapter): void;
|
|
31
39
|
export declare function getSuggestLocaleAdapter(locale: string): SuggestLocaleAdapter;
|
|
40
|
+
/** An unregistered locale shares the English clock fallback. A registered
|
|
41
|
+
* provider owns its absent or declining capability without augmentation. */
|
|
42
|
+
export declare function directLocaleTimeSuggestions(locale: string, input: string, limit: number): string[] | undefined;
|
|
43
|
+
/** Dispatch provider completion without constructing stock vocabulary for an
|
|
44
|
+
* unrelated input. Stock combined hooks already include their unchanged legacy
|
|
45
|
+
* matcher; a provider's independent legacy override remains a real fallback. */
|
|
46
|
+
export declare function completeLocalePrnSuggestions(adapter: SuggestLocaleAdapter, locale: string, input: string, reasons: (locale?: string) => string[], limit: number): string[] | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SymptomDefinition } from "./types";
|
|
1
|
+
import { SymptomDefinition, PrnReasonLookupRequest, PrnReasonSelection } from "./types";
|
|
2
2
|
export interface SymptomDictionaryEntry {
|
|
3
3
|
canonical: string;
|
|
4
4
|
definition: SymptomDefinition;
|
|
@@ -10,3 +10,7 @@ export declare const DEFAULT_SYMPTOM_DEFINITIONS: Record<string, SymptomDefiniti
|
|
|
10
10
|
export declare function resolveSymptomDefinition(surface: string, ...customMaps: Array<Record<string, SymptomDefinition> | undefined>): SymptomDefinition | undefined;
|
|
11
11
|
export declare function findSymptomDefinitionByCoding(system: string, code: string): SymptomDefinition | undefined;
|
|
12
12
|
export declare function listSymptomDefinitions(): SymptomDefinition[];
|
|
13
|
+
/** Shared exact selection keys for grammar ownership and later coding. */
|
|
14
|
+
export declare function buildCombinedPrnReasonCanonical(request: PrnReasonLookupRequest): string | undefined;
|
|
15
|
+
export declare function collectPrnReasonLookupCanonicals(request: PrnReasonLookupRequest): string[];
|
|
16
|
+
export declare function matchPrnReasonSelection(selections: PrnReasonSelection | PrnReasonSelection[] | undefined, request: PrnReasonLookupRequest): PrnReasonSelection | undefined;
|
package/dist/timing-summary.d.ts
CHANGED
|
@@ -1,21 +1,29 @@
|
|
|
1
|
+
import type { CanonicalScheduleExpr, FormatOptions } from "./types";
|
|
1
2
|
import { EventTiming, FhirDayOfWeek, FhirPeriodUnit, type ParseOptions } from "./types";
|
|
3
|
+
/** Resolve authored event-relative offsets without changing their stored sign. */
|
|
4
|
+
export declare function signedTimingEventOffset(code: string, offset: number): number;
|
|
5
|
+
/** Standard event meanings that already supply a before/after relation. */
|
|
6
|
+
export declare function timingEventHasDirectionalRelation(code: string): boolean;
|
|
2
7
|
/** Exact standard timing identities shared by native compilation and wire
|
|
3
8
|
* projection. Local codes remain text unless this vocabulary recognizes them. */
|
|
9
|
+
/** Lexical shorthand selects clinic clock defaults; the typed repeat owns its cadence. */
|
|
10
|
+
export declare const SIG_TIMING_SHORTHAND_SYSTEM = "urn:ezmedicationinput:CodeSystem:timing-shorthand";
|
|
4
11
|
export declare const FHIR_GTS_TIMING_SYSTEM = "http://terminology.hl7.org/CodeSystem/v3-GTSAbbreviation";
|
|
5
12
|
export declare const FHIR_GTS_TIMING_CODES: Set<string>;
|
|
6
|
-
|
|
7
|
-
export declare function isStandardTimingCoding(coding: {
|
|
13
|
+
type TimingCodingIdentity = {
|
|
8
14
|
system?: string;
|
|
15
|
+
_system?: unknown;
|
|
9
16
|
code?: string;
|
|
10
|
-
}
|
|
17
|
+
};
|
|
18
|
+
/** An absent namespace allows shorthand; an explicitly unknown namespace does not. */
|
|
19
|
+
export declare function hasStandardTimingSystem(coding: TimingCodingIdentity | undefined): boolean;
|
|
20
|
+
/** Supported standard identity for coding selection and wire projection. */
|
|
21
|
+
export declare function isStandardTimingCoding(coding: TimingCodingIdentity | undefined): boolean;
|
|
11
22
|
/** Existing compact interval vocabulary applies to text and systemless codes. */
|
|
12
23
|
export declare function isCompactIntervalTimingCode(code: string): boolean;
|
|
13
24
|
/** Existing clinical preview abbreviations include shorthand such as QHS
|
|
14
25
|
* that is not emitted as a standard FHIR code. Foreign systems stay opaque. */
|
|
15
|
-
export declare function isPreviewTimingCoding(coding:
|
|
16
|
-
system?: string;
|
|
17
|
-
code?: string;
|
|
18
|
-
} | undefined): boolean;
|
|
26
|
+
export declare function isPreviewTimingCoding(coding: TimingCodingIdentity | undefined): boolean;
|
|
19
27
|
/** Prefer an understood cadence over a local translation without changing
|
|
20
28
|
* either coding or its authored order. Local-only concepts keep their first code. */
|
|
21
29
|
export declare function preferredTimingCoding<T extends {
|
|
@@ -52,19 +60,39 @@ export declare const TIMING_CODE_HOURLY_PERIODS: Readonly<Record<string, number>
|
|
|
52
60
|
/** Exact elapsed scales used to compare a numeric cadence, without assigning
|
|
53
61
|
* calendar-month lengths or choosing clinic clocks. */
|
|
54
62
|
export declare const FIXED_TIMING_PERIOD_SECONDS: Readonly<Record<string, number>>;
|
|
63
|
+
/** Exact grouping on treatment days within a whole civil-day interval.
|
|
64
|
+
* Preview and execution retain their own behavior outside this shared scope. */
|
|
65
|
+
export declare function isExactTreatmentDayCadence(repeat: {
|
|
66
|
+
frequency?: number;
|
|
67
|
+
frequencyMax?: number;
|
|
68
|
+
period?: number;
|
|
69
|
+
periodMax?: number;
|
|
70
|
+
periodUnit?: string;
|
|
71
|
+
}): boolean;
|
|
55
72
|
/** One exact cadence comparison for execution and clinical preview. */
|
|
56
73
|
export declare function matchesDailyCodeCadence(daily: number, repeat: {
|
|
57
74
|
frequency?: number;
|
|
58
75
|
period?: number;
|
|
59
76
|
periodUnit?: string;
|
|
60
77
|
}): boolean;
|
|
78
|
+
/** Whether a known daily cadence fits an authored frequency/period range.
|
|
79
|
+
* Execution retains validation and clock selection; preview uses this same
|
|
80
|
+
* intersection without resolving or replacing either authored endpoint. */
|
|
81
|
+
export declare function dailyCodeFitsRecurrenceRange(daily: number, repeat: {
|
|
82
|
+
frequency?: number;
|
|
83
|
+
frequencyMax?: number;
|
|
84
|
+
period?: number;
|
|
85
|
+
periodMax?: number;
|
|
86
|
+
periodUnit?: string;
|
|
87
|
+
}): boolean;
|
|
61
88
|
/** Standard coding has its own clinical meaning; free SIG shorthand stays lexical. */
|
|
62
89
|
export declare function timingCodeMeaning(coding: {
|
|
63
90
|
system?: string;
|
|
64
91
|
code?: string;
|
|
65
92
|
} | undefined): string | undefined;
|
|
66
|
-
/** Emit a standard identity only when its meaning matches the parsed
|
|
67
|
-
|
|
93
|
+
/** Emit a standard identity only when its complete meaning matches the parsed
|
|
94
|
+
* shorthand. Restricted recurrence retains the established local-code map key. */
|
|
95
|
+
export declare function timingCodingFromSig(code: string | undefined, schedule?: CanonicalScheduleExpr): {
|
|
68
96
|
system: string;
|
|
69
97
|
code: string;
|
|
70
98
|
} | undefined;
|
|
@@ -77,7 +105,7 @@ export declare function intervalTimingPreviewDescriptor(code: string): {
|
|
|
77
105
|
periodMax?: number;
|
|
78
106
|
periodUnit: FhirPeriodUnit;
|
|
79
107
|
} | undefined;
|
|
80
|
-
export interface TimingSummaryOptions {
|
|
108
|
+
export interface TimingSummaryOptions extends Pick<ParseOptions, "locale" | "i18n"> {
|
|
81
109
|
/** Scoped vocabulary in the original parse/format request. Do not build
|
|
82
110
|
* any second registry or retain it on the canonical clinical course. */
|
|
83
111
|
instructionActionMap?: ParseOptions["instructionActionMap"];
|
|
@@ -85,6 +113,7 @@ export interface TimingSummaryOptions {
|
|
|
85
113
|
groupMealTimingsByRelation?: boolean;
|
|
86
114
|
includeTimesPerDaySummary?: boolean;
|
|
87
115
|
sitePlacement?: "natural" | "trailing";
|
|
116
|
+
pairedSiteWording?: FormatOptions["pairedSiteWording"];
|
|
88
117
|
}
|
|
89
118
|
export type MealRelation = "before" | "after" | "with";
|
|
90
119
|
export type MealName = "breakfast" | "lunch" | "dinner";
|
|
@@ -101,8 +130,12 @@ export interface TimingSummaryInput {
|
|
|
101
130
|
periodUnit?: FhirPeriodUnit;
|
|
102
131
|
timingCode?: string;
|
|
103
132
|
dayOfWeek?: FhirDayOfWeek[];
|
|
133
|
+
dayOfMonth?: number[];
|
|
104
134
|
when?: EventTiming[];
|
|
105
135
|
timeOfDay?: string[];
|
|
106
136
|
}
|
|
137
|
+
/** A named meal is an event anchor, distinct from a coarse morning/evening daypart. */
|
|
138
|
+
export declare function isSpecificMealTimingEvent(code: EventTiming): boolean;
|
|
107
139
|
export declare function getMealTimingGroup(when: EventTiming[], options?: TimingSummaryOptions): MealTimingGroup | undefined;
|
|
108
140
|
export declare function inferDailyOccurrenceCount(input: TimingSummaryInput, options?: TimingSummaryOptions): number | undefined;
|
|
141
|
+
export {};
|