ezmedicationinput 0.2.0 → 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.
Files changed (61) hide show
  1. package/README.md +201 -10
  2. package/dist/adapters/canonical-course.d.ts +128 -0
  3. package/dist/adapters/r5-course.d.ts +24 -0
  4. package/dist/advice.d.ts +36 -5
  5. package/dist/body-site-lookup.d.ts +3 -0
  6. package/dist/body-site-spatial.d.ts +6 -2
  7. package/dist/body-site-target.d.ts +9 -3
  8. package/dist/canonical/compile.d.ts +79 -0
  9. package/dist/canonical/course.d.ts +352 -0
  10. package/dist/canonical/format-course.d.ts +36 -0
  11. package/dist/dosage-course.d.ts +294 -29
  12. package/dist/execution/calendar.d.ts +107 -0
  13. package/dist/execution/engine.d.ts +11 -0
  14. package/dist/fhir-quantity-operator.d.ts +53 -0
  15. package/dist/fhir-translations.d.ts +5 -6
  16. package/dist/fhir.d.ts +99 -14
  17. package/dist/format.d.ts +105 -3
  18. package/dist/hpsg/constructions.d.ts +11 -3
  19. package/dist/hpsg/defaults.d.ts +2 -0
  20. package/dist/hpsg/lexical-classes.d.ts +115 -4
  21. package/dist/hpsg/procedural-context.d.ts +3 -3
  22. package/dist/hpsg/projection.d.ts +28 -1
  23. package/dist/hpsg/rule-context.d.ts +104 -7
  24. package/dist/hpsg/rules/clinical-quantity-rules.d.ts +16 -7
  25. package/dist/hpsg/rules/condition-rules.d.ts +0 -1
  26. package/dist/hpsg/rules/core-rules.d.ts +3 -0
  27. package/dist/hpsg/rules/instruction-rules.d.ts +2 -0
  28. package/dist/hpsg/rules/prn-rules.d.ts +3 -1
  29. package/dist/hpsg/rules/timing-rules.d.ts +17 -1
  30. package/dist/hpsg/signature.d.ts +13 -3
  31. package/dist/hpsg/unification.d.ts +3 -1
  32. package/dist/i18n.d.ts +37 -1
  33. package/dist/index.cjs +63500 -46393
  34. package/dist/index.d.ts +21 -9
  35. package/dist/index.js +63491 -46393
  36. package/dist/instruction-action-locale-adapter.d.ts +31 -3
  37. package/dist/instruction-action-terminology.d.ts +23 -3
  38. package/dist/instruction-concept-terminology.d.ts +7 -0
  39. package/dist/instruction-graph-fhir.d.ts +8 -2
  40. package/dist/instruction-graph.d.ts +80 -38
  41. package/dist/ir.d.ts +1 -1
  42. package/dist/lexer/surface-segmenter.d.ts +1 -1
  43. package/dist/lexer/surface.d.ts +1 -0
  44. package/dist/locale-detection.d.ts +3 -0
  45. package/dist/locales/course/en.d.ts +15 -0
  46. package/dist/locales/course/th.d.ts +12 -0
  47. package/dist/localization.d.ts +73 -0
  48. package/dist/maps.d.ts +10 -2
  49. package/dist/medication-condition.d.ts +1 -1
  50. package/dist/parser-state.d.ts +2 -2
  51. package/dist/regimen/grammar.d.ts +11 -0
  52. package/dist/regimen/parallel-course.d.ts +8 -41
  53. package/dist/regimen/regimen.d.ts +6 -2
  54. package/dist/relation-terminology.d.ts +1 -0
  55. package/dist/schedule.d.ts +14 -10
  56. package/dist/timing-summary.d.ts +82 -1
  57. package/dist/types.d.ts +510 -56
  58. package/dist/unit-lexicon.d.ts +7 -0
  59. package/dist/utils/text.d.ts +3 -0
  60. package/dist/utils/units.d.ts +19 -0
  61. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1,7 +1,18 @@
