@mieweb/ui 0.10.0-dev.11 → 0.10.0-dev.13

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 (130) hide show
  1. package/dist/Input-yN516s5_.d.cts +3 -0
  2. package/dist/Input-yN516s5_.d.ts +3 -0
  3. package/dist/ag-grid.d.cts +142 -1
  4. package/dist/ag-grid.d.ts +142 -1
  5. package/dist/{chunk-3M7TAXNR.js → chunk-3YFJBUX4.js} +3 -3
  6. package/dist/{chunk-3M7TAXNR.js.map → chunk-3YFJBUX4.js.map} +1 -1
  7. package/dist/{chunk-ACCAXVOG.js → chunk-4CXGT3P7.js} +61 -41
  8. package/dist/chunk-4CXGT3P7.js.map +1 -0
  9. package/dist/{chunk-OD47TTAW.cjs → chunk-V43ZFGCE.cjs} +9 -9
  10. package/dist/{chunk-OD47TTAW.cjs.map → chunk-V43ZFGCE.cjs.map} +1 -1
  11. package/dist/{chunk-X4XPNTCZ.cjs → chunk-YQ2NQV5C.cjs} +61 -41
  12. package/dist/chunk-YQ2NQV5C.cjs.map +1 -0
  13. package/dist/components/Alert/index.d.cts +1 -1
  14. package/dist/components/Alert/index.d.ts +1 -1
  15. package/dist/components/AlertDialog/index.d.cts +28 -3
  16. package/dist/components/AlertDialog/index.d.ts +28 -3
  17. package/dist/components/AudioRecorder/index.d.cts +2 -2
  18. package/dist/components/AudioRecorder/index.d.ts +2 -2
  19. package/dist/components/Autocomplete/index.d.cts +8 -2
  20. package/dist/components/Autocomplete/index.d.ts +8 -2
  21. package/dist/components/Avatar/index.d.cts +1 -1
  22. package/dist/components/Avatar/index.d.ts +1 -1
  23. package/dist/components/Badge/index.d.cts +1 -1
  24. package/dist/components/Badge/index.d.ts +1 -1
  25. package/dist/components/BoardView/index.d.cts +91 -4
  26. package/dist/components/BoardView/index.d.ts +91 -4
  27. package/dist/components/Button/index.d.cts +1 -1
  28. package/dist/components/Button/index.d.ts +1 -1
  29. package/dist/components/CalendarView/index.d.cts +1 -2
  30. package/dist/components/CalendarView/index.d.ts +1 -2
  31. package/dist/components/Card/index.d.cts +3 -3
  32. package/dist/components/Card/index.d.ts +3 -3
  33. package/dist/components/Dropdown/index.d.cts +2 -1
  34. package/dist/components/Dropdown/index.d.ts +2 -1
  35. package/dist/components/GanttView/index.d.cts +1 -2
  36. package/dist/components/GanttView/index.d.ts +1 -2
  37. package/dist/components/ListView/index.d.cts +2 -3
  38. package/dist/components/ListView/index.d.ts +2 -3
  39. package/dist/components/MediaEditor/index.d.cts +91 -2
  40. package/dist/components/MediaEditor/index.d.ts +91 -2
  41. package/dist/components/MediaPlayer/index.d.cts +1 -1
  42. package/dist/components/MediaPlayer/index.d.ts +1 -1
  43. package/dist/components/Pagination/index.d.cts +1 -1
  44. package/dist/components/Pagination/index.d.ts +1 -1
  45. package/dist/components/PhoneInput/index.d.cts +36 -3
  46. package/dist/components/PhoneInput/index.d.ts +36 -3
  47. package/dist/components/Progress/index.d.cts +1 -1
  48. package/dist/components/Progress/index.d.ts +1 -1
  49. package/dist/components/Q/index.d.cts +2 -2
  50. package/dist/components/Q/index.d.ts +2 -2
  51. package/dist/components/QuickAction/index.d.cts +1 -1
  52. package/dist/components/QuickAction/index.d.ts +1 -1
  53. package/dist/components/RecordButton/index.d.cts +1 -1
  54. package/dist/components/RecordButton/index.d.ts +1 -1
  55. package/dist/components/RichTextEditor/index.d.cts +7 -2
  56. package/dist/components/RichTextEditor/index.d.ts +7 -2
  57. package/dist/components/ScrollArea/index.d.cts +1 -1
  58. package/dist/components/ScrollArea/index.d.ts +1 -1
  59. package/dist/components/Select/index.d.cts +1 -2
  60. package/dist/components/Select/index.d.ts +1 -2
  61. package/dist/components/Skeleton/index.d.cts +1 -1
  62. package/dist/components/Skeleton/index.d.ts +1 -1
  63. package/dist/components/Slider/index.d.cts +2 -2
  64. package/dist/components/Slider/index.d.ts +2 -2
  65. package/dist/components/Spinner/index.d.cts +2 -2
  66. package/dist/components/Spinner/index.d.ts +2 -2
  67. package/dist/components/SuperChat/index.cjs +3 -3
  68. package/dist/components/SuperChat/index.d.cts +2 -4
  69. package/dist/components/SuperChat/index.d.ts +2 -4
  70. package/dist/components/SuperChat/index.js +1 -1
  71. package/dist/components/SuperChat/plugins/index.cjs +3 -3
  72. package/dist/components/SuperChat/plugins/index.d.cts +2 -3
  73. package/dist/components/SuperChat/plugins/index.d.ts +2 -3
  74. package/dist/components/SuperChat/plugins/index.js +2 -2
  75. package/dist/components/Text/index.d.cts +3 -3
  76. package/dist/components/Text/index.d.ts +3 -3
  77. package/dist/components/Textarea/index.d.cts +1 -2
  78. package/dist/components/Textarea/index.d.ts +1 -2
  79. package/dist/components/ThemeProvider/index.d.cts +3 -1
  80. package/dist/components/ThemeProvider/index.d.ts +3 -1
  81. package/dist/components/TranscriptView/index.d.cts +85 -4
  82. package/dist/components/TranscriptView/index.d.ts +85 -4
  83. package/dist/components/ViewSet/index.d.cts +120 -9
  84. package/dist/components/ViewSet/index.d.ts +120 -9
  85. package/dist/components/ViewSwitcher/index.d.cts +4 -40
  86. package/dist/components/ViewSwitcher/index.d.ts +4 -40
  87. package/dist/datavis.d.cts +167 -13
  88. package/dist/datavis.d.ts +167 -13
  89. package/dist/esheet.d.cts +183 -1
  90. package/dist/esheet.d.ts +183 -1
  91. package/dist/hooks/index.d.cts +383 -31
  92. package/dist/hooks/index.d.ts +383 -31
  93. package/dist/index-DoYYWsNc.d.cts +127 -0
  94. package/dist/index-DoYYWsNc.d.ts +127 -0
  95. package/dist/index.cjs +47 -47
  96. package/dist/index.d.cts +7600 -414
  97. package/dist/index.d.ts +7600 -414
  98. package/dist/index.js +4 -4
  99. package/dist/motion.d.cts +186 -2
  100. package/dist/motion.d.ts +186 -2
  101. package/dist/q.d.cts +25 -3
  102. package/dist/q.d.ts +25 -3
  103. package/dist/styles.css +1 -1
  104. package/dist/{types-B97JNRNQ.d.cts → types-DOxdTwmq.d.cts} +170 -2
  105. package/dist/{types-gZXrfLj6.d.ts → types-DOxdTwmq.d.ts} +170 -2
  106. package/dist/{types-CbWXIKbe.d.cts → types-DsdZvEI1.d.cts} +1 -28
  107. package/dist/{types-CbWXIKbe.d.ts → types-DsdZvEI1.d.ts} +1 -28
  108. package/dist/utils/index.d.cts +13 -2
  109. package/dist/utils/index.d.ts +13 -2
  110. package/package.json +3 -2
  111. package/dist/Animated-XmH6k8pZ.d.cts +0 -188
  112. package/dist/Animated-XmH6k8pZ.d.ts +0 -188
  113. package/dist/MedicationEditor-Bp4NLy7y.d.cts +0 -352
  114. package/dist/MedicationEditor-Bp4NLy7y.d.ts +0 -352
  115. package/dist/chunk-ACCAXVOG.js.map +0 -1
  116. package/dist/chunk-X4XPNTCZ.cjs.map +0 -1
  117. package/dist/html-MdxqSzjD.d.cts +0 -13
  118. package/dist/html-MdxqSzjD.d.ts +0 -13
  119. package/dist/orderRows-BUJYgSc7.d.cts +0 -221
  120. package/dist/orderRows-BUJYgSc7.d.ts +0 -221
  121. package/dist/transcript-Cg7uSW-C.d.cts +0 -84
  122. package/dist/transcript-Cg7uSW-C.d.ts +0 -84
  123. package/dist/types-CnPEwzlp.d.cts +0 -254
  124. package/dist/types-CnPEwzlp.d.ts +0 -254
  125. package/dist/useAnchoredPosition-CKwLSQW8.d.cts +0 -76
  126. package/dist/useAnchoredPosition-CKwLSQW8.d.ts +0 -76
  127. package/dist/useTheme-B9SWu6ui.d.cts +0 -24
  128. package/dist/useTheme-B9SWu6ui.d.ts +0 -24
  129. package/dist/useTranscriptEdits-CGzlemHT.d.cts +0 -182
  130. package/dist/useTranscriptEdits-D32bLs0l.d.ts +0 -182
