ezmedicationinput 0.3.0 → 0.3.2-beta.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 +138 -0
- package/dist/adapters/r5-course.d.ts +6 -0
- package/dist/body-site-grammar.d.ts +6 -2
- package/dist/body-site-target.d.ts +4 -1
- package/dist/canonical/course.d.ts +4 -1
- package/dist/canonical/dosage-agreement.d.ts +84 -0
- package/dist/canonical/format-course.d.ts +8 -1
- package/dist/combine-multilingual-dosages.d.ts +32 -0
- package/dist/event-timing-expression.d.ts +3 -1
- package/dist/execution/engine.d.ts +2 -1
- package/dist/fhir-translations.d.ts +13 -0
- package/dist/fhir.d.ts +1 -1
- package/dist/format.d.ts +4 -1
- package/dist/hpsg/constructions.d.ts +3 -0
- package/dist/hpsg/lexical-classes.d.ts +6 -0
- package/dist/hpsg/procedural-context.d.ts +11 -6
- package/dist/hpsg/projection.d.ts +2 -2
- package/dist/hpsg/rule-context.d.ts +9 -4
- package/dist/hpsg/rules/core-rules.d.ts +5 -3
- package/dist/hpsg/rules/prn-rules.d.ts +2 -1
- package/dist/hpsg/rules/timing-rules.d.ts +35 -25
- package/dist/hpsg/signature.d.ts +31 -1
- package/dist/hpsg/timing-lexicon.d.ts +5 -0
- package/dist/i18n.d.ts +3 -0
- package/dist/index.cjs +49230 -43847
- package/dist/index.d.ts +6 -1
- package/dist/index.js +49218 -43846
- package/dist/instruction-action-locale-adapter.d.ts +21 -3
- package/dist/instruction-action-parser.d.ts +16 -1
- package/dist/instruction-action-terminology.d.ts +7 -0
- package/dist/instruction-concept-terminology.d.ts +1 -0
- package/dist/instruction-graph-ownership.d.ts +9 -2
- package/dist/instruction-graph.d.ts +15 -4
- package/dist/locale-realization.d.ts +2 -0
- package/dist/locales/course/en.d.ts +10 -5
- package/dist/localization.d.ts +8 -1
- package/dist/medication-condition.d.ts +36 -1
- package/dist/prn.d.ts +2 -0
- package/dist/schedule.d.ts +5 -2
- package/dist/timing-summary.d.ts +3 -2
- package/dist/types.d.ts +104 -4
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SigTranslationConfig } from "./i18n";
|
|
2
|
+
import type { CanonicalBoundary } from "./canonical/course";
|
|
2
3
|
export interface FhirCoding {
|
|
3
4
|
id?: string;
|
|
4
5
|
system?: string;
|
|
@@ -610,6 +611,12 @@ export type MedicationCondition = {
|
|
|
610
611
|
name: string;
|
|
611
612
|
text: string;
|
|
612
613
|
expected: boolean;
|
|
614
|
+
finding?: {
|
|
615
|
+
system: string;
|
|
616
|
+
code: string;
|
|
617
|
+
version?: string;
|
|
618
|
+
display?: string;
|
|
619
|
+
};
|
|
613
620
|
} | {
|
|
614
621
|
kind: "text";
|
|
615
622
|
text: string;
|
|
@@ -962,11 +969,13 @@ export interface FormatOptions {
|
|
|
962
969
|
includeTimesPerDaySummary?: boolean;
|
|
963
970
|
/** Thai long-text site placement. `natural` uses route-sensitive Thai word order; `trailing` preserves the legacy trailing site phrase. */
|
|
964
971
|
sitePlacement?: "natural" | "trailing";
|
|
972
|
+
/** In normalized long text, name both paired sites while retaining the per-target dose. Defaults to `each`. */
|
|
973
|
+
pairedSiteWording?: "each" | "both";
|
|
965
974
|
}
|
|
966
975
|
export interface FormatBatchOptions extends FormatOptions {
|
|
967
976
|
/**
|
|
968
|
-
* String inserted between formatted clauses.
|
|
969
|
-
*
|
|
977
|
+
* String inserted between formatted clauses. For ordinary same-stage rows,
|
|
978
|
+
* defaults to a space between complete long sentences, otherwise ", ".
|
|
970
979
|
*/
|
|
971
980
|
separator?: string;
|
|
972
981
|
}
|
|
@@ -1034,6 +1043,8 @@ export interface BodySiteDefinition {
|
|
|
1034
1043
|
perTargetText?: string;
|
|
1035
1044
|
/** Locale-specific per-target surface, e.g. Thai `รูจมูกข้างละ`. */
|
|
1036
1045
|
perTargetI18n?: Record<string, string>;
|
|
1046
|
+
/** Localized qualifier in the explicit-pair form, e.g. `per eye` or `ทั้งสองข้าง`. */
|
|
1047
|
+
pairedDoseScopeI18n?: Record<string, string>;
|
|
1037
1048
|
/** Optional translations for different locales (e.g., { "th": "ตา" }) */
|
|
1038
1049
|
i18n?: Record<string, string>;
|
|
1039
1050
|
/**
|
|
@@ -1077,7 +1088,8 @@ export declare enum AdviceModality {
|
|
|
1077
1088
|
Might = "might",
|
|
1078
1089
|
Could = "could",
|
|
1079
1090
|
Should = "should",
|
|
1080
|
-
Must = "must"
|
|
1091
|
+
Must = "must",
|
|
1092
|
+
Need = "need"
|
|
1081
1093
|
}
|
|
1082
1094
|
export declare enum AdviceRelation {
|
|
1083
1095
|
With = "with",
|
|
@@ -1095,6 +1107,7 @@ export declare enum AdviceRelation {
|
|
|
1095
1107
|
On = "on",
|
|
1096
1108
|
To = "to",
|
|
1097
1109
|
If = "if",
|
|
1110
|
+
EvenIf = "even-if",
|
|
1098
1111
|
Unless = "unless",
|
|
1099
1112
|
When = "when",
|
|
1100
1113
|
While = "while"
|
|
@@ -1114,6 +1127,7 @@ export declare enum AdviceArgumentRole {
|
|
|
1114
1127
|
Amount = "amount",
|
|
1115
1128
|
Duration = "duration",
|
|
1116
1129
|
Time = "time",
|
|
1130
|
+
Condition = "condition",
|
|
1117
1131
|
Free = "free"
|
|
1118
1132
|
}
|
|
1119
1133
|
/** A constituent of a compound meaning, not an alternative coding of that whole meaning. */
|
|
@@ -1369,6 +1383,8 @@ export interface MedicationInstructionActionLocaleRealizerConfig {
|
|
|
1369
1383
|
routePhrases?: Record<string, string>;
|
|
1370
1384
|
/** Prefix for the duration of each administration occurrence. */
|
|
1371
1385
|
administrationDurationPrefix?: string;
|
|
1386
|
+
/** Locale wording for a selected procedural duration. */
|
|
1387
|
+
proceduralDurationPrefix?: string;
|
|
1372
1388
|
}
|
|
1373
1389
|
export interface MedicationInstructionActionRealizerConfig {
|
|
1374
1390
|
/** Locale-specific realization behavior keyed by BCP-47-ish language tag. */
|
|
@@ -1417,6 +1433,8 @@ export interface MedicationInstructionActionDefinition {
|
|
|
1417
1433
|
* The selected-dose form requires an explicit medication object or a typed dose-slot target;
|
|
1418
1434
|
* it never treats a bare avoidance verb, food object, or negation as withholding. */
|
|
1419
1435
|
medicationConditionEffect?: "withhold" | "withhold-selected-dose";
|
|
1436
|
+
/** Registered lexical governors of a local procedural duration. */
|
|
1437
|
+
durationArgumentIntroducers?: string[];
|
|
1420
1438
|
primaryConcepts?: string[];
|
|
1421
1439
|
secondaryConcepts?: string[];
|
|
1422
1440
|
implicitMatchedConcept?: string;
|
|
@@ -1475,8 +1493,14 @@ export interface MedicationInstructionActionInput extends Partial<MedicationInst
|
|
|
1475
1493
|
semanticClass?: string;
|
|
1476
1494
|
}
|
|
1477
1495
|
export interface MedicationInstructionConceptDefinition {
|
|
1496
|
+
/** An instruction-owned Object retains its own temporal complements. */
|
|
1497
|
+
localInstructionObject?: true;
|
|
1478
1498
|
code: string;
|
|
1479
1499
|
role: AdviceArgumentRole;
|
|
1500
|
+
/** The registered activity can itself close an instruction predicate. */
|
|
1501
|
+
conditionEvent?: true;
|
|
1502
|
+
/** An authored following duration measures this selected activity. */
|
|
1503
|
+
measuredActivity?: true;
|
|
1480
1504
|
/** A complete unqualified nominal refers to the administration's selected site. */
|
|
1481
1505
|
administrationSiteReference?: true;
|
|
1482
1506
|
/** A registered compound noun may entail a second independently typed
|
|
@@ -1843,6 +1867,14 @@ export interface CanonicalCalendarEventExpr {
|
|
|
1843
1867
|
*/
|
|
1844
1868
|
export interface CanonicalCycleDayConstraint {
|
|
1845
1869
|
days: number[];
|
|
1870
|
+
cycleConcept?: FhirR6Coding;
|
|
1871
|
+
/** An authored treatment start ordinal, distinct from a day of eligibility. */
|
|
1872
|
+
startDay?: number;
|
|
1873
|
+
/** Maximum number of treatment days in one cycle. */
|
|
1874
|
+
maxTreatmentDays?: number;
|
|
1875
|
+
/** Authored event defining day one. */
|
|
1876
|
+
dayOneEvent?: FhirR6Coding;
|
|
1877
|
+
dayOneSourceText?: string;
|
|
1846
1878
|
periodDays?: number;
|
|
1847
1879
|
cycles?: number;
|
|
1848
1880
|
anchor?: string;
|
|
@@ -1850,6 +1882,8 @@ export interface CanonicalCycleDayConstraint {
|
|
|
1850
1882
|
sourceText: string;
|
|
1851
1883
|
}
|
|
1852
1884
|
export interface CanonicalScheduleExpr {
|
|
1885
|
+
/** Exclusive event-offset daughters, lowered to ordinary native choice members. */
|
|
1886
|
+
eventAlternatives?: Array<Pick<CanonicalScheduleExpr, "when" | "offset" | "offsetMin" | "offsetMax">>;
|
|
1853
1887
|
/** Required cycle-day eligibility; do not execute the independent cadence until resolved. */
|
|
1854
1888
|
cycleDayConstraint?: CanonicalCycleDayConstraint;
|
|
1855
1889
|
/** Typed whole-course interval for a recurring active/rest construction. */
|
|
@@ -1976,6 +2010,21 @@ export interface CanonicalAdditionalInstructionExpr {
|
|
|
1976
2010
|
frames?: AdviceFrame[];
|
|
1977
2011
|
evidence?: CanonicalEvidence[];
|
|
1978
2012
|
}
|
|
2013
|
+
/** A procedural condition reuses the existing coded argument at its leaves.
|
|
2014
|
+
* Boolean scope is distinct from medication administration eligibility. */
|
|
2015
|
+
export type CanonicalInstructionCondition = (AdviceArgument & {
|
|
2016
|
+
aspect?: "persists" | "worsens";
|
|
2017
|
+
/** The selected predicate's live observation fields, independent of wording. */
|
|
2018
|
+
measurement?: Extract<MedicationCondition, {
|
|
2019
|
+
kind: "measurement";
|
|
2020
|
+
}>;
|
|
2021
|
+
}) | {
|
|
2022
|
+
operator: "all" | "any";
|
|
2023
|
+
operands: CanonicalInstructionCondition[];
|
|
2024
|
+
} | {
|
|
2025
|
+
operator: "not";
|
|
2026
|
+
operands: [CanonicalInstructionCondition];
|
|
2027
|
+
};
|
|
1979
2028
|
export interface CanonicalInstructionRelation {
|
|
1980
2029
|
/** Retained wire annotations are source data, never relationship semantics. */
|
|
1981
2030
|
sourceId?: string;
|
|
@@ -1986,6 +2035,13 @@ export interface CanonicalInstructionRelation {
|
|
|
1986
2035
|
fromActionIndex?: number;
|
|
1987
2036
|
toActionIndex: number;
|
|
1988
2037
|
text?: string;
|
|
2038
|
+
/** A complete registered predicate selected for this instruction scope. */
|
|
2039
|
+
condition?: CanonicalInstructionCondition;
|
|
2040
|
+
/** Temporal adjunct of the complete predicate, separate from its action. */
|
|
2041
|
+
conditionTiming?: AdviceArgument;
|
|
2042
|
+
/** The regimen target binder proved the complete medication nominal on this
|
|
2043
|
+
* conditional action. An absent/false value cannot authorize its suppression. */
|
|
2044
|
+
targetBindingComplete?: boolean;
|
|
1989
2045
|
span?: TextRange;
|
|
1990
2046
|
}
|
|
1991
2047
|
export interface CanonicalInstructionCoverage {
|
|
@@ -2041,6 +2097,8 @@ export interface CanonicalSourceSpan extends TextRange {
|
|
|
2041
2097
|
sourceExtensions?: FhirExtension[];
|
|
2042
2098
|
text: string;
|
|
2043
2099
|
tokenIndices?: number[];
|
|
2100
|
+
/** Conjunction or disjunction selected by the originating lexical sign. */
|
|
2101
|
+
coordination?: Exclude<AdministrationTargetCoordinationKind, "mixed">;
|
|
2044
2102
|
}
|
|
2045
2103
|
/** Lexical grammatical role carried from the originating typed sign.
|
|
2046
2104
|
* Production names remain diagnostic labels, never semantic dispatch keys. */
|
|
@@ -2051,7 +2109,7 @@ export interface CanonicalEvidence {
|
|
|
2051
2109
|
lexicalCategory?: CanonicalLexicalCategory;
|
|
2052
2110
|
/** Clinical role supplied by the typed sign. For conditions, the first span
|
|
2053
2111
|
* owns the antecedent; later spans may retain ancillary no-dose branches. */
|
|
2054
|
-
clinicalKind?: "condition" | "calendar-exclusion" | "treatment-pause" | "unresolved";
|
|
2112
|
+
clinicalKind?: "condition" | "calendar-exclusion" | "treatment-pause" | "course-boundary" | "unresolved";
|
|
2055
2113
|
spans: CanonicalSourceSpan[];
|
|
2056
2114
|
/** Exact schedule semantics owned by this evidence, independent of rule names. */
|
|
2057
2115
|
scheduleFields?: CanonicalScheduleSemanticField[];
|
|
@@ -2064,6 +2122,9 @@ export interface CanonicalEvidence {
|
|
|
2064
2122
|
* scope; FHIR only projects the resulting semantics. Raw/source data is kept.
|
|
2065
2123
|
*/
|
|
2066
2124
|
export interface CanonicalClinicalAdjuncts {
|
|
2125
|
+
/** Authored event boundaries selected by the administration grammar. */
|
|
2126
|
+
courseStart?: CanonicalBoundary;
|
|
2127
|
+
courseEnd?: CanonicalBoundary;
|
|
2067
2128
|
/** Finite medication-free interval selected by a typed withholding head. */
|
|
2068
2129
|
treatmentPause?: {
|
|
2069
2130
|
durationDays: number;
|
|
@@ -2141,8 +2202,12 @@ export interface CanonicalSigClause {
|
|
|
2141
2202
|
kind: AdviceRelation;
|
|
2142
2203
|
span: TextRange;
|
|
2143
2204
|
target: TextRange;
|
|
2205
|
+
condition?: CanonicalInstructionCondition;
|
|
2206
|
+
conditionTiming?: AdviceArgument;
|
|
2144
2207
|
}>;
|
|
2145
2208
|
patientInstruction?: string;
|
|
2209
|
+
/** Explicit wording supplied on the FHIR patientInstruction primitive. */
|
|
2210
|
+
patientInstructionI18n?: Record<string, string>;
|
|
2146
2211
|
instructionGraph?: CanonicalInstructionGraph;
|
|
2147
2212
|
additionalInstructions?: CanonicalAdditionalInstructionExpr[];
|
|
2148
2213
|
leftovers: CanonicalSourceSpan[];
|
|
@@ -2332,6 +2397,41 @@ export interface NextDueDoseOptions {
|
|
|
2332
2397
|
frequencyDefaults?: FrequencyFallbackTimes;
|
|
2333
2398
|
config?: NextDueDoseConfig;
|
|
2334
2399
|
}
|
|
2400
|
+
/** Authored selectors that contributed to this occurrence. An anchor can
|
|
2401
|
+
* resolve to a specific meal when the schedule names a generic meal. */
|
|
2402
|
+
export type DueDoseOrigin = {
|
|
2403
|
+
readonly kind: "anchor";
|
|
2404
|
+
readonly code: string;
|
|
2405
|
+
readonly event?: string;
|
|
2406
|
+
} | {
|
|
2407
|
+
readonly kind: "clock" | "configured-clock";
|
|
2408
|
+
readonly clock: string;
|
|
2409
|
+
} | {
|
|
2410
|
+
readonly kind: "date";
|
|
2411
|
+
readonly value: string;
|
|
2412
|
+
};
|
|
2413
|
+
/** Zero-based positions within the normalized input course, when known.
|
|
2414
|
+
* Source member and authored track identities are retained independently. */
|
|
2415
|
+
export interface DueDoseSource {
|
|
2416
|
+
readonly stageIndex?: number;
|
|
2417
|
+
readonly administrationIndex?: number;
|
|
2418
|
+
readonly sourceMember?: number;
|
|
2419
|
+
readonly trackIndex?: number;
|
|
2420
|
+
}
|
|
2421
|
+
type ReadonlyClinicalFacts<T> = {
|
|
2422
|
+
readonly [Key in keyof T]: ReadonlyClinicalFacts<T[Key]>;
|
|
2423
|
+
};
|
|
2424
|
+
/** One accepted scheduled opportunity. Its authored quantities may be
|
|
2425
|
+
* ranged, rates, or otherwise dependent on clinical information. */
|
|
2426
|
+
export interface DueDose {
|
|
2427
|
+
readonly time: string;
|
|
2428
|
+
readonly administration: ReadonlyClinicalFacts<import("./canonical/course").CanonicalAdministration>;
|
|
2429
|
+
readonly source?: DueDoseSource;
|
|
2430
|
+
readonly origins?: readonly DueDoseOrigin[];
|
|
2431
|
+
readonly asNeeded: boolean;
|
|
2432
|
+
/** Whether a clinical condition was absent, assumed, or admitted by the evaluator. */
|
|
2433
|
+
readonly condition: "none" | "assumed" | "evaluated";
|
|
2434
|
+
}
|
|
2335
2435
|
/** Due times calculated with each ordered medication-instruction phase respected. */
|
|
2336
2436
|
export interface RegimenDueTimes {
|
|
2337
2437
|
dosageIndex: number;
|
package/package.json
CHANGED