ezmedicationinput 0.1.15 → 0.1.16

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
@@ -270,6 +270,7 @@ export interface FhirDosage {
270
270
  timing?: FhirTiming;
271
271
  route?: FhirCodeableConcept;
272
272
  site?: FhirCodeableConcept;
273
+ additionalInstruction?: FhirCodeableConcept[];
273
274
  asNeededBoolean?: boolean;
274
275
  asNeededFor?: FhirCodeableConcept[];
275
276
  doseAndRate?: FhirDoseAndRate[];
@@ -295,7 +296,7 @@ export interface BodySiteCode {
295
296
  system?: string;
296
297
  }
297
298
  export interface BodySiteDefinition {
298
- coding: BodySiteCode;
299
+ coding?: BodySiteCode;
299
300
  text?: string;
300
301
  /**
301
302
  * Optional phrases that should resolve to the same coding as this entry.
@@ -304,6 +305,15 @@ export interface BodySiteDefinition {
304
305
  */
305
306
  aliases?: string[];
306
307
  }
308
+ export interface CodeableConceptDefinition {
309
+ coding?: FhirCoding;
310
+ text?: string;
311
+ aliases?: string[];
312
+ }
313
+ export interface PrnReasonDefinition extends CodeableConceptDefinition {
314
+ }
315
+ export interface AdditionalInstructionDefinition extends CodeableConceptDefinition {
316
+ }
307
317
  export interface TextRange {
308
318
  /** Inclusive start index of the matched substring within the original input. */
309
319
  start: number;
@@ -343,6 +353,31 @@ export interface SiteCodeSuggestion {
343
353
  export interface SiteCodeSuggestionsResult {
344
354
  suggestions: SiteCodeSuggestion[];
345
355
  }
356
+ export interface PrnReasonLookupRequest {
357
+ originalText: string;
358
+ text: string;
359
+ normalized: string;
360
+ canonical: string;
361
+ isProbe: boolean;
362
+ inputText: string;
363
+ sourceText?: string;
364
+ range?: TextRange;
365
+ }
366
+ export interface PrnReasonSelection {
367
+ canonical?: string;
368
+ text?: string;
369
+ range?: TextRange;
370
+ resolution: PrnReasonDefinition;
371
+ }
372
+ export interface PrnReasonSuggestion {
373
+ coding?: FhirCoding;
374
+ text?: string;
375
+ }
376
+ export interface PrnReasonSuggestionsResult {
377
+ suggestions: PrnReasonSuggestion[];
378
+ }
379
+ export type PrnReasonResolver = (request: PrnReasonLookupRequest) => PrnReasonDefinition | null | undefined | Promise<PrnReasonDefinition | null | undefined>;
380
+ export type PrnReasonSuggestionResolver = (request: PrnReasonLookupRequest) => PrnReasonSuggestionsResult | PrnReasonSuggestion[] | PrnReasonSuggestion | null | undefined | Promise<PrnReasonSuggestionsResult | PrnReasonSuggestion[] | PrnReasonSuggestion | null | undefined>;
346
381
  /**
347
382
  * Allows callers to override the parser's automatic site resolution for a
348
383
  * specific match. Matches can be scoped by the normalized phrase, the original
@@ -431,6 +466,23 @@ export interface ParseOptions extends FormatOptions {
431
466
  * requested a lookup via `{site}` placeholders.
432
467
  */
433
468
  siteCodeSuggestionResolvers?: SiteCodeSuggestionResolver | SiteCodeSuggestionResolver[];
469
+ /**
470
+ * Optional dictionary for translating PRN reason phrases into coded concepts.
471
+ */
472
+ prnReasonMap?: Record<string, PrnReasonDefinition>;
473
+ /**
474
+ * Explicit selections that override automatic PRN reason resolution.
475
+ */
476
+ prnReasonSelections?: PrnReasonSelection | PrnReasonSelection[];
477
+ /**
478
+ * Callback(s) that can translate PRN reason text into a coded concept.
479
+ */
480
+ prnReasonResolvers?: PrnReasonResolver | PrnReasonResolver[];
481
+ /**
482
+ * Callback(s) that provide PRN reason suggestions when automatic resolution
483
+ * fails or a `{reason}` placeholder explicitly requests lookup.
484
+ */
485
+ prnReasonSuggestionResolvers?: PrnReasonSuggestionResolver | PrnReasonSuggestionResolver[];
434
486
  }
435
487
  export interface ParseResult {
436
488
  fhir: FhirDosage;
@@ -447,11 +499,23 @@ export interface ParseResult {
447
499
  text?: string;
448
500
  coding?: BodySiteCode;
449
501
  };
502
+ prnReason?: {
503
+ text?: string;
504
+ coding?: FhirCoding;
505
+ };
506
+ additionalInstructions?: Array<{
507
+ text?: string;
508
+ coding?: FhirCoding;
509
+ }>;
450
510
  };
451
511
  siteLookups?: Array<{
452
512
  request: SiteCodeLookupRequest;
453
513
  suggestions: SiteCodeSuggestion[];
454
514
  }>;
515
+ prnReasonLookups?: Array<{
516
+ request: PrnReasonLookupRequest;
517
+ suggestions: PrnReasonSuggestion[];
518
+ }>;
455
519
  };
456
520
  }
457
521
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ezmedicationinput",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "Parse concise medication sigs into FHIR R5 Dosage JSON",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",