ezmedicationinput 0.1.62 → 0.1.64
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/dist/date-interpretation.d.ts +20 -0
- package/dist/fhir.d.ts +1 -0
- package/dist/hpsg/lexical-classes.d.ts +2 -0
- package/dist/hpsg/rule-context.d.ts +3 -0
- package/dist/hpsg/rules/timing-rules.d.ts +2 -0
- package/dist/hpsg/segmenter.d.ts +2 -0
- package/dist/hpsg/signature.d.ts +4 -1
- package/dist/index.cjs +2682 -1433
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2677 -1433
- package/dist/types.d.ts +87 -1
- package/package.json +11 -11
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CanonicalCalendarEventExpr, MedicationDateResolver, ParseOptions } from "./types";
|
|
2
|
+
export type MedicationDateRelation = "event" | "start-inclusive" | "start-exclusive" | "end-inclusive" | "end-exclusive";
|
|
3
|
+
export interface MedicationDateListMatch {
|
|
4
|
+
start: number;
|
|
5
|
+
end: number;
|
|
6
|
+
sourceText: string;
|
|
7
|
+
relation: MedicationDateRelation;
|
|
8
|
+
events: CanonicalCalendarEventExpr[];
|
|
9
|
+
unresolved: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** Register or replace a calendar resolver used by medication date interpretation. */
|
|
12
|
+
export declare function registerMedicationDateResolver(resolver: MedicationDateResolver): void;
|
|
13
|
+
/** Return the currently registered calendar resolver ids. */
|
|
14
|
+
export declare function listMedicationDateResolvers(): string[];
|
|
15
|
+
/** Scan structurally date-shaped numeric date lists, whether resolved or ambiguous. */
|
|
16
|
+
export declare function findMedicationDateListSpans(input: string, options?: ParseOptions): MedicationDateListMatch[];
|
|
17
|
+
/** Resolve a date list beginning exactly at the supplied source offset. */
|
|
18
|
+
export declare function parseMedicationDateListAt(input: string, start: number, options?: ParseOptions): MedicationDateListMatch | undefined;
|
|
19
|
+
/** True when a source range overlaps a recognized date-shaped list span. */
|
|
20
|
+
export declare function sourceRangeOverlapsMedicationDate(input: string, start: number, end: number, options?: ParseOptions): boolean;
|
package/dist/fhir.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare const TIMING_OFFSET_MAX_EXTENSION_URL = "https://solublelabs.com/
|
|
|
6
6
|
export declare const TIMING_OFFSET_EXACT_EXTENSION_URL = "https://solublelabs.com/fhir/StructureDefinition/medication-timing-offset-exact";
|
|
7
7
|
export declare const TIMING_ACTIVITY_WINDOW_EXTENSION_URL = "https://solublelabs.com/fhir/StructureDefinition/medication-timing-activity-window";
|
|
8
8
|
export declare const TIMING_OCCURRENCE_CAP_EXTENSION_URL = "https://solublelabs.com/fhir/StructureDefinition/medication-timing-occurrence-cap";
|
|
9
|
+
export declare const TIMING_EVENT_CALENDAR_SOURCE_EXTENSION_URL = "https://solublelabs.com/fhir/StructureDefinition/medication-timing-event-calendar-source";
|
|
9
10
|
export declare const PRN_TRIGGER_PHASE_EXTENSION_URL = "https://solublelabs.com/fhir/StructureDefinition/medication-prn-trigger-phase";
|
|
10
11
|
export declare function getExactTimingOffsetMinutes(repeat: FhirTimingRepeat | undefined): number | undefined;
|
|
11
12
|
export declare function getTimingOccurrenceCap(repeat: FhirTimingRepeat | undefined): CanonicalOccurrenceCapExpr | undefined;
|
|
@@ -95,6 +95,8 @@ export declare const FREQUENCY_SIMPLE_WORDS_DATA: Record<string, number>;
|
|
|
95
95
|
export declare const FREQUENCY_NUMBER_WORDS_DATA: Record<string, number>;
|
|
96
96
|
export declare const FREQUENCY_TIMES_WORDS_DATA: Set<string>;
|
|
97
97
|
export declare const FREQUENCY_CONNECTOR_WORDS_DATA: Set<string>;
|
|
98
|
+
export declare const FREQUENCY_ALTERNATIVE_CONNECTORS: Set<string>;
|
|
99
|
+
export declare const SINGLE_OCCURRENCE_PHRASES: string[][];
|
|
98
100
|
export declare const FREQUENCY_ADVERB_UNITS_DATA: Map<string, string>;
|
|
99
101
|
export declare const INTERVAL_UNIT_TOKENS_DATA: Map<string, string>;
|
|
100
102
|
export declare const WORKFLOW_START_WORDS: Set<string>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Token, ParserState } from "../parser-state";
|
|
2
2
|
import { ParseOptions } from "../types";
|
|
3
|
+
import type { MedicationDateListMatch } from "../date-interpretation";
|
|
3
4
|
import { HpsgLexicalRule } from "./signature";
|
|
4
5
|
import { HpsgProjectionDeps } from "./projection";
|
|
5
6
|
import { HpsgUnificationContext } from "./unification";
|
|
@@ -7,10 +8,12 @@ export interface HpsgClauseContext {
|
|
|
7
8
|
state: ParserState;
|
|
8
9
|
tokens: Token[];
|
|
9
10
|
options?: ParseOptions;
|
|
11
|
+
dateSpans: MedicationDateListMatch[];
|
|
10
12
|
limit: number;
|
|
11
13
|
deps: HpsgProjectionDeps & HpsgUnificationContext;
|
|
12
14
|
project?: boolean;
|
|
13
15
|
}
|
|
16
|
+
export declare function sourceRangeOverlapsContextDate(context: HpsgClauseContext, start: number, end: number): boolean;
|
|
14
17
|
export declare function normalizeTokenLower(token: Token): string;
|
|
15
18
|
export declare function isPunctuation(lower: string): boolean;
|
|
16
19
|
export declare function isClockLikeLower(lower: string): boolean;
|
|
@@ -17,8 +17,10 @@ export declare function cadenceFirstImplicitSingleDoseRule(): HpsgLexicalRule<Hp
|
|
|
17
17
|
* English word order.
|
|
18
18
|
*/
|
|
19
19
|
export declare function cadenceFirstFrequencyRule(): HpsgLexicalRule<HpsgClauseContext>;
|
|
20
|
+
export declare function singleOccurrencePhraseRule(): HpsgLexicalRule<HpsgClauseContext>;
|
|
20
21
|
export declare function countFrequencyRule(): HpsgLexicalRule<HpsgClauseContext>;
|
|
21
22
|
export declare function alternateEventCadenceRule(): HpsgLexicalRule<HpsgClauseContext>;
|
|
23
|
+
export declare function calendarDateListRule(): HpsgLexicalRule<HpsgClauseContext>;
|
|
22
24
|
export declare function timingLexicalRule(): HpsgLexicalRule<HpsgClauseContext>;
|
|
23
25
|
export declare function quantityFirstActivityTimingRule(): HpsgLexicalRule<HpsgClauseContext>;
|
|
24
26
|
/**
|
package/dist/hpsg/segmenter.d.ts
CHANGED
|
@@ -3,5 +3,7 @@ export interface HpsgSigSegment {
|
|
|
3
3
|
text: string;
|
|
4
4
|
start: number;
|
|
5
5
|
end: number;
|
|
6
|
+
/** A trailing duration on the next heterogeneous dose applies to this sibling too. */
|
|
7
|
+
inheritTrailingDurationFromNext?: boolean;
|
|
6
8
|
}
|
|
7
9
|
export declare function parseSigSegments(input: string, options?: ParseOptions): HpsgSigSegment[];
|
package/dist/hpsg/signature.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AdviceFrame, AdviceRelation, CanonicalDoseRange, CanonicalAdditionalInstructionExpr, CanonicalActivityTimingExpr, CanonicalOccurrenceCapExpr, BodySiteSpatialRelation, EventTiming, FhirCoding, FhirDayOfWeek, FhirPeriodUnit, FhirPrimitiveElement, RouteCode, PrnReasonLookupRequest, SiteCodeLookupRequest } from "../types";
|
|
1
|
+
import { AdviceFrame, AdviceRelation, CanonicalDoseRange, CanonicalAdditionalInstructionExpr, CanonicalActivityTimingExpr, CanonicalCalendarEventExpr, CanonicalOccurrenceCapExpr, BodySiteSpatialRelation, EventTiming, FhirCoding, FhirDayOfWeek, FhirPeriodUnit, FhirPrimitiveElement, RouteCode, PrnReasonLookupRequest, SiteCodeLookupRequest } from "../types";
|
|
2
2
|
import { Token } from "../parser-state";
|
|
3
3
|
import type { HpsgFeatureNode } from "./type-system";
|
|
4
4
|
export type HpsgType = "sign" | "word-sign" | "phrase-sign" | "headed-phrase" | "head-complement-phrase" | "head-adjunct-phrase" | "head-marker-phrase" | "procedure-sequence-phrase" | "conditional-instruction-phrase" | "coordination-phrase" | "clause-sign" | "administration-clause" | "method-sign" | "route-sign" | "site-sign" | "dose-sign" | "schedule-sign" | "prn-sign" | "instruction-sign" | "conditional-sign" | "adjustment-sign" | "connector-sign";
|
|
@@ -88,6 +88,8 @@ export interface HpsgScheduleFeature {
|
|
|
88
88
|
duration?: number;
|
|
89
89
|
durationMax?: number;
|
|
90
90
|
durationUnit?: FhirPeriodUnit;
|
|
91
|
+
boundsStart?: string;
|
|
92
|
+
boundsEnd?: string;
|
|
91
93
|
frequency?: number;
|
|
92
94
|
frequencyMax?: number;
|
|
93
95
|
period?: number;
|
|
@@ -99,6 +101,7 @@ export interface HpsgScheduleFeature {
|
|
|
99
101
|
when?: EventTiming[];
|
|
100
102
|
dayOfWeek?: FhirDayOfWeek[];
|
|
101
103
|
timeOfDay?: string[];
|
|
104
|
+
calendarEvents?: CanonicalCalendarEventExpr[];
|
|
102
105
|
activityTiming?: CanonicalActivityTimingExpr[];
|
|
103
106
|
occurrenceCap?: CanonicalOccurrenceCapExpr;
|
|
104
107
|
}
|