ezmedicationinput 0.1.67 → 0.3.0-beta.1
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 +222 -28
- package/dist/adapters/canonical-course.d.ts +128 -0
- package/dist/adapters/r5-course.d.ts +24 -0
- package/dist/advice.d.ts +52 -1
- package/dist/body-site-grammar.d.ts +34 -1
- package/dist/body-site-lookup.d.ts +3 -0
- package/dist/body-site-spatial.d.ts +6 -2
- package/dist/body-site-target.d.ts +9 -3
- package/dist/canonical/compile.d.ts +79 -0
- package/dist/canonical/course.d.ts +352 -0
- package/dist/canonical/format-course.d.ts +36 -0
- package/dist/date-interpretation.d.ts +2 -0
- package/dist/dosage-course.d.ts +453 -0
- package/dist/execution/calendar.d.ts +107 -0
- package/dist/execution/engine.d.ts +11 -0
- package/dist/fhir-quantity-operator.d.ts +53 -0
- package/dist/fhir-translations.d.ts +5 -6
- package/dist/fhir.d.ts +233 -13
- package/dist/format.d.ts +113 -3
- package/dist/hpsg/constructions.d.ts +113 -0
- package/dist/hpsg/defaults.d.ts +2 -0
- package/dist/hpsg/lexical-classes.d.ts +282 -2
- package/dist/hpsg/procedural-context.d.ts +18 -4
- package/dist/hpsg/projection.d.ts +38 -3
- package/dist/hpsg/rule-context.d.ts +117 -7
- package/dist/hpsg/rules/clinical-quantity-rules.d.ts +18 -0
- package/dist/hpsg/rules/condition-rules.d.ts +14 -0
- package/dist/hpsg/rules/core-rules.d.ts +32 -0
- package/dist/hpsg/rules/instruction-rules.d.ts +11 -1
- package/dist/hpsg/rules/prn-rules.d.ts +3 -1
- package/dist/hpsg/rules/timing-rules.d.ts +138 -8
- package/dist/hpsg/signature.d.ts +353 -5
- package/dist/hpsg/type-system.d.ts +16 -1
- package/dist/hpsg/unification.d.ts +4 -1
- package/dist/i18n.d.ts +39 -1
- package/dist/index.cjs +65539 -30893
- package/dist/index.d.ts +35 -7
- package/dist/index.js +65505 -30892
- package/dist/instruction-action-locale-adapter.d.ts +32 -3
- package/dist/instruction-action-terminology.d.ts +38 -3
- package/dist/instruction-concept-terminology.d.ts +8 -1
- package/dist/instruction-graph-fhir.d.ts +9 -3
- package/dist/instruction-graph.d.ts +85 -7
- package/dist/ir.d.ts +13 -2
- package/dist/lexer/surface-segmenter.d.ts +1 -1
- package/dist/lexer/surface.d.ts +1 -0
- package/dist/locale-detection.d.ts +3 -0
- package/dist/locales/course/en.d.ts +15 -0
- package/dist/locales/course/th.d.ts +12 -0
- package/dist/localization.d.ts +73 -0
- package/dist/maps.d.ts +24 -1
- package/dist/medication-condition.d.ts +42 -0
- package/dist/parser-state.d.ts +6 -2
- package/dist/parser.d.ts +5 -2
- package/dist/regimen/coordination-scope.d.ts +53 -0
- package/dist/regimen/grammar.d.ts +79 -0
- package/dist/regimen/parallel-course.d.ts +52 -0
- package/dist/regimen/planner.d.ts +19 -0
- package/dist/regimen/regimen.d.ts +70 -0
- package/dist/relation-terminology.d.ts +1 -0
- package/dist/schedule.d.ts +12 -5
- package/dist/stable-structure.d.ts +23 -1
- package/dist/timing-summary.d.ts +82 -1
- package/dist/types.d.ts +899 -40
- package/dist/unit-lexicon.d.ts +7 -0
- package/dist/utils/strength.d.ts +16 -0
- package/dist/utils/text.d.ts +3 -0
- package/dist/utils/units.d.ts +19 -0
- package/package.json +3 -2
package/dist/unit-lexicon.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FhirPeriodUnit } from "./types";
|
|
1
2
|
import type { DoseUnitApproximation, DoseUnitKind, DoseUnitSemantics, DoseUnitTerminologyEntry, MedicationContext, ParseOptions } from "./types";
|
|
2
3
|
export declare function normalizeUnit(token: string, options?: ParseOptions): string | undefined;
|
|
3
4
|
export declare function getDoseUnitKind(unit: string | undefined): DoseUnitKind | undefined;
|
|
@@ -6,3 +7,9 @@ export declare function getDoseUnitSemantics(unit: string | undefined, context?:
|
|
|
6
7
|
export declare function listDoseUnitTerminology(): DoseUnitTerminologyEntry[];
|
|
7
8
|
export declare function enforceHouseholdUnitPolicy(unit: string | undefined, options?: ParseOptions): string | undefined;
|
|
8
9
|
export declare function isDiscreteUnit(unit: string): boolean;
|
|
10
|
+
/** Interpret a quantity's time unit without changing its authored representation. */
|
|
11
|
+
export declare function getQuantityDurationUnit(quantity: {
|
|
12
|
+
code?: string;
|
|
13
|
+
unit?: string;
|
|
14
|
+
system?: string;
|
|
15
|
+
} | undefined): FhirPeriodUnit | undefined;
|
package/dist/utils/strength.d.ts
CHANGED
|
@@ -5,7 +5,23 @@ import { FhirRatio, FhirQuantity, MedicationContext } from "../types";
|
|
|
5
5
|
export declare function parseStrength(strength: string, context?: MedicationContext): {
|
|
6
6
|
strengthQuantity?: FhirQuantity;
|
|
7
7
|
strengthRatio?: FhirRatio;
|
|
8
|
+
strengthComponents?: Array<{
|
|
9
|
+
strengthQuantity?: FhirQuantity;
|
|
10
|
+
strengthRatio?: FhirRatio;
|
|
11
|
+
}>;
|
|
8
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* Retain each ingredient's strength separately. The names of the ingredients
|
|
15
|
+
* must come from the medication/product record, not from unnamed SIG numbers.
|
|
16
|
+
*
|
|
17
|
+
* Use this when parsing combination products: summing 875 mg + 125 mg as one
|
|
18
|
+
* active-ingredient strength would be clinically misleading.
|
|
19
|
+
* Returns null if any component cannot be parsed, not a partial ingredient set.
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseStrengthComponents(strength: string, context?: MedicationContext): Array<{
|
|
22
|
+
strengthQuantity?: FhirQuantity;
|
|
23
|
+
strengthRatio?: FhirRatio;
|
|
24
|
+
}> | null;
|
|
9
25
|
/**
|
|
10
26
|
* Internal helper to parse a strength string into a FHIR Ratio.
|
|
11
27
|
*/
|
package/dist/utils/text.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export declare function isWhitespaceChar(char: string): boolean;
|
|
2
2
|
export declare function isLoosePhraseSeparatorChar(char: string): boolean;
|
|
3
3
|
export declare function normalizeLoosePhraseKey(value: string): string;
|
|
4
|
+
/** Single-pass list join with historical comma/conjunction placement.
|
|
5
|
+
* No slice() plus join() array allocation. */
|
|
6
|
+
export declare function joinLocalizedList(parts: readonly string[], conjunction: string): string;
|
package/dist/utils/units.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export declare const MASS_UNITS: Record<string, number>;
|
|
2
2
|
export declare const VOLUME_UNITS: Record<string, number>;
|
|
3
3
|
export declare function getUnitCategory(unit?: string): "mass" | "volume" | "other";
|
|
4
|
+
/** Conversion groups retain the patient-weight denominator as a separate dimension. */
|
|
5
|
+
export declare function getUnitComparisonCategory(unit?: string): ReturnType<typeof getUnitCategory> | "mass-per-weight" | "volume-per-weight";
|
|
4
6
|
export declare function getBaseUnitFactor(unit?: string): number;
|
|
5
7
|
export declare function convertValue(value: number, fromUnit: string, toUnit: string, strength?: {
|
|
6
8
|
numerator: {
|
|
@@ -12,3 +14,20 @@ export declare function convertValue(value: number, fromUnit: string, toUnit: st
|
|
|
12
14
|
unit: string;
|
|
13
15
|
};
|
|
14
16
|
}): number | null;
|
|
17
|
+
type QuantityUnit = {
|
|
18
|
+
system?: string;
|
|
19
|
+
code?: string;
|
|
20
|
+
unit?: string;
|
|
21
|
+
};
|
|
22
|
+
/** Normalize equivalent count-unit labels before dimensional conversion. */
|
|
23
|
+
export declare function normalizeQuantityCapUnit(unit: string): string;
|
|
24
|
+
/** Coded identity ignores non-dimensional UCUM annotations, retaining annotation-only counts. */
|
|
25
|
+
export declare function quantityUnitIdentityCode(quantity: QuantityUnit): string | undefined;
|
|
26
|
+
/** Exact coding compares quantities without assigning an opaque code a dimension. */
|
|
27
|
+
export declare function sameCodedQuantityUnit(left: QuantityUnit | undefined, right: QuantityUnit | undefined): boolean;
|
|
28
|
+
/** The calculation unit shared by numeric comparison and compatible-unit indexing. */
|
|
29
|
+
export declare function getQuantityComparisonUnit(quantity: QuantityUnit | undefined): string;
|
|
30
|
+
/** Compare quantity identities before resolving their supported dimensional or
|
|
31
|
+
* plain-label units. Missing labels never make distinct coded quantities equal. */
|
|
32
|
+
export declare function convertQuantityValue(value: number, from: QuantityUnit | undefined, to: QuantityUnit | undefined, strength?: Parameters<typeof convertValue>[3]): number | null;
|
|
33
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ezmedicationinput",
|
|
3
|
-
"version": "0.1
|
|
4
|
-
"description": "Parse
|
|
3
|
+
"version": "0.3.0-beta.1",
|
|
4
|
+
"description": "Parse clinician SIGs into extended R5-style dosages with strict R5 and R6 projections",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"build": "tsup && tsc -p tsconfig.types.json",
|
|
20
20
|
"test": "vitest run --dir test",
|
|
21
21
|
"bench:torture": "npm run build && node bench/real-world-torture.mjs",
|
|
22
|
+
"bench:r6-regression": "npm run build && node bench/compare-r6.mjs",
|
|
22
23
|
"bench:adversarial": "npm run build && node bench/adversarial.mjs",
|
|
23
24
|
"bench:roundtrip": "npm run build && node bench/roundtrip.mjs",
|
|
24
25
|
"bench:suggest": "npm run build && node --expose-gc bench/suggest.mjs",
|