@@ -1,7 +1,6 @@
1
- import * as React$1 from 'react';
2
- import React__default from 'react';
1
+ import * as react from 'react';
2
+ import react__default from 'react';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
- import { P as PatientHistory, a as ProgramsMap, O as OrderRow } from './orderRows-BUJYgSc7.cjs';
5
4
 
6
5
  /**
7
6
  * EventBridge — Adapts the wcdatavis `mixinEventHandling` pub/sub pattern
@@ -345,7 +344,7 @@ interface TableFeatures {
345
344
  rowMode?: 'wrapped' | 'clipped';
346
345
  }
347
346
  /** Cell formatter function — returns React node */
348
- type CellFormatter = (value: unknown, row: RowData, column: TableColumn) => React__default.ReactNode;
347
+ type CellFormatter = (value: unknown, row: RowData, column: TableColumn) => react__default.ReactNode;
349
348
 
350
349
  /**
351
350
  * OperationsPalette — Inline toolbar of action buttons for row-level operations.
@@ -359,7 +358,7 @@ interface Operation {
359
358
  /** Display label */
360
359
  label?: string;
361
360
  /** Optional icon element */
362
- icon?: React__default.ReactNode;
361
+ icon?: react__default.ReactNode;
363
362
  /** Category for grouping */
364
363
  category?: string;
