ezmedicationinput 0.1.45 → 0.1.47
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 +294 -2
- package/dist/advice.d.ts +9 -0
- package/dist/body-site-grammar.d.ts +39 -0
- package/dist/body-site-lookup.d.ts +84 -0
- package/dist/body-site-resolution.d.ts +9 -0
- package/dist/body-site-spatial.d.ts +6 -0
- package/dist/clause-tail-grammar.d.ts +18 -0
- package/dist/fhir-translations.d.ts +4 -1
- package/dist/fhir.d.ts +9 -1
- package/dist/hpsg/chart.d.ts +14 -0
- package/dist/hpsg/clause-parser.d.ts +3 -0
- package/dist/hpsg/defaults.d.ts +9 -0
- package/dist/hpsg/lexical-classes.d.ts +97 -0
- package/dist/hpsg/method-lexicon.d.ts +15 -0
- package/dist/hpsg/projection.d.ts +12 -0
- package/dist/hpsg/rule-context.d.ts +32 -0
- package/dist/hpsg/rules/core-rules.d.ts +8 -0
- package/dist/hpsg/rules/instruction-rules.d.ts +4 -0
- package/dist/hpsg/rules/prn-rules.d.ts +3 -0
- package/dist/hpsg/rules/product-route.d.ts +2 -0
- package/dist/hpsg/rules/site-rules.d.ts +4 -0
- package/dist/hpsg/rules/timing-rules.d.ts +12 -0
- package/dist/hpsg/segmenter.d.ts +6 -0
- package/dist/hpsg/signature.d.ts +116 -0
- package/dist/hpsg/timing-lexicon.d.ts +31 -0
- package/dist/hpsg/unification.d.ts +8 -0
- package/dist/index.cjs +15918 -12849
- package/dist/index.d.ts +6 -0
- package/dist/index.js +15875 -12849
- package/dist/maps.d.ts +4 -2
- package/dist/parser-state.d.ts +4 -1
- package/dist/parser.d.ts +3 -13
- package/dist/prn-reason-coding.d.ts +8 -0
- package/dist/site-coding.d.ts +5 -0
- package/dist/snomed-postcoordination.d.ts +25 -0
- package/dist/snomed.d.ts +13 -0
- package/dist/types.d.ts +110 -16
- package/dist/unit-lexicon.d.ts +8 -0
- package/package.json +1 -1
- package/dist/segment.d.ts +0 -6
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { EventTiming, FhirCoding } from "../types";
|
|
2
|
+
type MealRelation = "before" | "after" | "with";
|
|
3
|
+
type MealTimingByRelation = Map<MealRelation, Map<EventTiming, EventTiming>>;
|
|
4
|
+
type BodySiteFeatureKind = "nominal" | "partitive" | "locative";
|
|
5
|
+
type CompoundDoseUnit = {
|
|
6
|
+
head: string;
|
|
7
|
+
tails: string[];
|
|
8
|
+
tailSequences?: string[][];
|
|
9
|
+
unit: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const SITE_ANCHORS: Set<string>;
|
|
12
|
+
export declare const SITE_SELF_DISPLAY_ANCHORS: Set<string>;
|
|
13
|
+
export declare const SITE_FILLERS: Set<string>;
|
|
14
|
+
export declare const BODY_SITE_LOCATIVE_RELATIONS: Set<string>;
|
|
15
|
+
export declare const BODY_SITE_LOCATIVE_RENDER_PREPOSITIONS: Map<string, string>;
|
|
16
|
+
export declare const BODY_SITE_SPATIAL_RELATION_CODINGS: Map<string, FhirCoding>;
|
|
17
|
+
export declare const BODY_SITE_PARTITIVE_HEADS: Set<string>;
|
|
18
|
+
export declare const BODY_SITE_PARTITIVE_MODIFIERS: Set<string>;
|
|
19
|
+
export declare const BODY_SITE_PARTITIVE_CONNECTORS: Set<string>;
|
|
20
|
+
export declare const BODY_SITE_BARE_NOMINAL_PREFIXES: Set<string>;
|
|
21
|
+
export declare const OTIC_SITE_WORDS: Set<string>;
|
|
22
|
+
export declare const OPHTHALMIC_SITE_WORDS: Set<string>;
|
|
23
|
+
export declare const NASAL_SITE_WORDS: Set<string>;
|
|
24
|
+
export declare const BODY_SITE_ADJECTIVE_SUFFIXES: readonly string[];
|
|
25
|
+
export declare const BODY_SITE_DISPLAY_PENALTY_WORDS: Set<string>;
|
|
26
|
+
export declare const BODY_SITE_FEATURE_SCORE_BONUS: Map<BodySiteFeatureKind, number>;
|
|
27
|
+
export declare const CONNECTORS: Set<string>;
|
|
28
|
+
export declare const ROUTE_SITE_PREPOSITIONS: Set<string>;
|
|
29
|
+
export declare const SITE_DISPLAY_FILLERS: Set<string>;
|
|
30
|
+
export declare const NON_SITE_ANCHORED_PHRASES: Set<string>;
|
|
31
|
+
export declare const EXTERNAL_SITE_LOCATIVE_PREFIXES: Set<string>;
|
|
32
|
+
export declare const ROUTE_BLOCKED_BY_FOLLOWING_PARTITIVE_HEADS: Set<string>;
|
|
33
|
+
export declare const PRN_LEADS: Set<string>;
|
|
34
|
+
export declare const PRN_REASON_LEAD_INS: Set<string>;
|
|
35
|
+
export declare const PRN_STANDALONE_REASON_LEADS: Set<string>;
|
|
36
|
+
export declare const PRN_REASON_MULTIWORD_LEAD_INS: Set<string>;
|
|
37
|
+
export declare const PRN_REASON_SITE_CONNECTORS: Set<string>;
|
|
38
|
+
export declare const PRN_REASON_COORDINATORS: Set<string>;
|
|
39
|
+
export declare const PRN_CONDITIONAL_SITE_BOUNDARY_ANCHORS: Set<string>;
|
|
40
|
+
export declare const PRN_PREDICATE_REASON_NORMALIZATIONS: Map<string, string>;
|
|
41
|
+
export declare const PRN_GENERIC_LOCATED_HEADS: Map<string, string>;
|
|
42
|
+
export declare const PRN_DEFAULT_SITE_CONNECTOR: string;
|
|
43
|
+
export declare const PRN_COMPACT_REASON_SEPARATORS: Set<string>;
|
|
44
|
+
export declare const SITE_ROUTE_HINTS_ALLOWED_IN_GRAMMAR: Set<import("../types").SNOMEDCTRouteCodes>;
|
|
45
|
+
export declare const PRODUCT_METHOD_TEXT: Record<string, Partial<Record<string, string>>>;
|
|
46
|
+
export declare const PRODUCT_METHOD_THAI: Record<string, string>;
|
|
47
|
+
export declare const COMPOUND_DOSE_UNITS: CompoundDoseUnit[];
|
|
48
|
+
export declare const IMPLICIT_SINGLE_DOSE_UNITS: Set<string>;
|
|
49
|
+
export declare const PERCENT_BODY_AREA_UNITS: Map<string, string>;
|
|
50
|
+
export declare const DOSE_FRACTION_WORDS: Map<string, number>;
|
|
51
|
+
export declare const DOSE_FRACTION_DENOMINATOR_WORDS: Map<string, number>;
|
|
52
|
+
export declare const DOSE_NUMBER_WORDS: Map<string, number>;
|
|
53
|
+
export declare const DOSE_UNIT_CONNECTORS: Set<string>;
|
|
54
|
+
export declare const MILLION_DOSE_MULTIPLIER_TOKENS: Set<string>;
|
|
55
|
+
export declare const SCHEDULE_UNIT_SEPARATOR_TOKENS: Set<string>;
|
|
56
|
+
export declare const COMPACT_LIST_SEPARATORS: Set<string>;
|
|
57
|
+
export declare const EVERY_INTERVAL_TOKENS_DATA: Set<string>;
|
|
58
|
+
export declare const COUNT_MARKER_TOKENS_DATA: Set<string>;
|
|
59
|
+
export declare const COUNT_CONNECTOR_WORDS_DATA: Set<string>;
|
|
60
|
+
export declare const FREQUENCY_SIMPLE_WORDS_DATA: Record<string, number>;
|
|
61
|
+
export declare const FREQUENCY_NUMBER_WORDS_DATA: Record<string, number>;
|
|
62
|
+
export declare const FREQUENCY_TIMES_WORDS_DATA: Set<string>;
|
|
63
|
+
export declare const FREQUENCY_CONNECTOR_WORDS_DATA: Set<string>;
|
|
64
|
+
export declare const FREQUENCY_ADVERB_UNITS_DATA: Map<string, string>;
|
|
65
|
+
export declare const INTERVAL_UNIT_TOKENS_DATA: Map<string, string>;
|
|
66
|
+
export declare const WORKFLOW_START_WORDS: Set<string>;
|
|
67
|
+
export declare const WORKFLOW_NOUNS: Set<string>;
|
|
68
|
+
export declare const ANTE_MERIDIEM_TOKENS: Set<string>;
|
|
69
|
+
export declare const POST_MERIDIEM_TOKENS: Set<string>;
|
|
70
|
+
export declare const MERIDIEM_TOKENS: Set<string>;
|
|
71
|
+
export declare const LIST_SEPARATORS: Set<string>;
|
|
72
|
+
export declare const MEDICATION_OBJECT_FILLERS: Set<string>;
|
|
73
|
+
export declare const CLOCK_LEAD_TOKENS: Set<string>;
|
|
74
|
+
export declare const EVENT_PREPOSITIONS: Set<string>;
|
|
75
|
+
export declare const EVENT_ARTICLE_TOKENS: Set<string>;
|
|
76
|
+
export declare const FIXED_EVENT_PHRASES: Map<string, EventTiming>;
|
|
77
|
+
export declare const MEAL_RELATION_BY_TOKEN: Map<string, MealRelation>;
|
|
78
|
+
export declare const MEAL_TIMING_BY_RELATION: MealTimingByRelation;
|
|
79
|
+
export declare const SLEEP_EVENT_ALIASES: Set<string>;
|
|
80
|
+
export declare const WAKE_EVENT_ALIASES: Set<string>;
|
|
81
|
+
export declare const FOOD_EVENT_ALIASES: Set<string>;
|
|
82
|
+
export declare const DAY_RANGE_CONNECTORS: Set<string>;
|
|
83
|
+
export declare const RANGE_CONNECTORS: Set<string>;
|
|
84
|
+
export declare const DURATION_LEAD_TOKENS: Set<string>;
|
|
85
|
+
export declare const INSTRUCTION_LEADING_SEPARATORS: Set<string>;
|
|
86
|
+
export declare const INSTRUCTION_START_WORDS: Set<string>;
|
|
87
|
+
export declare const SITE_TRAILING_INSTRUCTION_WORDS: Set<string>;
|
|
88
|
+
export declare const WORKFLOW_CONTINUATION_LICENSES: Set<string>;
|
|
89
|
+
export declare const AS_NEEDED_LEAD_PHRASES: Set<string>;
|
|
90
|
+
export declare const PRN_BREAKING_COORDINATORS: Set<string>;
|
|
91
|
+
export declare const EYE_SITE_ABBREVIATIONS: Set<string>;
|
|
92
|
+
export declare const NON_OCULAR_DOSE_UNITS: Set<string>;
|
|
93
|
+
export declare const OCULAR_ROUTE_CODES: Set<import("../types").SNOMEDCTRouteCodes>;
|
|
94
|
+
export declare const HARD_SEGMENT_BOUNDARY_TOKENS: Set<string>;
|
|
95
|
+
export declare const CLAUSE_LEAD_WORDS: Set<string>;
|
|
96
|
+
export declare const LATERAL_MODIFIER_WORDS: Set<string>;
|
|
97
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FhirCoding } from "../types";
|
|
2
|
+
export declare enum MethodAction {
|
|
3
|
+
Administer = "administer",
|
|
4
|
+
Apply = "apply",
|
|
5
|
+
Inhale = "inhale",
|
|
6
|
+
Inject = "inject",
|
|
7
|
+
Insert = "insert",
|
|
8
|
+
Instill = "instill",
|
|
9
|
+
Spray = "spray",
|
|
10
|
+
Swallow = "swallow",
|
|
11
|
+
Wash = "wash"
|
|
12
|
+
}
|
|
13
|
+
export declare const METHOD_ACTION_BY_VERB: Record<string, MethodAction>;
|
|
14
|
+
export declare const METHOD_CODING_BY_ACTION: Record<MethodAction, FhirCoding>;
|
|
15
|
+
export declare function cloneMethodCoding(coding: FhirCoding | undefined): FhirCoding | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ParserState, Token } from "../parser-state";
|
|
2
|
+
import { EventTiming, FhirDayOfWeek, RouteCode } from "../types";
|
|
3
|
+
import { HpsgSign } from "./signature";
|
|
4
|
+
export interface HpsgProjectionDeps {
|
|
5
|
+
addDayOfWeekList: (state: ParserState, days: FhirDayOfWeek[]) => void;
|
|
6
|
+
addWhen: (target: EventTiming[], whenCode: EventTiming) => void;
|
|
7
|
+
markToken: (state: ParserState, token: Token) => void;
|
|
8
|
+
recordEvidence: (state: ParserState, rule: string, startIndex: number, endIndex: number) => void;
|
|
9
|
+
refreshMethodSurface: (state: ParserState) => void;
|
|
10
|
+
setRoute: (state: ParserState, code: RouteCode, text?: string) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function projectHpsgSignToState(sign: HpsgSign, state: ParserState, tokens: Token[], deps: HpsgProjectionDeps): void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Token, ParserState } from "../parser-state";
|
|
2
|
+
import { ParseOptions } from "../types";
|
|
3
|
+
import { HpsgLexicalRule } from "./signature";
|
|
4
|
+
import { HpsgProjectionDeps } from "./projection";
|
|
5
|
+
import { HpsgUnificationContext } from "./unification";
|
|
6
|
+
export interface HpsgClauseContext {
|
|
7
|
+
state: ParserState;
|
|
8
|
+
tokens: Token[];
|
|
9
|
+
options?: ParseOptions;
|
|
10
|
+
limit: number;
|
|
11
|
+
deps: HpsgProjectionDeps & HpsgUnificationContext;
|
|
12
|
+
project?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function normalizeTokenLower(token: Token): string;
|
|
15
|
+
export declare function isPunctuation(lower: string): boolean;
|
|
16
|
+
export declare function isClockLikeLower(lower: string): boolean;
|
|
17
|
+
export declare function isAmPmLower(lower: string): boolean;
|
|
18
|
+
export declare function isAnteMeridiemLower(lower: string): boolean;
|
|
19
|
+
export declare function isPostMeridiemLower(lower: string): boolean;
|
|
20
|
+
export declare function parseClockToken(token: Token | undefined, meridiemToken?: Token | undefined): {
|
|
21
|
+
value: string;
|
|
22
|
+
tokens: Token[];
|
|
23
|
+
} | undefined;
|
|
24
|
+
export declare function tokensAvailable(context: HpsgClauseContext, start: number, span: number): Token[] | undefined;
|
|
25
|
+
export declare function rangeFromTokens(tokens: Token[]): {
|
|
26
|
+
start: number;
|
|
27
|
+
end: number;
|
|
28
|
+
} | undefined;
|
|
29
|
+
export declare function splitByLexicalSeparators(text: string, separators: ReadonlySet<string>): string[];
|
|
30
|
+
export declare function hasLexicalSeparator(text: string, separators: ReadonlySet<string>): boolean;
|
|
31
|
+
export declare function joinTokenText(tokens: Token[]): string;
|
|
32
|
+
export declare function lexicalRule(id: string, match: HpsgLexicalRule<HpsgClauseContext>["match"]): HpsgLexicalRule<HpsgClauseContext>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HpsgClauseContext } from "../rule-context";
|
|
2
|
+
import { HpsgLexicalRule } from "../signature";
|
|
3
|
+
export declare function methodLexicalRule(): HpsgLexicalRule<HpsgClauseContext>;
|
|
4
|
+
export declare function routeLexicalRule(): HpsgLexicalRule<HpsgClauseContext>;
|
|
5
|
+
export declare function fillerLexicalRule(): HpsgLexicalRule<HpsgClauseContext>;
|
|
6
|
+
export declare function productLexicalRule(): HpsgLexicalRule<HpsgClauseContext>;
|
|
7
|
+
export declare function doseLexicalRule(): HpsgLexicalRule<HpsgClauseContext>;
|
|
8
|
+
export declare function connectorLexicalRule(): HpsgLexicalRule<HpsgClauseContext>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { HpsgClauseContext } from "../rule-context";
|
|
2
|
+
import { HpsgLexicalRule } from "../signature";
|
|
3
|
+
export declare function workflowLexicalRule(): HpsgLexicalRule<HpsgClauseContext>;
|
|
4
|
+
export declare function instructionLexicalRule(): HpsgLexicalRule<HpsgClauseContext>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HpsgClauseContext } from "../rule-context";
|
|
2
|
+
import { HpsgLexicalRule } from "../signature";
|
|
3
|
+
export declare function multiplicativeDoseFrequencyRule(): HpsgLexicalRule<HpsgClauseContext>;
|
|
4
|
+
export declare function compactIntervalRule(): HpsgLexicalRule<HpsgClauseContext>;
|
|
5
|
+
export declare function separatedIntervalRule(): HpsgLexicalRule<HpsgClauseContext>;
|
|
6
|
+
export declare function countFrequencyRule(): HpsgLexicalRule<HpsgClauseContext>;
|
|
7
|
+
export declare function timingLexicalRule(): HpsgLexicalRule<HpsgClauseContext>;
|
|
8
|
+
export declare function eventTimingPhraseRule(): HpsgLexicalRule<HpsgClauseContext>;
|
|
9
|
+
export declare function dayRangeLexicalRule(): HpsgLexicalRule<HpsgClauseContext>;
|
|
10
|
+
export declare function countAndDurationRule(): HpsgLexicalRule<HpsgClauseContext>;
|
|
11
|
+
export declare function timeOfDayRule(): HpsgLexicalRule<HpsgClauseContext>;
|
|
12
|
+
export declare function isScheduleLead(context: HpsgClauseContext, index: number): boolean;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { CanonicalDoseRange, CanonicalAdditionalInstructionExpr, BodySiteSpatialRelation, EventTiming, FhirCoding, FhirDayOfWeek, FhirPeriodUnit, FhirPrimitiveElement, RouteCode, PrnReasonLookupRequest, SiteCodeLookupRequest } from "../types";
|
|
2
|
+
import { Token } from "../parser-state";
|
|
3
|
+
export type HpsgType = "sign" | "word-sign" | "phrase-sign" | "clause-sign" | "method-sign" | "route-sign" | "site-sign" | "dose-sign" | "schedule-sign" | "prn-sign" | "instruction-sign" | "connector-sign";
|
|
4
|
+
export interface HpsgEvidence {
|
|
5
|
+
rule: string;
|
|
6
|
+
tokenIndices: number[];
|
|
7
|
+
}
|
|
8
|
+
export interface HpsgMethodFeature {
|
|
9
|
+
verb: string;
|
|
10
|
+
text?: string;
|
|
11
|
+
textElement?: FhirPrimitiveElement;
|
|
12
|
+
coding?: FhirCoding;
|
|
13
|
+
}
|
|
14
|
+
export interface HpsgRouteFeature {
|
|
15
|
+
code: RouteCode;
|
|
16
|
+
text?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface HpsgSiteFeature {
|
|
19
|
+
text?: string;
|
|
20
|
+
source?: "abbreviation" | "text" | "selection" | "resolver";
|
|
21
|
+
coding?: FhirCoding;
|
|
22
|
+
spatialRelation?: BodySiteSpatialRelation;
|
|
23
|
+
lookupRequest?: SiteCodeLookupRequest;
|
|
24
|
+
}
|
|
25
|
+
export interface HpsgPrnFeature {
|
|
26
|
+
enabled: true;
|
|
27
|
+
reasonText?: string;
|
|
28
|
+
lookupRequest?: PrnReasonLookupRequest;
|
|
29
|
+
reasons?: Array<{
|
|
30
|
+
text: string;
|
|
31
|
+
lookupRequest?: PrnReasonLookupRequest;
|
|
32
|
+
}>;
|
|
33
|
+
lookupRequests?: PrnReasonLookupRequest[];
|
|
34
|
+
}
|
|
35
|
+
export interface HpsgInstructionFeature extends CanonicalAdditionalInstructionExpr {
|
|
36
|
+
}
|
|
37
|
+
export interface HpsgPatientInstructionFeature {
|
|
38
|
+
text: string;
|
|
39
|
+
}
|
|
40
|
+
export interface HpsgDoseFeature {
|
|
41
|
+
value?: number;
|
|
42
|
+
range?: CanonicalDoseRange;
|
|
43
|
+
unit?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface HpsgScheduleFeature {
|
|
46
|
+
timingCode?: string;
|
|
47
|
+
count?: number;
|
|
48
|
+
duration?: number;
|
|
49
|
+
durationMax?: number;
|
|
50
|
+
durationUnit?: FhirPeriodUnit;
|
|
51
|
+
frequency?: number;
|
|
52
|
+
frequencyMax?: number;
|
|
53
|
+
period?: number;
|
|
54
|
+
periodMax?: number;
|
|
55
|
+
periodUnit?: FhirPeriodUnit;
|
|
56
|
+
when?: EventTiming[];
|
|
57
|
+
dayOfWeek?: FhirDayOfWeek[];
|
|
58
|
+
timeOfDay?: string[];
|
|
59
|
+
}
|
|
60
|
+
export interface HpsgSynsem {
|
|
61
|
+
head: {
|
|
62
|
+
method?: HpsgMethodFeature;
|
|
63
|
+
route?: HpsgRouteFeature;
|
|
64
|
+
dose?: HpsgDoseFeature;
|
|
65
|
+
schedule?: HpsgScheduleFeature;
|
|
66
|
+
};
|
|
67
|
+
valence: {
|
|
68
|
+
site?: HpsgSiteFeature;
|
|
69
|
+
prn?: HpsgPrnFeature;
|
|
70
|
+
instructions?: HpsgInstructionFeature[];
|
|
71
|
+
patientInstruction?: HpsgPatientInstructionFeature;
|
|
72
|
+
};
|
|
73
|
+
cont: {
|
|
74
|
+
clauseKind?: "administration";
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export interface HpsgSign {
|
|
78
|
+
type: HpsgType;
|
|
79
|
+
span: {
|
|
80
|
+
start: number;
|
|
81
|
+
end: number;
|
|
82
|
+
};
|
|
83
|
+
tokens: Token[];
|
|
84
|
+
synsem: HpsgSynsem;
|
|
85
|
+
consumedTokenIndices: number[];
|
|
86
|
+
siteTokenIndices?: number[];
|
|
87
|
+
warnings?: string[];
|
|
88
|
+
evidence: HpsgEvidence[];
|
|
89
|
+
score: number;
|
|
90
|
+
}
|
|
91
|
+
export interface HpsgLexicalRule<TContext> {
|
|
92
|
+
id: string;
|
|
93
|
+
type: HpsgType;
|
|
94
|
+
match(context: TContext, start: number): HpsgSign[];
|
|
95
|
+
}
|
|
96
|
+
export interface HpsgPhraseRule<TContext> {
|
|
97
|
+
id: string;
|
|
98
|
+
left?: HpsgType;
|
|
99
|
+
right?: HpsgType;
|
|
100
|
+
combine(context: TContext, left: HpsgSign, right: HpsgSign): HpsgSign | undefined;
|
|
101
|
+
}
|
|
102
|
+
export interface HpsgGrammar<TContext> {
|
|
103
|
+
lexicalRules: HpsgLexicalRule<TContext>[];
|
|
104
|
+
phraseRules: HpsgPhraseRule<TContext>[];
|
|
105
|
+
}
|
|
106
|
+
export declare function emptySynsem(): HpsgSynsem;
|
|
107
|
+
export declare function lexicalSign(args: {
|
|
108
|
+
type: HpsgType;
|
|
109
|
+
rule: string;
|
|
110
|
+
tokens: Token[];
|
|
111
|
+
synsem: HpsgSynsem;
|
|
112
|
+
consumedTokenIndices?: number[];
|
|
113
|
+
siteTokenIndices?: number[];
|
|
114
|
+
warnings?: string[];
|
|
115
|
+
score?: number;
|
|
116
|
+
}): HpsgSign;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ParserState } from "../parser-state";
|
|
2
|
+
import { FhirPeriodUnit } from "../types";
|
|
3
|
+
import { HpsgScheduleFeature } from "./signature";
|
|
4
|
+
export declare const EVERY_INTERVAL_TOKENS: Set<string>;
|
|
5
|
+
export declare const COUNT_MARKER_TOKENS: Set<string>;
|
|
6
|
+
export declare const COUNT_CONNECTOR_WORDS: Set<string>;
|
|
7
|
+
export declare const FREQUENCY_SIMPLE_WORDS: Record<string, number>;
|
|
8
|
+
export declare const FREQUENCY_NUMBER_WORDS: Record<string, number>;
|
|
9
|
+
export declare const FREQUENCY_TIMES_WORDS: Set<string>;
|
|
10
|
+
export declare const FREQUENCY_CONNECTOR_WORDS: Set<string>;
|
|
11
|
+
export declare function normalizePeriodValue(value: number, unit: FhirPeriodUnit): {
|
|
12
|
+
value: number;
|
|
13
|
+
unit: FhirPeriodUnit;
|
|
14
|
+
};
|
|
15
|
+
export declare function normalizePeriodRange(low: number, high: number, unit: FhirPeriodUnit): {
|
|
16
|
+
low: number;
|
|
17
|
+
high: number;
|
|
18
|
+
unit: FhirPeriodUnit;
|
|
19
|
+
};
|
|
20
|
+
export declare function periodUnitSuffix(unit: FhirPeriodUnit): string | undefined;
|
|
21
|
+
export declare function applyPeriod(internal: ParserState, period: number, unit: FhirPeriodUnit): void;
|
|
22
|
+
export declare function buildPeriodScheduleFeature(period: number, unit: FhirPeriodUnit): HpsgScheduleFeature;
|
|
23
|
+
export declare function mapIntervalUnit(token: string): FhirPeriodUnit.Minute | FhirPeriodUnit.Hour | FhirPeriodUnit.Day | FhirPeriodUnit.Week | FhirPeriodUnit.Month | undefined;
|
|
24
|
+
export declare function mapFrequencyAdverb(token: string): FhirPeriodUnit | undefined;
|
|
25
|
+
export declare function parseNumericRange(token: string): {
|
|
26
|
+
low: number;
|
|
27
|
+
high: number;
|
|
28
|
+
} | undefined;
|
|
29
|
+
export declare function normalizeCountLimitValue(value: number | undefined): number | undefined;
|
|
30
|
+
export declare function applyDurationLimit(internal: ParserState, value: number | undefined, unit: FhirPeriodUnit | undefined, max?: number): boolean;
|
|
31
|
+
export declare function buildDurationScheduleFeature(value: number | undefined, unit: FhirPeriodUnit | undefined, max?: number): HpsgScheduleFeature | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HpsgSign, HpsgSynsem } from "./signature";
|
|
2
|
+
import { RouteCode } from "../types";
|
|
3
|
+
export interface HpsgUnificationContext {
|
|
4
|
+
normalizeSiteText(text: string): string;
|
|
5
|
+
isCompatibleRouteRefinement(current: RouteCode | undefined, next: RouteCode): boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function unifySynsem(left: HpsgSynsem, right: HpsgSynsem, context: HpsgUnificationContext): HpsgSynsem | undefined;
|
|
8
|
+
export declare function combineSigns(left: HpsgSign, right: HpsgSign, context: HpsgUnificationContext, rule: string): HpsgSign | undefined;
|