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
package/dist/maps.d.ts
CHANGED
|
@@ -25,10 +25,11 @@ export declare const DEFAULT_ROUTE_SYNONYMS: Record<string, RouteSynonym>;
|
|
|
25
25
|
* same logic to ensure consistent lookups.
|
|
26
26
|
*/
|
|
27
27
|
export declare function normalizeBodySiteKey(value: string): string;
|
|
28
|
-
|
|
28
|
+
type BodySiteSnomedSourceEntry = {
|
|
29
29
|
names: string[];
|
|
30
30
|
definition: BodySiteDefinition;
|
|
31
|
-
}
|
|
31
|
+
};
|
|
32
|
+
export declare const DEFAULT_BODY_SITE_SNOMED_SOURCE: BodySiteSnomedSourceEntry[];
|
|
32
33
|
export declare const DEFAULT_BODY_SITE_SNOMED: Record<string, BodySiteDefinition>;
|
|
33
34
|
export declare const DEFAULT_BODY_SITE_HINTS: Set<string>;
|
|
34
35
|
export declare const HOUSEHOLD_VOLUME_UNITS: readonly ["tsp", "tbsp"];
|
|
@@ -80,3 +81,4 @@ export declare const DEFAULT_PRN_REASON_DEFINITIONS: Record<string, PrnReasonDef
|
|
|
80
81
|
* Finds a default PRN reason definition by its SNOMED coding.
|
|
81
82
|
*/
|
|
82
83
|
export declare function findPrnReasonDefinitionByCoding(system: string, code: string): PrnReasonDefinition | undefined;
|
|
84
|
+
export {};
|
package/dist/parser-state.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AnnotatedLexToken } from "./lexer/meaning";
|
|
2
|
-
import { CanonicalAdditionalInstructionExpr, CanonicalDoseRange, CanonicalPrnReasonExpr, CanonicalSigClause, EventTiming, FhirCoding, FhirDayOfWeek, FhirPrimitiveElement, FhirPeriodUnit, PrnReasonLookupRequest, PrnReasonSuggestion, RouteCode, SiteCodeLookupRequest, SiteCodeSuggestion } from "./types";
|
|
2
|
+
import { CanonicalAdditionalInstructionExpr, BodySiteSpatialRelation, CanonicalDoseRange, CanonicalPrnReasonExpr, CanonicalSigClause, EventTiming, FhirCoding, FhirDayOfWeek, FhirPrimitiveElement, FhirPeriodUnit, PrnReasonLookupRequest, PrnReasonSuggestion, RouteCode, SiteCodeLookupRequest, SiteCodeSuggestion } from "./types";
|
|
3
3
|
export interface SiteLookupDetail {
|
|
4
4
|
request: SiteCodeLookupRequest;
|
|
5
5
|
suggestions: SiteCodeSuggestion[];
|
|
@@ -23,6 +23,7 @@ export declare class ParserState {
|
|
|
23
23
|
siteLookups: SiteLookupDetail[];
|
|
24
24
|
customSiteHints?: Set<string>;
|
|
25
25
|
prnReasonLookupRequest?: PrnReasonLookupRequest;
|
|
26
|
+
prnReasonLookupRequests?: PrnReasonLookupRequest[];
|
|
26
27
|
prnReasonLookups: PrnReasonLookupDetail[];
|
|
27
28
|
methodVerb?: string;
|
|
28
29
|
productFormKey?: string;
|
|
@@ -84,6 +85,8 @@ export declare class ParserState {
|
|
|
84
85
|
set siteSource(value: "abbreviation" | "text" | "selection" | "resolver" | undefined);
|
|
85
86
|
get siteCoding(): LocalizedCoding | undefined;
|
|
86
87
|
set siteCoding(value: LocalizedCoding | undefined);
|
|
88
|
+
get siteSpatialRelation(): BodySiteSpatialRelation | undefined;
|
|
89
|
+
set siteSpatialRelation(value: BodySiteSpatialRelation | undefined);
|
|
87
90
|
get additionalInstructions(): CanonicalAdditionalInstructionExpr[];
|
|
88
91
|
set additionalInstructions(value: CanonicalAdditionalInstructionExpr[]);
|
|
89
92
|
get patientInstruction(): string | undefined;
|
package/dist/parser.d.ts
CHANGED
|
@@ -1,20 +1,10 @@
|
|
|
1
1
|
import { ParserState, Token } from "./parser-state";
|
|
2
|
+
export { applyPrnReasonCoding, applyPrnReasonCodingAsync } from "./prn-reason-coding";
|
|
3
|
+
export { applySiteCoding, applySiteCodingAsync } from "./site-coding";
|
|
2
4
|
import { ParseOptions, TextRange } from "./types";
|
|
3
5
|
export declare function tokenize(input: string): Token[];
|
|
4
|
-
export declare function findUnparsedTokenGroups(
|
|
6
|
+
export declare function findUnparsedTokenGroups(state: ParserState): Array<{
|
|
5
7
|
tokens: Token[];
|
|
6
8
|
range?: TextRange;
|
|
7
9
|
}>;
|
|
8
10
|
export declare function parseClauseState(input: string, options?: ParseOptions): ParserState;
|
|
9
|
-
/**
|
|
10
|
-
* Resolves parsed site text against SNOMED dictionaries and synchronous
|
|
11
|
-
* callbacks, applying the best match to the in-progress parse result.
|
|
12
|
-
*/
|
|
13
|
-
export declare function applyPrnReasonCoding(internal: ParserState, options?: ParseOptions): void;
|
|
14
|
-
export declare function applyPrnReasonCodingAsync(internal: ParserState, options?: ParseOptions): Promise<void>;
|
|
15
|
-
export declare function applySiteCoding(internal: ParserState, options?: ParseOptions): void;
|
|
16
|
-
/**
|
|
17
|
-
* Asynchronous counterpart to {@link applySiteCoding} that awaits resolver and
|
|
18
|
-
* suggestion callbacks so remote terminology services can be used.
|
|
19
|
-
*/
|
|
20
|
-
export declare function applySiteCodingAsync(internal: ParserState, options?: ParseOptions): Promise<void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ParserState } from "./parser-state";
|
|
2
|
+
import { ParseOptions } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Resolves parsed PRN reason text against SNOMED dictionaries and synchronous
|
|
5
|
+
* callbacks, applying the best match to the in-progress parse result.
|
|
6
|
+
*/
|
|
7
|
+
export declare function applyPrnReasonCoding(internal: ParserState, options?: ParseOptions): void;
|
|
8
|
+
export declare function applyPrnReasonCodingAsync(internal: ParserState, options?: ParseOptions): Promise<void>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ParserState } from "./parser-state";
|
|
2
|
+
import { BodySiteDefinition, ParseOptions } from "./types";
|
|
3
|
+
export declare function applySiteCoding(internal: ParserState, options?: ParseOptions): void;
|
|
4
|
+
export declare function applySiteCodingAsync(internal: ParserState, options?: ParseOptions): Promise<void>;
|
|
5
|
+
export declare function lookupBodySiteDefinition(map: Record<string, BodySiteDefinition> | undefined, canonical: string): BodySiteDefinition | undefined;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BodySiteSpatialRelation, FhirCoding } from "./types";
|
|
2
|
+
export declare function hasSnomedFindingSitePostcoordination(code: string | undefined): boolean;
|
|
3
|
+
export declare function buildSnomedFindingSitePostcoordinationCode(focusCode: string, siteCode: string): string;
|
|
4
|
+
export declare function hasSnomedTopographicalModifierPostcoordination(code: string | undefined): boolean;
|
|
5
|
+
export declare function buildSnomedBodySiteTopographicalModifierPostcoordinationCode(siteCode: string, modifierCode: string): string;
|
|
6
|
+
export declare function hasSnomedBodySiteLateralityPostcoordination(code: string | undefined): boolean;
|
|
7
|
+
export declare function buildSnomedBodySiteLateralityPostcoordinationCode(siteCode: string, lateralityCode: string): string;
|
|
8
|
+
export declare function parseSnomedBodySiteTopographicalModifierPostcoordinationCode(code: string | undefined): {
|
|
9
|
+
siteCode: string;
|
|
10
|
+
modifierCode: string;
|
|
11
|
+
} | undefined;
|
|
12
|
+
export declare function parseSnomedBodySiteLateralityPostcoordinationCode(code: string | undefined): {
|
|
13
|
+
siteCode: string;
|
|
14
|
+
lateralityCode: string;
|
|
15
|
+
} | undefined;
|
|
16
|
+
export declare function parseSnomedFindingSitePostcoordinationCode(code: string | undefined): {
|
|
17
|
+
focusCode: string;
|
|
18
|
+
siteCode: string;
|
|
19
|
+
} | undefined;
|
|
20
|
+
export declare function buildSnomedFindingSiteCoding(params: {
|
|
21
|
+
focusCoding: FhirCoding | undefined;
|
|
22
|
+
siteCoding: FhirCoding | undefined;
|
|
23
|
+
display?: string;
|
|
24
|
+
spatialRelation?: BodySiteSpatialRelation;
|
|
25
|
+
}): FhirCoding | undefined;
|
package/dist/snomed.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const SNOMED_SYSTEM = "http://snomed.info/sct";
|
|
2
|
+
export declare const SNOMED_CT_FINDING_SITE_ATTRIBUTE_CODE = "363698007";
|
|
3
|
+
export declare const SNOMED_CT_FINDING_SITE_ATTRIBUTE_DISPLAY = "Finding site";
|
|
4
|
+
export declare const SNOMED_CT_TOPOGRAPHICAL_MODIFIER_CODE = "106233006";
|
|
5
|
+
export declare const SNOMED_CT_TOPOGRAPHICAL_MODIFIER_DISPLAY = "Topographical modifier";
|
|
6
|
+
export declare const SNOMED_CT_LATERALITY_ATTRIBUTE_CODE = "272741003";
|
|
7
|
+
export declare const SNOMED_CT_LATERALITY_ATTRIBUTE_DISPLAY = "Laterality";
|
|
8
|
+
export declare const SNOMED_CT_LEFT_QUALIFIER_CODE = "7771000";
|
|
9
|
+
export declare const SNOMED_CT_LEFT_QUALIFIER_DISPLAY = "Left";
|
|
10
|
+
export declare const SNOMED_CT_RIGHT_QUALIFIER_CODE = "24028007";
|
|
11
|
+
export declare const SNOMED_CT_RIGHT_QUALIFIER_DISPLAY = "Right";
|
|
12
|
+
export declare const SNOMED_CT_BILATERAL_QUALIFIER_CODE = "51440002";
|
|
13
|
+
export declare const SNOMED_CT_BILATERAL_QUALIFIER_DISPLAY = "Right and left";
|
package/dist/types.d.ts
CHANGED
|
@@ -3,12 +3,14 @@ export interface FhirCoding {
|
|
|
3
3
|
system?: string;
|
|
4
4
|
code?: string;
|
|
5
5
|
display?: string;
|
|
6
|
+
extension?: FhirExtension[];
|
|
6
7
|
_display?: FhirPrimitiveElement;
|
|
7
8
|
i18n?: Record<string, string>;
|
|
8
9
|
}
|
|
9
10
|
export interface FhirCodeableConcept {
|
|
10
11
|
coding?: FhirCoding[];
|
|
11
12
|
text?: string;
|
|
13
|
+
extension?: FhirExtension[];
|
|
12
14
|
_text?: FhirPrimitiveElement;
|
|
13
15
|
}
|
|
14
16
|
export interface FhirExtension {
|
|
@@ -16,6 +18,8 @@ export interface FhirExtension {
|
|
|
16
18
|
extension?: FhirExtension[];
|
|
17
19
|
valueCode?: string;
|
|
18
20
|
valueString?: string;
|
|
21
|
+
valueCoding?: FhirCoding;
|
|
22
|
+
valueCodeableConcept?: FhirCodeableConcept;
|
|
19
23
|
}
|
|
20
24
|
export interface FhirPrimitiveElement {
|
|
21
25
|
extension?: FhirExtension[];
|
|
@@ -26,6 +30,38 @@ export interface FhirQuantity {
|
|
|
26
30
|
system?: string;
|
|
27
31
|
code?: string;
|
|
28
32
|
}
|
|
33
|
+
export type DoseUnitKind = "metric" | "biologic_unit" | "counted_presentation" | "device_actuation" | "infusion_rate" | "product_specific_amount" | "length_of_product" | "body_area_proxy" | "qualitative_amount";
|
|
34
|
+
export type DoseUnitApproximationConfidence = "exact" | "approximate" | "product_specific";
|
|
35
|
+
export interface DoseUnitApproximation {
|
|
36
|
+
value: number;
|
|
37
|
+
unit: string;
|
|
38
|
+
confidence: DoseUnitApproximationConfidence;
|
|
39
|
+
basis: string;
|
|
40
|
+
source?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface DoseUnitTerminologyEntry {
|
|
43
|
+
unit: string;
|
|
44
|
+
kind: DoseUnitKind;
|
|
45
|
+
aliases?: string[];
|
|
46
|
+
/**
|
|
47
|
+
* Defaults to true. Use false for terminology entries such as infusion-rate
|
|
48
|
+
* units that should be exposed to consumers but must not be accepted as a
|
|
49
|
+
* doseQuantity unit until rateQuantity parsing is implemented.
|
|
50
|
+
*/
|
|
51
|
+
parseAsDose?: boolean;
|
|
52
|
+
approximateQuantity?: DoseUnitApproximation;
|
|
53
|
+
}
|
|
54
|
+
export interface DoseUnitSemantics {
|
|
55
|
+
unit: string;
|
|
56
|
+
kind: DoseUnitKind;
|
|
57
|
+
parseAsDose?: boolean;
|
|
58
|
+
approximateQuantity?: DoseUnitApproximation;
|
|
59
|
+
}
|
|
60
|
+
export interface EstimatedQuantity extends FhirQuantity {
|
|
61
|
+
confidence?: DoseUnitApproximationConfidence;
|
|
62
|
+
basis?: string;
|
|
63
|
+
source?: string;
|
|
64
|
+
}
|
|
29
65
|
export interface FhirRange {
|
|
30
66
|
low?: FhirQuantity;
|
|
31
67
|
high?: FhirQuantity;
|
|
@@ -297,6 +333,12 @@ export type RouteCode = SNOMEDCTRouteCodes;
|
|
|
297
333
|
export declare const RouteCode: typeof SNOMEDCTRouteCodes;
|
|
298
334
|
export interface MedicationContext {
|
|
299
335
|
dosageForm?: string;
|
|
336
|
+
/**
|
|
337
|
+
* Optional anatomical context used to disambiguate shorthand body-site
|
|
338
|
+
* phrases, e.g. Thai "ระหว่างนิ้ว" can mean fingers by default but toes
|
|
339
|
+
* when the active context is foot/feet/toes.
|
|
340
|
+
*/
|
|
341
|
+
bodySiteContext?: string;
|
|
300
342
|
/** "Simple" strength string; might be the only way strength is provided
|
|
301
343
|
* for discrete units this is the amount of medication for unit e.g. "500 mg" (1 tablet), or for mixed tablets might be like "400 mg + 80 mg"
|
|
302
344
|
* for things like creams or fluids or syrupsit might be "2%", 5 g/100g, 100mg/ 100 g, 262 mg/15 mL, 200 mg/2 mL, 1 mg/dL, or "400 mg/5mL + 80 mg/5mL"
|
|
@@ -306,6 +348,18 @@ export interface MedicationContext {
|
|
|
306
348
|
strengthQuantity?: FhirQuantity;
|
|
307
349
|
strengthRatio?: FhirRatio;
|
|
308
350
|
strengthCodeableConcept?: FhirCodeableConcept;
|
|
351
|
+
/**
|
|
352
|
+
* Canonical presentation/package unit for fractional package instructions
|
|
353
|
+
* such as "1/2 bottle". When the parsed dose unit matches this value,
|
|
354
|
+
* containerValue/containerUnit describe the inner amount held by one package.
|
|
355
|
+
*/
|
|
356
|
+
packageUnit?: string;
|
|
357
|
+
/**
|
|
358
|
+
* Optional per-unit approximation overrides keyed by normalized dose unit
|
|
359
|
+
* (for example FTU, drop, pump, applicatorful). These are used only for
|
|
360
|
+
* estimated amount reporting; they do not rewrite the parsed dose unit.
|
|
361
|
+
*/
|
|
362
|
+
unitApproximationMap?: Record<string, DoseUnitApproximation>;
|
|
309
363
|
containerValue?: number;
|
|
310
364
|
containerUnit?: string;
|
|
311
365
|
defaultUnit?: string;
|
|
@@ -339,9 +393,17 @@ export interface BodySiteCode {
|
|
|
339
393
|
system?: string;
|
|
340
394
|
i18n?: Record<string, string>;
|
|
341
395
|
}
|
|
396
|
+
export interface BodySiteSpatialRelation {
|
|
397
|
+
relationText: string;
|
|
398
|
+
relationCoding?: FhirCoding;
|
|
399
|
+
targetText?: string;
|
|
400
|
+
targetCoding?: BodySiteCode;
|
|
401
|
+
sourceText?: string;
|
|
402
|
+
}
|
|
342
403
|
export interface BodySiteDefinition {
|
|
343
404
|
coding?: BodySiteCode;
|
|
344
405
|
text?: string;
|
|
406
|
+
spatialRelation?: BodySiteSpatialRelation;
|
|
345
407
|
routeHint?: RouteCode;
|
|
346
408
|
/**
|
|
347
409
|
* Optional phrases that should resolve to the same coding as this entry.
|
|
@@ -455,6 +517,12 @@ export interface SiteCodeLookupRequest {
|
|
|
455
517
|
sourceText?: string;
|
|
456
518
|
/** Location of {@link sourceText} relative to the original input. */
|
|
457
519
|
range?: TextRange;
|
|
520
|
+
/**
|
|
521
|
+
* Parsed spatial relation when the site phrase is relation + body site
|
|
522
|
+
* (for example, "below ear" or "top of hand"). Terminology callbacks can
|
|
523
|
+
* use this to code either the full site phrase or the relation target.
|
|
524
|
+
*/
|
|
525
|
+
spatialRelation?: BodySiteSpatialRelation;
|
|
458
526
|
}
|
|
459
527
|
export interface SiteCodeResolution extends BodySiteDefinition {
|
|
460
528
|
}
|
|
@@ -465,11 +533,22 @@ export interface SiteCodeSuggestion {
|
|
|
465
533
|
export interface SiteCodeSuggestionsResult {
|
|
466
534
|
suggestions: SiteCodeSuggestion[];
|
|
467
535
|
}
|
|
536
|
+
/**
|
|
537
|
+
* PRN reason lookup context. For located reasons such as "pain at hand",
|
|
538
|
+
* `headCanonical` is the symptom head ("pain"), `locativeSiteCanonical` is the
|
|
539
|
+
* parsed site key when known ("hand"), `locativeSiteCoding` is preferred for
|
|
540
|
+
* coded SNOMED/FHIR output when present, and `locativeSiteSpatialRelation`
|
|
541
|
+
* carries modifiers such as "below ear" that refine the locative site.
|
|
542
|
+
*/
|
|
468
543
|
export interface PrnReasonLookupRequest {
|
|
469
544
|
originalText: string;
|
|
470
545
|
text: string;
|
|
471
546
|
normalized: string;
|
|
472
547
|
canonical: string;
|
|
548
|
+
headCanonical?: string;
|
|
549
|
+
locativeSiteCanonical?: string;
|
|
550
|
+
locativeSiteCoding?: FhirCoding;
|
|
551
|
+
locativeSiteSpatialRelation?: BodySiteSpatialRelation;
|
|
473
552
|
isProbe: boolean;
|
|
474
553
|
inputText: string;
|
|
475
554
|
sourceText?: string;
|
|
@@ -606,6 +685,13 @@ export interface ParseOptions extends FormatOptions {
|
|
|
606
685
|
* the default site dictionary (trimmed, lower-cased, collapsing whitespace).
|
|
607
686
|
*/
|
|
608
687
|
siteCodeMap?: Record<string, BodySiteDefinition>;
|
|
688
|
+
/**
|
|
689
|
+
* Defaults to true. When true, parsed spatial body-site phrases without a
|
|
690
|
+
* direct pre-coordinated site code may emit SNOMED topographical modifier
|
|
691
|
+
* postcoordination in FHIR Dosage.site.coding while preserving the structured
|
|
692
|
+
* spatial-relation extension.
|
|
693
|
+
*/
|
|
694
|
+
bodySitePostcoordination?: boolean;
|
|
609
695
|
/**
|
|
610
696
|
* Explicit selections that override automatic site resolution for matching
|
|
611
697
|
* phrases. Useful when custom dictionaries provide multiple options but a UI
|
|
@@ -660,6 +746,7 @@ export interface CanonicalRouteExpr {
|
|
|
660
746
|
export interface CanonicalSiteExpr {
|
|
661
747
|
text?: string;
|
|
662
748
|
coding?: BodySiteCode;
|
|
749
|
+
spatialRelation?: BodySiteSpatialRelation;
|
|
663
750
|
source?: "abbreviation" | "text" | "selection" | "resolver";
|
|
664
751
|
inferred?: boolean;
|
|
665
752
|
evidence?: CanonicalEvidence[];
|
|
@@ -689,6 +776,7 @@ export interface CanonicalScheduleExpr {
|
|
|
689
776
|
export interface CanonicalPrnReasonExpr {
|
|
690
777
|
text?: string;
|
|
691
778
|
coding?: FhirCoding;
|
|
779
|
+
spatialRelation?: BodySiteSpatialRelation;
|
|
692
780
|
}
|
|
693
781
|
export interface CanonicalPrnExpr {
|
|
694
782
|
enabled: boolean;
|
|
@@ -755,28 +843,31 @@ export interface ParseResult {
|
|
|
755
843
|
export interface ParseNormalizedMeta {
|
|
756
844
|
route?: RouteCode;
|
|
757
845
|
unit?: string;
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
};
|
|
846
|
+
unitKind?: DoseUnitKind;
|
|
847
|
+
unitSemantics?: DoseUnitSemantics;
|
|
848
|
+
site?: BodySiteDetail;
|
|
762
849
|
method?: {
|
|
763
850
|
text?: string;
|
|
764
851
|
coding?: FhirCoding;
|
|
765
852
|
};
|
|
766
853
|
patientInstruction?: string;
|
|
767
|
-
prnReason?:
|
|
768
|
-
|
|
769
|
-
coding?: FhirCoding;
|
|
770
|
-
};
|
|
771
|
-
prnReasons?: Array<{
|
|
772
|
-
text?: string;
|
|
773
|
-
coding?: FhirCoding;
|
|
774
|
-
}>;
|
|
854
|
+
prnReason?: ConceptSiteDetail;
|
|
855
|
+
prnReasons?: ConceptSiteDetail[];
|
|
775
856
|
additionalInstructions?: Array<{
|
|
776
857
|
text?: string;
|
|
777
858
|
coding?: FhirCoding;
|
|
778
859
|
}>;
|
|
779
860
|
}
|
|
861
|
+
export interface BodySiteDetail {
|
|
862
|
+
text?: string;
|
|
863
|
+
coding?: BodySiteCode;
|
|
864
|
+
spatialRelation?: BodySiteSpatialRelation;
|
|
865
|
+
}
|
|
866
|
+
export interface ConceptSiteDetail {
|
|
867
|
+
text?: string;
|
|
868
|
+
coding?: FhirCoding;
|
|
869
|
+
spatialRelation?: BodySiteSpatialRelation;
|
|
870
|
+
}
|
|
780
871
|
export interface ParseBatchSegmentMeta {
|
|
781
872
|
index: number;
|
|
782
873
|
text: string;
|
|
@@ -787,17 +878,17 @@ export interface ParseBatchResult {
|
|
|
787
878
|
count: number;
|
|
788
879
|
items: ParseResult[];
|
|
789
880
|
/**
|
|
790
|
-
*
|
|
881
|
+
* Top-level compatibility field mirroring the first parsed item so existing
|
|
791
882
|
* single-sig integrations can migrate incrementally.
|
|
792
883
|
*/
|
|
793
884
|
fhir: FhirDosage;
|
|
794
885
|
/**
|
|
795
|
-
*
|
|
886
|
+
* Top-level compatibility field mirroring the first parsed item so existing
|
|
796
887
|
* single-sig integrations can migrate incrementally.
|
|
797
888
|
*/
|
|
798
889
|
shortText: string;
|
|
799
890
|
/**
|
|
800
|
-
*
|
|
891
|
+
* Top-level compatibility field mirroring the first parsed item so existing
|
|
801
892
|
* single-sig integrations can migrate incrementally.
|
|
802
893
|
*/
|
|
803
894
|
longText: string;
|
|
@@ -841,7 +932,7 @@ export interface LintBatchResult {
|
|
|
841
932
|
count: number;
|
|
842
933
|
items: LintResult[];
|
|
843
934
|
/**
|
|
844
|
-
*
|
|
935
|
+
* Top-level compatibility fields mirroring the first parsed item so existing
|
|
845
936
|
* consumers of `lintSig` can migrate incrementally.
|
|
846
937
|
*/
|
|
847
938
|
result: ParseResult;
|
|
@@ -894,6 +985,9 @@ export interface NextDueDoseOptions {
|
|
|
894
985
|
export interface TotalUnitsResult {
|
|
895
986
|
totalUnits: number;
|
|
896
987
|
totalContainers?: number;
|
|
988
|
+
totalContainerQuantity?: FhirQuantity;
|
|
989
|
+
totalApproximateQuantity?: EstimatedQuantity;
|
|
990
|
+
totalApproximateIngredientQuantity?: EstimatedQuantity;
|
|
897
991
|
}
|
|
898
992
|
export interface TotalUnitsOptions extends NextDueDoseOptions {
|
|
899
993
|
dosage: FhirDosage | FhirDosage[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DoseUnitApproximation, DoseUnitKind, DoseUnitSemantics, DoseUnitTerminologyEntry, MedicationContext, ParseOptions } from "./types";
|
|
2
|
+
export declare function normalizeUnit(token: string, options?: ParseOptions): string | undefined;
|
|
3
|
+
export declare function getDoseUnitKind(unit: string | undefined): DoseUnitKind | undefined;
|
|
4
|
+
export declare function getDoseUnitApproximation(unit: string | undefined, context?: MedicationContext | null): DoseUnitApproximation | undefined;
|
|
5
|
+
export declare function getDoseUnitSemantics(unit: string | undefined, context?: MedicationContext | null): DoseUnitSemantics | undefined;
|
|
6
|
+
export declare function listDoseUnitTerminology(): DoseUnitTerminologyEntry[];
|
|
7
|
+
export declare function enforceHouseholdUnitPolicy(unit: string | undefined, options?: ParseOptions): string | undefined;
|
|
8
|
+
export declare function isDiscreteUnit(unit: string): boolean;
|
package/package.json
CHANGED