365
364
  /** Callback invoked when the operation is triggered */
@@ -369,7 +368,7 @@ interface OperationContext {
369
368
  /** Currently selected rows */
370
369
  rows: unknown[];
371
370
  /** The button element (for positioning popovers, etc.) */
372
- buttonRef?: React__default.RefObject<HTMLButtonElement>;
371
+ buttonRef?: react__default.RefObject<HTMLButtonElement>;
373
372
  }
374
373
 
375
374
  /**
@@ -627,7 +626,7 @@ interface DataVisNitroAggregate {
627
626
  fields: string[];
628
627
  }
629
628
  interface DataVisNitroSourceConfigurationProps {
630
- children?: React__default.ReactNode;
629
+ children?: react__default.ReactNode;
631
630
  groupBy?: Array<string | DataVisNitroGroupField>;
632
631
  aggregates?: DataVisNitroAggregate[];
633
632
  }
@@ -648,15 +647,15 @@ interface DataVisNitroGridProps extends Omit<DataGridProps, 'view' | 'children'
648
647
  columns?: DataVisNitroColumn[];
649
648
  allColumns?: TableColumn[];
650
649
  features?: TableFeatures;
651
- style?: React__default.CSSProperties;
650
+ style?: react__default.CSSProperties;
652
651
  trans?: TranslateFn;
653
652
  }
654
- declare const DataVisNitroContext: React__default.Context<ViewInstance | null>;
655
- declare function DataVisNitroSource(props: DataVisNitroSourceProps): React__default.JSX.Element;
653
+ declare const DataVisNitroContext: react__default.Context<ViewInstance | null>;
654
+ declare function DataVisNitroSource(props: DataVisNitroSourceProps): react__default.JSX.Element;
656
655
  declare namespace DataVisNitroSource {
657
656
  var displayName: string;
658
657
  }
659
- declare function DataVisNitroGrid(props: DataVisNitroGridProps): React__default.JSX.Element | null;
658
+ declare function DataVisNitroGrid(props: DataVisNitroGridProps): react__default.JSX.Element | null;
660
659
  declare namespace DataVisNitroGrid {
661
660
  var displayName: string;
662
661
  }
@@ -669,7 +668,7 @@ interface DataVisNitroGraphProps {
669
668
  height?: string;
670
669
  onConfigChange?: (config: GraphConfig) => void;
671
670
  }
672
- declare function DataVisNitroGraph(props: DataVisNitroGraphProps): React$1.JSX.Element | null;
671
+ declare function DataVisNitroGraph(props: DataVisNitroGraphProps): react.JSX.Element | null;
673
672
  declare namespace DataVisNitroGraph {
674
673
  var displayName: string;
675
674
  }
@@ -682,7 +681,162 @@ interface LanguageSelectorProps {
682
681
  /** Extra CSS class. */
683
682
  className?: string;
684
683
  }
