ezmedicationinput 0.1.46 → 0.1.48
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 +29 -0
- package/dist/advice.d.ts +9 -0
- package/dist/hpsg/lexical-classes.d.ts +8 -0
- package/dist/hpsg/method-lexicon.d.ts +2 -0
- package/dist/index.cjs +1483 -624
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1479 -624
- package/dist/types.d.ts +62 -2
- package/dist/unit-lexicon.d.ts +5 -1
- package/package.json +7 -7
package/dist/types.d.ts
CHANGED
|
@@ -18,9 +18,20 @@ export interface FhirExtension {
|
|
|
18
18
|
extension?: FhirExtension[];
|
|
19
19
|
valueCode?: string;
|
|
20
20
|
valueString?: string;
|
|
21
|
+
valueBoolean?: boolean;
|
|
22
|
+
valueInteger?: number;
|
|
23
|
+
valueDecimal?: number;
|
|
24
|
+
valueQuantity?: FhirQuantity;
|
|
21
25
|
valueCoding?: FhirCoding;
|
|
22
26
|
valueCodeableConcept?: FhirCodeableConcept;
|
|
23
27
|
}
|
|
28
|
+
export interface FhirElement {
|
|
29
|
+
id?: string;
|
|
30
|
+
extension?: FhirExtension[];
|
|
31
|
+
}
|
|
32
|
+
export interface FhirBackboneElement extends FhirElement {
|
|
33
|
+
modifierExtension?: FhirExtension[];
|
|
34
|
+
}
|
|
24
35
|
export interface FhirPrimitiveElement {
|
|
25
36
|
extension?: FhirExtension[];
|
|
26
37
|
}
|
|
@@ -30,6 +41,38 @@ export interface FhirQuantity {
|
|
|
30
41
|
system?: string;
|
|
31
42
|
code?: string;
|
|
32
43
|
}
|
|
44
|
+
export type DoseUnitKind = "metric" | "biologic_unit" | "counted_presentation" | "device_actuation" | "infusion_rate" | "product_specific_amount" | "length_of_product" | "body_area_proxy" | "qualitative_amount";
|
|
45
|
+
export type DoseUnitApproximationConfidence = "exact" | "approximate" | "product_specific";
|
|
46
|
+
export interface DoseUnitApproximation {
|
|
47
|
+
value: number;
|
|
48
|
+
unit: string;
|
|
49
|
+
confidence: DoseUnitApproximationConfidence;
|
|
50
|
+
basis: string;
|
|
51
|
+
source?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface DoseUnitTerminologyEntry {
|
|
54
|
+
unit: string;
|
|
55
|
+
kind: DoseUnitKind;
|
|
56
|
+
aliases?: string[];
|
|
57
|
+
/**
|
|
58
|
+
* Defaults to true. Use false for terminology entries such as infusion-rate
|
|
59
|
+
* units that should be exposed to consumers but must not be accepted as a
|
|
60
|
+
* doseQuantity unit until rateQuantity parsing is implemented.
|
|
61
|
+
*/
|
|
62
|
+
parseAsDose?: boolean;
|
|
63
|
+
approximateQuantity?: DoseUnitApproximation;
|
|
64
|
+
}
|
|
65
|
+
export interface DoseUnitSemantics {
|
|
66
|
+
unit: string;
|
|
67
|
+
kind: DoseUnitKind;
|
|
68
|
+
parseAsDose?: boolean;
|
|
69
|
+
approximateQuantity?: DoseUnitApproximation;
|
|
70
|
+
}
|
|
71
|
+
export interface EstimatedQuantity extends FhirQuantity {
|
|
72
|
+
confidence?: DoseUnitApproximationConfidence;
|
|
73
|
+
basis?: string;
|
|
74
|
+
source?: string;
|
|
75
|
+
}
|
|
33
76
|
export interface FhirRange {
|
|
34
77
|
low?: FhirQuantity;
|
|
35
78
|
high?: FhirQuantity;
|
|
@@ -277,7 +320,7 @@ export interface FhirTiming {
|
|
|
277
320
|
repeat?: FhirTimingRepeat;
|
|
278
321
|
code?: FhirCodeableConcept;
|
|
279
322
|
}
|
|
280
|
-
export interface FhirDoseAndRate {
|
|
323
|
+
export interface FhirDoseAndRate extends FhirBackboneElement {
|
|
281
324
|
type?: FhirCodeableConcept;
|
|
282
325
|
doseRange?: FhirRange;
|
|
283
326
|
doseQuantity?: FhirQuantity;
|
|
@@ -285,7 +328,7 @@ export interface FhirDoseAndRate {
|
|
|
285
328
|
rateRange?: FhirRange;
|
|
286
329
|
rateQuantity?: FhirQuantity;
|
|
287
330
|
}
|
|
288
|
-
export interface FhirDosage {
|
|
331
|
+
export interface FhirDosage extends FhirBackboneElement {
|
|
289
332
|
text?: string;
|
|
290
333
|
patientInstruction?: string;
|
|
291
334
|
timing?: FhirTiming;
|
|
@@ -316,6 +359,18 @@ export interface MedicationContext {
|
|
|
316
359
|
strengthQuantity?: FhirQuantity;
|
|
317
360
|
strengthRatio?: FhirRatio;
|
|
318
361
|
strengthCodeableConcept?: FhirCodeableConcept;
|
|
362
|
+
/**
|
|
363
|
+
* Canonical presentation/package unit for fractional package instructions
|
|
364
|
+
* such as "1/2 bottle". When the parsed dose unit matches this value,
|
|
365
|
+
* containerValue/containerUnit describe the inner amount held by one package.
|
|
366
|
+
*/
|
|
367
|
+
packageUnit?: string;
|
|
368
|
+
/**
|
|
369
|
+
* Optional per-unit approximation overrides keyed by normalized dose unit
|
|
370
|
+
* (for example FTU, drop, pump, applicatorful). These are used only for
|
|
371
|
+
* estimated amount reporting; they do not rewrite the parsed dose unit.
|
|
372
|
+
*/
|
|
373
|
+
unitApproximationMap?: Record<string, DoseUnitApproximation>;
|
|
319
374
|
containerValue?: number;
|
|
320
375
|
containerUnit?: string;
|
|
321
376
|
defaultUnit?: string;
|
|
@@ -799,6 +854,8 @@ export interface ParseResult {
|
|
|
799
854
|
export interface ParseNormalizedMeta {
|
|
800
855
|
route?: RouteCode;
|
|
801
856
|
unit?: string;
|
|
857
|
+
unitKind?: DoseUnitKind;
|
|
858
|
+
unitSemantics?: DoseUnitSemantics;
|
|
802
859
|
site?: BodySiteDetail;
|
|
803
860
|
method?: {
|
|
804
861
|
text?: string;
|
|
@@ -939,6 +996,9 @@ export interface NextDueDoseOptions {
|
|
|
939
996
|
export interface TotalUnitsResult {
|
|
940
997
|
totalUnits: number;
|
|
941
998
|
totalContainers?: number;
|
|
999
|
+
totalContainerQuantity?: FhirQuantity;
|
|
1000
|
+
totalApproximateQuantity?: EstimatedQuantity;
|
|
1001
|
+
totalApproximateIngredientQuantity?: EstimatedQuantity;
|
|
942
1002
|
}
|
|
943
1003
|
export interface TotalUnitsOptions extends NextDueDoseOptions {
|
|
944
1004
|
dosage: FhirDosage | FhirDosage[];
|
package/dist/unit-lexicon.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import { ParseOptions } from "./types";
|
|
1
|
+
import type { DoseUnitApproximation, DoseUnitKind, DoseUnitSemantics, DoseUnitTerminologyEntry, MedicationContext, ParseOptions } from "./types";
|
|
2
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[];
|
|
3
7
|
export declare function enforceHouseholdUnitPolicy(unit: string | undefined, options?: ParseOptions): string | undefined;
|
|
4
8
|
export declare function isDiscreteUnit(unit: string): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ezmedicationinput",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.48",
|
|
4
4
|
"description": "Parse concise medication sigs into FHIR R5 Dosage JSON",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -14,11 +14,6 @@
|
|
|
14
14
|
"default": "./dist/index.js"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
|
-
"scripts": {
|
|
18
|
-
"test:dist": "npm run build && vitest run test-dist",
|
|
19
|
-
"build": "tsup && tsc -p tsconfig.types.json",
|
|
20
|
-
"test": "vitest run --dir test"
|
|
21
|
-
},
|
|
22
17
|
"files": [
|
|
23
18
|
"dist"
|
|
24
19
|
],
|
|
@@ -39,5 +34,10 @@
|
|
|
39
34
|
"tsup": "^8.5.1",
|
|
40
35
|
"typescript": "^5.4.0",
|
|
41
36
|
"vitest": "^1.5.0"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"test:dist": "npm run build && vitest run test-dist",
|
|
40
|
+
"build": "tsup && tsc -p tsconfig.types.json",
|
|
41
|
+
"test": "vitest run --dir test"
|
|
42
42
|
}
|
|
43
|
-
}
|
|
43
|
+
}
|