1
+ import type { CanonicalCourse, CanonicalAdministration } from "./canonical/course";
2
+ /** Internal native import/projection helpers. Existing .fhir / .fhirNext fields retain
3
+ * their established versions; canonical is the internal source of meaning. */
4
+ export type { CanonicalCourse, CanonicalStage, CanonicalAdministration, CanonicalRecurrence, CanonicalTiming, CanonicalBoundary, CanonicalAmount, CanonicalDoseLimit, CanonicalMeasure, CanonicalRange, CanonicalRatio, CanonicalScheduleInput, CanonicalSupplyOptions } from "./canonical/course";
5
+ export { importCanonicalCourse } from "./adapters/canonical-course";
6
+ export { formatCanonicalCourse, formatCanonicalAdministration } from "./canonical/format-course";
7
+ export declare function projectCanonicalCourse(course: CanonicalCourse, options?: ParseOptions): {
8
+ fhir: FhirDosage[];
9
+ fhirNext: FhirR6DosageInstruction;
10
+ };
1
11
  import { toFhirR5Dosages as toFhirR5DosagesInternal } from "./dosage-course";
2
- import { FhirDosage, EzDosage, FhirR6DosageDetails, FormatBatchOptions, FormatOptions, LintBatchResult, ParseBatchResult, ParseOptions, ParseResult } from "./types";
12
+ import { FhirDosage, EzDosage, FhirR6DosageInstruction, FhirR6DosageInstructionInput, FormatBatchOptions, FormatOptions, LintBatchResult, ParseBatchResult, ParseOptions, ParseResult } from "./types";
3
13
  export { TIMING_FREQUENCY_MIN_EXTENSION_URL, TIMING_OFFSET_MIN_EXTENSION_URL, TIMING_OFFSET_MAX_EXTENSION_URL, TIMING_OFFSET_EXACT_EXTENSION_URL, TIMING_ACTIVITY_WINDOW_EXTENSION_URL, TIMING_OCCURRENCE_CAP_EXTENSION_URL, TIMING_EVENT_CALENDAR_SOURCE_EXTENSION_URL, PRN_TRIGGER_PHASE_EXTENSION_URL, INFUSION_CARRIER_MATERIAL_EXTENSION_URL, buildInfusionCarrierMaterialStructureDefinition, getTimingOccurrenceCap } from "./fhir";
4
14
  export { suggestSig } from "./suggest";
15
+ export { EMA_QUANTITY_COMPARATOR_EXTENSION_URL, EMA_QUANTITY_OPERATOR_SYSTEM, FHIR_QUANTITY_COMPARATOR_SYSTEM, getEmaQuantityComparator } from "./fhir-quantity-operator";
5
16
  export { parseInstructionActions, realizeInstructionGraph } from "./instruction-graph";
6
17
  export { getInstructionActionLocaleAdapter, registerInstructionActionLocaleAdapter } from "./instruction-action-locale-adapter";
7
18
  export type { InstructionActionLocaleAdapter, InstructionActionRealizationInput } from "./instruction-action-locale-adapter";