685
- declare function LanguageSelector({ value, onLanguageChange, className, }: LanguageSelectorProps): React$1.JSX.Element;
684
+ declare function LanguageSelector({ value, onLanguageChange, className, }: LanguageSelectorProps): react.JSX.Element;
685
+
686
+ /**
687
+ * Patient history — the minimal longitudinal facts the health-surveillance
688
+ * due engine needs: who the patient is (age, sex) and what has been done or
689
+ * is in flight (orders with status, observations, procedures, immunizations),
690
+ * plus problem-list context (conditions) and allergies for display/interop.
691
+ *
692
+ * All clinical entries are keyed by `CODETYPE|FULLCODE` — the same keys used
693
+ * by programs.json order sets and the codify shards — so the due engine can
694
+ * match history against a program's satisfying orders with plain string
695
+ * equality.
696
+ */
697
+ /** ISO date string (YYYY-MM-DD or full ISO timestamp). */
698
+ type IsoDate = string;
699
+ interface HistoryOrder {
700
+ /** CODETYPE|FULLCODE, e.g. "Quest Order|3058" or "HCPCS|92551" */
701
+ key: string;
702
+ /** Display label (optional; the due list falls back to the key) */
703
+ label?: string;
704
+ status: 'completed' | 'pending';
705
+ /** Completion date for completed orders; order date for pending ones */
706
+ date: IsoDate;
707
+ /** Ordering/performing provider display name (e.g. "Dr. Patel") */
708
+ provider?: string;
709
+ /** Requisition the order was bundled into — the document routing a batch
710
+ * of encounter orders to a provider/referral (e.g. "REQ-2024-0117") */
711
+ requisitionId?: string;
712
+ /** Encounter (visit) the order was placed in (e.g. "ENC-2024-0117") */
713
+ encounterId?: string;
714
+ }
715
+ interface HistoryObservation {
716
+ /** CODETYPE|FULLCODE, e.g. "LOINC|4548-4" (HbA1c) */
717
+ key: string;
718
+ label?: string;
719
+ /** Display value with units, e.g. "7.2 %" or "38 ug/dL" */
720
+ value?: string;
721
+ date: IsoDate;
722
+ }
723
+ interface HistoryProcedure {
724
+ key: string;
725
+ label?: string;
726
+ date: IsoDate;
727
+ }
728
+ interface HistoryImmunization {
729
+ /** CODETYPE|FULLCODE, e.g. "CVX|88" */
730
+ key: string;
731
+ label?: string;
732
+ date: IsoDate;
733
+ }
734
+ interface HistoryCondition {
735
+ key: string;
736
+ label?: string;
737
+ onset?: IsoDate;
738
+ }
739
+ interface HistoryAllergy {
740
+ /** Allergen key when coded (e.g. "RxNORM|7980"), else omit */
741
+ key?: string;
742
+ label: string;
743
+ reaction?: string;
744
+ severity?: 'mild' | 'moderate' | 'severe';
745
+ }
746
+ interface HistoryMedication {
747
+ key?: string;
748
+ label: string;
749
+ /** Sig / dose display, e.g. "10 mg daily" */
750
+ detail?: string;
751
+ }
752
+ interface PatientHistory {
753
+ /** Age in years */
754
+ age: number;
755
+ sex: 'M' | 'F';
756
+ /** Past + in-flight orders (completion drives the due engine) */
757
+ orders: HistoryOrder[];
758
+ observations?: HistoryObservation[];
759
+ procedures?: HistoryProcedure[];
760
+ immunizations?: HistoryImmunization[];
761
+ conditions?: HistoryCondition[];
762
+ allergies?: HistoryAllergy[];
763
+ medications?: HistoryMedication[];
764
+ }
765
+
766
+ /**
767
+ * Due-evaluation engine — the "knowledge" layer of health surveillance.
768
+ * Given a patient's history and the program metadata (programs.json from
769
+ * mieweb/codify, or a deployment's own), decides which programs/measures are
770
+ * due, overdue, pending, or satisfied. Pure functions, no I/O — the metadata
771
+ * is small, so this runs on the main thread.
772
+ */
773
+
774
+ /**
775
+ * One entry in a program's order set:
776
+ * - `"CODETYPE|FULLCODE"` — a plain required order
777
+ * - `{ alt: [a, b] }` — mutually exclusive alternatives (one-of): a
778
+ * colonoscopy OR a FIT satisfies colorectal screening
779
+ * - `{ key, after: […] }` — depends on completed prerequisites (Gantt edge):
780
+ * the RMO's fitness-for-duty determination needs the panel results first,
781
+ * and a program may carry several determinations (per panel / per SEG)
782
+ */
783
+ type ProgramOrder = string | {
784
+ key?: string;
785
+ alt?: string[];
786
+ after?: string[];
787
+ };
788
+ /** Program metadata — mirrors programs.json (see mieweb/codify). */
789
+ interface ProgramMeta {
790
+ kind?: 'surveillance' | 'fitness' | 'credential' | 'quality';
791
+ /** Omitted = one-time / event-driven (satisfied forever once done) */
792
+ periodicityMonths?: number;
793
+ ageMin?: number;
794
+ ageMax?: number;
795
+ sex?: 'M' | 'F';
796
+ /** Satisfying orders — plain keys, one-of alternatives, or dependent
797
+ * entries (see ProgramOrder) */
798
+ orders?: ProgramOrder[];
799
+ }
800
+ type ProgramsMap = Record<string, ProgramMeta>;
801
+
802
+ /**
803
+ * Order-row builders — flatten the order history and the due-evaluation
804
+ * output into grid-friendly rows (one row per encounter order) for the
805
+ * NITRO-backed ChartOrdersGrid / EncounterOrdersGrid.
806
+ *
807
+ * Pure functions, no I/O. Every field is a flat string so the DataVis engine
808
+ * can group/filter/aggregate on any of them (reason, provider, requisition,
809
+ * status, kind, date).
810
+ */
811
+
812
+ /** Per-order status — finer grained than the program-level DueStatus. */
813
+ type OrderRowStatus = 'completed' | 'pending' | 'available' | 'blocked';
814
+ /** One encounter order as a flat grid row. */
815
+ interface OrderRow {
816
+ /** CODETYPE|FULLCODE of the order */
817
+ orderKey: string;
818
+ /** Order display label */
819
+ order: string;
820
+ /** Reason/concern — the surveillance program or quality measure label */
821
+ reason: string;
822
+ /** Program key (CODETYPE|FULLCODE); '' when no program matches */
823
+ reasonKey: string;
824
+ /** Program kind label ('surveillance', 'quality measure', …) */
825
+ kind: string;
826
+ status: OrderRowStatus;
827
+ /** Completion date (completed) or order date (pending); '' otherwise */
828
+ date: string;
829
+ /** Program due date, when known */
830
+ dueDate: string;
831
+ /** Ordering/performing provider; '' when unknown */
832
+ provider: string;
833
+ /** Requisition the order is bundled into; '' = unprocessed */
834
+ requisitionId: string;
835
+ /** Encounter the order was placed in; '' for not-yet-placed rows */
836
+ encounterId: string;
837
+ /** Unmet prerequisite labels, comma-joined ('' when unblocked) */
838
+ blockedBy: string;
839
+ }
686
840
 
