ezmedicationinput 0.1.67 → 0.3.0-beta.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 +222 -28
- package/dist/adapters/canonical-course.d.ts +128 -0
- package/dist/adapters/r5-course.d.ts +24 -0
- package/dist/advice.d.ts +52 -1
- package/dist/body-site-grammar.d.ts +34 -1
- package/dist/body-site-lookup.d.ts +3 -0
- package/dist/body-site-spatial.d.ts +6 -2
- package/dist/body-site-target.d.ts +9 -3
- package/dist/canonical/compile.d.ts +79 -0
- package/dist/canonical/course.d.ts +352 -0
- package/dist/canonical/format-course.d.ts +36 -0
- package/dist/date-interpretation.d.ts +2 -0
- package/dist/dosage-course.d.ts +453 -0
- package/dist/execution/calendar.d.ts +107 -0
- package/dist/execution/engine.d.ts +11 -0
- package/dist/fhir-quantity-operator.d.ts +53 -0
- package/dist/fhir-translations.d.ts +5 -6
- package/dist/fhir.d.ts +233 -13
- package/dist/format.d.ts +113 -3
- package/dist/hpsg/constructions.d.ts +113 -0
- package/dist/hpsg/defaults.d.ts +2 -0
- package/dist/hpsg/lexical-classes.d.ts +282 -2
- package/dist/hpsg/procedural-context.d.ts +18 -4
- package/dist/hpsg/projection.d.ts +38 -3
- package/dist/hpsg/rule-context.d.ts +117 -7
- package/dist/hpsg/rules/clinical-quantity-rules.d.ts +18 -0
- package/dist/hpsg/rules/condition-rules.d.ts +14 -0
- package/dist/hpsg/rules/core-rules.d.ts +32 -0
- package/dist/hpsg/rules/instruction-rules.d.ts +11 -1
- package/dist/hpsg/rules/prn-rules.d.ts +3 -1
- package/dist/hpsg/rules/timing-rules.d.ts +138 -8
- package/dist/hpsg/signature.d.ts +353 -5
- package/dist/hpsg/type-system.d.ts +16 -1
- package/dist/hpsg/unification.d.ts +4 -1
- package/dist/i18n.d.ts +39 -1
- package/dist/index.cjs +65539 -30893
- package/dist/index.d.ts +35 -7
- package/dist/index.js +65505 -30892
- package/dist/instruction-action-locale-adapter.d.ts +32 -3
- package/dist/instruction-action-terminology.d.ts +38 -3
- package/dist/instruction-concept-terminology.d.ts +8 -1
- package/dist/instruction-graph-fhir.d.ts +9 -3
- package/dist/instruction-graph.d.ts +85 -7
- package/dist/ir.d.ts +13 -2
- package/dist/lexer/surface-segmenter.d.ts +1 -1
- package/dist/lexer/surface.d.ts +1 -0
- package/dist/locale-detection.d.ts +3 -0
- package/dist/locales/course/en.d.ts +15 -0
- package/dist/locales/course/th.d.ts +12 -0
- package/dist/localization.d.ts +73 -0
- package/dist/maps.d.ts +24 -1
- package/dist/medication-condition.d.ts +42 -0
- package/dist/parser-state.d.ts +6 -2
- package/dist/parser.d.ts +5 -2
- package/dist/regimen/coordination-scope.d.ts +53 -0
- package/dist/regimen/grammar.d.ts +79 -0
- package/dist/regimen/parallel-course.d.ts +52 -0
- package/dist/regimen/planner.d.ts +19 -0
- package/dist/regimen/regimen.d.ts +70 -0
- package/dist/relation-terminology.d.ts +1 -0
- package/dist/schedule.d.ts +12 -5
- package/dist/stable-structure.d.ts +23 -1
- package/dist/timing-summary.d.ts +82 -1
- package/dist/types.d.ts +899 -40
- package/dist/unit-lexicon.d.ts +7 -0
- package/dist/utils/strength.d.ts +16 -0
- package/dist/utils/text.d.ts +3 -0
- package/dist/utils/units.d.ts +19 -0
- package/package.json +3 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AdviceArgument, AdviceFrame, MedicationInstructionActionDefinition, MedicationInstructionActionRealizer } from "./types";
|
|
1
|
+
import { AdviceArgument, AdviceFrame, AdviceModality, AdviceRelation, MedicationInstructionActionDefinition, MedicationInstructionActionRealizer } from "./types";
|
|
2
2
|
export interface InstructionActionRealizationInput {
|
|
3
3
|
frame: AdviceFrame;
|
|
4
4
|
locale: string;
|
|
@@ -12,6 +12,11 @@ export interface InstructionActionRealizationInput {
|
|
|
12
12
|
result?: string;
|
|
13
13
|
activity?: string;
|
|
14
14
|
time?: string;
|
|
15
|
+
/** Selected Time's explicit or licensed inherited relation. */
|
|
16
|
+
timeRelation?: AdviceRelation;
|
|
17
|
+
/** Optional output evidence requested by action composition. Set only
|
|
18
|
+
* at the branch that actually includes the selected Time in its wording. */
|
|
19
|
+
timeWasRendered?: boolean;
|
|
15
20
|
duration?: string;
|
|
16
21
|
material?: string;
|
|
17
22
|
manner?: string;
|
|
@@ -22,8 +27,9 @@ export interface InstructionActionRealizationInput {
|
|
|
22
27
|
}
|
|
23
28
|
export interface InstructionActionLocaleAdapter {
|
|
24
29
|
locale: string;
|
|
30
|
+
selectLexicalRealization?(input: InstructionActionRealizationInput): InstructionActionRealizationInput;
|
|
25
31
|
render(realizer: MedicationInstructionActionRealizer, input: InstructionActionRealizationInput): string | undefined;
|
|
26
|
-
renderNegated(input: InstructionActionRealizationInput): string;
|
|
32
|
+
renderNegated(input: InstructionActionRealizationInput, completeAction?: string): string;
|
|
27
33
|
applyPositiveModality(text: string, frame: AdviceFrame): string;
|
|
28
34
|
parseConditionPersistence(body: string): {
|
|
29
35
|
body: string;
|
|
@@ -32,9 +38,32 @@ export interface InstructionActionLocaleAdapter {
|
|
|
32
38
|
renderConditionBody(base: string, conditionForm: string | undefined, persists: boolean): string;
|
|
33
39
|
joinConditionLead(lead: string, body: string): string;
|
|
34
40
|
conditionalContinuation(text: string, imperative: boolean): string;
|
|
35
|
-
postposedCondition(text: string): string;
|
|
41
|
+
postposedCondition(text: string, precedingText?: string): string;
|
|
36
42
|
sequenceSeparator(): string;
|
|
37
43
|
continuationText(text: string, understood: boolean): string;
|
|
44
|
+
withAuthoredDirections?(current: string, source: string): string;
|
|
45
|
+
directTime?(time: string): string;
|
|
38
46
|
}
|
|
39
47
|
export declare function registerInstructionActionLocaleAdapter(adapter: InstructionActionLocaleAdapter): void;
|
|
40
48
|
export declare function getInstructionActionLocaleAdapter(locale: string): InstructionActionLocaleAdapter;
|
|
49
|
+
export declare function instructionActionDefinitionForRealization(frame: AdviceFrame): MedicationInstructionActionDefinition | undefined;
|
|
50
|
+
/** The selected valence determines which daughter owns the frame relation. */
|
|
51
|
+
export declare function instructionFrameRelationOwnsTemporalArgument(frame: AdviceFrame, arg: AdviceArgument): boolean;
|
|
52
|
+
/** Resolve Site attachment before locale realization or Time consumption. */
|
|
53
|
+
export declare function instructionFrameSiteRelation(frame: AdviceFrame, site?: AdviceArgument): AdviceRelation | undefined;
|
|
54
|
+
export declare function instructionSiteRelation(input: InstructionActionRealizationInput, site?: AdviceArgument): string | undefined;
|
|
55
|
+
export declare const EN_POSITIVE_MODALITY_PREFIX: Partial<Record<AdviceModality, string>>;
|
|
56
|
+
/** Internal selection metadata; public locale inputs and callbacks stay unchanged. */
|
|
57
|
+
type SelectedTimeInput = Pick<InstructionActionRealizationInput, "locale" | "time" | "timeRelation" | "timeWasRendered"> & {
|
|
58
|
+
selectedTime?: AdviceArgument;
|
|
59
|
+
frame?: AdviceFrame;
|
|
60
|
+
};
|
|
61
|
+
/** Consume the selected typed Time once; locale adapters own direct wording. */
|
|
62
|
+
export declare function realizeTimeArgument(c: SelectedTimeInput): string | undefined;
|
|
63
|
+
export declare function quantityOnlyInstructionArgument(arg: AdviceArgument | undefined): boolean;
|
|
64
|
+
/** A typed measured nominal without its own noun label retains the opaque
|
|
65
|
+
* argument separately; its source text cannot override the current quantity. */
|
|
66
|
+
export declare function instructionArgumentNeedsAuthoredDirections(arg: AdviceArgument, locale: string): boolean;
|
|
67
|
+
export declare const TH_POSITIVE_MODALITY_PREFIX: Partial<Record<AdviceModality, string>>;
|
|
68
|
+
export declare function selectThaiApplyLabel(actionCode: string | undefined, label: string, unit?: string, args?: readonly AdviceArgument[]): string | undefined;
|
|
69
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FhirCoding, MedicationInstructionActionDefinition, ParseOptions } from "./types";
|
|
1
|
+
import { AdviceArgument, CanonicalMethodExpr, FhirCoding, FhirR6Coding, MedicationInstructionActionDefinition, ParseOptions } from "./types";
|
|
2
2
|
export declare const MEDICATION_INSTRUCTION_ACTION_SYSTEM: string;
|
|
3
3
|
export interface MedicationInstructionActionCodeSystem {
|
|
4
4
|
resourceType: "CodeSystem";
|
|
@@ -18,15 +18,50 @@ export interface MedicationInstructionActionCodeSystem {
|
|
|
18
18
|
}>;
|
|
19
19
|
}>;
|
|
20
20
|
}
|
|
21
|
+
/** Bound phrase matching by the declared lexicon without widening unrelated scans.
|
|
22
|
+
* @param lead Normalized first token of a possible instruction action.
|
|
23
|
+
*/
|
|
24
|
+
export declare function medicationInstructionActionSpanLimit(lead: string, options?: ParseOptions): number;
|
|
21
25
|
export declare function normalizeActionSurface(value: string): string;
|
|
26
|
+
/** Preserve coded constituents separately from equivalent whole-action codings. */
|
|
27
|
+
export declare function cloneMedicationInstructionActionSemanticComponents(components: MedicationInstructionActionDefinition["semanticComponents"]): MedicationInstructionActionDefinition["semanticComponents"];
|
|
22
28
|
export declare function cloneMedicationInstructionActionRealizerConfig(config: MedicationInstructionActionDefinition["realizerConfig"]): MedicationInstructionActionDefinition["realizerConfig"];
|
|
23
29
|
export declare function medicationInstructionActionLocaleRealizerConfig(config: MedicationInstructionActionDefinition["realizerConfig"], locale: string): import("./types").MedicationInstructionActionLocaleRealizerConfig | undefined;
|
|
30
|
+
/** Shared typed-argument matcher for both equivalent context codings and
|
|
31
|
+
* independent standards-coded constituents. No new language interpretation. */
|
|
32
|
+
export declare function matchesMedicationInstructionActionContextArgument(expected: NonNullable<MedicationInstructionActionDefinition["contextualCodings"]>[number]["whenArgument"], args: readonly AdviceArgument[]): boolean;
|
|
33
|
+
/** Resolve exact whole-action mappings licensed by typed argument semantics.
|
|
34
|
+
* Shared by the primary HPSG graph and optional semantic-resolver graph. */
|
|
35
|
+
export declare function medicationInstructionActionContextualCodings(definition: MedicationInstructionActionDefinition, args: readonly AdviceArgument[]): FhirCoding[];
|
|
36
|
+
/** Combine only constituents justified by this action's actual typed arguments.
|
|
37
|
+
* Do not place fragment/finding/qualifier codes in whole-predicate Codings. */
|
|
38
|
+
export declare function medicationInstructionActionSemanticComponentsForArgs(definition: MedicationInstructionActionDefinition, args: readonly AdviceArgument[]): MedicationInstructionActionDefinition["semanticComponents"];
|
|
24
39
|
export declare function resolveMedicationInstructionSequenceAction(surface: string, options?: ParseOptions): MedicationInstructionActionDefinition | undefined;
|
|
25
40
|
export declare function resolveMedicationInstructionSeparableAction(lead: string, particle: string, options?: ParseOptions): MedicationInstructionActionDefinition | undefined;
|
|
26
41
|
export declare function medicationInstructionActionIsSafetyScopeTarget(surface: string, options?: ParseOptions): boolean;
|
|
27
|
-
export declare function resolveMedicationInstructionAction(surface: string, options?: ParseOptions): MedicationInstructionActionDefinition | undefined;
|
|
28
|
-
|
|
42
|
+
export declare function resolveMedicationInstructionAction(surface: string, options?: ParseOptions, includeCode?: boolean): MedicationInstructionActionDefinition | undefined;
|
|
43
|
+
/** The package lookup accepts saved codes as well as registered surfaces.
|
|
44
|
+
* Internal lexical callers retain the surface-only default above. */
|
|
45
|
+
export declare function resolveMedicationInstructionActionWithCodeFallback(surface: string, options?: ParseOptions, includeCode?: boolean): MedicationInstructionActionDefinition | undefined;
|
|
46
|
+
/** Resolve a declared administration method by exact code identity. Known
|
|
47
|
+
* codings own the verb even when an external edit leaves stale display text.
|
|
48
|
+
* Unknown identities return undefined for the caller's existing text fallback. */
|
|
49
|
+
export declare function resolveMedicationInstructionActionByMethod(coding: FhirR6Coding | undefined, options?: ParseOptions): MedicationInstructionActionDefinition | undefined;
|
|
50
|
+
/** A translated coding can precede the known method in a CodeableConcept.
|
|
51
|
+
* Select its recognized identity in one pass and retain the first code as
|
|
52
|
+
* the fallback for wholly unfamiliar concepts. A display-only Coding remains
|
|
53
|
+
* a text fallback when no identity is supplied. The source array is untouched. */
|
|
54
|
+
export declare function selectMedicationInstructionMethodCoding<TCoding extends FhirR6Coding>(codings: readonly TCoding[] | undefined, options?: ParseOptions): TCoding | undefined;
|
|
55
|
+
/** Keep compatible authored verbs (Drink and Swallow share a method), while
|
|
56
|
+
* a recognized edited code replaces an incompatible retained verb. */
|
|
57
|
+
export declare function resolveMedicationInstructionActionForMethod(method: (Omit<CanonicalMethodExpr, "coding"> & {
|
|
58
|
+
coding?: FhirR6Coding;
|
|
59
|
+
}) | undefined, options?: ParseOptions, includeQualifiedHead?: boolean): MedicationInstructionActionDefinition | undefined;
|
|
60
|
+
export declare function getMedicationInstructionAction(code: string, options?: ParseOptions): MedicationInstructionActionDefinition | undefined;
|
|
29
61
|
export declare function listMedicationInstructionActions(): MedicationInstructionActionDefinition[];
|
|
62
|
+
/** A CodeSystem snapshot is a public value, not mutable global schema.
|
|
63
|
+
* Build it with one definition walk and one language-key walk per published
|
|
64
|
+
* action; avoid filter→map and map→filter pipelines on every public call. */
|
|
30
65
|
export declare function buildMedicationInstructionActionCodeSystem(): MedicationInstructionActionCodeSystem;
|
|
31
66
|
export declare function medicationInstructionActionCoding(definition: MedicationInstructionActionDefinition): FhirCoding;
|
|
32
67
|
export declare function medicationInstructionActionCodings(definition: MedicationInstructionActionDefinition): FhirCoding[];
|
|
@@ -19,8 +19,15 @@ export interface MedicationInstructionConceptCodeSystem {
|
|
|
19
19
|
}>;
|
|
20
20
|
}
|
|
21
21
|
export declare function normalizeConceptSurface(value: string): string;
|
|
22
|
+
export declare function cloneMedicationInstructionConceptComponents(components: MedicationInstructionConceptDefinition["components"]): MedicationInstructionConceptDefinition["components"];
|
|
23
|
+
/** Dictionary definitions are immutable by caller contract. Repeated
|
|
24
|
+
* lexical resolution must not recursively clone the same vocabulary tree.
|
|
25
|
+
* Explicit frame construction still copies only the fields it later edits. */
|
|
22
26
|
export declare function resolveMedicationInstructionConcept(surface: string, options?: ParseOptions): MedicationInstructionConceptDefinition | undefined;
|
|
23
|
-
export declare function getMedicationInstructionConcept(code: string): MedicationInstructionConceptDefinition | undefined;
|
|
27
|
+
export declare function getMedicationInstructionConcept(code: string, system?: string): MedicationInstructionConceptDefinition | undefined;
|
|
24
28
|
export declare function listMedicationInstructionConcepts(): MedicationInstructionConceptDefinition[];
|
|
29
|
+
/** The public CodeSystem is freshly returned, but its published concepts
|
|
30
|
+
* require only one source-definition walk and one designation walk each.
|
|
31
|
+
* This avoids filter->map and map->filter intermediary arrays per call. */
|
|
25
32
|
export declare function buildMedicationInstructionConceptCodeSystem(): MedicationInstructionConceptCodeSystem;
|
|
26
33
|
export declare function medicationInstructionConceptCodings(definition: MedicationInstructionConceptDefinition): FhirCoding[];
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import { CanonicalInstructionGraph, FhirExtension } from "./types";
|
|
2
|
-
export declare const MEDICATION_INSTRUCTION_GRAPH_EXTENSION_URL = "
|
|
1
|
+
import { AdviceFrame, CanonicalInstructionCoverage, CanonicalInstructionGraph, FhirExtension } from "./types";
|
|
2
|
+
export declare const MEDICATION_INSTRUCTION_GRAPH_EXTENSION_URL = "urn:ezmedicationinput:StructureDefinition:medication-instruction-graph";
|
|
3
|
+
export declare function buildActionExtension(frame: AdviceFrame): FhirExtension;
|
|
4
|
+
export declare function buildInstructionCoverageExtension(coverage: CanonicalInstructionCoverage): FhirExtension;
|
|
3
5
|
export declare function buildInstructionGraphExtension(graph: CanonicalInstructionGraph | undefined): FhirExtension | undefined;
|
|
4
|
-
|
|
6
|
+
/** One traversal per known graph/action/argument node. Repeated children retain
|
|
7
|
+
* order, first scalar fields retain ownership, and unknown metadata remains
|
|
8
|
+
* outside interpreted clinical meaning. No indexed heap copies or cached
|
|
9
|
+
* input identities are needed to read the same mutable external input again. */
|
|
10
|
+
export declare function parseInstructionGraphExtension<T extends Pick<FhirExtension, "url">>(extensions: readonly T[] | undefined): CanonicalInstructionGraph | undefined;
|
|
@@ -1,20 +1,96 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { lexInput } from "./lexer/lex";
|
|
2
|
+
import { AdviceFrame, AdviceModality, AdviceRelation, CanonicalInstructionCoverage, CanonicalInstructionGraph, CanonicalInstructionRelation, CanonicalSigClause, CanonicalAdditionalInstructionExpr, CanonicalSourceSpan, FhirCodeableConcept, MedicationInstructionActionDefinition, ParseOptions, TextRange } from "./types";
|
|
3
|
+
type ActionDefinition = MedicationInstructionActionDefinition;
|
|
4
|
+
type Lexeme = ReturnType<typeof lexInput>[number];
|
|
5
|
+
interface ActionMatch {
|
|
6
|
+
definition: ActionDefinition;
|
|
7
|
+
length: number;
|
|
8
|
+
separableParticleIndex?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function actionMatchAt(parts: Lexeme[], index: number, options?: ParseOptions): ActionMatch | undefined;
|
|
2
11
|
export declare function parseInstructionActions(sourceText: string, baseOffset?: number, options?: ParseOptions): AdviceFrame[];
|
|
12
|
+
export declare function frameActionDefinition(frame: AdviceFrame, options?: ParseOptions): ActionDefinition | undefined;
|
|
13
|
+
export declare function isSupplementalHydrationInstruction(frame: AdviceFrame): boolean;
|
|
14
|
+
export declare function relationFromSourceText(text: string): AdviceRelation | undefined;
|
|
15
|
+
export declare function buildInstructionCoverage(actions: AdviceFrame[], relations: CanonicalInstructionRelation[], opaqueSpans: CanonicalSourceSpan[]): CanonicalInstructionCoverage;
|
|
3
16
|
export declare function refreshInstructionGraphDerivedState(graph: CanonicalInstructionGraph): void;
|
|
4
|
-
export declare function buildInstructionGraph(input: string, clause: CanonicalSigClause, options?: ParseOptions): CanonicalInstructionGraph | undefined;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export declare function
|
|
8
|
-
|
|
17
|
+
export declare function buildInstructionGraph(input: string, clause: CanonicalSigClause, options?: ParseOptions, semanticOwnershipRanges?: readonly TextRange[], proceduralFrames?: readonly AdviceFrame[]): CanonicalInstructionGraph | undefined;
|
|
18
|
+
/** Select complete administration techniques from the already-composed clause
|
|
19
|
+
* and action program. Interchange only projects these selected codings. */
|
|
20
|
+
export declare function instructionGraphAdministrationTechnique(clause: CanonicalSigClause): {
|
|
21
|
+
route?: FhirCodeableConcept;
|
|
22
|
+
method?: FhirCodeableConcept;
|
|
23
|
+
} | undefined;
|
|
24
|
+
/** Realize one selected action with its existing external graph scope, when supplied. */
|
|
25
|
+
export declare function realizeInstructionAction(frame: AdviceFrame, locale?: string, graph?: CanonicalInstructionGraph): string;
|
|
26
|
+
/** A rich source action can carry its own Manner/Time but no Amount because a
|
|
27
|
+
* preceding preparatory verb supplied the original quantity. When the
|
|
28
|
+
* clinician edits the canonical dose, never let that amountless rich action
|
|
29
|
+
* replace the numeric administration text without the CURRENT dose.
|
|
30
|
+
* This is a display-only frame copy, not an edit of source graph/provenance. */
|
|
31
|
+
export declare function realizeRichPrimaryWithCanonicalDose(frame: AdviceFrame, clause: CanonicalSigClause, locale: string, options?: Pick<ParseOptions, "instructionActionMap" | "realizationMode">, coverage?: {
|
|
32
|
+
singleScheduledEvent: boolean;
|
|
33
|
+
}): string;
|
|
34
|
+
/** Typed warning equivalence retains complete qualifiers and the established negative-force tolerance. */
|
|
35
|
+
export declare function sameTypedWarning(left: AdviceFrame, right: AdviceFrame): boolean;
|
|
36
|
+
/** Locate an authored fragment; this is correspondence, not action identity. */
|
|
37
|
+
export declare function instructionSourceRange(graph: CanonicalInstructionGraph, text: string | undefined, source?: string): TextRange | undefined;
|
|
38
|
+
/** Selected instruction evidence covers exactly its complete typed frames. */
|
|
39
|
+
export declare function instructionHasCompleteFrameEvidence(instruction: CanonicalAdditionalInstructionExpr): boolean;
|
|
40
|
+
/** Exact source-backed discourse connector that introduces the first action
|
|
41
|
+
* after the canonical administration. This lets realization preserve contrast
|
|
42
|
+
* without pretending that it is the temporal THEN relation. */
|
|
43
|
+
export declare function instructionGraphPostAdministrationDiscourseConnector(graph: CanonicalInstructionGraph): CanonicalSourceSpan | undefined;
|
|
44
|
+
/** Counted or qualified sites use the canonical site's complete dose scope. */
|
|
45
|
+
export declare function canonicalSiteOwnsPrimaryPhrase(clause: CanonicalSigClause): boolean;
|
|
46
|
+
/** A sole typed preparation owns the amount before a later administration.
|
|
47
|
+
* Ordinary primary-only graphs return before the ownership walk. */
|
|
48
|
+
export declare function instructionGraphPreparationOwnsDose(clause: CanonicalSigClause, options?: Pick<ParseOptions, "instructionActionMap">): boolean;
|
|
49
|
+
/** Whole-source replay and action realization have the same amount owner.
|
|
50
|
+
* Unrelated later-stage Amounts are not evidence the canonical dose changed. */
|
|
51
|
+
export declare function instructionGraphSourceConflictsWithDose(clause: CanonicalSigClause, options?: Pick<ParseOptions, "instructionActionMap">): boolean;
|
|
9
52
|
export declare function instructionGraphRichPrimaryAction(clause: CanonicalSigClause): AdviceFrame | undefined;
|
|
10
53
|
export declare function instructionGraphRoundTripPrimaryAction(clause: CanonicalSigClause): AdviceFrame | undefined;
|
|
11
54
|
export declare function instructionGraphPrimarySiteRelation(clause: CanonicalSigClause): AdviceRelation | undefined;
|
|
12
55
|
export declare function instructionGraphPrimaryAdministrationModality(clause: CanonicalSigClause): AdviceModality | undefined;
|
|
13
|
-
|
|
56
|
+
/** Presentation classification only; action licensing and scope use their own typed facts. */
|
|
57
|
+
export declare function isInstructionGraphDisplayWarning(frame: AdviceFrame): boolean;
|
|
58
|
+
/** A graph condition whose primary action is rendered by the clause formatter. */
|
|
59
|
+
export interface InstructionGraphPrimaryCondition {
|
|
60
|
+
text: string;
|
|
61
|
+
position: "pre" | "post";
|
|
62
|
+
start: number;
|
|
63
|
+
imperative: boolean;
|
|
64
|
+
}
|
|
65
|
+
/** Attach only conditions owned by that primary, before independent graph
|
|
66
|
+
* actions/advice are composed. Ordinary clauses do not allocate this report. */
|
|
67
|
+
export declare function attachInstructionGraphPrimaryConditions(text: string, conditions: InstructionGraphPrimaryCondition[] | undefined, locale: string, guardedPrimary?: boolean): string;
|
|
68
|
+
/** Associate selected advice with current typed action occurrences; no display coverage is inferred. */
|
|
69
|
+
export declare function instructionGraphAdviceAssociation(graph: CanonicalInstructionGraph, instruction: CanonicalAdditionalInstructionExpr, includeRepresentation?: boolean): {
|
|
70
|
+
actionIndices: number[];
|
|
71
|
+
representedActionIndices: number[];
|
|
72
|
+
codingProved: boolean;
|
|
73
|
+
};
|
|
74
|
+
interface ClauseInstructionRealization {
|
|
75
|
+
pre?: string;
|
|
76
|
+
post?: string;
|
|
77
|
+
whole?: string;
|
|
78
|
+
patient?: string;
|
|
79
|
+
preFlowsIntoAdministration?: boolean;
|
|
80
|
+
postFlowsFromAdministration?: boolean;
|
|
81
|
+
}
|
|
82
|
+
/** Internal clause preview uses the same selected node walk as the public graph
|
|
83
|
+
* realizer. No receipt or source ownership is stored on the clinical values. */
|
|
84
|
+
export declare function realizeClauseInstructions(clause: CanonicalSigClause, locale: string, options: Parameters<typeof realizeInstructionGraph>[2], render: (instruction: CanonicalAdditionalInstructionExpr) => string | undefined, alreadyRendered?: readonly CanonicalAdditionalInstructionExpr[], presentGraphAction?: (text: string) => string | undefined): ClauseInstructionRealization;
|
|
14
85
|
export declare function realizeInstructionGraph(graph: CanonicalInstructionGraph, locale?: string, options?: {
|
|
15
86
|
includeWarnings?: boolean;
|
|
16
87
|
onlyWarnings?: boolean;
|
|
17
88
|
omitCanonicalAdministration?: CanonicalSigClause;
|
|
89
|
+
/** The selected primary action already realized with its full arguments.
|
|
90
|
+
* Identity remains valid even when imported source wording is absent. */
|
|
91
|
+
omitRenderedAction?: AdviceFrame;
|
|
92
|
+
/** Report conditions attached to the covered primary during this walk. */
|
|
93
|
+
primaryConditions?: InstructionGraphPrimaryCondition[];
|
|
18
94
|
/** Prefer each understood action's exact source wording when source and target locales match. */
|
|
19
95
|
preferSourceText?: boolean;
|
|
20
96
|
/** Source phrases already rendered through another semantic channel. */
|
|
@@ -23,4 +99,6 @@ export declare function realizeInstructionGraph(graph: CanonicalInstructionGraph
|
|
|
23
99
|
position?: "all" | "pre" | "post";
|
|
24
100
|
/** Prefer deliberately unambiguous lexical labels when generating parse-safe text. */
|
|
25
101
|
roundtripSafe?: boolean;
|
|
102
|
+
instructionActionMap?: ParseOptions["instructionActionMap"];
|
|
26
103
|
}): string | undefined;
|
|
104
|
+
export {};
|
package/dist/ir.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { ParserState } from "./parser-state";
|
|
2
2
|
import { CanonicalSigClause } from "./types";
|
|
3
|
-
export declare function canonicalClauseHasAdministrationSemantics(clause: CanonicalSigClause): boolean;
|
|
3
|
+
export declare function canonicalClauseHasAdministrationSemantics(clause: CanonicalSigClause, includeConstraints?: boolean): boolean;
|
|
4
4
|
export declare function buildCanonicalSigClauses(internal: ParserState): CanonicalSigClause[];
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Convert one segment's relative canonical source ranges into full-SIG ranges.
|
|
7
|
+
*
|
|
8
|
+
* Flattened dosage rows may share nested evidence, target, and instruction
|
|
9
|
+
* frames. Keep the same seen-set across their projections so an aliased source
|
|
10
|
+
* span moves once for the segment, not once for every projected dosage.
|
|
11
|
+
*
|
|
12
|
+
* @param clauses Canonical clauses to rebase.
|
|
13
|
+
* @param offset Absolute start of the source segment in the full SIG.
|
|
14
|
+
* @param shiftedSpans Identity set shared by all projections of one segment.
|
|
15
|
+
*/
|
|
16
|
+
export declare function shiftCanonicalSigClauses(clauses: CanonicalSigClause[], offset: number, shiftedSpans?: WeakSet<object>): void;
|
|
@@ -8,7 +8,7 @@ export interface MedicationSurfaceSegmenter {
|
|
|
8
8
|
segment(input: string): Iterable<MedicationSurfaceSegment>;
|
|
9
9
|
}
|
|
10
10
|
export declare function registerMedicationSurfaceSegmenter(segmenter: MedicationSurfaceSegmenter): void;
|
|
11
|
-
export declare function listMedicationSurfaceSegmenters(): MedicationSurfaceSegmenter[];
|
|
11
|
+
export declare function listMedicationSurfaceSegmenters(): Readonly<MedicationSurfaceSegmenter>[];
|
|
12
12
|
export declare function registerIntlMedicationSurfaceSegmenter(locale: string, script: RegExp): void;
|
|
13
13
|
export declare function splitMedicationScriptRuns(value: string): Array<{
|
|
14
14
|
text: string;
|
package/dist/lexer/surface.d.ts
CHANGED
|
@@ -7,3 +7,6 @@ export interface MedicationLocaleDetector {
|
|
|
7
7
|
export declare function registerMedicationLocaleDetector(detector: MedicationLocaleDetector): void;
|
|
8
8
|
export declare function shouldJoinAdjacentSourceTokens(left: string, right: string): boolean;
|
|
9
9
|
export declare function inferMedicationLocale(text: string, fallback?: string): string;
|
|
10
|
+
/** Registered source languages keep their authored wording; English uses the
|
|
11
|
+
* lexical definition's wording rather than overriding it with a surface form. */
|
|
12
|
+
export declare function withMedicationSourceI18n(sourceText: string, i18n: Record<string, string> | undefined): Record<string, string> | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
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;
|
|
@@ -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,73 @@ 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 unspecified: string;
|
|
38
|
+
withAuthoredDirections(current: string, source: string): string;
|
|
39
|
+
readonly treatmentStart: string;
|
|
40
|
+
readonly cycleStart: string;
|
|
41
|
+
readonly treatmentDayStart: string;
|
|
42
|
+
readonly afterPreviousPhase: string;
|
|
43
|
+
readonly nextDayAfterPreviousPhase: string;
|
|
44
|
+
readonly previousPhaseEnd?: string;
|
|
45
|
+
readonly incompleteInterpretation: string;
|
|
46
|
+
readonly retainedStructure: string;
|
|
47
|
+
readonly maxAdministrationLabel: string;
|
|
48
|
+
readonly maxLifetimeLabel: string;
|
|
49
|
+
readonly maxPeriodLabel: string;
|
|
50
|
+
readonly maxDosageLabel: string;
|
|
51
|
+
readonly courseLimitsLabel: string;
|
|
52
|
+
readonly stageLimitsLabel: string;
|
|
53
|
+
ifLimitExceeded(action: string): string;
|
|
54
|
+
eventWindow(start: string, end: string): string;
|
|
55
|
+
unresolvedCycleTiming(days: string, periodDays?: number, cycles?: number, anchor?: string): string;
|
|
56
|
+
weekdayName(day: string): string;
|
|
57
|
+
measurementName(name: string): string;
|
|
58
|
+
joinList(items: readonly string[]): string;
|
|
59
|
+
timeUnit(unit: string, value: number | undefined): string | undefined;
|
|
60
|
+
expression(kind: "dose" | "rate", detail: string | undefined): string;
|
|
61
|
+
upTo(value: string): string;
|
|
62
|
+
administrations(frequency: string, period?: string): string;
|
|
63
|
+
dosingPeriod(period: string): string;
|
|
64
|
+
periodContext(period: string): string;
|
|
65
|
+
startsWithinPeriod(offset: string, context: string): string;
|
|
66
|
+
endsWithinPeriod(offset: string, context: string): string;
|
|
67
|
+
afterTreatmentStart(offset: string): string;
|
|
68
|
+
relativeEvent(offset: string, event: string | undefined, before: boolean): string;
|
|
69
|
+
calendarWindow(start?: string, end?: string): string;
|
|
70
|
+
calendarEvents(events: readonly string[]): string;
|
|
71
|
+
reviewTiming(source?: string, boundary?: "end"): string;
|
|
72
|
+
dayRange(first: number, last: number): string;
|
|
73
|
+
fromDay(first: number): string;
|
|
74
|
+
throughDay(last: number): string;
|
|
75
|
+
noDoseDays(first: number, last: number): string;
|
|
76
|
+
noDoseWindow(start: string, end: string): string;
|
|
77
|
+
phaseCount(count: number): string;
|
|
78
|
+
unresolvedPhaseCount: string;
|
|
79
|
+
repeatCount(count: number): string;
|
|
80
|
+
repeatCycle(interval: string, exact: boolean, count?: number): string;
|
|
81
|
+
}
|
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, 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
|
|
@@ -15,6 +15,8 @@ export declare const ROUTE_TEXT: Record<RouteCode, string>;
|
|
|
15
15
|
* into our internal RouteCode abstraction during round-tripping.
|
|
16
16
|
*/
|
|
17
17
|
export declare const ROUTE_BY_SNOMED: Record<SNOMEDCTRouteCodes, RouteCode>;
|
|
18
|
+
/** 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;
|
|
18
20
|
export interface RouteSynonym {
|
|
19
21
|
code: RouteCode;
|
|
20
22
|
text: string;
|
|
@@ -35,6 +37,27 @@ export declare const DEFAULT_BODY_SITE_SNOMED: Record<string, BodySiteDefinition
|
|
|
35
37
|
export declare const DEFAULT_BODY_SITE_HINTS: Set<string>;
|
|
36
38
|
export declare const HOUSEHOLD_VOLUME_UNITS: readonly ["tsp", "tbsp"];
|
|
37
39
|
export declare const DEFAULT_UNIT_SYNONYMS: Record<string, string>;
|
|
40
|
+
/** Remove non-dimensional UCUM annotations for comparison only.
|
|
41
|
+
* Callers retain their own terminology, supported-unit and case rules. */
|
|
42
|
+
export declare function stripUcumAnnotations(code: string): string;
|
|
43
|
+
/** Resolve standard codes and plain unit labels to the same calculation unit.
|
|
44
|
+
* @param quantity A dose or limit quantity; its original display remains untouched.
|
|
45
|
+
* @param includeOpaqueCode Retain an unknown code as a display/counting label.
|
|
46
|
+
* Dimensional calculations disable that fallback, while still accepting authored
|
|
47
|
+
* unit labels and explicit UCUM expressions outside the simple-unit lexicon.
|
|
48
|
+
*/
|
|
49
|
+
export declare function getDoseQuantityUnit(quantity: {
|
|
50
|
+
system?: string;
|
|
51
|
+
code?: string;
|
|
52
|
+
unit?: string;
|
|
53
|
+
} | undefined, includeOpaqueCode?: boolean): string;
|
|
54
|
+
/** Resolve a known dosage unit without changing its display or numerical value.
|
|
55
|
+
* @param unit Canonical unit or supported synonym, including dimensional rates.
|
|
56
|
+
*/
|
|
57
|
+
export declare function getStandardDoseUnitCoding(unit: string | undefined): {
|
|
58
|
+
system: string;
|
|
59
|
+
code: string;
|
|
60
|
+
} | undefined;
|
|
38
61
|
export interface ProductFormHint {
|
|
39
62
|
routeHint?: RouteCode;
|
|
40
63
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { MedicationCondition } from "./types";
|
|
2
|
+
import type { HpsgGuardFeature } from "./hpsg/signature";
|
|
3
|
+
export { parseMedicationGuard } from "./hpsg/constructions";
|
|
4
|
+
export type { ParsedMedicationGuard } from "./hpsg/constructions";
|
|
5
|
+
export declare const CIRCUMSTANTIAL_CONDITION_HEADS: Set<string>;
|
|
6
|
+
export interface MedicationGuardLeadLexeme {
|
|
7
|
+
start: number;
|
|
8
|
+
end: number;
|
|
9
|
+
marker: "if" | "only-if" | "unless";
|
|
10
|
+
circumstantial?: true;
|
|
11
|
+
}
|
|
12
|
+
/** Recognize a conditional marker's spelling, leaving its predicate licensing
|
|
13
|
+
* and scope to the HPSG guard-head construction. */
|
|
14
|
+
export declare function medicationGuardLeadLexeme(source: string, licensedConsequent?: boolean): MedicationGuardLeadLexeme | undefined;
|
|
15
|
+
/** Lexical boundary spellings shared with the typed guard phrase. No result
|
|
16
|
+
* 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
|
+
/** Recognize one predicate atom. Incomplete comparisons remain unsatisfied
|
|
23
|
+
* head requirements, not measurements with a guessed variable name. */
|
|
24
|
+
export declare function medicationConditionAtomLexeme(input: string): HpsgGuardFeature;
|
|
25
|
+
/** Recognize a predicate negator, not the beginning of a comparison idiom.
|
|
26
|
+
* @param source One predicate atom before Boolean coordination.
|
|
27
|
+
*/
|
|
28
|
+
export declare function conditionNegationPrefixLength(source: string): number | undefined;
|
|
29
|
+
export interface ConditionSourceLexeme {
|
|
30
|
+
start: number;
|
|
31
|
+
end: number;
|
|
32
|
+
operator?: "all" | "any";
|
|
33
|
+
}
|
|
34
|
+
/** Lexicalize Boolean connective surfaces without assigning a tree or scope. */
|
|
35
|
+
export declare function conditionSourceLexemes(source: string, start: number, end: number): ConditionSourceLexeme[];
|
|
36
|
+
/** Punctuation boundary excluding decimal points inside lexical quantities. */
|
|
37
|
+
export declare function medicationGuardClauseBoundary(text: string): number;
|
|
38
|
+
/**
|
|
39
|
+
* Evaluate a typed Boolean tree if observation values were supplied by the caller.
|
|
40
|
+
* Unknown measurements never evaluate to true and remain unevaluated.
|
|
41
|
+
*/
|
|
42
|
+
export declare function evaluateMedicationCondition(condition: MedicationCondition, observed: Record<string, number | boolean>): boolean | undefined;
|
package/dist/parser-state.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AnnotatedLexToken } from "./lexer/meaning";
|
|
2
|
-
import { CanonicalAdditionalInstructionExpr, BodySiteSpatialRelation, CanonicalDoseRange, CanonicalPrnReasonExpr, CanonicalSigClause, EventTiming, FhirCoding, FhirDayOfWeek, FhirPrimitiveElement, FhirPeriodUnit, PrnReasonLookupRequest, PrnReasonSuggestion, RouteCode, SiteCodeLookupRequest, SiteCodeSuggestion } from "./types";
|
|
2
|
+
import { CanonicalAdditionalInstructionExpr, CanonicalAdministrationTargetGroup, BodySiteSpatialRelation, CanonicalDoseRange, CanonicalPrnReasonExpr, CanonicalSigClause, EventTiming, FhirCoding, FhirDayOfWeek, FhirPrimitiveElement, FhirR6PrimitiveElement, FhirPeriodUnit, PrnReasonLookupRequest, PrnReasonSuggestion, RouteCode, SiteCodeLookupRequest, SiteCodeSuggestion } from "./types";
|
|
3
3
|
export interface SiteLookupDetail {
|
|
4
4
|
request: SiteCodeLookupRequest;
|
|
5
5
|
suggestions: SiteCodeSuggestion[];
|
|
@@ -43,7 +43,7 @@ export declare class ParserState {
|
|
|
43
43
|
set routeText(value: string | undefined);
|
|
44
44
|
get methodText(): string | undefined;
|
|
45
45
|
set methodText(value: string | undefined);
|
|
46
|
-
get methodTextElement():
|
|
46
|
+
get methodTextElement(): FhirR6PrimitiveElement | undefined;
|
|
47
47
|
set methodTextElement(value: FhirPrimitiveElement | undefined);
|
|
48
48
|
get methodCoding(): LocalizedCoding | undefined;
|
|
49
49
|
set methodCoding(value: LocalizedCoding | undefined);
|
|
@@ -81,6 +81,8 @@ export declare class ParserState {
|
|
|
81
81
|
set activityTiming(value: import("./types").CanonicalActivityTimingExpr[] | undefined);
|
|
82
82
|
get occurrenceCap(): import("./types").CanonicalOccurrenceCapExpr | undefined;
|
|
83
83
|
set occurrenceCap(value: import("./types").CanonicalOccurrenceCapExpr | undefined);
|
|
84
|
+
get maxDosePerPeriod(): import("./types").CanonicalDosePeriodMaximumExpr[] | undefined;
|
|
85
|
+
set maxDosePerPeriod(value: import("./types").CanonicalDosePeriodMaximumExpr[] | undefined);
|
|
84
86
|
get timingCode(): string | undefined;
|
|
85
87
|
set timingCode(value: string | undefined);
|
|
86
88
|
get asNeeded(): boolean | undefined;
|
|
@@ -104,6 +106,8 @@ export declare class ParserState {
|
|
|
104
106
|
get siteSpatialRelation(): BodySiteSpatialRelation | undefined;
|
|
105
107
|
set siteSpatialRelation(value: BodySiteSpatialRelation | undefined);
|
|
106
108
|
get siteAdministrationTargetCount(): number | undefined;
|
|
109
|
+
get administrationTargetGroup(): CanonicalAdministrationTargetGroup | undefined;
|
|
110
|
+
set administrationTargetGroup(value: CanonicalAdministrationTargetGroup | undefined);
|
|
107
111
|
set siteAdministrationTargetCount(value: number | undefined);
|
|
108
112
|
get additionalInstructions(): CanonicalAdditionalInstructionExpr[];
|
|
109
113
|
set additionalInstructions(value: CanonicalAdditionalInstructionExpr[]);
|
package/dist/parser.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { ParserState, Token } from "./parser-state";
|
|
2
2
|
export { applyPrnReasonCoding, applyPrnReasonCodingAsync } from "./prn-reason-coding";
|
|
3
3
|
export { applySiteCoding, applySiteCodingAsync } from "./site-coding";
|
|
4
|
-
import { ParseOptions, TextRange } from "./types";
|
|
4
|
+
import { BodySiteDefinition, ParseOptions, TextRange } from "./types";
|
|
5
5
|
export declare function tokenize(input: string): Token[];
|
|
6
|
+
export declare function buildCustomSiteHints(map: Record<string, BodySiteDefinition> | undefined): Set<string> | undefined;
|
|
6
7
|
export declare function findUnparsedTokenGroups(state: ParserState): Array<{
|
|
7
8
|
tokens: Token[];
|
|
8
9
|
range?: TextRange;
|
|
9
10
|
}>;
|
|
10
|
-
|
|
11
|
+
/** Raw typed analysis for grammar/treebank tests; no canonical or FHIR projection. */
|
|
12
|
+
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;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ParserState } from '../parser-state';
|
|
2
|
+
import type { CanonicalScheduleSemanticField } from '../types';
|
|
3
|
+
import type { HpsgSigSegment } from '../hpsg/segmenter';
|
|
4
|
+
import type { BoundaryPlan } from '../hpsg/signature';
|
|
5
|
+
export interface CoordinatedClauseState {
|
|
6
|
+
state: ParserState;
|
|
7
|
+
start: number;
|
|
8
|
+
end: number;
|
|
9
|
+
}
|
|
10
|
+
export interface CoordinationScopeApplication {
|
|
11
|
+
rule: string;
|
|
12
|
+
from: number;
|
|
13
|
+
to: number;
|
|
14
|
+
fields: string[];
|
|
15
|
+
}
|
|
16
|
+
type ScheduleSemanticField = CanonicalScheduleSemanticField;
|
|
17
|
+
export interface TimingAnchorCompositionApplication {
|
|
18
|
+
rule: 'hpsg.cx.regimen.coordinated-timing-anchors' | 'hpsg.cx.regimen.interval-origin';
|
|
19
|
+
recipient: number;
|
|
20
|
+
donor: number;
|
|
21
|
+
fields: Array<ScheduleSemanticField | 'method'>;
|
|
22
|
+
}
|
|
23
|
+
export interface TimingAnchorCompositionResult {
|
|
24
|
+
absorbed: Set<number>;
|
|
25
|
+
applications: TimingAnchorCompositionApplication[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Compose equivalent typed administration daughters before FHIR lowering.
|
|
29
|
+
* Only clock/event anchors may differ; every other schedule and administration
|
|
30
|
+
* feature must already unify, so independent routes, sites and phases survive.
|
|
31
|
+
*/
|
|
32
|
+
export declare function composeCoordinatedTimingAnchors(states: readonly ParserState[], plan: BoundaryPlan, segments: readonly HpsgSigSegment[], source: string): TimingAnchorCompositionResult;
|
|
33
|
+
/**
|
|
34
|
+
* Scope a semicolon-terminal negative instruction over compatible dosage
|
|
35
|
+
* daughters before FHIR lowering. The HPSG action licenses the adjunct, and
|
|
36
|
+
* the boundary graph supplies its regimen path; no surface text is reparsed.
|
|
37
|
+
*/
|
|
38
|
+
export declare function scopeTrailingSharedNegativeInstructions(states: readonly ParserState[], plan: BoundaryPlan, segments: readonly {
|
|
39
|
+
start: number;
|
|
40
|
+
end: number;
|
|
41
|
+
}[], source: string): void;
|
|
42
|
+
export declare function scopeMedicationConditionTargets(states: ParserState[], plan: BoundaryPlan, segments: HpsgSigSegment[]): void;
|
|
43
|
+
export declare function applyCoordinatedCadenceScopes(states: readonly CoordinatedClauseState[], plan: BoundaryPlan, source: string): CoordinationScopeApplication[];
|
|
44
|
+
/**
|
|
45
|
+
* Apply the segmenter's licensed trailing shared course duration directly to
|
|
46
|
+
* typed HPSG clauses. This intentionally never touches FHIR or rendered text.
|
|
47
|
+
*/
|
|
48
|
+
export declare function scopeTrailingSharedDuration(states: readonly ParserState[], segments: readonly {
|
|
49
|
+
start: number;
|
|
50
|
+
text: string;
|
|
51
|
+
inheritTrailingDurationFromNext?: boolean;
|
|
52
|
+
}[]): void;
|
|
53
|
+
export {};
|