ezmedicationinput 0.1.46 → 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/dist/types.d.ts CHANGED
@@ -30,6 +30,38 @@ export interface FhirQuantity {
30
30
  system?: string;
31
31
  code?: string;
32
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
+ }
33
65
  export interface FhirRange {
34
66
  low?: FhirQuantity;
35
67
  high?: FhirQuantity;
@@ -316,6 +348,18 @@ export interface MedicationContext {
316
348
  strengthQuantity?: FhirQuantity;
317
349
  strengthRatio?: FhirRatio;
318
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>;
319
363
  containerValue?: number;
320
364
  containerUnit?: string;
321
365
  defaultUnit?: string;
@@ -799,6 +843,8 @@ export interface ParseResult {
799
843
  export interface ParseNormalizedMeta {
800
844
  route?: RouteCode;
801
845
  unit?: string;
846
+ unitKind?: DoseUnitKind;
847
+ unitSemantics?: DoseUnitSemantics;
802
848
  site?: BodySiteDetail;
803
849
  method?: {
804
850
  text?: string;
@@ -939,6 +985,9 @@ export interface NextDueDoseOptions {
939
985
  export interface TotalUnitsResult {
940
986
  totalUnits: number;
941
987
  totalContainers?: number;
988
+ totalContainerQuantity?: FhirQuantity;
989
+ totalApproximateQuantity?: EstimatedQuantity;
990
+ totalApproximateIngredientQuantity?: EstimatedQuantity;
942
991
  }
943
992
  export interface TotalUnitsOptions extends NextDueDoseOptions {
944
993
  dosage: FhirDosage | FhirDosage[];
@@ -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.46",
3
+ "version": "0.1.47",
4
4
  "description": "Parse concise medication sigs into FHIR R5 Dosage JSON",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",