687
841
  interface OrdersGridBaseProps {
688
842
  history: PatientHistory;
package/dist/datavis.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- import * as React$1 from 'react';
2
- import React__default from 'react';
1
+ import * as react from 'react';
2
+ import react__default from 'react';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
- import { P as PatientHistory, a as ProgramsMap, O as OrderRow } from './orderRows-BUJYgSc7.js';
5
4
 
6
5
  /**
7
6
  * EventBridge — Adapts the wcdatavis `mixinEventHandling` pub/sub pattern
@@ -345,7 +344,7 @@ interface TableFeatures {
345
344
  rowMode?: 'wrapped' | 'clipped';
346
345
  }
347
346
  /** Cell formatter function — returns React node */
348
- type CellFormatter = (value: unknown, row: RowData, column: TableColumn) => React__default.ReactNode;
347
+ type CellFormatter = (value: unknown, row: RowData, column: TableColumn) => react__default.ReactNode;
349
348
 
350
349
  /**
351
350
  * OperationsPalette — Inline toolbar of action buttons for row-level operations.
@@ -359,7 +358,7 @@ interface Operation {
359
358
  /** Display label */
360
359
  label?: string;
361
360
  /** Optional icon element */
362
- icon?: React__default.ReactNode;
361
+ icon?: react__default.ReactNode;
363
362
  /** Category for grouping */
364
363
  category?: string;
365
364
  /** Callback invoked when the operation is triggered */
@@ -369,7 +368,7 @@ interface OperationContext {
369
368
  /** Currently selected rows */
370
369
  rows: unknown[];
371
370
  /** The button element (for positioning popovers, etc.) */
372
- buttonRef?: React__default.RefObject<HTMLButtonElement>;
371
+ buttonRef?: react__default.RefObject<HTMLButtonElement>;
373
372
  }
374
373
 
375
374
  /**
@@ -627,7 +626,7 @@ interface DataVisNitroAggregate {
627
626
  fields: string[];
628
627
  }
629
628
  interface DataVisNitroSourceConfigurationProps {
630
- children?: React__default.ReactNode;
629
+ children?: react__default.ReactNode;
631
630
  groupBy?: Array<string | DataVisNitroGroupField>;
632
631
  aggregates?: DataVisNitroAggregate[];
633
632
  }
@@ -648,15 +647,15 @@ interface DataVisNitroGridProps extends Omit<DataGridProps, 'view' | 'children'
648
647
  columns?: DataVisNitroColumn[];
649
648
  allColumns?: TableColumn[];
650
649
  features?: TableFeatures;
651
- style?: React__default.CSSProperties;
650
+ style?: react__default.CSSProperties;
652
651
  trans?: TranslateFn;
653
652
  }
654
- declare const DataVisNitroContext: React__default.Context<ViewInstance | null>;
655
- declare function DataVisNitroSource(props: DataVisNitroSourceProps): React__default.JSX.Element;
653
+ declare const DataVisNitroContext: react__default.Context<ViewInstance | null>;
654
+ declare function DataVisNitroSource(props: DataVisNitroSourceProps): react__default.JSX.Element;
656
655
  declare namespace DataVisNitroSource {
657
656
  var displayName: string;
658
657
  }
659
- declare function DataVisNitroGrid(props: DataVisNitroGridProps): React__default.JSX.Element | null;
658
+ declare function DataVisNitroGrid(props: DataVisNitroGridProps): react__default.JSX.Element | null;
660
659
  declare namespace DataVisNitroGrid {
661
660
  var displayName: string;
662
661
  }
@@ -669,7 +668,7 @@ interface DataVisNitroGraphProps {
669
668
  height?: string;
670
669
  onConfigChange?: (config: GraphConfig) => void;
671
670
  }
672
- declare function DataVisNitroGraph(props: DataVisNitroGraphProps): React$1.JSX.Element | null;
671
+ declare function DataVisNitroGraph(props: DataVisNitroGraphProps): react.JSX.Element | null;
673
672
  declare namespace DataVisNitroGraph {
674
673
  var displayName: string;
675
674
  }
@@ -682,7 +681,162 @@ interface LanguageSelectorProps {
682
681
  /** Extra CSS class. */
683
682
  className?: string;
684
683
  }