@@ -15,7 +26,7 @@ export { listMedicationSurfaceSegmenters, registerIntlMedicationSurfaceSegmenter
15
26
  export type { MedicationSurfaceSegment, MedicationSurfaceSegmenter } from "./lexer/surface-segmenter";
16
27
  export { getSuggestLocaleAdapter, registerSuggestLocaleAdapter } from "./suggest-locale-adapter";
17
28
  export type { SuggestLocaleAdapter, SuggestLocaleLexemeResolver, SuggestLocaleUnitRoutePair } from "./suggest-locale-adapter";
18
- export { MEDICATION_INSTRUCTION_ACTION_SYSTEM, buildMedicationInstructionActionCodeSystem, getMedicationInstructionAction, listMedicationInstructionActions, resolveMedicationInstructionAction, resolveMedicationInstructionSequenceAction } from "./instruction-action-terminology";
29
+ export { MEDICATION_INSTRUCTION_ACTION_SYSTEM, buildMedicationInstructionActionCodeSystem, getMedicationInstructionAction, listMedicationInstructionActions, resolveMedicationInstructionActionWithCodeFallback as resolveMedicationInstructionAction, resolveMedicationInstructionSequenceAction } from "./instruction-action-terminology";
19
30
  export type { MedicationInstructionActionCodeSystem } from "./instruction-action-terminology";
20
31
  export { MEDICATION_INSTRUCTION_CONCEPT_SYSTEM, buildMedicationInstructionConceptCodeSystem, getMedicationInstructionConcept, listMedicationInstructionConcepts, resolveMedicationInstructionConcept } from "./instruction-concept-terminology";
21
32
  export type { MedicationInstructionConceptCodeSystem } from "./instruction-concept-terminology";
@@ -26,7 +37,7 @@ export type { AdviceRelationDefinition, AdviceRelationGrammarFeatures, BodySiteL
26
37
  export { MEDICATION_INSTRUCTION_GRAPH_EXTENSION_URL, buildInstructionGraphExtension, parseInstructionGraphExtension } from "./instruction-graph-fhir";
27
38
  export * from "./types";
28
39
  export { nextDueDoses, calculateTotalUnits, MedicationQuantityCalculationError } from "./schedule";
29
- export { toDosageDetails, toEzDosages, fromDosageDetails, getDosageCondition, setDosageCondition, getDosageExcludedDates, setDosageExcludedDates, getDosageExcludedWeekdays, setDosageExcludedWeekdays, DOSAGE_CONDITION_R5_URL, DOSAGE_EXCLUDED_DATES_R5_URL, DOSAGE_EXCLUDED_WEEKDAYS_R5_URL, DOSAGE_DETAILS_R5_URL, DOSAGE_ALTERNATIVE_CHOICE_URL, getDosageAlternativeChoice, setDosageAlternativeChoice, buildDosageAlternativeChoiceStructureDefinition } from "./dosage-course";
40
+ export { toDosageDetails, toEzDosages, fromDosageDetails, projectEditableR5Course, getDosageCondition, setDosageCondition, getDosageExcludedDates, setDosageExcludedDates, getDosageExcludedWeekdays, setDosageExcludedWeekdays, DOSAGE_CONDITION_R5_URL, DOSAGE_EXCLUDED_DATES_R5_URL, DOSAGE_EXCLUDED_WEEKDAYS_R5_URL, DOSAGE_DETAILS_R5_URL, DOSAGE_ALTERNATIVE_CHOICE_URL, getDosageAlternativeChoice, setDosageAlternativeChoice, buildDosageAlternativeChoiceStructureDefinition } from "./dosage-course";
30
41
  export type { DosageAlternativeChoice } from "./dosage-course";
31
42
  export { evaluateMedicationCondition } from "./medication-condition";
32
43
  export { parseStrength, parseStrengthIntoRatio, parseStrengthComponents } from "./utils/strength";
@@ -38,7 +49,7 @@ export { BODY_SITE_SPATIAL_RELATION_EXTENSION_URL, buildBodySiteSpatialRelationE
38
49
  export { SNOMED_CT_FINDING_SITE_ATTRIBUTE_CODE, SNOMED_CT_FINDING_SITE_ATTRIBUTE_DISPLAY, SNOMED_CT_BILATERAL_QUALIFIER_CODE, SNOMED_CT_BILATERAL_QUALIFIER_DISPLAY, SNOMED_CT_LATERALITY_ATTRIBUTE_CODE, SNOMED_CT_LATERALITY_ATTRIBUTE_DISPLAY, SNOMED_CT_LEFT_QUALIFIER_CODE, SNOMED_CT_LEFT_QUALIFIER_DISPLAY, SNOMED_CT_RIGHT_QUALIFIER_CODE, SNOMED_CT_RIGHT_QUALIFIER_DISPLAY, SNOMED_CT_TOPOGRAPHICAL_MODIFIER_CODE, SNOMED_CT_TOPOGRAPHICAL_MODIFIER_DISPLAY, SNOMED_SYSTEM } from "./snomed";
39
50
  export { buildSnomedBodySiteLateralityPostcoordinationCode, buildSnomedBodySiteTopographicalModifierPostcoordinationCode, buildSnomedFindingSiteCoding, buildSnomedFindingSitePostcoordinationCode, hasSnomedBodySiteLateralityPostcoordination, hasSnomedFindingSitePostcoordination, hasSnomedTopographicalModifierPostcoordination, parseSnomedBodySiteLateralityPostcoordinationCode, parseSnomedBodySiteTopographicalModifierPostcoordinationCode, parseSnomedFindingSitePostcoordinationCode } from "./snomed-postcoordination";
40
51
  export { getRegisteredSigLocalizations, registerSigLocalization, resolveSigLocalization, resolveSigTranslation } from "./i18n";
41
- export type { SigLocalization, SigLocalizationConfig, SigTranslation, SigTranslationConfig } from "./i18n";
52
+ export type { CourseLanguage, SigLocalization, SigLocalizationConfig, SigTranslation, SigTranslationConfig } from "./i18n";
42
53
  export { findMedicationDateListSpans, listMedicationDateResolvers, parseMedicationDateListAt, registerMedicationDateResolver } from "./date-interpretation";
43
54
  export { DEFAULT_BODY_SITE_SNOMED, DEFAULT_BODY_SITE_SNOMED_SOURCE, DEFAULT_ROUTE_SYNONYMS, DEFAULT_UNIT_BY_ROUTE, KNOWN_DOSAGE_FORMS_TO_DOSE } from './maps';
44
55
  /** The public strict R5 converter must carry the same in-memory FHIR contract
@@ -50,13 +61,14 @@ export declare function toFhirR5Dosages(input: Parameters<typeof toFhirR5Dosages
50
61
  export declare function parseSig(input: string, options?: ParseOptions): ParseBatchResult;
51
62
  export declare function lintSig(input: string, options?: ParseOptions): LintBatchResult;
52
63
  export declare function parseSigAsync(input: string, options?: ParseOptions): Promise<ParseBatchResult>;
53
- export declare function formatSig(input: FhirDosage | FhirR6DosageDetails | readonly EzDosage[], style?: "short" | "long", options?: FormatOptions): string;
64
+ export declare function formatSig(input: FhirDosage | FhirR6DosageInstructionInput | readonly EzDosage[] | CanonicalCourse | CanonicalAdministration, style?: "short" | "long", options?: FormatOptions): string;
54
65
  export declare function formatSigBatch(dosages: FhirDosage[], style?: "short" | "long", options?: FormatBatchOptions): string;
55
66
  export declare function formatParseBatch(batch: ParseBatchResult, style?: "short" | "long", separator?: string): string;
56
67
  /**
57
- * Load an R6 DosageDetails without reparsing a generated text instruction.
58
- * R5 component lowerings exist solely for per-clause provenance and formatting;
59
- * the original whole-course R6 object remains the primary FHIR output.
68
+ * Load the current R6 DosageInstruction without reparsing a generated text instruction.
69
+ * Native components are imported into the same clinical course the parser
70
+ * produces. R5 component rows are OUTPUT projections only, never interpreted
71
+ * or formatted back into native semantics.
60
72
  */
61
- export declare function fromFhir(dosageDetails: FhirR6DosageDetails, options?: FormatOptions): ParseBatchResult;
73
+ export declare function fromFhir(wire: FhirR6DosageInstructionInput, options?: FormatOptions): ParseBatchResult;
62
74
  export declare function fromFhirDosage(dosage: FhirDosage, options?: FormatOptions): ParseResult;