ezmedicationinput 0.1.9 → 0.1.12
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 +101 -1
- package/dist/fhir.js +28 -7
- package/dist/i18n.js +65 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +89 -28
- package/dist/internal-types.d.ts +8 -1
- package/dist/maps.d.ts +8 -1
- package/dist/maps.js +313 -5
- package/dist/parser.d.ts +10 -0
- package/dist/parser.js +372 -18
- package/dist/schedule.js +159 -1
- package/dist/types.d.ts +84 -0
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -289,6 +289,64 @@ export interface FormatOptions {
|
|
|
289
289
|
locale?: "en" | "th" | string;
|
|
290
290
|
i18n?: SigTranslationConfig;
|
|
291
291
|
}
|
|
292
|
+
export interface BodySiteCode {
|
|
293
|
+
code: string;
|
|
294
|
+
display?: string;
|
|
295
|
+
system?: string;
|
|
296
|
+
}
|
|
297
|
+
export interface BodySiteDefinition {
|
|
298
|
+
coding: BodySiteCode;
|
|
299
|
+
text?: string;
|
|
300
|
+
}
|
|
301
|
+
export interface TextRange {
|
|
302
|
+
/** Inclusive start index of the matched substring within the original input. */
|
|
303
|
+
start: number;
|
|
304
|
+
/** Exclusive end index of the matched substring within the original input. */
|
|
305
|
+
end: number;
|
|
306
|
+
}
|
|
307
|
+
export interface SiteCodeLookupRequest {
|
|
308
|
+
/** Original site text preserved for debugging or auditing. */
|
|
309
|
+
originalText: string;
|
|
310
|
+
/**
|
|
311
|
+
* Sanitized site text used for human-readable output. Connectors and braces
|
|
312
|
+
* are stripped but casing is preserved.
|
|
313
|
+
*/
|
|
314
|
+
text: string;
|
|
315
|
+
/** Lower-case variant of the text for case-insensitive lookups. */
|
|
316
|
+
normalized: string;
|
|
317
|
+
/** Canonical key generated by trimming and collapsing whitespace. */
|
|
318
|
+
canonical: string;
|
|
319
|
+
/** Indicates the text was wrapped in `{}` to request interactive lookup. */
|
|
320
|
+
isProbe: boolean;
|
|
321
|
+
/** Full original input string provided to the parser. */
|
|
322
|
+
inputText: string;
|
|
323
|
+
/**
|
|
324
|
+
* Substring captured directly from the original input, preserving spacing and
|
|
325
|
+
* casing. Undefined when a reliable slice cannot be determined.
|
|
326
|
+
*/
|
|
327
|
+
sourceText?: string;
|
|
328
|
+
/** Location of {@link sourceText} relative to the original input. */
|
|
329
|
+
range?: TextRange;
|
|
330
|
+
}
|
|
331
|
+
export interface SiteCodeResolution extends BodySiteDefinition {
|
|
332
|
+
}
|
|
333
|
+
export interface SiteCodeSuggestion {
|
|
334
|
+
coding: BodySiteCode;
|
|
335
|
+
text?: string;
|
|
336
|
+
}
|
|
337
|
+
export interface SiteCodeSuggestionsResult {
|
|
338
|
+
suggestions: SiteCodeSuggestion[];
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Site code resolvers can perform deterministic lookups or remote queries with
|
|
342
|
+
* access to the original sig text and extracted site range.
|
|
343
|
+
*/
|
|
344
|
+
export type SiteCodeResolver = (request: SiteCodeLookupRequest) => SiteCodeResolution | null | undefined | Promise<SiteCodeResolution | null | undefined>;
|
|
345
|
+
/**
|
|
346
|
+
* Suggestion providers receive the same context as resolvers, including the
|
|
347
|
+
* caller's full input and the character range of the detected site phrase.
|
|
348
|
+
*/
|
|
349
|
+
export type SiteCodeSuggestionResolver = (request: SiteCodeLookupRequest) => SiteCodeSuggestionsResult | SiteCodeSuggestion[] | SiteCodeSuggestion | null | undefined | Promise<SiteCodeSuggestionsResult | SiteCodeSuggestion[] | SiteCodeSuggestion | null | undefined>;
|
|
292
350
|
export interface ParseOptions extends FormatOptions {
|
|
293
351
|
/**
|
|
294
352
|
* Optional medication context that assists with default unit inference.
|
|
@@ -326,6 +384,23 @@ export interface ParseOptions extends FormatOptions {
|
|
|
326
384
|
* and tablespoon when set to false. Defaults to true.
|
|
327
385
|
*/
|
|
328
386
|
allowHouseholdVolumeUnits?: boolean;
|
|
387
|
+
/**
|
|
388
|
+
* Allows mapping normalized site phrases (e.g., "left arm") to
|
|
389
|
+
* institution-specific codings. Keys are normalized with the same logic as
|
|
390
|
+
* the default site dictionary (trimmed, lower-cased, collapsing whitespace).
|
|
391
|
+
*/
|
|
392
|
+
siteCodeMap?: Record<string, BodySiteDefinition>;
|
|
393
|
+
/**
|
|
394
|
+
* Callback(s) that can translate detected site text into a coded body site.
|
|
395
|
+
* Return a promise when using asynchronous terminology services.
|
|
396
|
+
*/
|
|
397
|
+
siteCodeResolvers?: SiteCodeResolver | SiteCodeResolver[];
|
|
398
|
+
/**
|
|
399
|
+
* Callback(s) that surface possible coded body sites for interactive flows
|
|
400
|
+
* when the parser cannot confidently resolve a site, or the input explicitly
|
|
401
|
+
* requested a lookup via `{site}` placeholders.
|
|
402
|
+
*/
|
|
403
|
+
siteCodeSuggestionResolvers?: SiteCodeSuggestionResolver | SiteCodeSuggestionResolver[];
|
|
329
404
|
}
|
|
330
405
|
export interface ParseResult {
|
|
331
406
|
fhir: FhirDosage;
|
|
@@ -338,7 +413,15 @@ export interface ParseResult {
|
|
|
338
413
|
normalized: {
|
|
339
414
|
route?: RouteCode;
|
|
340
415
|
unit?: string;
|
|
416
|
+
site?: {
|
|
417
|
+
text?: string;
|
|
418
|
+
coding?: BodySiteCode;
|
|
419
|
+
};
|
|
341
420
|
};
|
|
421
|
+
siteLookups?: Array<{
|
|
422
|
+
request: SiteCodeLookupRequest;
|
|
423
|
+
suggestions: SiteCodeSuggestion[];
|
|
424
|
+
}>;
|
|
342
425
|
};
|
|
343
426
|
}
|
|
344
427
|
/**
|
|
@@ -375,6 +458,7 @@ export interface NextDueDoseOptions {
|
|
|
375
458
|
from: Date | string;
|
|
376
459
|
orderedAt?: Date | string;
|
|
377
460
|
limit?: number;
|
|
461
|
+
priorCount?: number;
|
|
378
462
|
timeZone?: string;
|
|
379
463
|
eventClock?: EventClockMap;
|
|
380
464
|
mealOffsets?: MealOffsetMap;
|