685
- declare function LanguageSelector({ value, onLanguageChange, className, }: LanguageSelectorProps): React$1.JSX.Element;
684
+ declare function LanguageSelector({ value, onLanguageChange, className, }: LanguageSelectorProps): react.JSX.Element;
685
+
686
+ /**
687
+ * Patient history — the minimal longitudinal facts the health-surveillance
688
+ * due engine needs: who the patient is (age, sex) and what has been done or
689
+ * is in flight (orders with status, observations, procedures, immunizations),
690
+ * plus problem-list context (conditions) and allergies for display/interop.
691
+ *
692
+ * All clinical entries are keyed by `CODETYPE|FULLCODE` — the same keys used
693
+ * by programs.json order sets and the codify shards — so the due engine can
694
+ * match history against a program's satisfying orders with plain string
695
+ * equality.
696
+ */
697
+ /** ISO date string (YYYY-MM-DD or full ISO timestamp). */
698
+ type IsoDate = string;
699
+ interface HistoryOrder {
700
+ /** CODETYPE|FULLCODE, e.g. "Quest Order|3058" or "HCPCS|92551" */
701
+ key: string;
702
+ /** Display label (optional; the due list falls back to the key) */
703
+ label?: string;
704
+ status: 'completed' | 'pending';
705
+ /** Completion date for completed orders; order date for pending ones */
706
+ date: IsoDate;
707
+ /** Ordering/performing provider display name (e.g. "Dr. Patel") */
708
+ provider?: string;
709
+ /** Requisition the order was bundled into — the document routing a batch
710
+ * of encounter orders to a provider/referral (e.g. "REQ-2024-0117") */
711
+ requisitionId?: string;
712
+ /** Encounter (visit) the order was placed in (e.g. "ENC-2024-0117") */
713
+ encounterId?: string;
714
+ }
715
+ interface HistoryObservation {
716
+ /** CODETYPE|FULLCODE, e.g. "LOINC|4548-4" (HbA1c) */
717
+ key: string;
718
+ label?: string;
719
+ /** Display value with units, e.g. "7.2 %" or "38 ug/dL" */
720
+ value?: string;
721
+ date: IsoDate;
722
+ }
723
+ interface HistoryProcedure {
724
+ key: string;
725
+ label?: string;
726
+ date: IsoDate;
727
+ }
728
+ interface HistoryImmunization {
729
+ /** CODETYPE|FULLCODE, e.g. "CVX|88" */
730
+ key: string;
731
+ label?: string;
732
+ date: IsoDate;
733
+ }
734
+ interface HistoryCondition {
735
+ key: string;
736
+ label?: string;
737
+ onset?: IsoDate;
738
+ }
739
+ interface HistoryAllergy {
740
+ /** Allergen key when coded (e.g. "RxNORM|7980"), else omit */
741
+ key?: string;
742
+ label: string;
743
+ reaction?: string;
744
+ severity?: 'mild' | 'moderate' | 'severe';
745
+ }
746
+ interface HistoryMedication {
747
+ key?: string;
748
+ label: string;
749
+ /** Sig / dose display, e.g. "10 mg daily" */
750
+ detail?: string;
751
+ }
752
+ interface PatientHistory {
753
+ /** Age in years */
754
+ age: number;
755
+ sex: 'M' | 'F';
756
+ /** Past + in-flight orders (completion drives the due engine) */
757
+ orders: HistoryOrder[];
758
+ observations?: HistoryObservation[];
759
+ procedures?: HistoryProcedure[];
760
+ immunizations?: HistoryImmunization[];
761
+ conditions?: HistoryCondition[];
762
+ allergies?: HistoryAllergy[];
763
+ medications?: HistoryMedication[];
764
+ }
765
+
766
+ /**
767
+ * Due-evaluation engine — the "knowledge" layer of health surveillance.
768
+ * Given a patient's history and the program metadata (programs.json from
769
+ * mieweb/codify, or a deployment's own), decides which programs/measures are
770
+ * due, overdue, pending, or satisfied. Pure functions, no I/O — the metadata
771
+ * is small, so this runs on the main thread.
772
+ */
773
+
774
+ /**
775
+ * One entry in a program's order set:
776
+ * - `"CODETYPE|FULLCODE"` — a plain required order
777
+ * - `{ alt: [a, b] }` — mutually exclusive alternatives (one-of): a
778
+ * colonoscopy OR a FIT satisfies colorectal screening
779
+ * - `{ key, after: […] }` — depends on completed prerequisites (Gantt edge):
780
+ * the RMO's fitness-for-duty determination needs the panel results first,
781
+ * and a program may carry several determinations (per panel / per SEG)
782
+ */
783
+ type ProgramOrder = string | {
784
+ key?: string;
785
+ alt?: string[];
786
+ after?: string[];
787
+ };
788
+ /** Program metadata — mirrors programs.json (see mieweb/codify). */
789
+ interface ProgramMeta {
790
+ kind?: 'surveillance' | 'fitness' | 'credential' | 'quality';
791
+ /** Omitted = one-time / event-driven (satisfied forever once done) */
792
+ periodicityMonths?: number;
793
+ ageMin?: number;
794
+ ageMax?: number;
795
+ sex?: 'M' | 'F';
796
+ /** Satisfying orders — plain keys, one-of alternatives, or dependent
797
+ * entries (see ProgramOrder) */
798
+ orders?: ProgramOrder[];
799
+ }
800
+ type ProgramsMap = Record<string, ProgramMeta>;
801
+
802
+ /**
803
+ * Order-row builders — flatten the order history and the due-evaluation
804
+ * output into grid-friendly rows (one row per encounter order) for the
805
+ * NITRO-backed ChartOrdersGrid / EncounterOrdersGrid.
806
+ *
807
+ * Pure functions, no I/O. Every field is a flat string so the DataVis engine
808
+ * can group/filter/aggregate on any of them (reason, provider, requisition,
809
+ * status, kind, date).
810
+ */
811
+
812
+ /** Per-order status — finer grained than the program-level DueStatus. */
813
+ type OrderRowStatus = 'completed' | 'pending' | 'available' | 'blocked';
814
+ /** One encounter order as a flat grid row. */
815
+ interface OrderRow {
816
+ /** CODETYPE|FULLCODE of the order */
817
+ orderKey: string;
818
+ /** Order display label */
819
+ order: string;
820
+ /** Reason/concern — the surveillance program or quality measure label */
821
+ reason: string;
822
+ /** Program key (CODETYPE|FULLCODE); '' when no program matches */
823
+ reasonKey: string;
824
+ /** Program kind label ('surveillance', 'quality measure', …) */
825
+ kind: string;
826
+ status: OrderRowStatus;
827
+ /** Completion date (completed) or order date (pending); '' otherwise */
828
+ date: string;
829
+ /** Program due date, when known */
830
+ dueDate: string;
831
+ /** Ordering/performing provider; '' when unknown */
832
+ provider: string;
833
+ /** Requisition the order is bundled into; '' = unprocessed */
834
+ requisitionId: string;
835
+ /** Encounter the order was placed in; '' for not-yet-placed rows */
836
+ encounterId: string;
837
+ /** Unmet prerequisite labels, comma-joined ('' when unblocked) */
838
+ blockedBy: string;
839
+ }
686
840
 
687
841
  interface OrdersGridBaseProps {
688
842
  history: PatientHistory;
package/dist/esheet.d.cts CHANGED
@@ -3,7 +3,143 @@ export { FormDefinition } from '@esheet/core';
3
3
  export { EsheetBuilder, EsheetBuilderProps } from '@esheet/builder';
4
4
  export { EsheetRenderer, EsheetRendererHandle, EsheetRendererProps } from '@esheet/renderer';
5
5
  import * as React from 'react';
6
- import { C as CodeLookupConfig, M as Medication, A as Allergy } from './MedicationEditor-Bp4NLy7y.cjs';
6
+
7
+ /** Reconciliation status of a medication. */
8
+ type MedicationStatus = 'unreconciled' | 'taking' | 'taking-noncompliant' | 'not-taking' | 'unknown';
9
+ /** Coding-system reference for a medication (RxNorm / FDB / NDC …). */
10
+ interface MedicationCode {
11
+ /** Coding system, e.g. 'RxNORM', 'FDB', 'NDC' */
12
+ system: string;
13
+ /** Code within the system */
14
+ code: string;
15
+ /** Human-readable label the code was selected under */
16
+ display?: string;
17
+ }
18
+ /**
19
+ * A single medication in the presenting-medications list.
20
+ *
21
+ * Prescription-detail fields follow the NCPDP SCRIPT NewRx
22
+ * `MedicationPrescribed` composite — see the README for the field mapping.
23
+ * All are optional: a bare `{ id, name, status }` renders fine.
24
+ */
25
+ interface Medication {
26
+ /** Stable unique id */
27
+ id: string;
28
+ /** Display name, e.g. "lisinopril 10 mg tablet" (NCPDP DrugDescription) */
29
+ name: string;
30
+ /** Patient-friendly instructions (NCPDP Sig / Directions) */
31
+ sig?: string;
32
+ /** Current reconciliation status */
33
+ status: MedicationStatus;
34
+ /** Whether the medication's end date has passed */
35
+ expired?: boolean;
36
+ /** Discontinued date (display string) — shown as "Discontinued on: date" */
37
+ discontinuedDate?: string;
38
+ /** Free-text note attached to the medication */
39
+ note?: string;
40
+ /** Follow-up task attached to the medication */
41
+ task?: string;
42
+ /** Code reference (RxNorm / FDB / NDC) */
43
+ code?: MedicationCode;
44
+ /** Strength, e.g. "10 mg" (Strength + StrengthUnitOfMeasure) */
45
+ strength?: string;
46
+ /** Dose form, e.g. "tablet" (DrugCoded/FormCode) */
47
+ doseForm?: string;
48
+ /** Quantity dispensed (Quantity/Value) */
49
+ quantity?: string;
50
+ /** Quantity unit of measure (Quantity/QuantityUnitOfMeasure) */
51
+ quantityUnit?: string;
52
+ /** Days supply (DaysSupply) */
53
+ daysSupply?: string;
54
+ /** Route of administration, e.g. "oral" */
55
+ route?: string;
56
+ /** Administration frequency, e.g. "Twice daily" */
57
+ frequency?: string;
58
+ /** As-needed flag (PRN) */
59
+ prn?: boolean;
60
+ /** Number of refills (NumberOfRefills) */
61
+ refills?: string;
62
+ /** Substitution / DAW: '0' permitted, '1' dispense as written */
63
+ substitution?: '0' | '1';
64
+ /** Start / written date (ISO yyyy-mm-dd) */
65
+ startDate?: string;
66
+ /** End date (ISO yyyy-mm-dd) */
67
+ endDate?: string;
68
+ /** Indication / diagnosis the medication treats */
69
+ indication?: string;
70
+ /** Note to pharmacy (Note) */
71
+ pharmacyNotes?: string;
72
+ }
73
+
74
+ /**
75
+ * MedicationEditor — prescription editor modal for a `Medication`.
76
+ *
77
+ * Captures the NCPDP SCRIPT NewRx `MedicationPrescribed` field set and codes
78
+ * the drug via `CodeLookup` (RxNorm / FDB, offline). Used by
79
+ * `MedicationReconciliation` for both **Correct** (edit) and **Add
80
+ * Medication**, and usable directly:
81
+ *
82
+ * ```tsx
83
+ * <MedicationEditor
84
+ * open={editing !== null}
85
+ * medication={editing ?? undefined}
86
+ * codeLookup={{ indexUrl: '/codify' }}
87
+ * onClose={() => setEditing(null)}
88
+ * onSave={(med) => upsert(med)}
89
+ * />
90
+ * ```
91
+ *
92
+ * NCPDP mapping (NewRx / MedicationPrescribed):
93
+ *
94
+ * | Editor field | NCPDP element |
95
+ * |----------------|----------------------------------------|
96
+ * | Medication | DrugDescription |
97
+ * | Code | DrugCoded (ProductCode / DrugDBCode) |
98
+ * | Strength | Strength + StrengthUnitOfMeasure |
99
+ * | Dose form | DrugCoded/FormCode |
100
+ * | Quantity | Quantity/Value |
101
+ * | Quantity unit | Quantity/QuantityUnitOfMeasure |
102
+ * | Days supply | DaysSupply |
103
+ * | Directions | Sig/SigText |
104
+ * | Refills | NumberOfRefills |
105
+ * | Substitution | Substitutions (0 permitted / 1 DAW) |
106
+ * | Start date | WrittenDate / EffectiveDate |
107
+ * | Indication | Diagnosis/Primary |
108
+ * | Pharmacy notes | Note |
109
+ */
110
+
111
+ /** Minimal shape of a CodeLookup selection the editor consumes. */
112
+ interface MedicationLookupResult {
113
+ label: string;
114
+ codetype: string;
115
+ fullcode: string;
116
+ }
117
+ /**
118
+ * Structural subset of `CodeLookupProps` the editor uses. `CodeLookup`
119
+ * satisfies this — it is injected (not imported) because its Web Worker
120
+ * keeps it out of the library build (see CodeLookup/index.ts).
121
+ */
122
+ interface MedicationLookupProps {
123
+ indexUrl: string;
124
+ locale?: string;
125
+ domains?: 'med'[];
126
+ bare?: boolean;
127
+ clearOnSelect?: boolean;
128
+ placeholder?: string;
129
+ initialQuery?: string;
130
+ initialSearch?: boolean;
131
+ onSelect?: (result: MedicationLookupResult) => void;
132
+ onFreeText?: (text: string) => void;
133
+ }
134
+ /** CodeLookup wiring for the editor (component injected by the consumer). */
135
+ interface CodeLookupConfig {
136
+ /** The CodeLookup component: `import { CodeLookup } from '…/CodeLookup'` */
137
+ component: React.ComponentType<MedicationLookupProps>;
138
+ /** Base URL of the codify index, e.g. '/codify' */
139
+ indexUrl: string;
140
+ /** Shard locale (default 'en') */
141
+ locale?: string;
142
+ }
7
143
 
8
144
  /**
9
145
  * MedicationListField — eSheet custom field wrapper around
@@ -51,6 +187,52 @@ declare function registerMedicationListFieldType(options?: {
51
187
  codeLookup?: CodeLookupConfig | false;
52
188
  }): void;
53
189
 
190
+ /** Allergy category (FHIR AllergyIntolerance.category). */
191
+ type AllergyType = 'drug' | 'food' | 'environmental' | 'other';
192
+ /**
193
+ * Mechanism distinction (FHIR AllergyIntolerance.type): a true
194
+ * immune-mediated allergy vs a non-immune intolerance (e.g. GI upset).
195
+ * The distinction matters clinically — an intolerance mislabeled as an
196
+ * allergy causes unnecessary avoidance of first-line drugs.
197
+ */
198
+ type AllergyKind = 'allergy' | 'intolerance';
199
+ /** Reaction severity (FHIR reaction.severity). */
200
+ type AllergySeverity = 'mild' | 'moderate' | 'severe';
201
+ /** Coding-system reference for an allergen (RxNorm / FDB / SNOMED …). */
202
+ interface AllergyCode {
203
+ system: string;
204
+ code: string;
205
+ display?: string;
206
+ }
207
+ /**
208
+ * A single allergy / intolerance.
209
+ *
210
+ * Loosely follows FHIR AllergyIntolerance: allergen (+ optional code),
211
+ * category, reaction, severity, onset, and clinical status.
212
+ */
213
+ interface Allergy {
214
+ /** Stable unique id */
215
+ id: string;
216
+ /** Allergen display name, e.g. "penicillin" */
217
+ allergen: string;
218
+ /** Category — groups the list */
219
+ type?: AllergyType;
220
+ /** Allergy vs intolerance (FHIR AllergyIntolerance.type; default 'allergy') */
221
+ kind?: AllergyKind;
222
+ /** Reaction description, e.g. "hives" */
223
+ reaction?: string;
224
+ /** Reaction severity — drives the badge color */
225
+ severity?: AllergySeverity;
226
+ /** Onset date (display string) */
227
+ onsetDate?: string;
228
+ /** Free-text note */
229
+ note?: string;
230
+ /** Inactive/resolved entries render struck through */
231
+ inactive?: boolean;
232
+ /** Code reference (RxNorm/FDB for drugs, SNOMED otherwise) */
233
+ code?: AllergyCode;
234
+ }
235
+
54
236
  /**
55
237
  * AllergyListField — eSheet custom field wrapper around AllergyManager.
56
238
  *